v0.10.0
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 /* MoFEM is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License as published by the
7  * Free Software Foundation, either version 3 of the License, or (at your
8  * option) any later version.
9  *
10  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13  * License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
17  */
18 
19 #include <MoFEM.hpp>
20 
21 #include "impl/ErrorHandler.cpp"
22 
23 extern "C" {
25 }
26 
27 namespace MoFEM {
28 
29 constexpr const int CoreTmp<0>::value;
30 constexpr const int CoreTmp<-1>::value;
31 
33  UnknownInterface **iface) const {
35  *iface = NULL;
36  if (uuid == IDD_MOFEMCoreInterface) {
37  *iface = static_cast<CoreInterface *>(const_cast<Core *>(this));
39  } else if (uuid == IDD_MOFEMDeprecatedCoreInterface) {
40  *iface = static_cast<DeprecatedCoreInterface *>(const_cast<Core *>(this));
42  }
43  // Get sub-interface
44  unsigned long int id = uuid.uUId.to_ulong();
45  boost::ptr_map<unsigned long, UnknownInterface>::iterator it;
46  it = iFaces.find(id);
47  if (it != iFaces.end()) {
48  *iface = it->second;
50  }
51  *iface = NULL;
52  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
54 }
55 
56 bool Core::isGloballyInitialised = false;
58 PetscBool Core::isInitialized;
59 
60 MoFEMErrorCode Core::Initialize(int *argc, char ***args, const char file[],
61  const char help[]) {
62 
63  MPI_Initialized(&mpiInitialised);
64  if (!mpiInitialised)
65  MPI_Init(argc, args);
66 
67  PetscInitialized(&isInitialized);
68  if (isInitialized == PETSC_FALSE) {
69  PetscInitialize(argc, args, file, help);
70  PetscPushErrorHandler(mofem_error_handler, PETSC_NULL);
71  }
72 
73  LogManager::createDefaultSinks(MPI_COMM_WORLD);
74  PetscVFPrintf = LogManager::logPetscFPrintf;
76  isGloballyInitialised = true;
77 
78  MOFEM_LOG_CHANNEL("WORLD");
79  char petsc_version[255];
80  CHKERR PetscGetVersion(petsc_version, 255);
81  MOFEM_LOG_C("WORLD", Sev::inform, "MoFEM version %d.%d.%d (%s %s)",
82  MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD,
83  MOAB_VERSION_STRING, petsc_version);
84  MOFEM_LOG_C("WORLD", Sev::inform, "git commit id %s", GIT_SHA1_NAME);
85 
86  auto log_time = [&](const auto perefix, auto time) {
87  MOFEM_LOG("WORLD", Sev::inform)
88  << perefix << time.date().year() << "-" << time.date().month() << "-"
89  << time.date().day() << " " << time.time_of_day().hours() << ":"
90  << time.time_of_day().minutes() << ":" << time.time_of_day().seconds();
91  };
92 
93  // Get current system time
94  log_time("Local time: ", boost::posix_time::second_clock::local_time());
95  log_time("UTC time: ", boost::posix_time::second_clock::universal_time());
96 
97  return MOFEM_SUCCESS;
98 }
99 
101  if (isGloballyInitialised) {
102  PetscPopErrorHandler();
103  isGloballyInitialised = false;
104 
105  if (isInitialized == PETSC_FALSE) {
106  PetscBool is_finalized;
107  PetscFinalized(&is_finalized);
108  if (!is_finalized)
109  PetscFinalize();
110  }
111 
112  if (!mpiInitialised) {
113  int mpi_finalized;
114  MPI_Finalized(&mpi_finalized);
115  if (!mpi_finalized)
116  MPI_Finalize();
117  }
118  }
119 
120  return 0;
121 }
122 
123 // Use SFINAE to decide which template should be run,
124 // if exist getSubInterfaceOptions run this one.
125 template <class T>
126 static auto get_sub_iface_options_imp(T *const ptr, int)
127  -> decltype(ptr->getSubInterfaceOptions()) {
128  return ptr->getSubInterfaceOptions();
129 };
130 
131 // Use SFINAE to decide which template should be run,
132 // if getSubInterfaceOptions not exist run this one.
133 template <class T>
134 static auto get_sub_iface_options_imp(T *const ptr, long) -> MoFEMErrorCode {
135  return 0;
136 };
137 
138 template <class IFACE>
141  CHKERR registerInterface<IFACE>(uid, false);
142  unsigned long int id = uid.uUId.to_ulong();
143  IFACE *ptr = new IFACE(*this);
144 
145  // If sub interface has function getSubInterfaceOptions run
146  // it after construction. getSubInterfaceOptions is used to
147  // get parameters from command line.
148  // See SFINAE:
149  // https://stackoverflow.com/questions/257288/is-it-possible-to-write-a-template-to-check-for-a-functions-existence
150  // https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error
151  auto get_sub_iface_options = [](auto *const ptr) {
152  return get_sub_iface_options_imp(ptr, 0);
153  };
154  CHKERR get_sub_iface_options(ptr);
155 
156  iFaces.insert(id, ptr);
158 }
159 
161  MPI_Comm comm, const int verbose) {
163 
164  // This is deprecated ONE should use MoFEM::Core::Initialize
165  if (!isGloballyInitialised)
166  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
167  "MoFEM globally is not initialised, call MoFEM::Core::Initialize");
168 
169  // Create duplicate communicator
170  wrapMPIComm = boost::make_shared<WrapMPIComm>(comm, cOmm);
171  MPI_Comm_size(cOmm, &sIze);
172  MPI_Comm_rank(cOmm, &rAnk);
173 
174  // CHeck if moab has set communicator if not set communicator interbally
175  ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
176  if (pComm == NULL)
177  pComm = new ParallelComm(&moab, cOmm);
178 
179  // Register interfaces for this implementation
180  CHKERR registerInterface<UnknownInterface>(IDD_MOFEMUnknown);
181  CHKERR registerInterface<CoreInterface>(IDD_MOFEMCoreInterface);
182  CHKERR registerInterface<DeprecatedCoreInterface>(
184 
185  // Register MOFEM events in PETSc
186  PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
187  PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
188  PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
189  PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
190 
192 }
193 
194 Core::CoreTmp(moab::Interface &moab, ///< MoAB interface
195  MPI_Comm comm, ///< MPI communicator
196  const int verbose ///< Verbosity level
197 
198  )
199  : CoreTmp(moab, comm, verbose, CoreValue<0>()) {
200 
201  // Register sub-interfaces
202  ierr = this->registerSubInterfaces();
203  CHKERRABORT(comm, ierr);
204  ierr = this->clearMap();
205  CHKERRABORT(comm, ierr);
206  ierr = this->getTags();
207  CHKERRABORT(comm, ierr);
208  ierr = this->getOptions(verbose);
209  CHKERRABORT(comm, ierr);
210 
211  this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
212  setRefEntBasicDataPtr(*this, this->basicEntityDataPtr);
213 
214  ierr = this->initialiseDatabaseFromMesh(verbose);
215  CHKERRABORT(comm, ierr);
216 }
217 
219  moab::Interface &moab, ///< MoAB interface
220  MPI_Comm comm, ///< MPI communicator
221  const int verbose ///< Verbosity level
222 
223  )
224  : CoreTmp<0>(moab, comm, verbose, CoreValue<-1>()) {
225 
226  // Register sub-interfaces
227  ierr = this->registerSubInterfaces();
228  CHKERRABORT(comm, ierr);
229  ierr = this->clearMap();
230  CHKERRABORT(comm, ierr);
231  ierr = this->getTags();
232  CHKERRABORT(comm, ierr);
233  ierr = this->getOptions(verbose);
234  CHKERRABORT(comm, ierr);
235 
236  this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
237  setRefEntBasicDataPtr(*this, this->basicEntityDataPtr);
238 
239  ierr = this->initialiseDatabaseFromMesh(verbose);
240  CHKERRABORT(comm, ierr);
241 }
242 
244  PetscBool is_finalized;
245  PetscFinalized(&is_finalized);
246  // Destroy interfaces
247  iFaces.clear();
248  // This is deprecated ONE should use MoFEM::Core::Initialize
249  if (isGloballyInitialised && is_finalized) {
250  isGloballyInitialised = false;
251  }
252 }
253 
255  MOFEM_LOG_CHANNEL("WORLD");
257  if (verb == -1)
258  verb = verbose;
259 
260  CoordSystemsManager *cs_manger_ptr;
261  CHKERR getInterface(cs_manger_ptr);
262 
263  // Initialize coordinate systems
264  CHKERR cs_manger_ptr->initialiseDatabaseFromMesh(verb);
265 
266  Range ref_elems_to_add;
267 
268  auto m_moab = &get_moab();
269 
270  // Initialize database
271  Range meshsets;
272  CHKERR get_moab().get_entities_by_type(0, MBENTITYSET, meshsets, false);
273  Range special_meshsets;
274  for (auto mit : meshsets) {
275  BitFieldId field_id;
276  // Get bit id form field tag
277  CHKERR get_moab().tag_get_data(th_FieldId, &mit, 1, &field_id);
278  // Check if meshset if field meshset
279  if (field_id != 0) {
280  const char *cs_name;
281  int cs_name_size;
282  boost::shared_ptr<CoordSys> cs_ptr;
283  rval =
284  get_moab().tag_get_by_ptr(cs_manger_ptr->get_th_CoordSysName(), &mit,
285  1, (const void **)&cs_name, &cs_name_size);
286  if (rval == MB_SUCCESS && cs_name_size)
287  CHKERR cs_manger_ptr->getCoordSysPtr(std::string(cs_name, cs_name_size),
288  cs_ptr);
289  else
290  CHKERR cs_manger_ptr->getCoordSysPtr("UNDEFINED", cs_ptr);
291 
292  auto p = fIelds.insert(boost::make_shared<Field>(moab, mit, cs_ptr));
293 
294  if (verb > QUIET)
295  MOFEM_LOG("WORLD", Sev::verbose) << "Read field " << **p.first;
296 
297  if (!p.second) {
298  // Field meshset exists, remove duplicate meshsets from other
299  // processors.
300  Range ents;
301  CHKERR get_moab().get_entities_by_handle(mit, ents, true);
302  CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
303  CHKERR get_moab().delete_entities(&mit, 1);
304  } else {
305  special_meshsets.insert(mit);
306  }
307  }
308  // Check for finite elements
309  BitFieldId fe_id;
310  // Get bit id from fe tag
311  CHKERR get_moab().tag_get_data(th_FEId, &mit, 1, &fe_id);
312  // check if meshset is finite element meshset
313  if (fe_id != 0) {
314  std::pair<FiniteElement_multiIndex::iterator, bool> p =
315  finiteElements.insert(
316  boost::shared_ptr<FiniteElement>(new FiniteElement(moab, mit)));
317  if (verb > QUIET)
318  MOFEM_LOG("WORLD", Sev::verbose) << "Read finite element " << **p.first;
319 
320  Range ents;
321  CHKERR get_moab().get_entities_by_type(mit, MBENTITYSET, ents, false);
322  CHKERR get_moab().get_entities_by_handle(mit, ents, true);
323  ref_elems_to_add.merge(ents);
324  if (!p.second) {
325  // Finite element mesh set exist, could be created on other processor.
326  // Remove duplicate.
327  CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
328  CHKERR get_moab().delete_entities(&mit, 1);
329  } else {
330  special_meshsets.insert(mit);
331  }
332  }
333  BitProblemId problem_id;
334  // get bit id form problem tag
335  CHKERR get_moab().tag_get_data(th_ProblemId, &mit, 1, &problem_id);
336  // check if meshset if problem meshset
337  if (problem_id != 0) {
338  std::pair<Problem_multiIndex::iterator, bool> p =
339  pRoblems.insert(Problem(moab, mit));
340  if (verb > QUIET) {
341  MOFEM_LOG("WORLD", Sev::verbose) << "Read problem " << *p.first;
342  MOFEM_LOG("WORLD", Sev::noisy)
343  << "\tBitRef " << p.first->getBitRefLevel() << " BitMask "
344  << p.first->getMaskBitRefLevel();
345  }
346 
347  if (!p.second) {
348  // Problem meshset exists, could be created on other processor.
349  // Remove duplicate.
350  Range ents;
351  CHKERR get_moab().get_entities_by_handle(mit, ents, true);
352  CHKERR get_moab().get_entities_by_type(mit, MBENTITYSET, ents, true);
353  CHKERR get_moab().add_entities(p.first->meshset, ents);
354  CHKERR get_moab().delete_entities(&mit, 1);
355  } else {
356  special_meshsets.insert(mit);
357  }
358  }
359  }
360 
361  // Add entities to database
362  Range bit_ref_ents;
363  CHKERR get_moab().get_entities_by_handle(0, bit_ref_ents, false);
364  bit_ref_ents = subtract(bit_ref_ents, special_meshsets);
365  CHKERR getInterface<BitRefManager>()->filterEntitiesByRefLevel(
366  BitRefLevel().set(), BitRefLevel().set(), bit_ref_ents);
367  CHKERR getInterface<BitRefManager>()->setEntitiesBitRefLevel(bit_ref_ents);
368  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
369  ref_elems_to_add);
370 
371  // Build field entities
372  for (auto field : fIelds) {
373  if (field->getSpace() != NOSPACE) {
374  Range ents_of_id_meshset;
375  CHKERR get_moab().get_entities_by_handle(field->getMeshset(),
376  ents_of_id_meshset, false);
377  CHKERR set_field_order(ents_of_id_meshset, field->getId(), -1, verb);
378  }
379  }
380 
381  if (initaliseAndBuildField || initaliseAndBuildFiniteElements) {
382  CHKERR build_fields(verb);
383  if (initaliseAndBuildFiniteElements) {
384  CHKERR build_finite_elements(verb);
385  }
386  }
387 
388  if (verb > VERY_NOISY) {
389  list_fields();
390  list_finite_elements();
391  list_problem();
392  }
393 
394  // Initialize interfaces
395  MeshsetsManager *m_manger_ptr;
396  CHKERR getInterface(m_manger_ptr);
397  CHKERR m_manger_ptr->initialiseDatabaseFromMesh(verb);
398  SeriesRecorder *series_recorder_ptr;
399  CHKERR getInterface(series_recorder_ptr);
400  CHKERR series_recorder_ptr->initialiseDatabaseFromMesh(verb);
401 
403 }
404 
407  if (verb == -1)
408  verb = verbose;
409 
410  // clear moab database
411  CHKERR clearMap();
412 
413  // set new reference
414  moab = std::ref(new_moab);
415 
416  // check if moab has set communicator if not set communicator internally
417  ParallelComm *pComm = ParallelComm::get_pcomm(&new_moab, MYPCOMM_INDEX);
418  if (pComm == NULL) {
419  pComm = new ParallelComm(&new_moab, cOmm);
420  }
421 
422  // create MoFEM tags
423  CHKERR getTags();
424 
425  // Create basic entity data struture
426  basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
427  setRefEntBasicDataPtr(*this, this->basicEntityDataPtr);
428 
429  // Initalise database
430  CHKERR this->initialiseDatabaseFromMesh(verb);
431 
433 };
434 
437 
438  iFaces.clear();
439 
440  // Register sub interfaces
441  CHKERR regSubInterface<LogManager>(IDD_MOFEMLogManager);
442  CHKERR regSubInterface<Simple>(IDD_MOFEMSimple);
443  CHKERR regSubInterface<PipelineManager>(IDD_MOFEMBasic);
444  CHKERR regSubInterface<ProblemsManager>(IDD_MOFEMProblemsManager);
445  CHKERR regSubInterface<MatrixManager>(IDD_MOFEMMatrixManager);
446  CHKERR regSubInterface<ISManager>(IDD_MOFEMISManager);
447  CHKERR regSubInterface<VecManager>(IDD_MOFEMVEC);
448  CHKERR regSubInterface<FieldBlas>(IDD_MOFEMFieldBlas);
449  CHKERR regSubInterface<BitRefManager>(IDD_MOFEMBitRefManager);
450  CHKERR regSubInterface<Tools>(IDD_MOFEMTools);
451  CHKERR regSubInterface<CommInterface>(IDD_MOFEMComm);
452  CHKERR regSubInterface<MeshsetsManager>(IDD_MOFEMMeshsetsManager);
453  CHKERR regSubInterface<CoordSystemsManager>(IDD_MOFEMCoordsSystemsManager);
454  CHKERR regSubInterface<NodeMergerInterface>(IDD_MOFEMNodeMerger);
455  CHKERR regSubInterface<BitLevelCoupler>(IDD_MOFEMBitLevelCoupler);
456  CHKERR regSubInterface<PrismsFromSurfaceInterface>(
458  CHKERR regSubInterface<MeshRefinement>(IDD_MOFEMMeshRefine);
459  CHKERR regSubInterface<PrismInterface>(IDD_MOFEMPrismInterface);
460  CHKERR regSubInterface<CutMeshInterface>(IDD_MOFEMCutMesh);
461  CHKERR regSubInterface<SeriesRecorder>(IDD_MOFEMSeriesRecorder);
462 #ifdef WITH_TETGEN
463  CHKERR regSubInterface<TetGenInterface>(IDD_MOFEMTetGegInterface);
464 #endif
465 #ifdef WITH_MED
466  CHKERR regSubInterface<MedInterface>(IDD_MOFEMMedInterface);
467 #endif
468  CHKERR regSubInterface<FieldEvaluatorInterface>(IDD_MOFEMFieldEvaluator);
469 
471 };
472 
474  if (*fShift >= BITFIELDID_SIZE)
475  THROW_MESSAGE("Number of field elements exceeded");
476  return BitFieldId().set(((*fShift)++) - 1);
477 }
479  if (*feShift >= BitFEId().set().to_ulong())
480  THROW_MESSAGE("Number of finite elements exceeded");
481  return BitFEId(1 << (((*feShift)++) - 1));
482 }
483 
485  if (*pShift >= BitProblemId().set().to_ulong())
486  THROW_MESSAGE("Number of problems exceeded");
487  return BitProblemId(1 << (((*pShift)++) - 1));
488 }
489 
492  // Cleaning databases in interfaces
493  CHKERR getInterface<SeriesRecorder>()->clearMap();
494  CHKERR getInterface<MeshsetsManager>()->clearMap();
495  CHKERR getInterface<CoordSystemsManager>()->clearMap();
496  CHKERR getInterface<CutMeshInterface>()->clearMap();
497  // Cleaning databases
498  refinedEntities.clear();
499  refinedFiniteElements.clear();
500  fIelds.clear();
501  entsFields.clear();
502  dofsField.clear();
503  finiteElements.clear();
504  entsFiniteElements.clear();
505  entFEAdjacencies.clear();
506  pRoblems.clear();
508 }
509 
512  if (verb == -1)
513  verb = verbose;
514  std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
515  p_ent = refinedEntities.insert(
516  boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
517  if (p_ent.second) {
518  std::pair<RefElement_multiIndex::iterator, bool> p;
519  p = refinedFiniteElements.insert(
520  boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)));
521  int num_nodes;
522  const EntityHandle *conn;
523  CHKERR get_moab().get_connectivity(prism, conn, num_nodes, true);
524  Range face_side3, face_side4;
525  CHKERR get_moab().get_adjacencies(conn, 3, 2, false, face_side3);
526  CHKERR get_moab().get_adjacencies(&conn[3], 3, 2, false, face_side4);
527  if (face_side3.size() != 1)
528  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
529  "prism don't have side face 3");
530  if (face_side4.size() != 1)
531  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
532  "prims don't have side face 4");
533  p.first->get()->getSideNumberPtr(*face_side3.begin());
534  p.first->get()->getSideNumberPtr(*face_side4.begin());
535  }
537 }
538 
541 
542  const EntityHandle root_meshset = get_moab().get_root_set();
543  if (root_meshset) {
544  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
545  "Root meshset should be 0");
546  }
547 
548  // Set version
549  {
550  Version version;
551  CHKERR getFileVersion(moab, version);
552  }
553 
554  // Global Variables
555  {
556 
557  auto check_tag_allocated = [](auto &rval) {
559  if (rval == MB_ALREADY_ALLOCATED)
560  rval = MB_SUCCESS;
561  else
562  CHKERRG(rval);
564  };
565 
566  // Fields
567  int def_shift = 1;
568  rval = get_moab().tag_get_handle("_FieldShift", 1, MB_TYPE_INTEGER,
569  th_FieldShift, MB_TAG_CREAT | MB_TAG_MESH,
570  &def_shift);
571  CHKERR check_tag_allocated(rval);
572 
573  const void *tag_data[1];
574  CHKERR get_moab().tag_get_by_ptr(th_FieldShift, &root_meshset, 1, tag_data);
575  fShift = (int *)tag_data[0];
576  // FE
577  rval = get_moab().tag_get_handle("_FEShift", 1, MB_TYPE_INTEGER, th_FEShift,
578  MB_TAG_CREAT | MB_TAG_MESH, &def_shift);
579  CHKERR check_tag_allocated(rval);
580 
581  CHKERR get_moab().tag_get_by_ptr(th_FEShift, &root_meshset, 1, tag_data);
582  feShift = (int *)tag_data[0];
583  // Problem
584  rval = get_moab().tag_get_handle("_ProblemShift", 1, MB_TYPE_INTEGER,
585  th_ProblemShift,
586  MB_TAG_CREAT | MB_TAG_MESH, &def_shift);
587  CHKERR check_tag_allocated(rval);
588 
589  CHKERR get_moab().tag_get_by_ptr(th_ProblemShift, &root_meshset, 1,
590  tag_data);
591  pShift = (int *)tag_data[0];
592  // Safety nets
593  int def_bool = 0;
594  rval = get_moab().tag_get_handle("_MoFEMBuild", 1, MB_TYPE_INTEGER,
595  th_MoFEMBuild, MB_TAG_CREAT | MB_TAG_MESH,
596  &def_bool);
597  CHKERR check_tag_allocated(rval);
598 
599  CHKERR get_moab().tag_get_by_ptr(th_MoFEMBuild, &root_meshset, 1,
600  (const void **)&buildMoFEM);
601  }
602 
603  // Tags saved in vtk-files
604  {
605  const int def_part = -1;
606  CHKERR get_moab().tag_get_handle("PARTITION", 1, MB_TYPE_INTEGER, th_Part,
607  MB_TAG_CREAT | MB_TAG_SPARSE, &def_part);
608  }
609 
610  // Tags Ref
611  {
612  const int def_part = -1;
613  CHKERR get_moab().tag_get_handle("_MeshsetPartition", 1, MB_TYPE_INTEGER,
614  th_Part, MB_TAG_CREAT | MB_TAG_SPARSE,
615  &def_part);
616  EntityHandle def_handle = 0;
617  CHKERR get_moab().tag_get_handle("_RefParentHandle", 1, MB_TYPE_HANDLE,
618  th_RefParentHandle,
619  MB_TAG_CREAT | MB_TAG_SPARSE, &def_handle);
620  BitRefLevel def_bit_level = 0;
621  CHKERR get_moab().tag_get_handle(
622  "_RefBitLevel", sizeof(BitRefLevel), MB_TYPE_OPAQUE, th_RefBitLevel,
623  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_bit_level);
624  BitRefLevel def_bit_level_mask = BitRefLevel().set();
625  CHKERR get_moab().tag_get_handle(
626  "_RefBitLevelMask", sizeof(BitRefLevel), MB_TYPE_OPAQUE,
627  th_RefBitLevel_Mask, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
628  &def_bit_level_mask);
629  BitRefEdges def_bit_edge = 0;
630  CHKERR get_moab().tag_get_handle(
631  "_RefBitEdge", sizeof(BitRefEdges), MB_TYPE_OPAQUE, th_RefBitEdge,
632  MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_bit_edge);
633  const int def_type[] = {0, 0};
634  CHKERR get_moab().tag_get_handle("_RefType", 2, MB_TYPE_INTEGER, th_RefType,
635  MB_TAG_CREAT | MB_TAG_SPARSE, def_type);
636  }
637 
638  // Tags Field
639  {
640  const unsigned long int def_id = 0;
641  CHKERR get_moab().tag_get_handle(
642  "_FieldId", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FieldId,
643  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
644  FieldSpace def_space = LASTSPACE;
645  CHKERR get_moab().tag_get_handle(
646  "_FieldSpace", sizeof(FieldSpace), MB_TYPE_OPAQUE, th_FieldSpace,
647  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_space);
648  FieldApproximationBase def_base = LASTBASE;
649  CHKERR get_moab().tag_get_handle(
650  "_FieldBase", sizeof(FieldApproximationBase), MB_TYPE_OPAQUE,
651  th_FieldBase, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_base);
652  const int def_val_len = 0;
653  CHKERR get_moab().tag_get_handle(
654  "_FieldName", def_val_len, MB_TYPE_OPAQUE, th_FieldName,
655  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
656  CHKERR get_moab().tag_get_handle(
657  "_FieldName_DataNamePrefix", def_val_len, MB_TYPE_OPAQUE,
658  th_FieldName_DataNamePrefix,
659  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
660  }
661 
662  // Tags FE
663  {
664  const unsigned long int def_id = 0;
665  const int def_val_len = 0;
666  CHKERR get_moab().tag_get_handle(
667  "_FEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_FEId,
668  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
669  CHKERR get_moab().tag_get_handle(
670  "_FEName", def_val_len, MB_TYPE_OPAQUE, th_FEName,
671  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
672  CHKERR get_moab().tag_get_handle(
673  "_FEIdCol", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdCol,
674  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
675  CHKERR get_moab().tag_get_handle(
676  "_FEIdRow", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdRow,
677  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
678  CHKERR get_moab().tag_get_handle(
679  "_FEIdData", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdData,
680  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
681  }
682 
683  // Tags Problem
684  {
685  const unsigned long int def_id = 0;
686  const int def_val_len = 0;
687  CHKERR get_moab().tag_get_handle(
688  "_ProblemId", sizeof(BitProblemId), MB_TYPE_OPAQUE, th_ProblemId,
689  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
690  CHKERR get_moab().tag_get_handle(
691  "_ProblemFEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_ProblemFEId,
692  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
693  CHKERR get_moab().tag_get_handle(
694  "_ProblemName", def_val_len, MB_TYPE_OPAQUE, th_ProblemName,
695  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
696  DofIdx def_nbdofs = 0;
697  CHKERR get_moab().tag_get_handle(
698  "_ProblemNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
699  th_ProblemNbDofsRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
700  &def_nbdofs);
701  CHKERR get_moab().tag_get_handle(
702  "_ProblemNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
703  th_ProblemNbDofsCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
704  &def_nbdofs);
705  CHKERR get_moab().tag_get_handle(
706  "_ProblemLocalNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
707  th_ProblemLocalNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
708  &def_nbdofs);
709  CHKERR get_moab().tag_get_handle(
710  "_ProblemGhostNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
711  th_ProblemGhostNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
712  &def_nbdofs);
713  CHKERR get_moab().tag_get_handle(
714  "_ProblemLocalNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
715  th_ProblemLocalNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
716  &def_nbdofs);
717  CHKERR get_moab().tag_get_handle(
718  "_ProblemGhostNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
719  th_ProblemGhostNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
720  &def_nbdofs);
721  }
722 
723  // Meshsets with boundary conditions and material sets
724  MeshsetsManager *meshsets_manager_ptr;
725  CHKERR getInterface(meshsets_manager_ptr);
726  CHKERR meshsets_manager_ptr->getTags(verb);
727 
728  // Series recorder
729  SeriesRecorder *series_recorder_ptr;
730  CHKERR getInterface(series_recorder_ptr);
731  CHKERR series_recorder_ptr->getTags(verb);
732 
733  // Coordinate systems
734  CoordSystemsManager *cs_manger_ptr;
735  CHKERR getInterface(cs_manger_ptr);
736  CHKERR cs_manger_ptr->getTags(verb);
737 
739 }
740 
743  if (verb == -1)
744  verb = verbose;
745  CHKERR clearMap();
747 }
748 
751  if (verb == -1)
752  verb = verbose;
753  CHKERR this->clearMap();
754  CHKERR this->getTags(verb);
755  CHKERR this->initialiseDatabaseFromMesh(verb);
757 }
758 
760  return this->setMoabInterface(new_moab, verb);
761 };
762 
764  int verb) {
765  return this->setMoabInterface(new_moab, verb);
766 };
767 
770  if (verb == -1)
771  verb = verbose;
772 
773  CHKERR PetscOptionsBegin(cOmm, optionsPrefix.c_str(), "Mesh cut options",
774  "See MoFEM documentation");
775 
776  CHKERR PetscOptionsBool(
777  "-mofem_init_fields", "Initialise fields on construction", "",
778  initaliseAndBuildField, &initaliseAndBuildField, NULL);
779 
780  CHKERR PetscOptionsBool(
781  "-mofem_init_fields", "Initialise fields on construction", "",
782  initaliseAndBuildFiniteElements, &initaliseAndBuildFiniteElements, NULL);
783 
784  // TODO: Add read verbosity level
785  // TODO: Add option to initalise problems ??? - DO WE REALLY NEED THAT
786 
787  ierr = PetscOptionsEnd();
788  CHKERRG(ierr);
789 
791 }
792 
793 // cubit meshsets
794 
797  *fields_ptr = &fIelds;
799 }
800 
802 Core::get_ref_ents(const RefEntity_multiIndex **refined_entities_ptr) const {
804  *refined_entities_ptr = &refinedEntities;
806 }
808  const RefElement_multiIndex **refined_finite_elements_ptr) const {
810  *refined_finite_elements_ptr = &refinedFiniteElements;
812 }
813 
814 MoFEMErrorCode Core::get_problem(const std::string &problem_name,
815  const Problem **problem_ptr) const {
818  const ProblemsByName &problems = pRoblems.get<Problem_mi_tag>();
819  ProblemsByName::iterator p_miit = problems.find(problem_name);
820  if (p_miit == problems.end()) {
821  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
822  "problem < %s > not found, (top tip: check spelling)",
823  problem_name.c_str());
824  }
825  *problem_ptr = &*p_miit;
827 }
828 
830 Core::get_problems(const Problem_multiIndex **problems_ptr) const {
832  *problems_ptr = &pRoblems;
834 }
835 
837 Core::get_field_ents(const FieldEntity_multiIndex **field_ents) const {
839  *field_ents = &entsFields;
841 }
844  *dofs_ptr = &dofsField;
846 }
847 
851  *fe_ptr = &finiteElements;
853 }
854 
856  const EntFiniteElement_multiIndex **fe_ent_ptr) const {
858  *fe_ent_ptr = &entsFiniteElements;
860 }
861 
863  MeshsetsManager *meshsets_manager_ptr;
864  getInterface(meshsets_manager_ptr);
865  return meshsets_manager_ptr;
866 }
867 
869  MeshsetsManager *meshsets_manager_ptr;
870  getInterface(meshsets_manager_ptr);
871  return meshsets_manager_ptr;
872 }
873 
876  *dofs_elements_adjacency) const {
878  *dofs_elements_adjacency = &entFEAdjacencies;
880 }
881 
884  return &entFEAdjacencies;
885 }
886 
887 const Field_multiIndex *Core::get_fields() const { return &fIelds; }
889  return &refinedEntities;
890 }
892  return &refinedFiniteElements;
893 }
895  return &finiteElements;
896 }
898  return &entsFiniteElements;
899 }
901  return &entsFields;
902 }
903 const DofEntity_multiIndex *Core::get_dofs() const { return &dofsField; }
904 const Problem *Core::get_problem(const std::string &problem_name) const {
905  const Problem *prb;
906  CHKERR get_problem(problem_name, &prb);
907  return prb;
908 }
909 const Problem_multiIndex *Core::get_problems() const { return &pRoblems; }
910 
911 template <int V, typename std::enable_if<(V >= 0), int>::type * = nullptr>
912 void set_ref_ent_basic_data_ptr_impl(boost::shared_ptr<BasicEntityData> &ptr) {
914 };
915 
916 template <int V, typename std::enable_if<(V < 0), int>::type * = nullptr>
917 void set_ref_ent_basic_data_ptr_impl(boost::shared_ptr<BasicEntityData> &ptr) {
918  return;
919 };
920 
921 void Core::setRefEntBasicDataPtr(MoFEM::Interface &m_field,
922  boost::shared_ptr<BasicEntityData> &ptr) {
923 
924  boost::hana::for_each(
925 
926  boost::hana::make_range(boost::hana::int_c<-1>,
927  boost::hana::int_c<MAX_CORE_TMP>),
928 
929  [&](auto r) {
930  if (m_field.getValue() == r)
931  set_ref_ent_basic_data_ptr_impl<r>(ptr);
932  }
933 
934  );
935 };
936 
937 boost::shared_ptr<RefEntityTmp<0>>
938 Core::makeSharedRefEntity(MoFEM::Interface &m_field, const EntityHandle ent) {
939 
940  boost::shared_ptr<RefEntityTmp<0>> ref_ent_ptr;
941 
942  boost::hana::for_each(
943 
944  boost::hana::make_range(boost::hana::int_c<-1>,
945  boost::hana::int_c<MAX_CORE_TMP>),
946 
947  [&](auto r) {
948  if (m_field.getValue() == r)
949  ref_ent_ptr = boost::shared_ptr<RefEntityTmp<0>>(
950 
951  new RefEntityTmp<r>(m_field.get_basic_entity_data_ptr(), ent)
952 
953  );
954  }
955 
956  );
957 
958  return ref_ent_ptr;
959 }
960 
961 boost::shared_ptr<RefEntityTmp<0>>
962 Core::make_shared_ref_entity(const EntityHandle ent) {
963  return this->makeSharedRefEntity(*this, ent);
964 }
965 
966 boost::shared_ptr<RefEntityTmp<0>>
968  return this->makeSharedRefEntity(*this, ent);
969 }
970 
971 } // namespace MoFEM
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=0)
CoreTmp(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
static const MOFEMuuid IDD_MOFEMSeriesRecorder
MoFEMErrorCode get_problem(const std::string &problem_name, const Problem **problem_ptr) const
Get problem database (data structure)
Definition: Core.cpp:814
MoFEMErrorCode getTags(int verb=DEFAULT_VERBOSITY)
Get tag handles.
Definition: Core.cpp:539
const RefEntity_multiIndex * get_ref_ents() const
Get the ref ents object.
Definition: Core.cpp:888
static const MOFEMuuid IDD_MOFEMCoreInterface
Definition: Interface.hpp:24
MoFEM interface unique ID.
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:1027
MoFEMErrorCode coreGenericConstructor(moab::Interface &moab, MPI_Comm comm, const int verbose)
Definition: Core.cpp:160
static const MOFEMuuid IDD_MOFEMMeshsetsManager
const FieldEntityEntFiniteElementAdjacencyMap_multiIndex * get_ents_elements_adjacency() const
Get the dofs elements adjacency object.
Definition: Core.cpp:883
static const MOFEMuuid IDD_MOFEMProblemsManager
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
BitFieldId getFieldShift()
Return unique field Id.
Definition: Core.cpp:473
const FieldEntity_multiIndex * get_field_ents() const
Get the field ents object.
Definition: Core.cpp:900
BitProblemId getProblemShift()
Return unique problem Id.
Definition: Core.cpp:484
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.
static const MOFEMuuid IDD_MOFEMLogManager
Definition: LogManager.hpp:31
static void createDefaultSinks(MPI_Comm comm)
Create default sinks.
Definition: LogManager.cpp:293
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition: Core.cpp:862
MoFEMErrorCode set_moab_interface(moab::Interface &new_moab, int verb)
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509
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.
static Index< 'p', 3 > p
static PetscErrorCode logPetscFPrintf(FILE *fd, const char format[], va_list Argp)
Use to handle PETSc output.
Definition: LogManager.cpp:375
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:303
keeps data about abstract PRISM finite element
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.
base class for all interface classes
static MoFEMErrorCode getOptions()
Get logger option.
Definition: LogManager.cpp:137
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:306
static const MOFEMuuid IDD_MOFEMUnknown
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:60
const FiniteElement_multiIndex * get_finite_elements() const
Get the finite elements object.
Definition: Core.cpp:894
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:552
static PetscBool isInitialized
petsc was initialised by other agent
Definition: Core.hpp:1029
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
Field_multiIndex for Field.
static const MOFEMuuid IDD_MOFEMBitRefManager
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition: Core.cpp:254
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
MultiIndex container keeps FieldEntity.
BitIntefaceId uUId
static const MOFEMuuid IDD_MOFEMNodeMerger
Definition: NodeMerger.hpp:23
Interface for managing meshsets containing materials and boundary conditions.
const DofEntity_multiIndex * get_dofs() const
Get the dofs object.
Definition: Core.cpp:903
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:628
static const MOFEMuuid IDD_MOFEMVEC
Definition: VecManager.hpp:26
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition: Types.hpp:55
static const MOFEMuuid IDD_MOFEMPrismsFromSurface
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
keeps basic data about problemThis is low level structure with information about problem,...
MoFEMErrorCode regSubInterface(const MOFEMuuid &uid)
Register subinterfac in core interface.
Definition: Core.cpp:139
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
static const MOFEMuuid IDD_MOFEMSimple
Definition: Simple.hpp:29
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:181
MoFEMErrorCode getTags(int verb=-1)
get tags handlers used on meshsets
static auto get_sub_iface_options_imp(T *const ptr, int) -> decltype(ptr->getSubInterfaceOptions())
Definition: Core.cpp:126
std::bitset< BITREFEDGES_SIZE > BitRefEdges
Definition: Types.hpp:45
MoFEMErrorCode getTags(int verb=-1)
get tags handlers used on meshsets
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:54
MoFEMErrorCode set_moab_interface(moab::Interface &new_moab, int verb=VERBOSE)
Set the moab interface object.
Definition: Core.cpp:759
BitFEId getFEShift()
Return unique finite element Id.
Definition: Core.cpp:478
const RefElement_multiIndex * get_ref_finite_elements() const
Get the ref finite elements object.
Definition: Core.cpp:891
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=0)
MoFEMErrorCode getCoordSysPtr(const EntityHandle id, boost::shared_ptr< CoordSys > &cs_ptr)
Get the Coord Sys Ptr object.
FieldApproximationBase
approximation base
Definition: definitions.h:150
Finite element definition.
static constexpr int value
Definition: Core.hpp:79
MoFEMErrorCode getTags(int verb=-1)
get tags handlers used on meshsets conating information about coordinate systems
static const MOFEMuuid IDD_MOFEMMeshRefine
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:24
#define BITFIELDID_SIZE
max number of fields
Definition: definitions.h:287
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
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 > >, ordered_non_unique< tag< FiniteElement_name_mi_tag >, const_mem_fun< EntFiniteElement::interface_type_FiniteElement, boost::string_ref, &EntFiniteElement::getNameRef > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< EntFiniteElement, const_mem_fun< EntFiniteElement::interface_type_FiniteElement, boost::string_ref, &EntFiniteElement::getNameRef >, const_mem_fun< EntFiniteElement::interface_type_RefEntity, EntityHandle, &EntFiniteElement::getEnt > > > > > EntFiniteElement_multiIndex
MultiIndex container for EntFiniteElement.
CoreTmp(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
Definition: Core.cpp:194
MoFEMErrorCode registerSubInterfaces()
Register insterfaces.
Definition: Core.cpp:435
static const MOFEMuuid IDD_MOFEMBasic
static const MOFEMuuid IDD_MOFEMTools
Definition: Tools.hpp:23
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:279
FieldSpace
approximation spaces
Definition: definitions.h:174
const EntFiniteElement_multiIndex * get_ents_finite_elements() const
Get the ents finite elements object.
Definition: Core.cpp:897
static const MOFEMuuid IDD_MOFEMTetGegInterface
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition: Types.hpp:53
#define CHKERR
Inline error check.
Definition: definitions.h:604
static const MOFEMuuid IDD_MOFEMCutMesh
static const MOFEMuuid IDD_MOFEMMatrixManager
static const MOFEMuuid IDD_MOFEMCoordsSystemsManager
static char help[]
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:292
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
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< 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 int mpiInitialised
mpi was initialised by other agent
Definition: Core.hpp:1028
MoFEMErrorCode addPrismToDatabase(const EntityHandle prism, int verb=DEFAULT_VERBOSITY)
add prim element
Definition: Core.cpp:510
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
Definition: Core.cpp:768
MoFEMErrorCode clear_database(int verb=DEFAULT_VERBOSITY)
Clear database.
Definition: Core.cpp:741
static const MOFEMuuid IDD_MOFEMFieldBlas
Definition: FieldBlas.hpp:26
void set_ref_ent_basic_data_ptr_impl(boost::shared_ptr< BasicEntityData > &ptr)
Definition: Core.cpp:912
const Problem_multiIndex * get_problems() const
Get the problems object.
Definition: Core.cpp:909
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
MoFEMErrorCode setMoabInterface(moab::Interface &new_moab, int verb=VERBOSE)
Definition: Core.cpp:405
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=0)
int DofIdx
Index of DOF.
Definition: Types.hpp:29
static const MOFEMuuid IDD_MOFEMFieldEvaluator
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
static const MOFEMuuid IDD_MOFEMISManager
Definition: ISManager.hpp:26
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:490
static const MOFEMuuid IDD_MOFEMDeprecatedCoreInterface
Definition: Interface.hpp:26
static const MOFEMuuid IDD_MOFEMPrismInterface
const Field_multiIndex * get_fields() const
Get the fields object.
Definition: Core.cpp:887
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:100
DEPRECATED IFace * query_interface() const
static const MOFEMuuid IDD_MOFEMMedInterface
static const MOFEMuuid IDD_MOFEMBitLevelCoupler
MoFEMErrorCode rebuild_database(int verb=DEFAULT_VERBOSITY)
Clear database and initialize it once again.
Definition: Core.cpp:749
static const MOFEMuuid IDD_MOFEMComm