v0.9.1
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  int rank;
55  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
56 
57  PetscVFPrintf = LogManager::logPetscFPrintf;
58 
59  auto core_log = logging::core::get();
60  core_log->add_sink(LogManager::createSink(
61  boost::shared_ptr<std::ostream>(&std::clog, boost::null_deleter()),
62  "PETSC"));
63  LogManager::setLog("PETSC");
64  MOFEM_LOG_TAG("PETSC", "petsc");
65  core_log->add_global_attribute("Proc", attrs::constant<unsigned int>(rank));
66 
67  ierr = PetscInitialize(argc, args, file, help);
68  CHKERRG(ierr);
69 
70  ierr = PetscPushErrorHandler(mofem_error_handler, PETSC_NULL);
71  CHKERRG(ierr);
72 
73  isGloballyInitialised = true;
74  return MOFEM_SUCCESS;
75 }
76 
78  CHKERRQ(ierr);
79  ierr = PetscPopErrorHandler();
80  CHKERRG(ierr);
81  isGloballyInitialised = false;
82  PetscFinalize();
83  return MPI_Finalize();
84 }
85 
86 // Use SFINAE to decide which template should be run,
87 // if exist getSubInterfaceOptions run this one.
88 template <class T>
89 static auto get_sub_iface_options_imp(T *const ptr, int)
90  -> decltype(ptr->getSubInterfaceOptions()) {
91  return ptr->getSubInterfaceOptions();
92 };
93 
94 // Use SFINAE to decide which template should be run,
95 // if getSubInterfaceOptions not exist run this one.
96 template <class T>
97 static auto get_sub_iface_options_imp(T *const ptr, long) -> MoFEMErrorCode {
98  return 0;
99 };
100 
101 template <class IFACE>
104  CHKERR registerInterface<IFACE>(uid, false);
105  unsigned long int id = uid.uUId.to_ulong();
106  IFACE *ptr = new IFACE(*this);
107 
108  // If sub interface has function getSubInterfaceOptions run
109  // it after construction. getSubInterfaceOptions is used to
110  // get parameters from command line.
111  // See SFINAE:
112  // https://stackoverflow.com/questions/257288/is-it-possible-to-write-a-template-to-check-for-a-functions-existence
113  // https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error
114  auto get_sub_iface_options = [](auto *const ptr) {
115  return get_sub_iface_options_imp(ptr, 0);
116  };
117  CHKERR get_sub_iface_options(ptr);
118 
119  iFaces.insert(id, ptr);
121 }
122 
123 Core::Core(moab::Interface &moab, MPI_Comm comm, const int verbose,
124  const bool distributed_mesh)
125  : moab(moab), cOmm(0), verbose(verbose),
126  initaliseAndBuildField(PETSC_FALSE),
127  initaliseAndBuildFiniteElements(PETSC_FALSE) {
128 
129  // This is deprecated ONE should use MoFEM::Core::Initialize
130  if (!isGloballyInitialised) {
131  PetscPushErrorHandler(mofem_error_handler, PETSC_NULL);
132  isGloballyInitialised = true;
133  }
134 
135  // Create duplicate communicator
136  wrapMPIComm = boost::make_shared<WrapMPIComm>(comm, cOmm);
137  MPI_Comm_size(cOmm, &sIze);
138  MPI_Comm_rank(cOmm, &rAnk);
139  // CHeck if moab has set communicator if not set communicator interbally
140  ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
141  if (pComm == NULL) {
142  pComm = new ParallelComm(&moab, cOmm);
143  }
144 
145  // Register interfaces for this implementation
146  ierr = registerInterface<UnknownInterface>(IDD_MOFEMUnknown);
147  CHKERRABORT(comm, ierr);
148  ierr = registerInterface<CoreInterface>(IDD_MOFEMCoreInterface);
149  CHKERRABORT(comm, ierr);
150  ierr = registerInterface<DeprecatedCoreInterface>(
152  CHKERRABORT(comm, ierr);
153 
154  // Register sub-interfaces
156  CHKERRABORT(PETSC_COMM_SELF, ierr);
157 
158  // Print version
159  if (verbose > QUIET) {
160  MOFEM_LOG_CHANNEL("WORLD");
161  char petsc_version[255];
162  ierr = PetscGetVersion(petsc_version, 255);
163  CHKERRABORT(comm, ierr);
164  MOFEM_C_LOG("WORLD", Sev::inform, "MoFEM version %d.%d.%d (%s %s)",
165  MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD,
166  MOAB_VERSION_STRING, petsc_version);
167  MOFEM_C_LOG("WORLD", Sev::inform, "git commit id %s", GIT_SHA1_NAME);
168  }
169 
170  // Register MOFEM events in PETSc
171  PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
172  PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
173  PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
174  PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
175 
176  // Initialize database
177  ierr = getTags();
178  CHKERRABORT(cOmm, ierr);
179  ierr = clearMap();
180  CHKERRABORT(cOmm, ierr);
181 
182  basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
183  if (distributed_mesh)
184  basicEntityDataPtr->setDistributedMesh();
185  else
186  basicEntityDataPtr->unSetDistributedMesh();
187 
189  CHKERRABORT(cOmm, ierr);
191  CHKERRABORT(cOmm, ierr);
192 }
193 
195  PetscBool is_finalized;
196  PetscFinalized(&is_finalized);
197  // Destroy interfaces
198  iFaces.clear();
199  // This is deprecated ONE should use MoFEM::Core::Initialize
200  if (isGloballyInitialised && is_finalized) {
201  isGloballyInitialised = false;
202  }
203 }
204 
207 
208  iFaces.clear();
209 
210  // Register sub interfaces
211  CHKERR regSubInterface<LogManager>(IDD_MOFEMLogManager);
212  CHKERR regSubInterface<Simple>(IDD_MOFEMSimple);
213  CHKERR regSubInterface<PipelineManager>(IDD_MOFEMBasic);
214  CHKERR regSubInterface<ProblemsManager>(IDD_MOFEMProblemsManager);
215  CHKERR regSubInterface<MatrixManager>(IDD_MOFEMMatrixManager);
216  CHKERR regSubInterface<ISManager>(IDD_MOFEMISManager);
217  CHKERR regSubInterface<VecManager>(IDD_MOFEMVEC);
218  CHKERR regSubInterface<FieldBlas>(IDD_MOFEMFieldBlas);
219  CHKERR regSubInterface<BitRefManager>(IDD_MOFEMBitRefManager);
220  CHKERR regSubInterface<Tools>(IDD_MOFEMTools);
221  CHKERR regSubInterface<CommInterface>(IDD_MOFEMComm);
222  CHKERR regSubInterface<MeshsetsManager>(IDD_MOFEMMeshsetsManager);
223  CHKERR regSubInterface<CoordSystemsManager>(IDD_MOFEMCoordsSystemsManager);
224  CHKERR regSubInterface<NodeMergerInterface>(IDD_MOFEMNodeMerger);
225  CHKERR regSubInterface<BitLevelCoupler>(IDD_MOFEMBitLevelCoupler);
226  CHKERR regSubInterface<PrismsFromSurfaceInterface>(
228  CHKERR regSubInterface<MeshRefinement>(IDD_MOFEMMeshRefine);
229  CHKERR regSubInterface<PrismInterface>(IDD_MOFEMPrismInterface);
230  CHKERR regSubInterface<CutMeshInterface>(IDD_MOFEMCutMesh);
231  CHKERR regSubInterface<SeriesRecorder>(IDD_MOFEMSeriesRecorder);
232 #ifdef WITH_TETGEN
233  CHKERR regSubInterface<TetGenInterface>(IDD_MOFEMTetGegInterface);
234 #endif
235 #ifdef WITH_MED
236  CHKERR regSubInterface<MedInterface>(IDD_MOFEMMedInterface);
237 #endif
238  CHKERR regSubInterface<FieldEvaluatorInterface>(IDD_MOFEMFieldEvaluator);
239 
241 };
242 
244  if (*fShift >= BITFIELDID_SIZE) {
245  char msg[] = "number of fields exceeded";
246  PetscTraceBackErrorHandler(cOmm, __LINE__, PETSC_FUNCTION_NAME, __FILE__,
247  MOFEM_DATA_INCONSISTENCY, PETSC_ERROR_INITIAL,
248  msg, PETSC_NULL);
249  PetscMPIAbortErrorHandler(cOmm, __LINE__, PETSC_FUNCTION_NAME, __FILE__,
250  MOFEM_DATA_INCONSISTENCY, PETSC_ERROR_INITIAL,
251  msg, PETSC_NULL);
252  }
253  return BitFieldId().set(((*fShift)++) - 1);
254 }
256  assert((unsigned int)*feShift < BitFEId().set().to_ulong());
257  return BitFEId(1 << (((*feShift)++) - 1));
258 }
259 
261  assert((unsigned int)*pShift < BitProblemId().set().to_ulong());
262  return BitProblemId(1 << (((*pShift)++) - 1));
263 }
264 
267  // Cleaning databases in interfaces
268  CHKERR getInterface<SeriesRecorder>()->clearMap();
269  CHKERR getInterface<MeshsetsManager>()->clearMap();
270  CHKERR getInterface<CoordSystemsManager>()->clearMap();
271  CHKERR getInterface<CutMeshInterface>()->clearMap();
272  // Cleaning databases
273  refinedEntities.clear();
274  refinedFiniteElements.clear();
275  fIelds.clear();
276  entsFields.clear();
277  dofsField.clear();
278  finiteElements.clear();
279  entsFiniteElements.clear();
280  entFEAdjacencies.clear();
281  pRoblems.clear();
283 }
284 
287  if (verb == -1)
288  verb = verbose;
289  std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
290  p_ent = refinedEntities.insert(
291  boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
292  if (p_ent.second) {
293  std::pair<RefElement_multiIndex::iterator, bool> p;
294  p = refinedFiniteElements.insert(
295  boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)));
296  int num_nodes;
297  const EntityHandle *conn;
298  CHKERR get_moab().get_connectivity(prism, conn, num_nodes, true);
299  Range face_side3, face_side4;
300  CHKERR get_moab().get_adjacencies(conn, 3, 2, false, face_side3);
301  CHKERR get_moab().get_adjacencies(&conn[3], 3, 2, false, face_side4);
302  if (face_side3.size() != 1)
303  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
304  "prism don't have side face 3");
305  if (face_side4.size() != 1)
306  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
307  "prims don't have side face 4");
308  p.first->get()->getSideNumberPtr(*face_side3.begin());
309  p.first->get()->getSideNumberPtr(*face_side4.begin());
310  }
312 }
313 
316 
317  const EntityHandle root_meshset = get_moab().get_root_set();
318  if (root_meshset) {
319  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
320  "Root meshset should be 0");
321  }
322 
323  // Set version
324  {
325  Version version;
326  CHKERR getFileVersion(moab, version);
327  }
328 
329  // Global Variables
330  {
331 
332  auto check_tag_allocated = [](auto &rval) {
334  if (rval == MB_ALREADY_ALLOCATED)
335  rval = MB_SUCCESS;
336  else
337  CHKERRG(rval);
339  };
340 
341  // Fields
342  int def_shift = 1;
343  rval = get_moab().tag_get_handle("_FieldShift", 1, MB_TYPE_INTEGER,
344  th_FieldShift, MB_TAG_CREAT | MB_TAG_MESH,
345  &def_shift);
346  CHKERR check_tag_allocated(rval);
347 
348  const void *tag_data[1];
349  CHKERR get_moab().tag_get_by_ptr(th_FieldShift, &root_meshset, 1, tag_data);
350  fShift = (int *)tag_data[0];
351  // FE
352  rval = get_moab().tag_get_handle("_FEShift", 1, MB_TYPE_INTEGER, th_FEShift,
353  MB_TAG_CREAT | MB_TAG_MESH, &def_shift);
354  CHKERR check_tag_allocated(rval);
355 
356  CHKERR get_moab().tag_get_by_ptr(th_FEShift, &root_meshset, 1, tag_data);
357  feShift = (int *)tag_data[0];
358  // Problem
359  rval = get_moab().tag_get_handle("_ProblemShift", 1, MB_TYPE_INTEGER,
361  MB_TAG_CREAT | MB_TAG_MESH, &def_shift);
362  CHKERR check_tag_allocated(rval);
363 
364  CHKERR get_moab().tag_get_by_ptr(th_ProblemShift, &root_meshset, 1,
365  tag_data);
366  pShift = (int *)tag_data[0];
367  // Safety nets
368  int def_bool = 0;
369  rval = get_moab().tag_get_handle("_MoFEMBuild", 1, MB_TYPE_INTEGER,
370  th_MoFEMBuild, MB_TAG_CREAT | MB_TAG_MESH,
371  &def_bool);
372  CHKERR check_tag_allocated(rval);
373 
374  CHKERR get_moab().tag_get_by_ptr(th_MoFEMBuild, &root_meshset, 1,
375  (const void **)&buildMoFEM);
376  }
377 
378  // Tags saved in vtk-files
379  {
380  const int def_part = -1;
381  CHKERR get_moab().tag_get_handle("PARTITION", 1, MB_TYPE_INTEGER, th_Part,
382  MB_TAG_CREAT | MB_TAG_SPARSE, &def_part);
383  int def_elem_type = MBMAXTYPE;
384  CHKERR get_moab().tag_get_handle("ElemType", 1, MB_TYPE_INTEGER,
385  th_ElemType, MB_TAG_CREAT | MB_TAG_SPARSE,
386  &def_elem_type);
387  }
388 
389  // Tags Ref
390  {
391  EntityHandle def_handle = 0;
392  CHKERR get_moab().tag_get_handle("_RefParentHandle", 1, MB_TYPE_HANDLE,
394  MB_TAG_CREAT | MB_TAG_SPARSE, &def_handle);
395  BitRefLevel def_bit_level = 0;
396  CHKERR get_moab().tag_get_handle(
397  "_RefBitLevel", sizeof(BitRefLevel), MB_TYPE_OPAQUE, th_RefBitLevel,
398  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_bit_level);
399  BitRefLevel def_bit_level_mask = BitRefLevel().set();
400  CHKERR get_moab().tag_get_handle(
401  "_RefBitLevelMask", sizeof(BitRefLevel), MB_TYPE_OPAQUE,
402  th_RefBitLevel_Mask, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
403  &def_bit_level_mask);
404  BitRefEdges def_bit_edge = 0;
405  CHKERR get_moab().tag_get_handle(
406  "_RefBitEdge", sizeof(BitRefEdges), MB_TYPE_OPAQUE, th_RefBitEdge,
407  MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_bit_edge);
408  const int def_type[] = {0, 0};
409  CHKERR get_moab().tag_get_handle("_RefType", 2, MB_TYPE_INTEGER, th_RefType,
410  MB_TAG_CREAT | MB_TAG_SPARSE, def_type);
411  }
412 
413  // Tags Field
414  {
415  const unsigned long int def_id = 0;
416  CHKERR get_moab().tag_get_handle(
417  "_FieldId", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FieldId,
418  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
419  FieldSpace def_space = LASTSPACE;
420  CHKERR get_moab().tag_get_handle(
421  "_FieldSpace", sizeof(FieldSpace), MB_TYPE_OPAQUE, th_FieldSpace,
422  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_space);
423  FieldApproximationBase def_base = LASTBASE;
424  CHKERR get_moab().tag_get_handle(
425  "_FieldBase", sizeof(FieldApproximationBase), MB_TYPE_OPAQUE,
426  th_FieldBase, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_base);
427  const int def_val_len = 0;
428  CHKERR get_moab().tag_get_handle(
429  "_FieldName", def_val_len, MB_TYPE_OPAQUE, th_FieldName,
430  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
431  CHKERR get_moab().tag_get_handle(
432  "_FieldName_DataNamePrefix", def_val_len, MB_TYPE_OPAQUE,
434  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
435  }
436 
437  // Tags FE
438  {
439  const unsigned long int def_id = 0;
440  const int def_val_len = 0;
441  CHKERR get_moab().tag_get_handle(
442  "_FEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_FEId,
443  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
444  CHKERR get_moab().tag_get_handle(
445  "_FEName", def_val_len, MB_TYPE_OPAQUE, th_FEName,
446  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
447  CHKERR get_moab().tag_get_handle(
448  "_FEIdCol", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdCol,
449  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
450  CHKERR get_moab().tag_get_handle(
451  "_FEIdRow", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdRow,
452  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
453  CHKERR get_moab().tag_get_handle(
454  "_FEIdData", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdData,
455  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
456  }
457 
458  // Tags Problem
459  {
460  const unsigned long int def_id = 0;
461  const int def_val_len = 0;
462  CHKERR get_moab().tag_get_handle(
463  "_ProblemId", sizeof(BitProblemId), MB_TYPE_OPAQUE, th_ProblemId,
464  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
465  CHKERR get_moab().tag_get_handle(
466  "_ProblemFEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_ProblemFEId,
467  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
468  CHKERR get_moab().tag_get_handle(
469  "_ProblemName", def_val_len, MB_TYPE_OPAQUE, th_ProblemName,
470  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
471  DofIdx def_nbdofs = 0;
472  CHKERR get_moab().tag_get_handle(
473  "_ProblemNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
474  th_ProblemNbDofsRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
475  &def_nbdofs);
476  CHKERR get_moab().tag_get_handle(
477  "_ProblemNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
478  th_ProblemNbDofsCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
479  &def_nbdofs);
480  CHKERR get_moab().tag_get_handle(
481  "_ProblemLocalNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
482  th_ProblemLocalNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
483  &def_nbdofs);
484  CHKERR get_moab().tag_get_handle(
485  "_ProblemGhostNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
486  th_ProblemGhostNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
487  &def_nbdofs);
488  CHKERR get_moab().tag_get_handle(
489  "_ProblemLocalNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
490  th_ProblemLocalNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
491  &def_nbdofs);
492  CHKERR get_moab().tag_get_handle(
493  "_ProblemGhostNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
494  th_ProblemGhostNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
495  &def_nbdofs);
496  }
497 
498  // Meshsets with boundary conditions and material sets
499  MeshsetsManager *meshsets_manager_ptr;
500  CHKERR getInterface(meshsets_manager_ptr);
501  CHKERR meshsets_manager_ptr->getTags(verb);
502 
503  // Series recorder
504  SeriesRecorder *series_recorder_ptr;
505  CHKERR getInterface(series_recorder_ptr);
506  CHKERR series_recorder_ptr->getTags(verb);
507 
508  // Coordinate systems
509  CoordSystemsManager *cs_manger_ptr;
510  CHKERR getInterface(cs_manger_ptr);
511  CHKERR cs_manger_ptr->getTags(verb);
512 
514 }
515 
518  if (verb == -1)
519  verb = verbose;
520  CHKERR clearMap();
522 }
523 
526  if (verb == -1)
527  verb = verbose;
528  CHKERR clearMap();
529  CHKERR getTags(verb);
532 }
533 
535  const bool distributed_mesh) {
537  if (verb == -1)
538  verb = verbose;
539 
540  // clear moab database
541  CHKERR clearMap();
542 
543  // set new reference
544  moab = std::ref(new_moab);
545 
546  // check if moab has set communicator if not set communicator internally
547  ParallelComm *pComm = ParallelComm::get_pcomm(&new_moab, MYPCOMM_INDEX);
548  if (pComm == NULL) {
549  pComm = new ParallelComm(&new_moab, cOmm);
550  }
551 
552  // create MoFEM tags
553  CHKERR getTags();
554 
555  // Create basic entity data struture
556  basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
557  if (distributed_mesh)
558  basicEntityDataPtr->setDistributedMesh();
559  else
560  basicEntityDataPtr->unSetDistributedMesh();
561 
562  // Initalise database
564 
566 };
567 
570  if (verb == -1)
571  verb = verbose;
572 
573  CHKERR PetscOptionsBegin(cOmm, optionsPrefix.c_str(), "Mesh cut options",
574  "See MoFEM documentation");
575 
576  CHKERR PetscOptionsBool(
577  "-mofem_init_fields", "Initialise fields on construction", "",
579 
580  CHKERR PetscOptionsBool(
581  "-mofem_init_fields", "Initialise fields on construction", "",
583 
584  // TODO: Add read verbosity level
585  // TODO: Add option to initalise problems ??? - DO WE REALLY NEED THAT
586 
587  ierr = PetscOptionsEnd();
588  CHKERRG(ierr);
589 
591 }
592 
595  if (verb == -1)
596  verb = verbose;
597 
598  CoordSystemsManager *cs_manger_ptr;
599  CHKERR getInterface(cs_manger_ptr);
600 
601  // Initialize coordinate systems
602  CHKERR cs_manger_ptr->initialiseDatabaseFromMesh(verb);
603 
604  Range ref_elems_to_add;
605 
606  // Initialize database
607  Range meshsets;
608  CHKERR get_moab().get_entities_by_type(0, MBENTITYSET, meshsets, false);
609  Range special_meshsets;
610  for (Range::iterator mit = meshsets.begin(); mit != meshsets.end(); mit++) {
611  BitFieldId field_id;
612  // Get bit id form field tag
613  CHKERR get_moab().tag_get_data(th_FieldId, &*mit, 1, &field_id);
614  // Check if meshset if field meshset
615  if (field_id != 0) {
616  std::pair<Field_multiIndex::iterator, bool> p;
617  const char *cs_name;
618  int cs_name_size;
619  boost::shared_ptr<CoordSys> cs_ptr;
620  rval =
621  get_moab().tag_get_by_ptr(cs_manger_ptr->get_th_CoordSysName(), &*mit,
622  1, (const void **)&cs_name, &cs_name_size);
623  if (rval == MB_SUCCESS && cs_name_size)
624  CHKERR cs_manger_ptr->getCoordSysPtr(std::string(cs_name, cs_name_size),
625  cs_ptr);
626  else
627  CHKERR cs_manger_ptr->getCoordSysPtr("UNDEFINED", cs_ptr);
628 
629  p = fIelds.insert(
630  boost::shared_ptr<Field>(new Field(moab, *mit, cs_ptr)));
631  if (verb >= VERBOSE) {
632  std::ostringstream ss;
633  ss << "read field " << **p.first << std::endl;
634  PetscPrintf(cOmm, ss.str().c_str());
635  }
636  if (!p.second) {
637  // Field meshset exists, remove duplicate meshsets from other
638  // processors.
639  Range ents;
640  CHKERR get_moab().get_entities_by_handle(*mit, ents, true);
641  CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
642  CHKERR get_moab().delete_entities(&*mit, 1);
643  } else {
644  special_meshsets.insert(*mit);
645  }
646  }
647  // Check for finite elements
648  BitFieldId fe_id;
649  // Get bit id from fe tag
650  CHKERR get_moab().tag_get_data(th_FEId, &*mit, 1, &fe_id);
651  // check if meshset is finite element meshset
652  if (fe_id != 0) {
653  std::pair<FiniteElement_multiIndex::iterator, bool> p =
654  finiteElements.insert(
655  boost::shared_ptr<FiniteElement>(new FiniteElement(moab, *mit)));
656  if (verb >= VERBOSE) {
657  std::ostringstream ss;
658  ss << "read finite element " << **p.first << std::endl;
659  PetscPrintf(cOmm, ss.str().c_str());
660  }
661  Range ents;
662  CHKERR get_moab().get_entities_by_type(*mit, MBENTITYSET, ents, false);
663  CHKERR get_moab().get_entities_by_handle(*mit, ents, true);
664  ref_elems_to_add.merge(ents);
665  if (!p.second) {
666  // Finite element mesh set exist, could be created on other processor.
667  // Remove duplicate.
668  CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
669  CHKERR get_moab().delete_entities(&*mit, 1);
670  } else {
671  special_meshsets.insert(*mit);
672  }
673  }
674  BitProblemId problem_id;
675  // get bit id form problem tag
676  CHKERR get_moab().tag_get_data(th_ProblemId, &*mit, 1, &problem_id);
677  // check if meshset if problem meshset
678  if (problem_id != 0) {
679  std::pair<Problem_multiIndex::iterator, bool> p =
680  pRoblems.insert(Problem(moab, *mit));
681  if (verb >= VERBOSE) {
682  std::ostringstream ss;
683  ss << "read problem " << *p.first << " bit ref "
684  << p.first->getBitRefLevel() << " bit mask "
685  << p.first->getMaskBitRefLevel() << std::endl;
686  PetscPrintf(cOmm, ss.str().c_str());
687  }
688  if (!p.second) {
689  // Problem meshset exists, could be created on other processor.
690  // Remove duplicate.
691  Range ents;
692  CHKERR get_moab().get_entities_by_handle(*mit, ents, true);
693  CHKERR get_moab().get_entities_by_type(*mit, MBENTITYSET, ents, true);
694  CHKERR get_moab().add_entities(p.first->meshset, ents);
695  CHKERR get_moab().delete_entities(&*mit, 1);
696  } else {
697  special_meshsets.insert(*mit);
698  }
699  }
700  }
701 
702  // Add entities to database
703  Range bit_ref_ents;
704  CHKERR get_moab().get_entities_by_handle(0, bit_ref_ents, false);
705  bit_ref_ents = subtract(bit_ref_ents, special_meshsets);
706  CHKERR getInterface<BitRefManager>()->filterEntitiesByRefLevel(
707  BitRefLevel().set(), BitRefLevel().set(), bit_ref_ents);
708  CHKERR getInterface<BitRefManager>()->setEntitiesBitRefLevel(bit_ref_ents);
709  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
710  ref_elems_to_add);
711 
712  // Build field entities
713  for (Field_multiIndex::iterator fit = fIelds.begin(); fit != fIelds.end();
714  ++fit) {
715  if ((*fit)->getSpace() != NOSPACE) {
716  Range ents_of_id_meshset;
717  CHKERR get_moab().get_entities_by_handle(fit->get()->getMeshset(),
718  ents_of_id_meshset, false);
719  CHKERR set_field_order(ents_of_id_meshset, fit->get()->getId(), -1, verb);
720  }
721  }
722 
724  CHKERR build_fields(verb);
727  }
728  }
729 
730  if (verb > VERY_NOISY) {
731  list_fields();
733  list_problem();
734  }
735 
736  // Initialize interfaces
737  MeshsetsManager *m_manger_ptr;
738  CHKERR getInterface(m_manger_ptr);
739  CHKERR m_manger_ptr->initialiseDatabaseFromMesh(verb);
740  SeriesRecorder *series_recorder_ptr;
741  CHKERR getInterface(series_recorder_ptr);
742  CHKERR series_recorder_ptr->initialiseDatabaseFromMesh(verb);
743 
745 }
746 
747 // cubit meshsets
748 
751  *fields_ptr = &fIelds;
753 }
754 
756 Core::get_ref_ents(const RefEntity_multiIndex **refined_entities_ptr) const {
758  *refined_entities_ptr = &refinedEntities;
760 }
762  const RefElement_multiIndex **refined_finite_elements_ptr) const {
764  *refined_finite_elements_ptr = &refinedFiniteElements;
766 }
767 
768 MoFEMErrorCode Core::get_problem(const std::string &problem_name,
769  const Problem **problem_ptr) const {
772  const ProblemsByName &problems = pRoblems.get<Problem_mi_tag>();
773  ProblemsByName::iterator p_miit = problems.find(problem_name);
774  if (p_miit == problems.end()) {
775  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
776  "problem < %s > not found, (top tip: check spelling)",
777  problem_name.c_str());
778  }
779  *problem_ptr = &*p_miit;
781 }
782 
784 Core::get_problems(const Problem_multiIndex **problems_ptr) const {
786  *problems_ptr = &pRoblems;
788 }
789 
791 Core::get_field_ents(const FieldEntity_multiIndex **field_ents) const {
793  *field_ents = &entsFields;
795 }
798  *dofs_ptr = &dofsField;
800 }
801 
803  MeshsetsManager *meshsets_manager_ptr;
804  getInterface(meshsets_manager_ptr);
805  return meshsets_manager_ptr;
806 }
807 
809  MeshsetsManager *meshsets_manager_ptr;
810  getInterface(meshsets_manager_ptr);
811  return meshsets_manager_ptr;
812 }
813 
814 } // namespace MoFEM
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=0)
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:265
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:848
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition: Core.cpp:593
Tag th_FieldName_DataNamePrefix
Definition: Core.hpp:204
static const MOFEMuuid IDD_MOFEMMeshsetsManager
PetscLogEvent MOFEM_EVENT_postProcess
Event for postProcess finite element.
Definition: Core.hpp:836
boost::shared_ptr< WrapMPIComm > wrapMPIComm
Definition: Core.hpp:882
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:845
int * fShift
Ptr to tag handle storing last set bit in field ID.
Definition: Core.hpp:886
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
static const MOFEMuuid IDD_MOFEMLogManager
Definition: LogManager.hpp:44
MoFEMErrorCode rebuild_database(int verb=DEFAULT_VERBOSITY)
Clear database and initialize it once again.
Definition: Core.cpp:524
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
#define MOFEM_LOG_TAG(channel, tag)
Tag channelTag channel tag is set until MOFEM_LOG_CHANNEL is called, then new tag can be set.
Definition: LogManager.hpp:321
MoFEMErrorCode regSubInterface(const MOFEMuuid &uid)
Register subinterfac in core interface.
Definition: Core.cpp:102
PetscLogEvent MOFEM_EVENT_operator
Event for evaluating operator of finite element.
Definition: Core.hpp:834
static PetscErrorCode logPetscFPrintf(FILE *fd, const char format[], va_list Argp)
Use to handle PETSc output.
Definition: LogManager.cpp:308
keeps data about abstract PRISM finite element
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
#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:534
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.
MoFEMErrorCode get_fields(const Field_multiIndex **fields_ptr) const
Get fields multi-index from database.
Definition: Core.cpp:749
static const MOFEMuuid IDD_MOFEMBitRefManager
MoFEMErrorCode list_finite_elements() const
list finite elements in database
Definition: FECore.cpp:324
BitIntefaceId uUId
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:837
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:810
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:123
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:205
#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:260
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:832
#define MOFEM_C_LOG(channel, severity, format,...)
Definition: LogManager.hpp:293
MoFEMErrorCode list_fields() const
list entities in the field
Definition: FieldCore.cpp:1169
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.
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:181
MoFEMErrorCode get_ref_finite_elements(const RefElement_multiIndex **refined_finite_elements_ptr) const
Get ref finite elements multi-index form database.
Definition: Core.cpp:761
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:89
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:285
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Definition: LogManager.cpp:238
MoFEMErrorCode clear_database(int verb=DEFAULT_VERBOSITY)
Clear database.
Definition: Core.cpp:516
Tag th_FieldId
Definition: Core.hpp:204
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:84
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:900
Tag th_ProblemGhostNbDofCol
Definition: Core.hpp:211
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Definition: LogManager.cpp:298
Tag th_ProblemId
Definition: Core.hpp:208
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:849
Tag th_RefType
Definition: Core.hpp:203
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:255
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:568
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:1139
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:895
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:66
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:887
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition: Core.cpp:802
MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_entities_ptr) const
Get ref entities multi-index from database.
Definition: Core.cpp:756
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:314
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:896
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:266
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
MoFEMErrorCode get_field_ents(const FieldEntity_multiIndex **field_ents) const
Get field multi index.
Definition: Core.cpp:791
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
PetscBool initaliseAndBuildFiniteElements
Definition: Core.hpp:903
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
int * pShift
Ptr to tag handle storing last set bit in problem ID.
Definition: Core.hpp:888
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:768
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 get_problems(const Problem_multiIndex **problems_ptr) const
Get pointer to problems multi-index.
Definition: Core.cpp:784
MoFEMErrorCode set_field_order(const Range &ents, const BitFieldId id, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:401
static const MOFEMuuid IDD_MOFEMFieldBlas
Definition: FieldBlas.hpp:26
MoFEMErrorCode get_dofs(const DofEntity_multiIndex **dofs_ptr) const
Get dofs multi index.
Definition: Core.cpp:796
Tag th_ProblemShift
Definition: Core.hpp:212
ParallelComm * pComm
MOAB communicator structure.
Definition: Core.hpp:846
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1788
int verbose
Verbosity level.
Definition: Core.hpp:884
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:893
#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:898
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:243
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:77
static const MOFEMuuid IDD_MOFEMComm