v0.16.3
Loading...
Searching...
No Matches
Core.cpp
Go to the documentation of this file.
1/** \file Core.cpp
2 * \brief Multi-index containers, data structures and other low-level functions
3 */
4
5
6#include <MoFEM.hpp>
7
9
10extern "C" {
12}
13
14namespace MoFEM {
15
16WrapMPIComm::WrapMPIComm(MPI_Comm comm, bool petsc)
17 : comm(comm), isPetscComm(petsc) {
18 if (isPetscComm) {
19 ierr = PetscCommDuplicate(comm, &duplicatedComm, NULL);
20 CHKERRABORT(comm, ierr);
21 } else {
22 int ierr = MPI_Comm_dup(comm, &duplicatedComm);
23 if (ierr) {
24 THROW_MESSAGE("MPI_Comm_dup not working");
25 }
26 }
27}
29 if (isPetscComm) {
30 ierr = PetscCommDestroy(&duplicatedComm);
31 CHKERRABORT(comm, ierr);
32 } else {
33 int ierr = MPI_Comm_free(&duplicatedComm);
34 if (ierr) {
35 CHKERRABORT(comm, MOFEM_DATA_INCONSISTENCY);
36 }
37 }
38}
39
40constexpr const int CoreTmp<0>::value;
41constexpr const int CoreTmp<-1>::value;
42
43MoFEMErrorCode Core::query_interface(boost::typeindex::type_index type_index,
44 UnknownInterface **iface) const {
46 *iface = NULL;
47 if (type_index == boost::typeindex::type_id<CoreInterface>()) {
48 *iface = static_cast<CoreInterface *>(const_cast<Core *>(this));
50 } else if (type_index ==
51 boost::typeindex::type_id<DeprecatedCoreInterface>()) {
52 *iface = static_cast<DeprecatedCoreInterface *>(const_cast<Core *>(this));
54 }
55
56 // Get sub-interface
57 auto it = iFaces.find(type_index);
58 if (it != iFaces.end()) {
59 *iface = it->second;
61 }
62
63 *iface = NULL;
64 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
66}
67
68MoFEMErrorCode Core::Initialize(int *argc, char ***args, const char file[],
69 const char help[]) {
70
71 MPI_Initialized(&mpiInitialised);
72 if (!mpiInitialised)
73 MPI_Init(argc, args);
74
75 PetscInitialized(&isInitialized);
76 if (isInitialized == PETSC_FALSE) {
77 bool has_param_file_arg = false;
78 for (int i = 0; i < *argc - 1; ++i) {
79 if (std::strcmp((*args)[i], "-param_file") == 0) {
80 file = (*args)[i + 1];
81 has_param_file_arg = true;
82 petscOptionsFile = file ? file : "";
83 break;
84 }
85 }
86 if (!has_param_file_arg && file && !std::ifstream(file)) {
87 file = PETSC_NULLPTR;
88 petscOptionsFile.clear();
89 }
90 PetscInitialize(argc, args, file, help);
91 PetscPushErrorHandler(mofem_error_handler, PETSC_NULLPTR);
92 }
93
94 LogManager::createDefaultSinks(MPI_COMM_WORLD);
95 PetscVFPrintf = LogManager::logPetscFPrintf;
97 isGloballyInitialised = true;
98
99 MOFEM_LOG_CHANNEL("WORLD");
100 char petsc_version[255];
101 CHKERR PetscGetVersion(petsc_version, 255);
102 MOFEM_LOG_C("WORLD", Sev::inform, "MoFEM version %d.%d.%d (%s %s)",
103 MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD,
104 MOAB_VERSION_STRING, petsc_version);
105 MOFEM_LOG_C("WORLD", Sev::inform, "git commit id %s", GIT_SHA1_NAME);
106
107 auto log_time = [&](const auto perefix, auto time) {
108 MOFEM_LOG("WORLD", Sev::inform)
109 << perefix << time.date().year() << "-" << time.date().month() << "-"
110 << time.date().day() << " " << time.time_of_day().hours() << ":"
111 << time.time_of_day().minutes() << ":" << time.time_of_day().seconds();
112 };
113
114 // Get current system time
115 log_time("Local time: ", boost::posix_time::second_clock::local_time());
116 log_time("UTC time: ", boost::posix_time::second_clock::universal_time());
117
118 return MOFEM_SUCCESS;
119}
120
121const std::string &Core::getPetscOptionsFile() { return petscOptionsFile; }
122
124 if (isGloballyInitialised) {
125 PetscPopErrorHandler();
126 isGloballyInitialised = false;
127
128 if (isInitialized == PETSC_FALSE) {
129 PetscBool is_finalized;
130 PetscFinalized(&is_finalized);
131 if (!is_finalized)
132 PetscFinalize();
133 }
134
135 if (!mpiInitialised) {
136 int mpi_finalized;
137 MPI_Finalized(&mpi_finalized);
138 if (!mpi_finalized)
139 MPI_Finalize();
140 }
141 }
142
143 return 0;
144}
145
146// Use SFINAE to decide which template should be run,
147// if exist getSubInterfaceOptions run this one.
148template <class T>
149static auto get_sub_iface_options_imp(T *const ptr, int)
150 -> decltype(ptr->getSubInterfaceOptions()) {
151 return ptr->getSubInterfaceOptions();
152};
153
154// Use SFINAE to decide which template should be run,
155// if getSubInterfaceOptions not exist run this one.
156template <class T>
157static auto get_sub_iface_options_imp(T *const ptr, long) -> MoFEMErrorCode {
158 return 0;
159};
160
161template <class T>
162static auto get_event_options_imp(T *const ptr, int)
163 -> decltype(ptr->getEventOptions()) {
164 return ptr->getEventptions();
165};
166
167// Use SFINAE to decide which template should be run,
168// if getSubInterfaceOptions not exist run this one.
169// See SFINAE:
170// https://stackoverflow.com/questions/257288/is-it-possible-to-write-a-template-to-check-for-a-functions-existence
171// https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error
172template <class T>
173static auto get_event_options_imp(T *const ptr, long) -> MoFEMErrorCode {
174 return 0;
175};
176
177template <class IFACE> MoFEMErrorCode Core::regSubInterface() {
179 CHKERR registerInterface<IFACE>(true);
180 IFACE *ptr = createInterface<IFACE>(*this);
181
182 // If sub interface has function getSubInterfaceOptions run
183 // it after construction. getSubInterfaceOptions is used to
184 // get parameters from command line.
185 auto get_sub_iface_options = [](auto *const ptr) {
186 return get_sub_iface_options_imp(ptr, 0);
187 };
188 CHKERR get_sub_iface_options(ptr);
189
190 auto type_idx = boost::typeindex::type_id<IFACE>();
191 iFaces.insert(type_idx, ptr);
193}
194
195template <class IFACE> MoFEMErrorCode Core::regEvents() {
197 auto ptr = boost::make_shared<IFACE>();
198 // See SFINAE:
199 // https://stackoverflow.com/questions/257288/is-it-possible-to-write-a-template-to-check-for-a-functions-existence
200 // https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error
201 auto get_event_options = [](auto *const ptr) {
202 return get_event_options_imp(ptr, 0);
203 };
204 CHKERR get_event_options(ptr.get());
206}
207
209 MPI_Comm comm, const int verbose) {
211
212 // This is deprecated ONE should use MoFEM::Core::Initialize
213 if (!isGloballyInitialised)
214 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
215 "MoFEM globally is not initialised, call MoFEM::Core::Initialize");
216
217 // Create duplicate communicator
218 wrapMPIMOABComm = boost::make_shared<WrapMPIComm>(comm, false);
219
220 MPI_Comm_size(mofemComm, &sIze);
221 MPI_Comm_rank(mofemComm, &rAnk);
222
223 // CHeck if moab has set communicator if not set communicator internally
224 ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
225 if (pComm == NULL)
226 pComm = new ParallelComm(&moab, wrapMPIMOABComm->get_comm());
227
228 // Register interfaces for this implementation
229 CHKERR registerInterface<UnknownInterface>();
230 CHKERR registerInterface<CoreInterface>();
231 CHKERR registerInterface<DeprecatedCoreInterface>();
232
233 // Register MOFEM events in PETSc
234 PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
235 PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
236 PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
237 PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
238
239 MOFEM_LOG_CHANNEL("WORLD");
240 MOFEM_LOG_CHANNEL("SELF");
241 MOFEM_LOG_CHANNEL("SYNC");
242
244}
245
246Core::CoreTmp(moab::Interface &moab, ///< MoAB interface
247 MPI_Comm comm, ///< MPI communicator
248 const int verbose ///< Verbosity level
249
250 )
251 : CoreTmp(moab, comm, verbose, CoreValue<0>()) {
252
253 // Register sub-interfaces
254 ierr = this->registerSubInterfaces();
255 CHKERRABORT(comm, ierr);
256 ierr = this->clearMap();
257 CHKERRABORT(comm, ierr);
258 ierr = this->getTags();
259 CHKERRABORT(comm, ierr);
260 ierr = this->getOptions(verbose);
261 CHKERRABORT(comm, ierr);
262
263 this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
264 setRefEntBasicDataPtr(*this, this->basicEntityDataPtr);
265
266 ierr = this->initialiseDatabaseFromMesh(verbose);
267 CHKERRABORT(comm, ierr);
268}
269
270CoreTmp<-1>::CoreTmp(moab::Interface &moab, ///< MoAB interface
271 MPI_Comm comm, ///< MPI communicator
272 const int verbose ///< Verbosity level
273
274 )
275 : CoreTmp<0>(moab, comm, verbose, CoreValue<-1>()) {
276
277 // Register sub-interfaces
278 ierr = this->registerSubInterfaces();
279 CHKERRABORT(comm, ierr);
280 ierr = this->clearMap();
281 CHKERRABORT(comm, ierr);
282 ierr = this->getTags();
283 CHKERRABORT(comm, ierr);
284 ierr = this->getOptions(verbose);
285 CHKERRABORT(comm, ierr);
286
287 this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
288 setRefEntBasicDataPtr(*this, this->basicEntityDataPtr);
289
290 ierr = this->initialiseDatabaseFromMesh(verbose);
291 CHKERRABORT(comm, ierr);
292}
293
295 PetscBool is_finalized = PETSC_FALSE;
296 PetscFinalized(&is_finalized);
297 if (!is_finalized && !iFaces.empty())
298 clearMap();
299 // Destroy interfaces
300 iFaces.clear();
301 // This is deprecated ONE should use MoFEM::Core::Initialize
302 if (isGloballyInitialised && is_finalized) {
303 isGloballyInitialised = false;
304 }
305}
306
308 BOOST_LOG_SCOPED_THREAD_ATTR("Timeline", attrs::timer());
309 MOFEM_LOG_CHANNEL("WORLD");
310
312 if (verb == -1)
313 verb = verbose;
314
315 Range ref_elems_to_add;
316
317 MOFEM_LOG("WORLD", Sev::verbose) << "Get MoFEM meshsets";
318 // Initialize database
319 Range meshsets;
320 CHKERR get_moab().get_entities_by_type(0, MBENTITYSET, meshsets, false);
321 Range special_meshsets;
322 for (auto mit : meshsets) {
323 BitFieldId field_id;
324 // Get bit id form field tag
325 CHKERR get_moab().tag_get_data(th_FieldId, &mit, 1, &field_id);
326 // Check if meshset if field meshset
327 if (field_id != 0) {
328
329 const void *tag_name;
330 int tag_name_size;
331 CHKERR get_moab().tag_get_by_ptr(
332 th_FieldName, &mit, 1, (const void **)&tag_name, &tag_name_size);
333
334 if (verb > QUIET)
335 MOFEM_LOG("WORLD", Sev::verbose)
336 << "Read field "
337 << boost::string_ref((char *)tag_name, tag_name_size);
338
339 auto p = fIelds.insert(boost::make_shared<Field>(moab, mit));
340
341 if (!p.second) {
342 // Field meshset exists, remove duplicate meshsets from other
343 // processors.
344 Range ents;
345 CHKERR get_moab().get_entities_by_handle(mit, ents, true);
346 CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
348 get_moab(), mit, get_basic_entity_data_ptr()->pcommID);
349 CHKERR get_moab().delete_entities(&mit, 1);
350 } else {
351 special_meshsets.insert(mit);
352 }
353 }
354 // Check for finite elements
355 BitFieldId fe_id;
356 // Get bit id from fe tag
357 CHKERR get_moab().tag_get_data(th_FEId, &mit, 1, &fe_id);
358 // check if meshset is finite element meshset
359 if (fe_id != 0) {
360 std::pair<FiniteElement_multiIndex::iterator, bool> p =
361 finiteElements.insert(
362 boost::shared_ptr<FiniteElement>(new FiniteElement(moab, mit)));
363 if (verb > QUIET)
364 MOFEM_LOG("WORLD", Sev::verbose) << "Read finite element " << **p.first;
365
366 Range ents;
367 CHKERR get_moab().get_entities_by_type(mit, MBENTITYSET, ents, false);
368 CHKERR get_moab().get_entities_by_handle(mit, ents, true);
369 ref_elems_to_add.merge(ents);
370 if (!p.second) {
371 // Finite element mesh set exist, could be created on other processor.
372 // Remove duplicate.
373 CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
375 get_moab(), mit, get_basic_entity_data_ptr()->pcommID);
376 CHKERR get_moab().delete_entities(&mit, 1);
377 } else {
378 special_meshsets.insert(mit);
379 }
380 }
381 BitProblemId problem_id;
382 // get bit id form problem tag
383 CHKERR get_moab().tag_get_data(th_ProblemId, &mit, 1, &problem_id);
384 // check if meshset if problem meshset
385 if (problem_id != 0) {
386 std::pair<Problem_multiIndex::iterator, bool> p =
387 pRoblems.insert(Problem(moab, mit));
388 if (verb > QUIET) {
389 MOFEM_LOG("WORLD", Sev::verbose) << "Read problem " << *p.first;
390 MOFEM_LOG("WORLD", Sev::noisy)
391 << "\tBitRef " << p.first->getBitRefLevel() << " BitMask "
392 << p.first->getBitRefLevelMask();
393 }
394
395 if (!p.second) {
396 // Problem meshset exists, could be created on other processor.
397 // Remove duplicate.
398 Range ents;
399 CHKERR get_moab().get_entities_by_handle(mit, ents, true);
400 CHKERR get_moab().get_entities_by_type(mit, MBENTITYSET, ents, true);
401 CHKERR get_moab().add_entities(p.first->meshset, ents);
403 get_moab(), mit, get_basic_entity_data_ptr()->pcommID);
404 CHKERR get_moab().delete_entities(&mit, 1);
405 } else {
406 special_meshsets.insert(mit);
407 }
408 }
409 }
410 MOFEM_LOG("WORLD", Sev::verbose) << "Get MoFEM meshsets <- done";
411
412 // Add entities to database
413 MOFEM_LOG("WORLD", Sev::verbose) << "Add entities to database";
414 Range bit_ref_ents;
415 CHKERR get_moab().get_entities_by_handle(0, bit_ref_ents, false);
416 bit_ref_ents = subtract(bit_ref_ents, special_meshsets);
417 CHKERR getInterface<BitRefManager>()->filterEntitiesByRefLevel(
418 BitRefLevel().set(), BitRefLevel().set(), bit_ref_ents);
419 CHKERR getInterface<BitRefManager>()->setEntitiesBitRefLevel(bit_ref_ents);
420 CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
421 ref_elems_to_add);
422 MOFEM_LOG("WORLD", Sev::verbose) << "Add entities to database <- done";
423
424 // Build field entities
425 MOFEM_LOG("WORLD", Sev::verbose) << "Add field to database";
426 for (auto field : fIelds) {
427 if (field->getSpace() != NOSPACE) {
428 Range ents_of_id_meshset;
429 CHKERR get_moab().get_entities_by_handle(field->getMeshset(),
430 ents_of_id_meshset, false);
431 CHKERR set_field_order(ents_of_id_meshset, field->getId(), -1, verb);
432 }
433 }
434 MOFEM_LOG("WORLD", Sev::verbose) << "Add field to database <- done";
435
436 if (initaliseAndBuildField || initaliseAndBuildFiniteElements) {
437 MOFEM_LOG("WORLD", Sev::verbose) << "Build fields elements";
438 CHKERR build_fields(verb);
439 MOFEM_LOG("WORLD", Sev::verbose) << "Build fields elements <- done";
440 if (initaliseAndBuildFiniteElements) {
441 MOFEM_LOG("WORLD", Sev::verbose) << "Build finite elements";
442 CHKERR build_finite_elements(verb);
443 MOFEM_LOG("WORLD", Sev::verbose) << "Build finite elements <- done";
444 }
445 }
446
447 if (verb > VERY_NOISY) {
448 list_fields();
449 list_finite_elements();
450 list_problem();
451 }
452
453 // Initialize interfaces
454 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise interfaces from mesh";
455
456 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise MeshsetManager";
457 CHKERR getInterface<MeshsetsManager>() -> initialiseDatabaseFromMesh(verb);
458 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise MeshsetManager <- done";
459 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise SeriesRecorder";
460 CHKERR getInterface<SeriesRecorder>() -> initialiseDatabaseFromMesh(verb);
461 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise SeriesRecorder <- done";
462
463 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise interfaces from mesh <- done";
464
466}
467
468MoFEMErrorCode Core::setMoabInterface(moab::Interface &new_moab, int verb) {
470 if (verb == -1)
471 verb = verbose;
472
473 // clear moab database
474 CHKERR clearMap();
475
476 // set new reference
477 moab = std::ref(new_moab);
478
479 // check if moab has set communicator if not set communicator internally
480 ParallelComm *pComm = ParallelComm::get_pcomm(&new_moab, MYPCOMM_INDEX);
481 if (pComm == NULL) {
482 pComm = new ParallelComm(&new_moab, wrapMPIMOABComm->get_comm());
483 }
484
485 // create MoFEM tags
486 CHKERR getTags();
487
488 // Create basic entity data struture
489 basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
490 setRefEntBasicDataPtr(*this, this->basicEntityDataPtr);
491
492 // Initalise database
493 CHKERR this->initialiseDatabaseFromMesh(verb);
494
496};
497
500
501 iFaces.clear();
502
503 // Register sub interfaces
504 CHKERR regSubInterface<LogManager>();
505 CHKERR regSubInterface<JsonConfigManager>();
506 CHKERR regSubInterface<Simple>();
507 CHKERR regSubInterface<OperatorsTester>();
508 CHKERR regSubInterface<TestingInterface>();
509 CHKERR regSubInterface<CouplerInterface>();
510 CHKERR regSubInterface<DGProjectionInterface>();
511#ifdef WITH_CGAL
512 CHKERR regSubInterface<CGALInterface>();
513#endif
514 CHKERR regSubInterface<PipelineManager>();
515 CHKERR regSubInterface<PipelineGraph>();
516 CHKERR regSubInterface<ProblemsManager>();
517 CHKERR regSubInterface<MatrixManager>();
518 CHKERR regSubInterface<ISManager>();
519 CHKERR regSubInterface<VecManager>();
520 CHKERR regSubInterface<FieldBlas>();
521 CHKERR regSubInterface<BitRefManager>();
522 CHKERR regSubInterface<Tools>();
523 CHKERR regSubInterface<CommInterface>();
524 CHKERR regSubInterface<MeshsetsManager>();
525 CHKERR regSubInterface<NodeMergerInterface>();
526 CHKERR regSubInterface<PrismsFromSurfaceInterface>();
527 CHKERR regSubInterface<MeshRefinement>();
528 CHKERR regSubInterface<PrismInterface>();
529 CHKERR regSubInterface<CutMeshInterface>();
530 CHKERR regSubInterface<SeriesRecorder>();
531#ifdef WITH_TETGEN
532 CHKERR regSubInterface<TetGenInterface>();
533#endif
534#ifdef WITH_MED
535 CHKERR regSubInterface<MedInterface>();
536#endif
537 CHKERR regSubInterface<FieldEvaluatorInterface>();
538 CHKERR regSubInterface<BcManager>();
539
540 // Register events
541 CHKERR regEvents<SchurEvents>();
542
544};
545
548 // Cleaning databases in interfaces
549 CHKERR getInterface<SeriesRecorder>()->clearMap();
550 CHKERR getInterface<MeshsetsManager>()->clearMap();
551 CHKERR getInterface<CutMeshInterface>()->clearMap();
552 // Cleaning databases
553 refinedEntities.clear();
554 refinedFiniteElements.clear();
555 fIelds.clear();
556 entsFields.clear();
557 dofsField.clear();
558 finiteElements.clear();
559 entsFiniteElements.clear();
560 entFEAdjacencies.clear();
561 pRoblems.clear();
563}
564
565MoFEMErrorCode Core::addPrismToDatabase(const EntityHandle prism, int verb) {
567 if (verb == -1)
568 verb = verbose;
569 std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
570 p_ent = refinedEntities.insert(
571 boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
572 if (p_ent.second) {
573 std::pair<RefElement_multiIndex::iterator, bool> p;
574 p = refinedFiniteElements.insert(
575 boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)));
576 int num_nodes;
577 const EntityHandle *conn;
578 CHKERR get_moab().get_connectivity(prism, conn, num_nodes, true);
579 Range face_side3, face_side4;
580 CHKERR get_moab().get_adjacencies(conn, 3, 2, false, face_side3);
581 CHKERR get_moab().get_adjacencies(&conn[3], 3, 2, false, face_side4);
582 if (face_side3.size() != 1)
583 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
584 "prism don't have side face 3");
585 if (face_side4.size() != 1)
586 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
587 "prims don't have side face 4");
588 p.first->get()->getSideNumberPtr(*face_side3.begin());
589 p.first->get()->getSideNumberPtr(*face_side4.begin());
590 }
592}
593
596
597 const EntityHandle root_meshset = get_moab().get_root_set();
598 if (root_meshset) {
599 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
600 "Root meshset should be 0");
601 }
602
603 // Set version
604 {
605 Version version;
606 CHKERR getFileVersion(moab, version);
607 }
608
609 // Global Variables
610 {
611
612 auto check_tag_allocated = [](auto &rval) {
614 if (rval == MB_ALREADY_ALLOCATED)
615 rval = MB_SUCCESS;
616 else
617 CHKERRG(rval);
619 };
620
621 // Safety nets
622 int def_bool = 0;
623 rval = get_moab().tag_get_handle("_MoFEMBuild", 1, MB_TYPE_INTEGER,
624 th_MoFEMBuild, MB_TAG_CREAT | MB_TAG_MESH,
625 &def_bool);
626 CHKERR check_tag_allocated(rval);
627
628 CHKERR get_moab().tag_get_by_ptr(th_MoFEMBuild, &root_meshset, 1,
629 (const void **)&buildMoFEM);
630 }
631
632 // Tags saved in vtk-files
633 {
634 const int def_part = -1;
635 CHKERR get_moab().tag_get_handle("PARTITION", 1, MB_TYPE_INTEGER, th_Part,
636 MB_TAG_CREAT | MB_TAG_SPARSE, &def_part);
637 }
638
639 // Tags Ref
640 {
641
642 // Fix size of bir ref level tags
644
645 const int def_part = -1;
646 CHKERR get_moab().tag_get_handle("_MeshsetPartition", 1, MB_TYPE_INTEGER,
647 th_Part, MB_TAG_CREAT | MB_TAG_SPARSE,
648 &def_part);
649 EntityHandle def_handle = 0;
650 CHKERR get_moab().tag_get_handle("_RefParentHandle", 1, MB_TYPE_HANDLE,
651 th_RefParentHandle,
652 MB_TAG_CREAT | MB_TAG_SPARSE, &def_handle);
653 BitRefLevel def_bit_level = 0;
654 CHKERR get_moab().tag_get_handle(
655 "_RefBitLevel", sizeof(BitRefLevel), MB_TYPE_OPAQUE, th_RefBitLevel,
656 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_bit_level);
657 BitRefLevel def_bit_level_mask = BitRefLevel().set();
658 CHKERR get_moab().tag_get_handle(
659 "_RefBitLevelMask", sizeof(BitRefLevel), MB_TYPE_OPAQUE,
660 th_RefBitLevel_Mask, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
661 &def_bit_level_mask);
662 BitRefEdges def_bit_edge = 0;
663 CHKERR get_moab().tag_get_handle(
664 "_RefBitEdge", sizeof(BitRefEdges), MB_TYPE_OPAQUE, th_RefBitEdge,
665 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_bit_edge);
666 }
667
668 // Tags Field
669 {
670 const unsigned long int def_id = 0;
671 CHKERR get_moab().tag_get_handle(
672 "_FieldId", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FieldId,
673 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
674 FieldSpace def_space = LASTSPACE;
675 CHKERR get_moab().tag_get_handle(
676 "_FieldSpace", sizeof(FieldSpace), MB_TYPE_OPAQUE, th_FieldSpace,
677 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_space);
678 FieldContinuity def_continuity = LASTCONTINUITY;
679 CHKERR get_moab().tag_get_handle(
680 "_FieldContinuity", sizeof(FieldContinuity), MB_TYPE_OPAQUE,
681 th_FieldContinuity, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
682 &def_continuity);
684 CHKERR get_moab().tag_get_handle(
685 "_FieldBase", sizeof(FieldApproximationBase), MB_TYPE_OPAQUE,
686 th_FieldBase, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_base);
687 const int def_val_len = 0;
688 CHKERR get_moab().tag_get_handle(
689 "_FieldName", def_val_len, MB_TYPE_OPAQUE, th_FieldName,
690 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
691 CHKERR get_moab().tag_get_handle(
692 "_FieldName_DataNamePrefix", def_val_len, MB_TYPE_OPAQUE,
693 th_FieldName_DataNamePrefix,
694 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
695 }
696
697 // Tags FE
698 {
699 const unsigned long int def_id = 0;
700 const int def_val_len = 0;
701 CHKERR get_moab().tag_get_handle(
702 "_FEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_FEId,
703 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
704 CHKERR get_moab().tag_get_handle(
705 "_FEName", def_val_len, MB_TYPE_OPAQUE, th_FEName,
706 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
707 CHKERR get_moab().tag_get_handle(
708 "_FEIdCol", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdCol,
709 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
710 CHKERR get_moab().tag_get_handle(
711 "_FEIdRow", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdRow,
712 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
713 CHKERR get_moab().tag_get_handle(
714 "_FEIdData", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdData,
715 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
716 }
717
718 // Tags Problem
719 {
720 const unsigned long int def_id = 0;
721 const int def_val_len = 0;
722 CHKERR get_moab().tag_get_handle(
723 "_ProblemId", sizeof(BitProblemId), MB_TYPE_OPAQUE, th_ProblemId,
724 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
725 CHKERR get_moab().tag_get_handle(
726 "_ProblemFEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_ProblemFEId,
727 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
728 CHKERR get_moab().tag_get_handle(
729 "_ProblemName", def_val_len, MB_TYPE_OPAQUE, th_ProblemName,
730 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
731 DofIdx def_nbdofs = 0;
732 CHKERR get_moab().tag_get_handle(
733 "_ProblemNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
734 th_ProblemNbDofsRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
735 &def_nbdofs);
736 CHKERR get_moab().tag_get_handle(
737 "_ProblemNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
738 th_ProblemNbDofsCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
739 &def_nbdofs);
740 CHKERR get_moab().tag_get_handle(
741 "_ProblemLocalNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
742 th_ProblemLocalNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
743 &def_nbdofs);
744 CHKERR get_moab().tag_get_handle(
745 "_ProblemGhostNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
746 th_ProblemGhostNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
747 &def_nbdofs);
748 CHKERR get_moab().tag_get_handle(
749 "_ProblemLocalNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
750 th_ProblemLocalNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
751 &def_nbdofs);
752 CHKERR get_moab().tag_get_handle(
753 "_ProblemGhostNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
754 th_ProblemGhostNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
755 &def_nbdofs);
756 }
757
758 // Meshsets with boundary conditions and material sets
759 MeshsetsManager *meshsets_manager_ptr;
760 CHKERR getInterface(meshsets_manager_ptr);
761 CHKERR meshsets_manager_ptr->getTags(verb);
762
763 // Series recorder
764 SeriesRecorder *series_recorder_ptr;
765 CHKERR getInterface(series_recorder_ptr);
766 CHKERR series_recorder_ptr->getTags(verb);
767
769}
770
773 if (verb == -1)
774 verb = verbose;
775 CHKERR clearMap();
777}
778
781 if (verb == -1)
782 verb = verbose;
783 CHKERR this->clearMap();
784 CHKERR this->getTags(verb);
785 CHKERR this->initialiseDatabaseFromMesh(verb);
787}
788
789MoFEMErrorCode Core::set_moab_interface(moab::Interface &new_moab, int verb) {
790 return this->setMoabInterface(new_moab, verb);
791};
792
794 int verb) {
795 return this->setMoabInterface(new_moab, verb);
796};
797
800 if (verb == -1)
801 verb = verbose;
802
803 PetscOptionsBegin(mofemComm, optionsPrefix.c_str(), "Mesh cut options",
804 "See MoFEM documentation");
805
806 CHKERR PetscOptionsBool(
807 "-mofem_init_fields", "Initialise fields on construction", "",
808 initaliseAndBuildField, &initaliseAndBuildField, NULL);
809
810 CHKERR PetscOptionsBool(
811 "-mofem_init_fields", "Initialise fields on construction", "",
812 initaliseAndBuildFiniteElements, &initaliseAndBuildFiniteElements, NULL);
813
814 // TODO: Add read verbosity level
815 // TODO: Add option to initalise problems ??? - DO WE REALLY NEED THAT
816
817 PetscOptionsEnd();
818
820}
821
822// cubit meshsets
823
826 *fields_ptr = &fIelds;
828}
829
831Core::get_ref_ents(const RefEntity_multiIndex **refined_entities_ptr) const {
833 *refined_entities_ptr = &refinedEntities;
835}
837 const RefElement_multiIndex **refined_finite_elements_ptr) const {
839 *refined_finite_elements_ptr = &refinedFiniteElements;
841}
842
843MoFEMErrorCode Core::get_problem(const std::string &problem_name,
844 const Problem **problem_ptr) const {
846 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
847 const ProblemsByName &problems = pRoblems.get<Problem_mi_tag>();
848 ProblemsByName::iterator p_miit = problems.find(problem_name);
849 if (p_miit == problems.end()) {
850 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
851 "problem < %s > not found, (top tip: check spelling)",
852 problem_name.c_str());
853 }
854 *problem_ptr = &*p_miit;
856}
857
859Core::get_problems(const Problem_multiIndex **problems_ptr) const {
861 *problems_ptr = &pRoblems;
863}
864
868 *field_ents = &entsFields;
870}
873 *dofs_ptr = &dofsField;
875}
876
880 *fe_ptr = &finiteElements;
882}
883
885 const EntFiniteElement_multiIndex **fe_ent_ptr) const {
887 *fe_ent_ptr = &entsFiniteElements;
889}
890
892 MeshsetsManager *meshsets_manager_ptr;
893 getInterface(meshsets_manager_ptr);
894 return meshsets_manager_ptr;
895}
896
898 MeshsetsManager *meshsets_manager_ptr;
899 getInterface(meshsets_manager_ptr);
900 return meshsets_manager_ptr;
901}
902
905 *dofs_elements_adjacency) const {
907 *dofs_elements_adjacency = &entFEAdjacencies;
909}
910
913 return &entFEAdjacencies;
914}
915
916const Field_multiIndex *Core::get_fields() const { return &fIelds; }
918 return &refinedEntities;
919}
921 return &refinedFiniteElements;
922}
924 return &finiteElements;
925}
927 return &entsFiniteElements;
928}
930 return &entsFields;
931}
932const DofEntity_multiIndex *Core::get_dofs() const { return &dofsField; }
933const Problem *Core::get_problem(const std::string problem_name) const {
934 const Problem *prb;
935 CHK_THROW_MESSAGE(get_problem(problem_name, &prb),
936 "Problem of given name not found");
937 return prb;
938}
939const Problem_multiIndex *Core::get_problems() const { return &pRoblems; }
940
941template <int V, typename std::enable_if<(V >= 0), int>::type * = nullptr>
942void set_ref_ent_basic_data_ptr_impl(boost::shared_ptr<BasicEntityData> &ptr) {
944};
945
946template <int V, typename std::enable_if<(V < 0), int>::type * = nullptr>
947void set_ref_ent_basic_data_ptr_impl(boost::shared_ptr<BasicEntityData> &ptr) {
948 return;
949};
950
951void Core::setRefEntBasicDataPtr(MoFEM::Interface &m_field,
952 boost::shared_ptr<BasicEntityData> &ptr) {
953
954 switch (m_field.getValue()) {
955 case -1:
956 set_ref_ent_basic_data_ptr_impl<-1>(ptr);
957 break;
958 case 0:
959 set_ref_ent_basic_data_ptr_impl<0>(ptr);
960 break;
961 case 1:
962 set_ref_ent_basic_data_ptr_impl<1>(ptr);
963 break;
964 default:
965 THROW_MESSAGE("Core index can vary from -1 to MAX_CORE_TMP");
966 }
967};
968
969boost::shared_ptr<RefEntityTmp<0>>
970Core::makeSharedRefEntity(MoFEM::Interface &m_field, const EntityHandle ent) {
971
972 boost::shared_ptr<RefEntityTmp<0>> ref_ent_ptr;
973
974 switch (m_field.getValue()) {
975 case -1:
976 ref_ent_ptr = boost::shared_ptr<RefEntityTmp<0>>(
977
978 new RefEntityTmp<-1>(m_field.get_basic_entity_data_ptr(), ent)
979
980 );
981 break;
982 case 0:
983 ref_ent_ptr = boost::shared_ptr<RefEntityTmp<0>>(
984
985 new RefEntityTmp<0>(m_field.get_basic_entity_data_ptr(), ent)
986
987 );
988 break;
989 case 1:
990 ref_ent_ptr = boost::shared_ptr<RefEntityTmp<0>>(
991
992 new RefEntityTmp<1>(m_field.get_basic_entity_data_ptr(), ent)
993
994 );
995 break;
996 default:
997 THROW_MESSAGE("Core index can vary from -1 to MAX_CORE_TMP");
998 }
999
1000 return ref_ent_ptr;
1001}
1002
1003boost::shared_ptr<RefEntityTmp<0>>
1004Core::make_shared_ref_entity(const EntityHandle ent) {
1005 return this->makeSharedRefEntity(*this, ent);
1006}
1007
1008boost::shared_ptr<RefEntityTmp<0>>
1010 return this->makeSharedRefEntity(*this, ent);
1011}
1012
1013} // namespace MoFEM
multi_index_container< FieldEntityEntFiniteElementAdjacencyMap, indexed_by< ordered_unique< tag< Composite_Unique_mi_tag >, composite_key< FieldEntityEntFiniteElementAdjacencyMap, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getEntUniqueId >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getFeUniqueId > > >, ordered_non_unique< tag< Unique_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getEntUniqueId > >, ordered_non_unique< tag< FE_Unique_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getFeUniqueId > >, ordered_non_unique< tag< FEEnt_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, EntityHandle, &FieldEntityEntFiniteElementAdjacencyMap::getFeHandle > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, EntityHandle, &FieldEntityEntFiniteElementAdjacencyMap::getEntHandle > > > > FieldEntityEntFiniteElementAdjacencyMap_multiIndex
MultiIndex container keeps Adjacencies Element and dof entities adjacencies and vice versa.
std::string optionsPrefix
MPI_Comm comm
void macro_is_deprecated_using_deprecated_function()
Is used to indicate that macro is deprecated Do nothing just triggers error at the compilation.
Definition Core.cpp:11
ProjectedField & field
static PetscErrorCode mofem_error_handler(MPI_Comm comm, int line, const char *fun, const char *file, PetscErrorCode n, PetscErrorType p, const char *mess, void *ctx)
multi_index_container< boost::shared_ptr< Field >, indexed_by< hashed_unique< tag< BitFieldId_mi_tag >, const_mem_fun< Field, const BitFieldId &, &Field::getId >, HashBit< BitFieldId >, EqBit< BitFieldId > >, ordered_unique< tag< Meshset_mi_tag >, member< Field, EntityHandle, &Field::meshSet > >, ordered_unique< tag< FieldName_mi_tag >, const_mem_fun< Field, boost::string_ref, &Field::getNameRef > >, ordered_non_unique< tag< BitFieldId_space_mi_tag >, const_mem_fun< Field, FieldSpace, &Field::getSpace > > > > Field_multiIndex
Multi-index container for field storage and retrieval.
std::string type
#define MOFEM_LOG_C(channel, severity, format,...)
It it
Definition Schur.cpp:2568
static char help[]
@ QUIET
@ VERY_NOISY
FieldApproximationBase
approximation base
Definition definitions.h:58
@ LASTBASE
Definition definitions.h:69
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
FieldSpace
approximation spaces
Definition definitions.h:82
@ LASTSPACE
FieldSpace in [ 0, LASTSPACE )
Definition definitions.h:89
@ NOSPACE
Definition definitions.h:83
#define MYPCOMM_INDEX
default communicator number PCOMM
FieldContinuity
Field continuity.
Definition definitions.h:99
@ LASTCONTINUITY
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
@ MOFEM_SUCCESS
Definition definitions.h:30
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
multi_index_container< boost::shared_ptr< DofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< DofEntity, UId, &DofEntity::getLocalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt > > > > DofEntity_multiIndex
MultiIndex container keeps DofEntity.
multi_index_container< boost::shared_ptr< EntFiniteElement >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< EntFiniteElement, UId, &EntFiniteElement::getLocalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< EntFiniteElement::interface_type_RefEntity, EntityHandle, &EntFiniteElement::getEnt > > > > EntFiniteElement_multiIndex
MultiIndex container for EntFiniteElement.
multi_index_container< Problem, indexed_by< ordered_unique< tag< Meshset_mi_tag >, member< Problem, EntityHandle, &Problem::meshset > >, hashed_unique< tag< BitProblemId_mi_tag >, const_mem_fun< Problem, BitProblemId, &Problem::getId >, HashBit< BitProblemId >, EqBit< BitProblemId > >, hashed_unique< tag< Problem_mi_tag >, const_mem_fun< Problem, std::string, &Problem::getName > > > > Problem_multiIndex
MultiIndex for entities for Problem.
multi_index_container< boost::shared_ptr< FiniteElement >, indexed_by< hashed_unique< tag< FiniteElement_Meshset_mi_tag >, member< FiniteElement, EntityHandle, &FiniteElement::meshset > >, hashed_unique< tag< BitFEId_mi_tag >, const_mem_fun< FiniteElement, BitFEId, &FiniteElement::getId >, HashBit< BitFEId >, EqBit< BitFEId > >, ordered_unique< tag< FiniteElement_name_mi_tag >, const_mem_fun< FiniteElement, boost::string_ref, &FiniteElement::getNameRef > > > > FiniteElement_multiIndex
MultiIndex for entities for FiniteElement.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
MoFEMErrorCode getTags(int verb=-1)
Get tag handles used on meshsets.
FTensor::Index< 'i', SPACE_DIM > i
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition Types.hpp:43
int DofIdx
Index of DOF.
Definition Types.hpp:18
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition Types.hpp:44
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition Types.hpp:42
std::bitset< BITREFEDGES_SIZE > BitRefEdges
Definition Types.hpp:34
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getEnt > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
static auto get_sub_iface_options_imp(T *const ptr, int) -> decltype(ptr->getSubInterfaceOptions())
Definition Core.cpp:149
void set_ref_ent_basic_data_ptr_impl(boost::shared_ptr< BasicEntityData > &ptr)
Definition Core.cpp:942
multi_index_container< boost::shared_ptr< RefElement >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityHandle, &RefElement::getEnt > > > > RefElement_multiIndex
static auto get_event_options_imp(T *const ptr, int) -> decltype(ptr->getEventOptions())
Definition Core.cpp:162
multi_index_container< boost::shared_ptr< FieldEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, member< FieldEntity, UId, &FieldEntity::localUId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FieldEntity::interface_type_RefEntity, EntityHandle, &FieldEntity::getEnt > > > > FieldEntity_multiIndex
static MoFEMErrorCode fixTagSize(moab::Interface &moab, bool *changed=nullptr)
Fix tag size when BITREFLEVEL_SIZE of core library is different than file BITREFLEVEL_SIZE.
static MoFEMErrorCode removeMeshsetFromPartition(moab::Interface &moab, const EntityHandle meshset, const int pcomm_id=MYPCOMM_INDEX)
Remove a meshset from all partition sets before it is deleted.
Core (interface) class.
Definition Core.hpp:83
MoFEMErrorCode clearMap()
Cleaning database.
Definition Core.cpp:546
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Getting interface of core database.
Definition Core.cpp:43
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition Core.cpp:68
MoFEMErrorCode regSubInterface()
Register sub-interfaces in core interface.
Definition Core.cpp:177
const RefElement_multiIndex * get_ref_finite_elements() const
Get the ref finite elements object.
Definition Core.cpp:920
static const std::string & getPetscOptionsFile()
Definition Core.cpp:121
const FieldEntity_multiIndex * get_field_ents() const
Get the field ents object.
Definition Core.cpp:929
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition Core.cpp:307
MoFEMErrorCode registerSubInterfaces()
Register insterfaces.
Definition Core.cpp:498
const Field_multiIndex * get_fields() const
Get the fields object.
Definition Core.cpp:916
const Problem_multiIndex * get_problems() const
Get the problems object.
Definition Core.cpp:939
MoFEMErrorCode coreGenericConstructor(moab::Interface &moab, MPI_Comm comm, const int verbose)
Definition Core.cpp:208
const DofEntity_multiIndex * get_dofs() const
Get the dofs object.
Definition Core.cpp:932
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
Definition Core.cpp:798
const RefEntity_multiIndex * get_ref_ents() const
Get the ref ents object.
Definition Core.cpp:917
const FieldEntityEntFiniteElementAdjacencyMap_multiIndex * get_ents_elements_adjacency() const
Get the dofs elements adjacency object.
Definition Core.cpp:912
const EntFiniteElement_multiIndex * get_ents_finite_elements() const
Get the ents finite elements object.
Definition Core.cpp:926
const FiniteElement_multiIndex * get_finite_elements() const
Get the finite elements object.
Definition Core.cpp:923
MoFEMErrorCode addPrismToDatabase(const EntityHandle prism, int verb=DEFAULT_VERBOSITY)
add prim element
Definition Core.cpp:565
MoFEMErrorCode regEvents()
Register petsc events.
Definition Core.cpp:195
virtual ~CoreTmp()
Definition Core.cpp:294
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:123
MoFEMErrorCode set_moab_interface(moab::Interface &new_moab, int verb=VERBOSE)
Set the moab interface object.
Definition Core.cpp:789
MoFEMErrorCode setMoabInterface(moab::Interface &new_moab, int verb=VERBOSE)
Definition Core.cpp:468
MoFEMErrorCode get_problem(const std::string &problem_name, const Problem **problem_ptr) const
Get problem database (data structure)
Definition Core.cpp:843
MoFEMErrorCode getTags(int verb=DEFAULT_VERBOSITY)
Get tag handles.
Definition Core.cpp:594
CoreTmp(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
Definition Core.cpp:246
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition Core.cpp:891
MoFEMErrorCode rebuild_database(int verb=DEFAULT_VERBOSITY)
Clear database and initialize it once again.
Definition Core.cpp:779
MoFEMErrorCode clear_database(int verb=DEFAULT_VERBOSITY)
Clear database.
Definition Core.cpp:771
MoFEMErrorCode set_moab_interface(moab::Interface &new_moab, int verb)
CoreTmp(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
Deprecated interface functions.
Finite element definition.
static MoFEMErrorCode getOptions()
Get logger option.
static void createDefaultSinks(MPI_Comm comm)
Create default sinks.
static PetscErrorCode logPetscFPrintf(FILE *fd, const char format[], va_list Argp)
Use to handle PETSc output.
Interface for managing meshsets containing materials and boundary conditions.
keeps basic data about problem
keeps data about abstract PRISM finite element
MoFEMErrorCode getTags(int verb=-1)
get tags handlers used on meshsets
base class for all interface classes
MPI_Comm duplicatedComm
Definition Core.hpp:27
WrapMPIComm(MPI_Comm comm, bool petsc)
Definition Core.cpp:16
MPI_Comm comm
Definition Core.hpp:26