v0.9.2
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 extern "C" {
21 }
22 
23 namespace MoFEM {
24 
26  UnknownInterface **iface) const {
28  *iface = NULL;
29  if (uuid == IDD_MOFEMCoreInterface) {
30  *iface = static_cast<CoreInterface *>(const_cast<Core *>(this));
32  } else if (uuid == IDD_MOFEMDeprecatedCoreInterface) {
33  *iface = static_cast<DeprecatedCoreInterface *>(const_cast<Core *>(this));
35  }
36  // Get sub-interface
37  unsigned long int id = uuid.uUId.to_ulong();
38  boost::ptr_map<unsigned long, UnknownInterface>::iterator it;
39  it = iFaces.find(id);
40  if (it != iFaces.end()) {
41  *iface = it->second;
43  }
44  *iface = NULL;
45  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
47 }
48 
49 bool Core::isGloballyInitialised = false;
50 
51 MoFEMErrorCode Core::Initialize(int *argc, char ***args, const char file[],
52  const char help[]) {
53  MPI_Init(argc, args);
54  LogManager::createDefaultSinks(MPI_COMM_WORLD);
55  PetscVFPrintf = LogManager::logPetscFPrintf;
56 
57  ierr = PetscInitialize(argc, args, file, help);
58  CHKERRG(ierr);
59 
60  ierr = PetscPushErrorHandler(mofem_error_handler, PETSC_NULL);
61  CHKERRG(ierr);
62 
64 
65  isGloballyInitialised = true;
66  return MOFEM_SUCCESS;
67 }
68 
70  CHKERRQ(ierr);
71  ierr = PetscPopErrorHandler();
72  CHKERRG(ierr);
73  isGloballyInitialised = false;
74  PetscFinalize();
75  return MPI_Finalize();
76 }
77 
78 // Use SFINAE to decide which template should be run,
79 // if exist getSubInterfaceOptions run this one.
80 template <class T>
81 static auto get_sub_iface_options_imp(T *const ptr, int)
82  -> decltype(ptr->getSubInterfaceOptions()) {
83  return ptr->getSubInterfaceOptions();
84 };
85 
86 // Use SFINAE to decide which template should be run,
87 // if getSubInterfaceOptions not exist run this one.
88 template <class T>
89 static auto get_sub_iface_options_imp(T *const ptr, long) -> MoFEMErrorCode {
90  return 0;
91 };
92 
93 template <class IFACE>
96  CHKERR registerInterface<IFACE>(uid, false);
97  unsigned long int id = uid.uUId.to_ulong();
98  IFACE *ptr = new IFACE(*this);
99 
100  // If sub interface has function getSubInterfaceOptions run
101  // it after construction. getSubInterfaceOptions is used to
102  // get parameters from command line.
103  // See SFINAE:
104  // https://stackoverflow.com/questions/257288/is-it-possible-to-write-a-template-to-check-for-a-functions-existence
105  // https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error
106  auto get_sub_iface_options = [](auto *const ptr) {
107  return get_sub_iface_options_imp(ptr, 0);
108  };
109  CHKERR get_sub_iface_options(ptr);
110 
111  iFaces.insert(id, ptr);
113 }
114 
115 Core::Core(moab::Interface &moab, MPI_Comm comm, const int verbose,
116  const bool distributed_mesh)
117  : moab(moab), cOmm(0), verbose(verbose),
118  initaliseAndBuildField(PETSC_FALSE),
119  initaliseAndBuildFiniteElements(PETSC_FALSE) {
120 
121  // This is deprecated ONE should use MoFEM::Core::Initialize
122  if (!isGloballyInitialised) {
123  PetscPushErrorHandler(mofem_error_handler, PETSC_NULL);
124  isGloballyInitialised = true;
125  }
126 
127  // Create duplicate communicator
128  wrapMPIComm = boost::make_shared<WrapMPIComm>(comm, cOmm);
129  MPI_Comm_size(cOmm, &sIze);
130  MPI_Comm_rank(cOmm, &rAnk);
131  // CHeck if moab has set communicator if not set communicator interbally
132  ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
133  if (pComm == NULL) {
134  pComm = new ParallelComm(&moab, cOmm);
135  }
136 
137  // Register interfaces for this implementation
138  ierr = registerInterface<UnknownInterface>(IDD_MOFEMUnknown);
139  CHKERRABORT(comm, ierr);
140  ierr = registerInterface<CoreInterface>(IDD_MOFEMCoreInterface);
141  CHKERRABORT(comm, ierr);
142  ierr = registerInterface<DeprecatedCoreInterface>(
144  CHKERRABORT(comm, ierr);
145 
146  // Register sub-interfaces
148  CHKERRABORT(PETSC_COMM_SELF, ierr);
149 
150  // Print version
151  if (verbose > QUIET) {
152  MOFEM_LOG_CHANNEL("WORLD");
153  char petsc_version[255];
154  ierr = PetscGetVersion(petsc_version, 255);
155  CHKERRABORT(comm, ierr);
156  MOFEM_LOG_C("WORLD", Sev::inform, "MoFEM version %d.%d.%d (%s %s)",
157  MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD,
158  MOAB_VERSION_STRING, petsc_version);
159  MOFEM_LOG_C("WORLD", Sev::inform, "git commit id %s", GIT_SHA1_NAME);
160 
161  auto log_time = [&](const auto perefix, auto time) {
162  MOFEM_LOG("WORLD", Sev::inform)
163  << perefix << time.date().year() << "-" << time.date().month()
164  << "-" << time.date().day() << " " << time.time_of_day().hours()
165  << ":" << time.time_of_day().minutes() << ":"
166  << time.time_of_day().seconds();
167  };
168 
169  // Get current system time
170  log_time("Local time: ", boost::posix_time::second_clock::local_time());
171  log_time("UTC time: ", boost::posix_time::second_clock::universal_time());
172 
173  }
174 
175  // Register MOFEM events in PETSc
176  PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
177  PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
178  PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
179  PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
180 
181  // Initialize database
182  ierr = getTags();
183  CHKERRABORT(cOmm, ierr);
184  ierr = clearMap();
185  CHKERRABORT(cOmm, ierr);
186 
187  basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
188  if (distributed_mesh)
189  basicEntityDataPtr->setDistributedMesh();
190  else
191  basicEntityDataPtr->unSetDistributedMesh();
192 
194  CHKERRABORT(cOmm, ierr);
196  CHKERRABORT(cOmm, ierr);
197 }
198 
200  PetscBool is_finalized;
201  PetscFinalized(&is_finalized);
202  // Destroy interfaces
203  iFaces.clear();
204  // This is deprecated ONE should use MoFEM::Core::Initialize
205  if (isGloballyInitialised && is_finalized) {
206  isGloballyInitialised = false;
207  }
208 }
209 
212 
213  iFaces.clear();
214 
215  // Register sub interfaces
216  CHKERR regSubInterface<LogManager>(IDD_MOFEMLogManager);
217  CHKERR regSubInterface<Simple>(IDD_MOFEMSimple);
218  CHKERR regSubInterface<PipelineManager>(IDD_MOFEMBasic);
219  CHKERR regSubInterface<ProblemsManager>(IDD_MOFEMProblemsManager);
220  CHKERR regSubInterface<MatrixManager>(IDD_MOFEMMatrixManager);
221  CHKERR regSubInterface<ISManager>(IDD_MOFEMISManager);
222  CHKERR regSubInterface<VecManager>(IDD_MOFEMVEC);
223  CHKERR regSubInterface<FieldBlas>(IDD_MOFEMFieldBlas);
224  CHKERR regSubInterface<BitRefManager>(IDD_MOFEMBitRefManager);
225  CHKERR regSubInterface<Tools>(IDD_MOFEMTools);
226  CHKERR regSubInterface<CommInterface>(IDD_MOFEMComm);
227  CHKERR regSubInterface<MeshsetsManager>(IDD_MOFEMMeshsetsManager);
228  CHKERR regSubInterface<CoordSystemsManager>(IDD_MOFEMCoordsSystemsManager);
229  CHKERR regSubInterface<NodeMergerInterface>(IDD_MOFEMNodeMerger);
230  CHKERR regSubInterface<BitLevelCoupler>(IDD_MOFEMBitLevelCoupler);
231  CHKERR regSubInterface<PrismsFromSurfaceInterface>(
233  CHKERR regSubInterface<MeshRefinement>(IDD_MOFEMMeshRefine);
234  CHKERR regSubInterface<PrismInterface>(IDD_MOFEMPrismInterface);
235  CHKERR regSubInterface<CutMeshInterface>(IDD_MOFEMCutMesh);
236  CHKERR regSubInterface<SeriesRecorder>(IDD_MOFEMSeriesRecorder);
237 #ifdef WITH_TETGEN
238  CHKERR regSubInterface<TetGenInterface>(IDD_MOFEMTetGegInterface);
239 #endif
240 #ifdef WITH_MED
241  CHKERR regSubInterface<MedInterface>(IDD_MOFEMMedInterface);
242 #endif
243  CHKERR regSubInterface<FieldEvaluatorInterface>(IDD_MOFEMFieldEvaluator);
244 
246 };
247 
249  if (*fShift >= BITFIELDID_SIZE) {
250  char msg[] = "number of fields exceeded";
251  PetscTraceBackErrorHandler(cOmm, __LINE__, PETSC_FUNCTION_NAME, __FILE__,
252  MOFEM_DATA_INCONSISTENCY, PETSC_ERROR_INITIAL,
253  msg, PETSC_NULL);
254  PetscMPIAbortErrorHandler(cOmm, __LINE__, PETSC_FUNCTION_NAME, __FILE__,
255  MOFEM_DATA_INCONSISTENCY, PETSC_ERROR_INITIAL,
256  msg, PETSC_NULL);
257  }
258  return BitFieldId().set(((*fShift)++) - 1);
259 }
261  assert((unsigned int)*feShift < BitFEId().set().to_ulong());
262  return BitFEId(1 << (((*feShift)++) - 1));
263 }
264 
266  assert((unsigned int)*pShift < BitProblemId().set().to_ulong());
267  return BitProblemId(1 << (((*pShift)++) - 1));
268 }
269 
272  // Cleaning databases in interfaces
273  CHKERR getInterface<SeriesRecorder>()->clearMap();
274  CHKERR getInterface<MeshsetsManager>()->clearMap();
275  CHKERR getInterface<CoordSystemsManager>()->clearMap();
276  CHKERR getInterface<CutMeshInterface>()->clearMap();
277  // Cleaning databases
278  refinedEntities.clear();
279  refinedFiniteElements.clear();
280  fIelds.clear();
281  entsFields.clear();
282  dofsField.clear();
283  finiteElements.clear();
284  entsFiniteElements.clear();
285  entFEAdjacencies.clear();
286  pRoblems.clear();
288 }
289 
292  if (verb == -1)
293  verb = verbose;
294  std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
295  p_ent = refinedEntities.insert(
296  boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
297  if (p_ent.second) {
298  std::pair<RefElement_multiIndex::iterator, bool> p;
299  p = refinedFiniteElements.insert(
300  boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)));
301  int num_nodes;
302  const EntityHandle *conn;
303  CHKERR get_moab().get_connectivity(prism, conn, num_nodes, true);
304  Range face_side3, face_side4;
305  CHKERR get_moab().get_adjacencies(conn, 3, 2, false, face_side3);
306  CHKERR get_moab().get_adjacencies(&conn[3], 3, 2, false, face_side4);
307  if (face_side3.size() != 1)
308  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
309  "prism don't have side face 3");
310  if (face_side4.size() != 1)
311  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
312  "prims don't have side face 4");
313  p.first->get()->getSideNumberPtr(*face_side3.begin());
314  p.first->get()->getSideNumberPtr(*face_side4.begin());
315  }
317 }
318 
321 
322  const EntityHandle root_meshset = get_moab().get_root_set();
323  if (root_meshset) {
324  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
325  "Root meshset should be 0");
326  }
327 
328  // Set version
329  {
330  Version version;
331  CHKERR getFileVersion(moab, version);
332  }
333 
334  // Global Variables
335  {
336 
337  auto check_tag_allocated = [](auto &rval) {
339  if (rval == MB_ALREADY_ALLOCATED)
340  rval = MB_SUCCESS;
341  else
342  CHKERRG(rval);
344  };
345 
346  // Fields
347  int def_shift = 1;
348  rval = get_moab().tag_get_handle("_FieldShift", 1, MB_TYPE_INTEGER,
349  th_FieldShift, MB_TAG_CREAT | MB_TAG_MESH,
350  &def_shift);
351  CHKERR check_tag_allocated(rval);
352 
353  const void *tag_data[1];
354  CHKERR get_moab().tag_get_by_ptr(th_FieldShift, &root_meshset, 1, tag_data);
355  fShift = (int *)tag_data[0];
356  // FE
357  rval = get_moab().tag_get_handle("_FEShift", 1, MB_TYPE_INTEGER, th_FEShift,
358  MB_TAG_CREAT | MB_TAG_MESH, &def_shift);
359  CHKERR check_tag_allocated(rval);
360 
361  CHKERR get_moab().tag_get_by_ptr(th_FEShift, &root_meshset, 1, tag_data);
362  feShift = (int *)tag_data[0];
363  // Problem
364  rval = get_moab().tag_get_handle("_ProblemShift", 1, MB_TYPE_INTEGER,
366  MB_TAG_CREAT | MB_TAG_MESH, &def_shift);
367  CHKERR check_tag_allocated(rval);
368 
369  CHKERR get_moab().tag_get_by_ptr(th_ProblemShift, &root_meshset, 1,
370  tag_data);
371  pShift = (int *)tag_data[0];
372  // Safety nets
373  int def_bool = 0;
374  rval = get_moab().tag_get_handle("_MoFEMBuild", 1, MB_TYPE_INTEGER,
375  th_MoFEMBuild, MB_TAG_CREAT | MB_TAG_MESH,
376  &def_bool);
377  CHKERR check_tag_allocated(rval);
378 
379  CHKERR get_moab().tag_get_by_ptr(th_MoFEMBuild, &root_meshset, 1,
380  (const void **)&buildMoFEM);
381  }
382 
383  // Tags saved in vtk-files
384  {
385  const int def_part = -1;
386  CHKERR get_moab().tag_get_handle("PARTITION", 1, MB_TYPE_INTEGER, th_Part,
387  MB_TAG_CREAT | MB_TAG_SPARSE, &def_part);
388  int def_elem_type = MBMAXTYPE;
389  CHKERR get_moab().tag_get_handle("ElemType", 1, MB_TYPE_INTEGER,
390  th_ElemType, MB_TAG_CREAT | MB_TAG_SPARSE,
391  &def_elem_type);
392  }
393 
394  // Tags Ref
395  {
396  EntityHandle def_handle = 0;
397  CHKERR get_moab().tag_get_handle("_RefParentHandle", 1, MB_TYPE_HANDLE,
399  MB_TAG_CREAT | MB_TAG_SPARSE, &def_handle);
400  BitRefLevel def_bit_level = 0;
401  CHKERR get_moab().tag_get_handle(
402  "_RefBitLevel", sizeof(BitRefLevel), MB_TYPE_OPAQUE, th_RefBitLevel,
403  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_bit_level);
404  BitRefLevel def_bit_level_mask = BitRefLevel().set();
405  CHKERR get_moab().tag_get_handle(
406  "_RefBitLevelMask", sizeof(BitRefLevel), MB_TYPE_OPAQUE,
407  th_RefBitLevel_Mask, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
408  &def_bit_level_mask);
409  BitRefEdges def_bit_edge = 0;
410  CHKERR get_moab().tag_get_handle(
411  "_RefBitEdge", sizeof(BitRefEdges), MB_TYPE_OPAQUE, th_RefBitEdge,
412  MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_bit_edge);
413  const int def_type[] = {0, 0};
414  CHKERR get_moab().tag_get_handle("_RefType", 2, MB_TYPE_INTEGER, th_RefType,
415  MB_TAG_CREAT | MB_TAG_SPARSE, def_type);
416  }
417 
418  // Tags Field
419  {
420  const unsigned long int def_id = 0;
421  CHKERR get_moab().tag_get_handle(
422  "_FieldId", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FieldId,
423  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
424  FieldSpace def_space = LASTSPACE;
425  CHKERR get_moab().tag_get_handle(
426  "_FieldSpace", sizeof(FieldSpace), MB_TYPE_OPAQUE, th_FieldSpace,
427  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_space);
428  FieldApproximationBase def_base = LASTBASE;
429  CHKERR get_moab().tag_get_handle(
430  "_FieldBase", sizeof(FieldApproximationBase), MB_TYPE_OPAQUE,
431  th_FieldBase, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_base);
432  const int def_val_len = 0;
433  CHKERR get_moab().tag_get_handle(
434  "_FieldName", def_val_len, MB_TYPE_OPAQUE, th_FieldName,
435  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
436  CHKERR get_moab().tag_get_handle(
437  "_FieldName_DataNamePrefix", def_val_len, MB_TYPE_OPAQUE,
439  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
440  }
441 
442  // Tags FE
443  {
444  const unsigned long int def_id = 0;
445  const int def_val_len = 0;
446  CHKERR get_moab().tag_get_handle(
447  "_FEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_FEId,
448  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
449  CHKERR get_moab().tag_get_handle(
450  "_FEName", def_val_len, MB_TYPE_OPAQUE, th_FEName,
451  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
452  CHKERR get_moab().tag_get_handle(
453  "_FEIdCol", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdCol,
454  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
455  CHKERR get_moab().tag_get_handle(
456  "_FEIdRow", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdRow,
457  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
458  CHKERR get_moab().tag_get_handle(
459  "_FEIdData", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdData,
460  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
461  }
462 
463  // Tags Problem
464  {
465  const unsigned long int def_id = 0;
466  const int def_val_len = 0;
467  CHKERR get_moab().tag_get_handle(
468  "_ProblemId", sizeof(BitProblemId), MB_TYPE_OPAQUE, th_ProblemId,
469  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
470  CHKERR get_moab().tag_get_handle(
471  "_ProblemFEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_ProblemFEId,
472  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
473  CHKERR get_moab().tag_get_handle(
474  "_ProblemName", def_val_len, MB_TYPE_OPAQUE, th_ProblemName,
475  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
476  DofIdx def_nbdofs = 0;
477  CHKERR get_moab().tag_get_handle(
478  "_ProblemNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
479  th_ProblemNbDofsRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
480  &def_nbdofs);
481  CHKERR get_moab().tag_get_handle(
482  "_ProblemNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
483  th_ProblemNbDofsCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
484  &def_nbdofs);
485  CHKERR get_moab().tag_get_handle(
486  "_ProblemLocalNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
487  th_ProblemLocalNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
488  &def_nbdofs);
489  CHKERR get_moab().tag_get_handle(
490  "_ProblemGhostNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
491  th_ProblemGhostNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
492  &def_nbdofs);
493  CHKERR get_moab().tag_get_handle(
494  "_ProblemLocalNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
495  th_ProblemLocalNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
496  &def_nbdofs);
497  CHKERR get_moab().tag_get_handle(
498  "_ProblemGhostNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
499  th_ProblemGhostNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
500  &def_nbdofs);
501  }
502 
503  // Meshsets with boundary conditions and material sets
504  MeshsetsManager *meshsets_manager_ptr;
505  CHKERR getInterface(meshsets_manager_ptr);
506  CHKERR meshsets_manager_ptr->getTags(verb);
507 
508  // Series recorder
509  SeriesRecorder *series_recorder_ptr;
510  CHKERR getInterface(series_recorder_ptr);
511  CHKERR series_recorder_ptr->getTags(verb);
512 
513  // Coordinate systems
514  CoordSystemsManager *cs_manger_ptr;
515  CHKERR getInterface(cs_manger_ptr);
516  CHKERR cs_manger_ptr->getTags(verb);
517 
519 }
520 
523  if (verb == -1)
524  verb = verbose;
525  CHKERR clearMap();
527 }
528 
531  if (verb == -1)
532  verb = verbose;
533  CHKERR clearMap();
534  CHKERR getTags(verb);
537 }
538 
540  const bool distributed_mesh) {
542  if (verb == -1)
543  verb = verbose;
544 
545  // clear moab database
546  CHKERR clearMap();
547 
548  // set new reference
549  moab = std::ref(new_moab);
550 
551  // check if moab has set communicator if not set communicator internally
552  ParallelComm *pComm = ParallelComm::get_pcomm(&new_moab, MYPCOMM_INDEX);
553  if (pComm == NULL) {
554  pComm = new ParallelComm(&new_moab, cOmm);
555  }
556 
557  // create MoFEM tags
558  CHKERR getTags();
559 
560  // Create basic entity data struture
561  basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
562  if (distributed_mesh)
563  basicEntityDataPtr->setDistributedMesh();
564  else
565  basicEntityDataPtr->unSetDistributedMesh();
566 
567  // Initalise database
569 
571 };
572 
575  if (verb == -1)
576  verb = verbose;
577 
578  CHKERR PetscOptionsBegin(cOmm, optionsPrefix.c_str(), "Mesh cut options",
579  "See MoFEM documentation");
580 
581  CHKERR PetscOptionsBool(
582  "-mofem_init_fields", "Initialise fields on construction", "",
584 
585  CHKERR PetscOptionsBool(
586  "-mofem_init_fields", "Initialise fields on construction", "",
588 
589  // TODO: Add read verbosity level
590  // TODO: Add option to initalise problems ??? - DO WE REALLY NEED THAT
591 
592  ierr = PetscOptionsEnd();
593  CHKERRG(ierr);
594 
596 }
597 
600  if (verb == -1)
601  verb = verbose;
602 
603  CoordSystemsManager *cs_manger_ptr;
604  CHKERR getInterface(cs_manger_ptr);
605 
606  // Initialize coordinate systems
607  CHKERR cs_manger_ptr->initialiseDatabaseFromMesh(verb);
608 
609  Range ref_elems_to_add;
610 
611  // Initialize database
612  Range meshsets;
613  CHKERR get_moab().get_entities_by_type(0, MBENTITYSET, meshsets, false);
614  Range special_meshsets;
615  for (Range::iterator mit = meshsets.begin(); mit != meshsets.end(); mit++) {
616  BitFieldId field_id;
617  // Get bit id form field tag
618  CHKERR get_moab().tag_get_data(th_FieldId, &*mit, 1, &field_id);
619  // Check if meshset if field meshset
620  if (field_id != 0) {
621  std::pair<Field_multiIndex::iterator, bool> p;
622  const char *cs_name;
623  int cs_name_size;
624  boost::shared_ptr<CoordSys> cs_ptr;
625  rval =
626  get_moab().tag_get_by_ptr(cs_manger_ptr->get_th_CoordSysName(), &*mit,
627  1, (const void **)&cs_name, &cs_name_size);
628  if (rval == MB_SUCCESS && cs_name_size)
629  CHKERR cs_manger_ptr->getCoordSysPtr(std::string(cs_name, cs_name_size),
630  cs_ptr);
631  else
632  CHKERR cs_manger_ptr->getCoordSysPtr("UNDEFINED", cs_ptr);
633 
634  p = fIelds.insert(
635  boost::shared_ptr<Field>(new Field(moab, *mit, cs_ptr)));
636  if (verb >= VERBOSE) {
637  std::ostringstream ss;
638  ss << "read field " << **p.first << std::endl;
639  PetscPrintf(cOmm, ss.str().c_str());
640  }
641  if (!p.second) {
642  // Field meshset exists, remove duplicate meshsets from other
643  // processors.
644  Range ents;
645  CHKERR get_moab().get_entities_by_handle(*mit, ents, true);
646  CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
647  CHKERR get_moab().delete_entities(&*mit, 1);
648  } else {
649  special_meshsets.insert(*mit);
650  }
651  }
652  // Check for finite elements
653  BitFieldId fe_id;
654  // Get bit id from fe tag
655  CHKERR get_moab().tag_get_data(th_FEId, &*mit, 1, &fe_id);
656  // check if meshset is finite element meshset
657  if (fe_id != 0) {
658  std::pair<FiniteElement_multiIndex::iterator, bool> p =
659  finiteElements.insert(
660  boost::shared_ptr<FiniteElement>(new FiniteElement(moab, *mit)));
661  if (verb >= VERBOSE) {
662  std::ostringstream ss;
663  ss << "read finite element " << **p.first << std::endl;
664  PetscPrintf(cOmm, ss.str().c_str());
665  }
666  Range ents;
667  CHKERR get_moab().get_entities_by_type(*mit, MBENTITYSET, ents, false);
668  CHKERR get_moab().get_entities_by_handle(*mit, ents, true);
669  ref_elems_to_add.merge(ents);
670  if (!p.second) {
671  // Finite element mesh set exist, could be created on other processor.
672  // Remove duplicate.
673  CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
674  CHKERR get_moab().delete_entities(&*mit, 1);
675  } else {
676  special_meshsets.insert(*mit);
677  }
678  }
679  BitProblemId problem_id;
680  // get bit id form problem tag
681  CHKERR get_moab().tag_get_data(th_ProblemId, &*mit, 1, &problem_id);
682  // check if meshset if problem meshset
683  if (problem_id != 0) {
684  std::pair<Problem_multiIndex::iterator, bool> p =
685  pRoblems.insert(Problem(moab, *mit));
686  if (verb >= VERBOSE) {
687  std::ostringstream ss;
688  ss << "read problem " << *p.first << " bit ref "
689  << p.first->getBitRefLevel() << " bit mask "
690  << p.first->getMaskBitRefLevel() << std::endl;
691  PetscPrintf(cOmm, ss.str().c_str());
692  }
693  if (!p.second) {
694  // Problem meshset exists, could be created on other processor.
695  // Remove duplicate.
696  Range ents;
697  CHKERR get_moab().get_entities_by_handle(*mit, ents, true);
698  CHKERR get_moab().get_entities_by_type(*mit, MBENTITYSET, ents, true);
699  CHKERR get_moab().add_entities(p.first->meshset, ents);
700  CHKERR get_moab().delete_entities(&*mit, 1);
701  } else {
702  special_meshsets.insert(*mit);
703  }
704  }
705  }
706 
707  // Add entities to database
708  Range bit_ref_ents;
709  CHKERR get_moab().get_entities_by_handle(0, bit_ref_ents, false);
710  bit_ref_ents = subtract(bit_ref_ents, special_meshsets);
711  CHKERR getInterface<BitRefManager>()->filterEntitiesByRefLevel(
712  BitRefLevel().set(), BitRefLevel().set(), bit_ref_ents);
713  CHKERR getInterface<BitRefManager>()->setEntitiesBitRefLevel(bit_ref_ents);
714  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
715  ref_elems_to_add);
716 
717  // Build field entities
718  for (Field_multiIndex::iterator fit = fIelds.begin(); fit != fIelds.end();
719  ++fit) {
720  if ((*fit)->getSpace() != NOSPACE) {
721  Range ents_of_id_meshset;
722  CHKERR get_moab().get_entities_by_handle(fit->get()->getMeshset(),
723  ents_of_id_meshset, false);
724  CHKERR set_field_order(ents_of_id_meshset, fit->get()->getId(), -1, verb);
725  }
726  }
727 
729  CHKERR build_fields(verb);
732  }
733  }
734 
735  if (verb > VERY_NOISY) {
736  list_fields();
738  list_problem();
739  }
740 
741  // Initialize interfaces
742  MeshsetsManager *m_manger_ptr;
743  CHKERR getInterface(m_manger_ptr);
744  CHKERR m_manger_ptr->initialiseDatabaseFromMesh(verb);
745  SeriesRecorder *series_recorder_ptr;
746  CHKERR getInterface(series_recorder_ptr);
747  CHKERR series_recorder_ptr->initialiseDatabaseFromMesh(verb);
748 
750 }
751 
752 // cubit meshsets
753 
756  *fields_ptr = &fIelds;
758 }
759 
761 Core::get_ref_ents(const RefEntity_multiIndex **refined_entities_ptr) const {
763  *refined_entities_ptr = &refinedEntities;
765 }
767  const RefElement_multiIndex **refined_finite_elements_ptr) const {
769  *refined_finite_elements_ptr = &refinedFiniteElements;
771 }
772 
773 MoFEMErrorCode Core::get_problem(const std::string &problem_name,
774  const Problem **problem_ptr) const {
777  const ProblemsByName &problems = pRoblems.get<Problem_mi_tag>();
778  ProblemsByName::iterator p_miit = problems.find(problem_name);
779  if (p_miit == problems.end()) {
780  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
781  "problem < %s > not found, (top tip: check spelling)",
782  problem_name.c_str());
783  }
784  *problem_ptr = &*p_miit;
786 }
787 
789 Core::get_problems(const Problem_multiIndex **problems_ptr) const {
791  *problems_ptr = &pRoblems;
793 }
794 
796 Core::get_field_ents(const FieldEntity_multiIndex **field_ents) const {
798  *field_ents = &entsFields;
800 }
803  *dofs_ptr = &dofsField;
805 }
806 
810  *fe_ptr = &finiteElements;
812 }
813 
815  const EntFiniteElement_multiIndex **fe_ent_ptr) const {
817  *fe_ent_ptr = &entsFiniteElements;
819 }
820 
822  MeshsetsManager *meshsets_manager_ptr;
823  getInterface(meshsets_manager_ptr);
824  return meshsets_manager_ptr;
825 }
826 
828  MeshsetsManager *meshsets_manager_ptr;
829  getInterface(meshsets_manager_ptr);
830  return meshsets_manager_ptr;
831 }
832 
834  return &fIelds;
835 }
837  return &refinedEntities;
838 }
840  return &refinedFiniteElements;
841 }
843  return &finiteElements;
844 }
846  return &entsFiniteElements;
847 }
849  return &entsFields;
850 }
852  return &dofsField;
853 }
854 const Problem *Core::get_problem(const std::string &problem_name) const {
855  const Problem *prb;
856  CHKERR get_problem(problem_name, &prb);
857  return prb;
858 }
860  return &pRoblems;
861 }
862 
863 } // namespace MoFEM
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=0)
const DofEntity_multiIndex * get_dofs() const
Get the dofs object.
Definition: Core.cpp:851
Tag th_ProblemNbDofsCol
Definition: Core.hpp:209
static const MOFEMuuid IDD_MOFEMSeriesRecorder
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:249
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:270
static const MOFEMuuid IDD_MOFEMCoreInterface
Definition: Interface.hpp:24
Tag th_FieldSpace
Definition: Core.hpp:204
MoFEM interface unique ID.
int sIze
MoFEM communicator size.
Definition: Core.hpp:859
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition: Core.cpp:598
Tag th_FieldName_DataNamePrefix
Definition: Core.hpp:204
static const MOFEMuuid IDD_MOFEMMeshsetsManager
const EntFiniteElement_multiIndex * get_ents_finite_elements() const
Get the ents finite elements object.
Definition: Core.cpp:845
PetscLogEvent MOFEM_EVENT_postProcess
Event for postProcess finite element.
Definition: Core.hpp:847
boost::shared_ptr< WrapMPIComm > wrapMPIComm
Definition: Core.hpp:893
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::getRefEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityType, &RefElement::getEntType > > > > RefElement_multiIndex
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
int * fShift
Ptr to tag handle storing last set bit in field ID.
Definition: Core.hpp:897
Tag th_FEIdCol
Definition: Core.hpp:207
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:244
Provide data structure for (tensor) field approximation.The Field is intended to provide support for ...
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:248
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
MoFEMErrorCode rebuild_database(int verb=DEFAULT_VERBOSITY)
Clear database and initialize it once again.
Definition: Core.cpp:529
static void createDefaultSinks(MPI_Comm comm)
Create default sinks.
Definition: LogManager.cpp:293
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:507
MoFEMErrorCode regSubInterface(const MOFEMuuid &uid)
Register subinterfac in core interface.
Definition: Core.cpp:94
PetscLogEvent MOFEM_EVENT_operator
Event for evaluating operator of finite element.
Definition: Core.hpp:845
const RefEntity_multiIndex * get_ref_ents() const
Get the ref ents object.
Definition: Core.cpp:836
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
const RefElement_multiIndex * get_ref_finite_elements() const
Get the ref finite elements object.
Definition: Core.cpp:839
base class for all interface classes
multi_index_container< boost::shared_ptr< FieldEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, member< FieldEntity, UId, &FieldEntity::globalUId > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< FieldEntity::interface_type_Field, boost::string_ref, &FieldEntity::getNameRef > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FieldEntity, EntityHandle, &FieldEntity::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< FieldEntity, const_mem_fun< FieldEntity::interface_type_Field, boost::string_ref, &FieldEntity::getNameRef >, const_mem_fun< FieldEntity, EntityHandle, &FieldEntity::getEnt > > > > > FieldEntity_multiIndex
MultiIndex container keeps FieldEntity.
Tag th_RefParentHandle
Definition: Core.hpp:201
static MoFEMErrorCode getOptions()
Get logger option.
Definition: LogManager.cpp:137
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:306
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
static const MOFEMuuid IDD_MOFEMUnknown
IFACE getInterface() const
Get interface pointer to pointer of interface.
MoFEMErrorCode set_moab_interface(moab::Interface &new_moab, int verb=VERBOSE, const bool distributed_mesh=true)
Set the moab interface object.
Definition: Core.cpp:539
Tag th_ProblemFEId
Definition: Core.hpp:208
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:550
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 list_finite_elements() const
list finite elements in database
Definition: FECore.cpp:310
BitIntefaceId uUId
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:848
static const MOFEMuuid IDD_MOFEMNodeMerger
Definition: NodeMerger.hpp:23
Tag th_FieldShift
Definition: Core.hpp:212
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)
Build finite elementsBuild finite element data structures. Have to be run before problem and adjacenc...
Definition: FECore.cpp:796
static const MOFEMuuid IDD_MOFEMVEC
Definition: VecManager.hpp:26
Tag th_Part
Tag for partition number.
Definition: Core.hpp:200
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition: Types.hpp:54
Core(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE, const bool distributed_mesh=true)
Definition: Core.cpp:115
static const MOFEMuuid IDD_MOFEMPrismsFromSurface
Tag th_FEName
Definition: Core.hpp:206
Tag th_ElemType
Needed for VTK files.
Definition: Core.hpp:213
MoFEMErrorCode registerSubInterfaces()
Register insterfaces.
Definition: Core.cpp:210
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
BitProblemId getProblemShift()
Return unique problem Id.
Definition: Core.cpp:265
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:265
keeps basic data about problemThis is low level structure with information about problem,...
PetscLogEvent MOFEM_EVENT_preProcess
Event for preProcess finite element.
Definition: Core.hpp:843
const Problem_multiIndex * get_problems() const
Get the problems object.
Definition: Core.cpp:859
MoFEMErrorCode list_fields() const
list entities in the field
Definition: FieldCore.cpp:1168
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
static const MOFEMuuid IDD_MOFEMSimple
Definition: Simple.hpp:29
virtual const MoFEMErrorCode getFileVersion(moab::Interface &moab, Version &version) const
Get database major version.
const FieldEntity_multiIndex * get_field_ents() const
Get the field ents object.
Definition: Core.cpp:848
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:81
std::bitset< BITREFEDGES_SIZE > BitRefEdges
Definition: Types.hpp:44
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:51
MoFEMErrorCode getTags(int verb=-1)
get tags handlers used on meshsets
MoFEMErrorCode addPrismToDatabase(const EntityHandle prism, int verb=DEFAULT_VERBOSITY)
add prim element
Definition: Core.cpp:290
MoFEMErrorCode clear_database(int verb=DEFAULT_VERBOSITY)
Clear database.
Definition: Core.cpp:521
Tag th_FieldId
Definition: Core.hpp:204
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
Tag th_RefBitEdge
Definition: Core.hpp:201
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:53
Tag th_ProblemName
Definition: Core.hpp:208
PetscBool initaliseAndBuildField
Definition: Core.hpp:911
Tag th_ProblemGhostNbDofCol
Definition: Core.hpp:211
Tag th_ProblemId
Definition: Core.hpp:208
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:860
Tag th_RefType
Definition: Core.hpp:203
const Field_multiIndex * get_fields() const
Get the fields object.
Definition: Core.cpp:833
Tag th_ProblemNbDofsRow
Definition: Core.hpp:209
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=0)
MoFEMErrorCode getCoordSysPtr(const EntityHandle id, boost::shared_ptr< CoordSys > &cs_ptr)
Get the Coord Sys Ptr object.
BitFEId getFEShift()
Return unique finite element Id.
Definition: Core.cpp:260
FieldApproximationBase
approximation base
Definition: definitions.h:150
Tag th_ProblemGhostNbDofRow
Definition: Core.hpp:210
Finite element definition.
MoFEMErrorCode getTags(int verb=-1)
get tags handlers used on meshsets conating information about coordinate systems
static const MOFEMuuid IDD_MOFEMMeshRefine
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
Definition: Core.cpp:573
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:20
MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1138
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
multi_index_container< boost::shared_ptr< DofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, member< DofEntity, UId, &DofEntity::globalUId > >, ordered_non_unique< tag< Composite_Name_And_Ent_And_EntDofIdx_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt >, const_mem_fun< DofEntity, DofIdx, &DofEntity::getEntDofIdx > > >, ordered_non_unique< tag< Unique_Ent_mi_tag >, const_mem_fun< DofEntity, const UId &, &DofEntity::getEntGlobalUniqueId > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt > > >, ordered_non_unique< tag< Composite_Name_And_Type_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity::interface_type_RefEntity, EntityType, &DofEntity::getEntType > > > > > DofEntity_multiIndex
MultiIndex container keeps DofEntity.
CHKERRQ(ierr)
Tag th_FieldBase
Definition: Core.hpp:204
#define BITFIELDID_SIZE
max number of fields
Definition: definitions.h:286
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
Tag th_MoFEMBuild
Definition: Core.hpp:214
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:245
int * feShift
Ptr to tag handle storing last set bit in finite element ID.
Definition: Core.hpp:898
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition: Core.cpp:821
Tag th_ProblemLocalNbDofRow
Definition: Core.hpp:210
static const MOFEMuuid IDD_MOFEMBasic
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:257
MoFEMErrorCode getTags(int verb=DEFAULT_VERBOSITY)
Get tag handles.
Definition: Core.cpp:319
static const MOFEMuuid IDD_MOFEMTools
Definition: Tools.hpp:23
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.
Tag th_ProblemLocalNbDofCol
Definition: Core.hpp:211
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:907
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:279
MoFEMErrorCode list_problem() const
list problems
Tag th_FieldName
Definition: Core.hpp:204
FieldSpace
approximation spaces
Definition: definitions.h:174
Tag th_FEShift
Definition: Core.hpp:212
static const MOFEMuuid IDD_MOFEMTetGegInterface
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition: Types.hpp:52
#define CHKERR
Inline error check.
Definition: definitions.h:602
multi_index_container< boost::shared_ptr< EntFiniteElement >, indexed_by< ordered_unique< tag< Unique_mi_tag >, member< EntFiniteElement, UId, &EntFiniteElement::globalUId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< EntFiniteElement, 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< BitFEId_mi_tag >, const_mem_fun< EntFiniteElement::interface_type_FiniteElement, BitFEId, &EntFiniteElement::getId >, LtBit< BitFEId > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< EntFiniteElement::interface_type_RefEntity, EntityType, &EntFiniteElement::getEntType > >, 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, EntityHandle, &EntFiniteElement::getEnt > > > > > EntFiniteElement_multiIndex
MultiIndex container for EntFiniteElement.
PetscBool initaliseAndBuildFiniteElements
Definition: Core.hpp:914
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
int * pShift
Ptr to tag handle storing last set bit in problem ID.
Definition: Core.hpp:899
static const MOFEMuuid IDD_MOFEMCutMesh
static const MOFEMuuid IDD_MOFEMMatrixManager
static const MOFEMuuid IDD_MOFEMCoordsSystemsManager
static char help[]
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:225
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:291
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
MoFEMErrorCode get_problem(const std::string &problem_name, const Problem **problem_ptr) const
Get problem database (data structure)
Definition: Core.cpp:773
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 >, member< RefEntity::BasicEntity, EntityHandle, &RefEntity::ent > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType > >, ordered_non_unique< tag< ParentEntType_mi_tag >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, 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::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
MoFEMErrorCode set_field_order(const Range &ents, const BitFieldId id, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:400
static const MOFEMuuid IDD_MOFEMFieldBlas
Definition: FieldBlas.hpp:26
Tag th_ProblemShift
Definition: Core.hpp:212
ParallelComm * pComm
MOAB communicator structure.
Definition: Core.hpp:857
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1879
int verbose
Verbosity level.
Definition: Core.hpp:895
Tag th_RefBitLevel_Mask
Definition: Core.hpp:201
Tag th_FEId
Definition: Core.hpp:206
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=0)
int DofIdx
Index of DOF.
Definition: Types.hpp:29
static const MOFEMuuid IDD_MOFEMFieldEvaluator
boost::ptr_map< unsigned long, UnknownInterface > iFaces
Hash map of pointers to interfaces.
Definition: Core.hpp:904
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
static const MOFEMuuid IDD_MOFEMISManager
Definition: ISManager.hpp:26
std::string optionsPrefix
Prefix for options on command line.
Definition: Core.hpp:909
Tag th_RefBitLevel
Definition: Core.hpp:201
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:252
static const MOFEMuuid IDD_MOFEMDeprecatedCoreInterface
Definition: Interface.hpp:26
static const MOFEMuuid IDD_MOFEMPrismInterface
Tag th_FEIdData
Definition: Core.hpp:207
DEPRECATED IFace * query_interface() const
static const MOFEMuuid IDD_MOFEMMedInterface
BitFieldId getFieldShift()
Return unique field Id.
Definition: Core.cpp:248
static const MOFEMuuid IDD_MOFEMBitLevelCoupler
Tag th_FEIdRow
Definition: Core.hpp:207
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:69
static const MOFEMuuid IDD_MOFEMComm
const FiniteElement_multiIndex * get_finite_elements() const
Get the finite elements object.
Definition: Core.cpp:842