17 : comm(comm), isPetscComm(petsc) {
41constexpr const int CoreTmp<-1>::value;
47 if (type_index == boost::typeindex::type_id<CoreInterface>()) {
50 }
else if (type_index ==
51 boost::typeindex::type_id<DeprecatedCoreInterface>()) {
57 auto it = iFaces.find(type_index);
58 if (it != iFaces.end()) {
71 MPI_Initialized(&mpiInitialised);
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 :
"";
86 if (!has_param_file_arg && file && !std::ifstream(file)) {
88 petscOptionsFile.clear();
90 PetscInitialize(argc, args, file,
help);
97 isGloballyInitialised =
true;
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);
107 auto log_time = [&](
const auto perefix,
auto time) {
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();
115 log_time(
"Local time: ", boost::posix_time::second_clock::local_time());
116 log_time(
"UTC time: ", boost::posix_time::second_clock::universal_time());
124 if (isGloballyInitialised) {
125 PetscPopErrorHandler();
126 isGloballyInitialised =
false;
128 if (isInitialized == PETSC_FALSE) {
129 PetscBool is_finalized;
130 PetscFinalized(&is_finalized);
135 if (!mpiInitialised) {
137 MPI_Finalized(&mpi_finalized);
150 ->
decltype(ptr->getSubInterfaceOptions()) {
151 return ptr->getSubInterfaceOptions();
163 ->
decltype(ptr->getEventOptions()) {
164 return ptr->getEventptions();
179 CHKERR registerInterface<IFACE>(
true);
180 IFACE *ptr =
new IFACE(*
this);
185 auto get_sub_iface_options = [](
auto *
const ptr) {
188 CHKERR get_sub_iface_options(ptr);
190 auto type_idx = boost::typeindex::type_id<IFACE>();
191 iFaces.insert(type_idx, ptr);
197 auto ptr = boost::make_shared<IFACE>();
201 auto get_event_options = [](
auto *
const ptr) {
204 CHKERR get_event_options(ptr.get());
209 MPI_Comm comm,
const int verbose) {
213 if (!isGloballyInitialised)
215 "MoFEM globally is not initialised, call MoFEM::Core::Initialize");
218 wrapMPIMOABComm = boost::make_shared<WrapMPIComm>(comm,
false);
220 MPI_Comm_size(mofemComm, &sIze);
221 MPI_Comm_rank(mofemComm, &rAnk);
224 ParallelComm *pComm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
226 pComm =
new ParallelComm(&moab, wrapMPIMOABComm->get_comm());
229 CHKERR registerInterface<UnknownInterface>();
230 CHKERR registerInterface<CoreInterface>();
231 CHKERR registerInterface<DeprecatedCoreInterface>();
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);
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);
263 this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
264 setRefEntBasicDataPtr(*
this, this->basicEntityDataPtr);
266 ierr = this->initialiseDatabaseFromMesh(verbose);
267 CHKERRABORT(comm,
ierr);
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);
287 this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
288 setRefEntBasicDataPtr(*
this, this->basicEntityDataPtr);
290 ierr = this->initialiseDatabaseFromMesh(verbose);
291 CHKERRABORT(comm,
ierr);
295 PetscBool is_finalized = PETSC_FALSE;
296 PetscFinalized(&is_finalized);
297 if (!is_finalized && !iFaces.empty())
302 if (isGloballyInitialised && is_finalized) {
303 isGloballyInitialised =
false;
308 BOOST_LOG_SCOPED_THREAD_ATTR(
"Timeline", attrs::timer());
315 Range ref_elems_to_add;
317 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Get MoFEM meshsets";
320 CHKERR get_moab().get_entities_by_type(0, MBENTITYSET, meshsets,
false);
321 Range special_meshsets;
322 for (
auto mit : meshsets) {
325 CHKERR get_moab().tag_get_data(th_FieldId, &mit, 1, &field_id);
329 const void *tag_name;
331 CHKERR get_moab().tag_get_by_ptr(
332 th_FieldName, &mit, 1, (
const void **)&tag_name, &tag_name_size);
337 << boost::string_ref((
char *)tag_name, tag_name_size);
339 auto p = fIelds.insert(boost::make_shared<Field>(moab, mit));
345 CHKERR get_moab().get_entities_by_handle(mit, ents,
true);
346 CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
347 CHKERR get_moab().delete_entities(&mit, 1);
349 special_meshsets.insert(mit);
355 CHKERR get_moab().tag_get_data(th_FEId, &mit, 1, &fe_id);
358 std::pair<FiniteElement_multiIndex::iterator, bool> p =
359 finiteElements.insert(
360 boost::shared_ptr<FiniteElement>(
new FiniteElement(moab, mit)));
362 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Read finite element " << **p.first;
365 CHKERR get_moab().get_entities_by_type(mit, MBENTITYSET, ents,
false);
366 CHKERR get_moab().get_entities_by_handle(mit, ents,
true);
367 ref_elems_to_add.merge(ents);
371 CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
372 CHKERR get_moab().delete_entities(&mit, 1);
374 special_meshsets.insert(mit);
379 CHKERR get_moab().tag_get_data(th_ProblemId, &mit, 1, &problem_id);
381 if (problem_id != 0) {
382 std::pair<Problem_multiIndex::iterator, bool> p =
383 pRoblems.insert(
Problem(moab, mit));
385 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Read problem " << *p.first;
387 <<
"\tBitRef " << p.first->getBitRefLevel() <<
" BitMask "
388 << p.first->getBitRefLevelMask();
395 CHKERR get_moab().get_entities_by_handle(mit, ents,
true);
396 CHKERR get_moab().get_entities_by_type(mit, MBENTITYSET, ents,
true);
397 CHKERR get_moab().add_entities(p.first->meshset, ents);
398 CHKERR get_moab().delete_entities(&mit, 1);
400 special_meshsets.insert(mit);
404 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Get MoFEM meshsets <- done";
407 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Add entities to database";
409 CHKERR get_moab().get_entities_by_handle(0, bit_ref_ents,
false);
410 bit_ref_ents = subtract(bit_ref_ents, special_meshsets);
411 CHKERR getInterface<BitRefManager>()->filterEntitiesByRefLevel(
413 CHKERR getInterface<BitRefManager>()->setEntitiesBitRefLevel(bit_ref_ents);
414 CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
416 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Add entities to database <- done";
419 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Add field to database";
420 for (
auto field : fIelds) {
421 if (field->getSpace() !=
NOSPACE) {
422 Range ents_of_id_meshset;
423 CHKERR get_moab().get_entities_by_handle(field->getMeshset(),
424 ents_of_id_meshset,
false);
425 CHKERR set_field_order(ents_of_id_meshset, field->getId(), -1, verb);
428 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Add field to database <- done";
430 if (initaliseAndBuildField || initaliseAndBuildFiniteElements) {
431 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Build fields elements";
432 CHKERR build_fields(verb);
433 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Build fields elements <- done";
434 if (initaliseAndBuildFiniteElements) {
435 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Build finite elements";
436 CHKERR build_finite_elements(verb);
437 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Build finite elements <- done";
443 list_finite_elements();
448 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Initialise interfaces from mesh";
450 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Initialise MeshsetManager";
451 CHKERR getInterface<MeshsetsManager>() -> initialiseDatabaseFromMesh(verb);
452 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Initialise MeshsetManager <- done";
453 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Initialise SeriesRecorder";
454 CHKERR getInterface<SeriesRecorder>() -> initialiseDatabaseFromMesh(verb);
455 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Initialise SeriesRecorder <- done";
457 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Initialise interfaces from mesh <- done";
471 moab = std::ref(new_moab);
474 ParallelComm *pComm = ParallelComm::get_pcomm(&new_moab,
MYPCOMM_INDEX);
476 pComm =
new ParallelComm(&new_moab, wrapMPIMOABComm->get_comm());
483 basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
484 setRefEntBasicDataPtr(*
this, this->basicEntityDataPtr);
487 CHKERR this->initialiseDatabaseFromMesh(verb);
498 CHKERR regSubInterface<LogManager>();
499 CHKERR regSubInterface<JsonConfigManager>();
500 CHKERR regSubInterface<Simple>();
501 CHKERR regSubInterface<OperatorsTester>();
502 CHKERR regSubInterface<PipelineManager>();
503 CHKERR regSubInterface<PipelineGraph>();
504 CHKERR regSubInterface<ProblemsManager>();
505 CHKERR regSubInterface<MatrixManager>();
506 CHKERR regSubInterface<ISManager>();
507 CHKERR regSubInterface<VecManager>();
508 CHKERR regSubInterface<FieldBlas>();
509 CHKERR regSubInterface<BitRefManager>();
510 CHKERR regSubInterface<Tools>();
511 CHKERR regSubInterface<CommInterface>();
512 CHKERR regSubInterface<MeshsetsManager>();
513 CHKERR regSubInterface<NodeMergerInterface>();
514 CHKERR regSubInterface<PrismsFromSurfaceInterface>();
515 CHKERR regSubInterface<MeshRefinement>();
516 CHKERR regSubInterface<PrismInterface>();
517 CHKERR regSubInterface<CutMeshInterface>();
518 CHKERR regSubInterface<SeriesRecorder>();
520 CHKERR regSubInterface<TetGenInterface>();
523 CHKERR regSubInterface<MedInterface>();
525 CHKERR regSubInterface<FieldEvaluatorInterface>();
526 CHKERR regSubInterface<BcManager>();
529 CHKERR regEvents<SchurEvents>();
537 CHKERR getInterface<SeriesRecorder>()->clearMap();
538 CHKERR getInterface<MeshsetsManager>()->clearMap();
539 CHKERR getInterface<CutMeshInterface>()->clearMap();
541 refinedEntities.clear();
542 refinedFiniteElements.clear();
546 finiteElements.clear();
547 entsFiniteElements.clear();
548 entFEAdjacencies.clear();
557 std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
558 p_ent = refinedEntities.insert(
559 boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
561 std::pair<RefElement_multiIndex::iterator, bool> p;
562 p = refinedFiniteElements.insert(
566 CHKERR get_moab().get_connectivity(prism, conn, num_nodes,
true);
567 Range face_side3, face_side4;
568 CHKERR get_moab().get_adjacencies(conn, 3, 2,
false, face_side3);
569 CHKERR get_moab().get_adjacencies(&conn[3], 3, 2,
false, face_side4);
570 if (face_side3.size() != 1)
572 "prism don't have side face 3");
573 if (face_side4.size() != 1)
575 "prims don't have side face 4");
576 p.first->get()->getSideNumberPtr(*face_side3.begin());
577 p.first->get()->getSideNumberPtr(*face_side4.begin());
585 const EntityHandle root_meshset = get_moab().get_root_set();
588 "Root meshset should be 0");
594 CHKERR getFileVersion(moab, version);
600 auto check_tag_allocated = [](
auto &
rval) {
602 if (
rval == MB_ALREADY_ALLOCATED)
611 rval = get_moab().tag_get_handle(
"_MoFEMBuild", 1, MB_TYPE_INTEGER,
612 th_MoFEMBuild, MB_TAG_CREAT | MB_TAG_MESH,
616 CHKERR get_moab().tag_get_by_ptr(th_MoFEMBuild, &root_meshset, 1,
617 (
const void **)&buildMoFEM);
622 const int def_part = -1;
623 CHKERR get_moab().tag_get_handle(
"PARTITION", 1, MB_TYPE_INTEGER, th_Part,
624 MB_TAG_CREAT | MB_TAG_SPARSE, &def_part);
633 const int def_part = -1;
634 CHKERR get_moab().tag_get_handle(
"_MeshsetPartition", 1, MB_TYPE_INTEGER,
635 th_Part, MB_TAG_CREAT | MB_TAG_SPARSE,
638 CHKERR get_moab().tag_get_handle(
"_RefParentHandle", 1, MB_TYPE_HANDLE,
640 MB_TAG_CREAT | MB_TAG_SPARSE, &def_handle);
642 CHKERR get_moab().tag_get_handle(
643 "_RefBitLevel",
sizeof(
BitRefLevel), MB_TYPE_OPAQUE, th_RefBitLevel,
644 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_bit_level);
646 CHKERR get_moab().tag_get_handle(
647 "_RefBitLevelMask",
sizeof(
BitRefLevel), MB_TYPE_OPAQUE,
648 th_RefBitLevel_Mask, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
649 &def_bit_level_mask);
651 CHKERR get_moab().tag_get_handle(
652 "_RefBitEdge",
sizeof(
BitRefEdges), MB_TYPE_OPAQUE, th_RefBitEdge,
653 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_bit_edge);
658 const unsigned long int def_id = 0;
659 CHKERR get_moab().tag_get_handle(
660 "_FieldId",
sizeof(
BitFieldId), MB_TYPE_OPAQUE, th_FieldId,
661 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
663 CHKERR get_moab().tag_get_handle(
664 "_FieldSpace",
sizeof(
FieldSpace), MB_TYPE_OPAQUE, th_FieldSpace,
665 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_space);
667 CHKERR get_moab().tag_get_handle(
669 th_FieldContinuity, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
672 CHKERR get_moab().tag_get_handle(
674 th_FieldBase, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_base);
675 const int def_val_len = 0;
676 CHKERR get_moab().tag_get_handle(
677 "_FieldName", def_val_len, MB_TYPE_OPAQUE, th_FieldName,
678 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
679 CHKERR get_moab().tag_get_handle(
680 "_FieldName_DataNamePrefix", def_val_len, MB_TYPE_OPAQUE,
681 th_FieldName_DataNamePrefix,
682 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
687 const unsigned long int def_id = 0;
688 const int def_val_len = 0;
689 CHKERR get_moab().tag_get_handle(
690 "_FEId",
sizeof(
BitFEId), MB_TYPE_OPAQUE, th_FEId,
691 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
692 CHKERR get_moab().tag_get_handle(
693 "_FEName", def_val_len, MB_TYPE_OPAQUE, th_FEName,
694 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
695 CHKERR get_moab().tag_get_handle(
696 "_FEIdCol",
sizeof(
BitFieldId), MB_TYPE_OPAQUE, th_FEIdCol,
697 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
698 CHKERR get_moab().tag_get_handle(
699 "_FEIdRow",
sizeof(
BitFieldId), MB_TYPE_OPAQUE, th_FEIdRow,
700 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
701 CHKERR get_moab().tag_get_handle(
702 "_FEIdData",
sizeof(
BitFieldId), MB_TYPE_OPAQUE, th_FEIdData,
703 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
708 const unsigned long int def_id = 0;
709 const int def_val_len = 0;
710 CHKERR get_moab().tag_get_handle(
711 "_ProblemId",
sizeof(
BitProblemId), MB_TYPE_OPAQUE, th_ProblemId,
712 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
713 CHKERR get_moab().tag_get_handle(
714 "_ProblemFEId",
sizeof(
BitFEId), MB_TYPE_OPAQUE, th_ProblemFEId,
715 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
716 CHKERR get_moab().tag_get_handle(
717 "_ProblemName", def_val_len, MB_TYPE_OPAQUE, th_ProblemName,
718 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
720 CHKERR get_moab().tag_get_handle(
721 "_ProblemNbDofsRow",
sizeof(
DofIdx), MB_TYPE_OPAQUE,
722 th_ProblemNbDofsRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
724 CHKERR get_moab().tag_get_handle(
725 "_ProblemNbDofsCol",
sizeof(
DofIdx), MB_TYPE_OPAQUE,
726 th_ProblemNbDofsCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
728 CHKERR get_moab().tag_get_handle(
729 "_ProblemLocalNbDofsRow",
sizeof(
DofIdx), MB_TYPE_OPAQUE,
730 th_ProblemLocalNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
732 CHKERR get_moab().tag_get_handle(
733 "_ProblemGhostNbDofsRow",
sizeof(
DofIdx), MB_TYPE_OPAQUE,
734 th_ProblemGhostNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
736 CHKERR get_moab().tag_get_handle(
737 "_ProblemLocalNbDofsCol",
sizeof(
DofIdx), MB_TYPE_OPAQUE,
738 th_ProblemLocalNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
740 CHKERR get_moab().tag_get_handle(
741 "_ProblemGhostNbDofsCol",
sizeof(
DofIdx), MB_TYPE_OPAQUE,
742 th_ProblemGhostNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
748 CHKERR getInterface(meshsets_manager_ptr);
753 CHKERR getInterface(series_recorder_ptr);
772 CHKERR this->getTags(verb);
773 CHKERR this->initialiseDatabaseFromMesh(verb);
778 return this->setMoabInterface(new_moab, verb);
783 return this->setMoabInterface(new_moab, verb);
791 PetscOptionsBegin(mofemComm, optionsPrefix.c_str(),
"Mesh cut options",
792 "See MoFEM documentation");
795 "-mofem_init_fields",
"Initialise fields on construction",
"",
796 initaliseAndBuildField, &initaliseAndBuildField, NULL);
799 "-mofem_init_fields",
"Initialise fields on construction",
"",
800 initaliseAndBuildFiniteElements, &initaliseAndBuildFiniteElements, NULL);
814 *fields_ptr = &fIelds;
821 *refined_entities_ptr = &refinedEntities;
827 *refined_finite_elements_ptr = &refinedFiniteElements;
832 const Problem **problem_ptr)
const {
834 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
836 ProblemsByName::iterator p_miit = problems.find(problem_name);
837 if (p_miit == problems.end()) {
839 "problem < %s > not found, (top tip: check spelling)",
840 problem_name.c_str());
842 *problem_ptr = &*p_miit;
849 *problems_ptr = &pRoblems;
856 *field_ents = &entsFields;
861 *dofs_ptr = &dofsField;
868 *fe_ptr = &finiteElements;
875 *fe_ent_ptr = &entsFiniteElements;
881 getInterface(meshsets_manager_ptr);
882 return meshsets_manager_ptr;
887 getInterface(meshsets_manager_ptr);
888 return meshsets_manager_ptr;
893 *dofs_elements_adjacency)
const {
895 *dofs_elements_adjacency = &entFEAdjacencies;
901 return &entFEAdjacencies;
906 return &refinedEntities;
909 return &refinedFiniteElements;
912 return &finiteElements;
915 return &entsFiniteElements;
924 "Problem of given name not found");
929template <
int V,
typename std::enable_if<(V >= 0),
int>
::type * =
nullptr>
934template <
int V,
typename std::enable_if<(V < 0),
int>::type * =
nullptr>
935void set_ref_ent_basic_data_ptr_impl(boost::shared_ptr<BasicEntityData> &ptr) {
939void Core::setRefEntBasicDataPtr(MoFEM::Interface &m_field,
940 boost::shared_ptr<BasicEntityData> &ptr) {
942 switch (m_field.getValue()) {
944 set_ref_ent_basic_data_ptr_impl<-1>(ptr);
947 set_ref_ent_basic_data_ptr_impl<0>(ptr);
950 set_ref_ent_basic_data_ptr_impl<1>(ptr);
953 THROW_MESSAGE("Core index can vary from -1 to MAX_CORE_TMP");
957boost::shared_ptr<RefEntityTmp<0>>
958Core::makeSharedRefEntity(MoFEM::Interface &m_field, const EntityHandle ent) {
960 boost::shared_ptr<RefEntityTmp<0>> ref_ent_ptr;
962 switch (m_field.getValue()) {
964 ref_ent_ptr = boost::shared_ptr<RefEntityTmp<0>>(
966 new RefEntityTmp<-1>(m_field.get_basic_entity_data_ptr(), ent)
971 ref_ent_ptr = boost::shared_ptr<RefEntityTmp<0>>(
973 new RefEntityTmp<0>(m_field.get_basic_entity_data_ptr(), ent)
978 ref_ent_ptr = boost::shared_ptr<RefEntityTmp<0>>(
980 new RefEntityTmp<1>(m_field.get_basic_entity_data_ptr(), ent)
985 THROW_MESSAGE("Core index can vary from -1 to MAX_CORE_TMP");
991boost::shared_ptr<RefEntityTmp<0>>
992Core::make_shared_ref_entity(const EntityHandle ent) {
993 return this->makeSharedRefEntity(*
this, ent);
996boost::shared_ptr<RefEntityTmp<0>>
998 return this->makeSharedRefEntity(*
this, ent);
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.
void macro_is_deprecated_using_deprecated_function()
Is used to indicate that macro is deprecated Do nothing just triggers error at the compilation.
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.
#define MOFEM_LOG_C(channel, severity, format,...)
FieldApproximationBase
approximation base
#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
@ LASTSPACE
FieldSpace in [ 0, LASTSPACE )
#define MYPCOMM_INDEX
default communicator number PCOMM
FieldContinuity
Field continuity.
#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
@ MOFEM_DATA_INCONSISTENCY
#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.
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
std::bitset< BITREFEDGES_SIZE > BitRefEdges
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
implementation of Data Operators for Forces and Sources
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())
void set_ref_ent_basic_data_ptr_impl(boost::shared_ptr< BasicEntityData > &ptr)
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())
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.
MoFEMErrorCode clearMap()
Cleaning database.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Getting interface of core database.
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
MoFEMErrorCode regSubInterface()
Register sub-interfaces in core interface.
const RefElement_multiIndex * get_ref_finite_elements() const
Get the ref finite elements object.
static const std::string & getPetscOptionsFile()
const FieldEntity_multiIndex * get_field_ents() const
Get the field ents object.
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
MoFEMErrorCode registerSubInterfaces()
Register insterfaces.
const Field_multiIndex * get_fields() const
Get the fields object.
const Problem_multiIndex * get_problems() const
Get the problems object.
MoFEMErrorCode coreGenericConstructor(moab::Interface &moab, MPI_Comm comm, const int verbose)
const DofEntity_multiIndex * get_dofs() const
Get the dofs object.
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
const RefEntity_multiIndex * get_ref_ents() const
Get the ref ents object.
const FieldEntityEntFiniteElementAdjacencyMap_multiIndex * get_ents_elements_adjacency() const
Get the dofs elements adjacency object.
const EntFiniteElement_multiIndex * get_ents_finite_elements() const
Get the ents finite elements object.
const FiniteElement_multiIndex * get_finite_elements() const
Get the finite elements object.
MoFEMErrorCode addPrismToDatabase(const EntityHandle prism, int verb=DEFAULT_VERBOSITY)
add prim element
MoFEMErrorCode regEvents()
Register petsc events.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
MoFEMErrorCode set_moab_interface(moab::Interface &new_moab, int verb=VERBOSE)
Set the moab interface object.
MoFEMErrorCode setMoabInterface(moab::Interface &new_moab, int verb=VERBOSE)
MoFEMErrorCode get_problem(const std::string &problem_name, const Problem **problem_ptr) const
Get problem database (data structure)
MoFEMErrorCode getTags(int verb=DEFAULT_VERBOSITY)
Get tag handles.
CoreTmp(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
MoFEMErrorCode rebuild_database(int verb=DEFAULT_VERBOSITY)
Clear database and initialize it once again.
MoFEMErrorCode clear_database(int verb=DEFAULT_VERBOSITY)
Clear database.
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
WrapMPIComm(MPI_Comm comm, bool petsc)