v0.9.2
Core.hpp
Go to the documentation of this file.
1 /** \file Core.hpp
2  * \brief Core interface class for user interface
3  *
4  * Low level data structures not used directly by user
5  *
6  * FIXME It is a mess with names of core cpp files need better organization
7  *
8  */
9 
10 /*
11  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
18  */
19 
20 #ifndef __CORE_HPP__
21 #define __CORE_HPP__
22 
23 namespace MoFEM {
24 
25 // This is to have obsolete back compatibility
26 struct MeshsetsManager;
27 
28 /** \brief Core (interface) class
29 * \ingroup mofem
30 * \nosubgrouping
31 
32 This is the implementation of abstract MoFEM::Interface class. Similarly to the
33 convention used in MoAB, we use small letters to name function of purely
34 abstract classes. This is an exception used only here. For more details about
35 naming functions see \ref coding_practice
36 
37 This class is not used directly by the user. For internal use only. It is
38 database with basic functions to access data. Abstraction of this is MoFEM
39 Interface structure.
40 
41 Such deign to hide complexities for users and allow low development
42 without interfering with users modules programmer work.
43 
44 \todo Implement static functions for Initialization and Finalization of MoFEM.
45 Those functions should keep all static variables and initialize/finalize other
46 libs like PETSc. Moreover initialization functions should set error handlers,
47 etc.
48 
49 */
50 struct Core : public Interface {
51 
52  /**
53  * Construct core database
54  */
55  Core(moab::Interface &moab, ///< MoAB interface
56  MPI_Comm comm = PETSC_COMM_WORLD, ///< MPI communicator
57  const int verbose = VERBOSE, ///< Verbosity level
58  const bool distributed_mesh = true ///< UId of entities and dofs depends
59  ///< on owing processor, assumed that
60  ///< mesh is distributed. Otherwise
61  ///< is assumed that all processors
62  ///< have the same meshes and same
63  ///< entity handlers.
64 
65  );
66 
67  ~Core();
68 
69  /** \name Global initialisation and finalisation */
70 
71  /**@{*/
72 
73  /**
74  * @brief Initializes the MoFEM database PETSc, MOAB and MPI.
75  *
76  * \note This function calls PetscInitialize, for more details see
77  * <http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscInitialize.html>
78  *
79  * Example:
80  * \code
81  *
82  * int main(int argc, char *argv[]) {
83  *
84  * // Initailise MoFEM and Petsc
85  * MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
86  *
87  * try {
88  *
89  * moab::Core mb_instance; // MoAB database
90  * moab::Interface &moab = mb_instance;
91  * MoFEM::Core core(moab); // MOFEM database
92  * MoFEM::CoreInterface &m_field = core;
93  *
94  * CHKERR foo(); // Call function
95  *
96  * }
97  * CATCH_ERRORS;
98  *
99  * return MoFEM::Core::Finalize();
100  *
101  * }
102  *
103  * \endcode
104  *
105  * @param argc count of number of command line arguments
106  * @param args the command line arguments
107  * @param file [optional] PETSc database file, also checks ~username/.petscrc
108  * * and .petscrc use NULL to not check for code specific file. Use *
109  * -skip_petscrc in the code specific file to skip the .petscrc files
110  * @param help [optional] Help message to print, use NULL for no message
111  * @return MoFEMErrorCode
112  */
113  static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[],
114  const char help[]);
115 
116  /**
117  * @brief Checks for options to be called at the conclusion of the program.
118  *
119  * MPI_Finalize() is called only if the user had not called MPI_Init() before
120  * calling Initialize.
121  *
122  * \note This function calls PetscInitialize, for more details see
123  * <http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscFinalize.html>
124  *
125  * @return MoFEMErrorCode
126  */
127  static MoFEMErrorCode Finalize();
128 
129  /**@}*/
130 
131  /** \name Assessing interfaces */
132 
133  /**@{*/
134 
135  /**
136  * \brief Getting interface of core database
137  * @param uuid unique ID of interface
138  * @param iface returned pointer to interface
139  * @return error code
140  */
142  UnknownInterface **iface) const;
143 
144  /**@}*/
145 
146  /** \name Get tag handles to data on the mesh */
147 
148  /**@{*/
149 
150  inline Tag get_th_RefParentHandle() const { return th_RefParentHandle; }
151  inline Tag get_th_RefBitLevel() const { return th_RefBitLevel; }
152  inline Tag get_th_RefBitEdge() const { return th_RefBitEdge; }
153  inline Tag get_th_RefType() const { return th_RefType; }
154 
155  /**@}*/
156 
157  /** \name Auxiliary data and functions */
158 
159  /**@{*/
160 
161  /**
162  * Is used to check consistency. I n future properly this will be removed and
163  * replaced by other solution. It is only for internal use.
164  */
166  BUILD_FIELD = 1 << 0,
167  BUILD_FE = 1 << 1,
168  BUILD_ADJ = 1 << 2,
169  BUILD_PROBLEM = 1 << 3,
171  PARTITION_FE = 1 << 5,
173  PARTITION_MESH = 1 << 7
174  };
175 
176  /**
177  * \brief Get flags/semaphores for different stages
178  */
179  inline int &getBuildMoFEM() const { return *buildMoFEM; }
180 
181  /**
182  * \brief add prim element
183  *
184  * FIXME: This is dirt solution, need to be fixed
185  *
186  * @param prism prim handle
187  * @param verb verbosity level
188  * @return error code
189  */
191  int verb = DEFAULT_VERBOSITY);
192 
193  /**@}*/
194 
195 protected:
196  /** \name Tags to data on mesh and entities */
197 
198  /**@{*/
199 
200  Tag th_Part; ///< Tag for partition number
205  th_FieldBase;
213  Tag th_ElemType; ///< Needed for VTK files
214  Tag th_MoFEMBuild; ///< Internal use storing state, used to detect error and
215  ///< inconsistencies
216 
217  /**
218  * @return pointer to BasicEntityData structure
219  *
220  * BasicEntityData is structure which every BasicEntity have. It keeps data
221  * about tags to handles on the mesh, in particular tag to BitRefLevel and
222  * tag with handle to parent.
223  *
224  */
225  boost::shared_ptr<BasicEntityData> basicEntityDataPtr;
226 
227  /**
228  * \brief Get pointer to basic entity data.
229  *
230  * This structure keeps data like tags handlers and other data used to
231  * construct mofem entities, dofs and finite elements.
232  *
233  */
234  boost::shared_ptr<BasicEntityData> &get_basic_entity_data_ptr() {
235  return basicEntityDataPtr;
236  }
237 
238  /**@}*/
239 
240  /** \name Multi-Indices accessing data on the mesh */
241 
242  /**@{*/
243 
244  RefEntity_multiIndex refinedEntities; ///< refined entities
246 
248  FieldEntity_multiIndex entsFields; ///< entities on fields
249  DofEntity_multiIndex dofsField; ///< dofs on fields
250 
252  EntFiniteElement_multiIndex entsFiniteElements; ///< finite element entities
253 
255  entFEAdjacencies; ///< adjacencies of elements to dofs
256 
257  Problem_multiIndex pRoblems; ///< problems multi-index
258 
259  /**@}*/
260 
261  /** \name Get moab database */
262 
263  /**@{*/
264 
265  std::reference_wrapper<moab::Interface> moab; ///< moab database
266  inline moab::Interface &get_moab() { return moab; }
267  inline const moab::Interface &get_moab() const { return moab; }
268 
270  int verb = VERBOSE,
271  const bool distributed_mesh = true);
272 
273  /**@}*/
274 
275  /** \name Check database consistency */
276 
277  /**@{*/
278 
280  check_number_of_ents_in_ents_field(const std::string &name) const;
283  check_number_of_ents_in_ents_finite_element(const std::string &name) const;
285 
286  /**@}*/
287 
288  /** \name Clear database */
289 
290  /**@{*/
291 
294 
295  /**@}*/
296 
297  /** \name Getting access to meshset manager */
298 
299  /**@{*/
300 
304  return *get_meshsets_manager_ptr();
305  }
306  inline const MeshsetsManager &get_meshsets_manager() const {
307  return *get_meshsets_manager_ptr();
308  }
309 
310  /**@}*/
311 
312  /** \name Remove and delete entities */
313 
314  /**@{*/
315 
316  MoFEMErrorCode remove_parents_by_ents(const Range &ents,
317  int verb = DEFAULT_VERBOSITY);
318 
320  const BitRefLevel mask,
321  int verb = DEFAULT_VERBOSITY);
322 
323  MoFEMErrorCode remove_parents_by_parents(const Range &ents,
324  int verb = DEFAULT_VERBOSITY);
325 
326  MoFEMErrorCode remove_ents(const Range ents, int verb = DEFAULT_VERBOSITY);
327 
329  const BitRefLevel mask,
330  int verb = DEFAULT_VERBOSITY);
332  const BitRefLevel mask,
333  const bool remove_parent = false,
334  int verb = DEFAULT_VERBOSITY);
335  /**@}*/
336 
337  /** \name Fields */
338 
339  /**@{*/
340 
341  /**
342  * \brief Add filed
343  * @param name Field name
344  * @param space Space L2,H1,Hdiv,Hcurl
345  * @param base Approximation base AINSWORTH_LEGENDRE_BASE,
346  AINSWORTH_BERNSTEIN_BEZIER_BASE ...
347  * @param nb_coefficients Number of field coefficients
348  * @param tag_type Tag type, MB_TAG_DENSE or MB_TAG_SPARSE (default)
349  * @param bh Control behavior, if MF_EXCL throws error if exist
350  * @param verb Verbosity level
351  * @return Return error code
352 
353  TODO: \todo MB_TAG_DENSE will not work properly in general case. It is need to
354  separate field tags for each entity separately. That will allow for HO orders
355  but homogenous approx. order on each entity. Need some discussion what is
356  optimal solution. MB_TAG_SPARSE gives flexibility, but it not memory
357  efficient. MB_TAG_DENSE uses memory more efficient and in principle allow for
358  better efficiency if properly utilized.
359 
360  FIXME: \bug Need to resolve problem of dense tags at this stage of development
361  will make only problems
362 
363  */
364  MoFEMErrorCode add_field(const std::string &name, const FieldSpace space,
365  const FieldApproximationBase base,
366  const FieldCoefficientsNumber nb_coefficients,
367  const TagType tag_type = MB_TAG_SPARSE,
368  const enum MoFEMTypes bh = MF_EXCL,
369  int verb = DEFAULT_VERBOSITY);
370  MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim,
371  const std::string &name,
372  int verb = DEFAULT_VERBOSITY);
373  MoFEMErrorCode add_ents_to_field_by_dim(const Range &ents, const int dim,
374  const std::string &name,
375  int verb = DEFAULT_VERBOSITY);
376  MoFEMErrorCode add_ents_to_field_by_type(const Range &ents,
377  const EntityType type,
378  const std::string &name,
379  int verb = DEFAULT_VERBOSITY);
381  const int dim,
382  const std::string &name,
383  const bool recursive = true,
384  int verb = DEFAULT_VERBOSITY);
386  const EntityType type,
387  const std::string &name,
388  const bool recursive = true,
389  int verb = DEFAULT_VERBOSITY);
390 
391  MoFEMErrorCode create_vertices_and_add_to_field(const std::string name,
392  const double coords[],
393  int size,
394  int verb = DEFAULT_VERBOSITY);
395 
396  /// \name Set approximation order
397 
398  MoFEMErrorCode set_field_order(const Range &ents, const BitFieldId id,
400  int verb = DEFAULT_VERBOSITY);
402  const EntityType type, const BitFieldId id,
404  int verb = DEFAULT_VERBOSITY);
405  MoFEMErrorCode set_field_order(const Range &ents, const std::string &name,
407  int verb = DEFAULT_VERBOSITY);
409  const EntityType type, const std::string &name,
411  int verb = DEFAULT_VERBOSITY);
413  const BitRefLevel &bit, const BitRefLevel &mask, const EntityType type,
414  const BitFieldId id, const ApproximationOrder order,
415  int verb = DEFAULT_VERBOSITY);
417  const BitRefLevel &bit, const BitRefLevel &mask, const EntityType type,
418  const std::string &name, const ApproximationOrder order,
419  int verb = DEFAULT_VERBOSITY);
420 
421  /// \name Build fields
422 
424  std::map<EntityType, int> &dof_counter,
425  int verb = DEFAULT_VERBOSITY);
428  std::map<EntityType, int> &dof_counter,
429  std::map<EntityType, int> &inactive_dof_counter,
430  int verb = DEFAULT_VERBOSITY);
431 
432  MoFEMErrorCode buildField(const boost::shared_ptr<Field> &field,
433  int verb = DEFAULT_VERBOSITY);
434 
436 
437  MoFEMErrorCode build_field(const std::string field_name,
438  int verb = DEFAULT_VERBOSITY);
439 
440  /// \name Clear DOFs
443  const BitRefLevel mask,
444  int verb = DEFAULT_VERBOSITY);
445  MoFEMErrorCode clear_dofs_fields(const Range ents,
446  int verb = DEFAULT_VERBOSITY);
447  MoFEMErrorCode clear_dofs_fields(const std::string name, const Range ents,
448  int verb = DEFAULT_VERBOSITY);
449 
450  /// \name Clear ENTs
452  const BitRefLevel mask,
453  int verb = DEFAULT_VERBOSITY);
454  MoFEMErrorCode clear_ents_fields(const Range ents,
455  int verb = DEFAULT_VERBOSITY);
456  MoFEMErrorCode clear_ents_fields(const std::string name, const Range ents,
457  int verb = DEFAULT_VERBOSITY);
458 
459  /// \name Remove field entities
460 
463  const BitRefLevel mask,
464  int verb = DEFAULT_VERBOSITY);
465  MoFEMErrorCode remove_ents_from_field(const std::string name,
466  const EntityHandle meshset,
467  const EntityType type,
468  int verb = DEFAULT_VERBOSITY);
469  MoFEMErrorCode remove_ents_from_field(const std::string name,
470  const Range ents,
471  int verb = DEFAULT_VERBOSITY);
472  MoFEMErrorCode remove_ents_from_field(const Range ents,
473  int verb = DEFAULT_VERBOSITY);
474 
475  /// \name Other auxiliary functions for fields
476 
477  MoFEMErrorCode list_dofs_by_field_name(const std::string &name) const;
478  MoFEMErrorCode list_fields() const;
479  BitFieldId getBitFieldId(const std::string &name) const;
480  EntityHandle get_field_meshset(const BitFieldId id) const;
481  EntityHandle get_field_meshset(const std::string &name) const;
482  MoFEMErrorCode get_field_entities_by_dimension(const std::string name,
483  int dim, Range &ents) const;
484  MoFEMErrorCode get_field_entities_by_type(const std::string name,
485  EntityType type, Range &ents) const;
486  MoFEMErrorCode get_field_entities_by_handle(const std::string name,
487  Range &ents) const;
488  bool check_field(const std::string &name) const;
489  const Field *get_field_structure(const std::string &name);
490 
491  /**@}*/
492 
493  /** \name Finite elements */
494 
495  /**@{*/
496 
497  bool check_finite_element(const std::string &name) const;
498  MoFEMErrorCode add_finite_element(const std::string &fe_name,
499  enum MoFEMTypes bh = MF_EXCL,
500  int verb = DEFAULT_VERBOSITY);
502  modify_finite_element_adjacency_table(const std::string &fe_name,
503  const EntityType type,
504  ElementAdjacencyFunct function);
506  modify_finite_element_add_field_data(const std::string &fe_name,
507  const std::string &name_filed);
509  modify_finite_element_add_field_row(const std::string &fe_name,
510  const std::string &name_row);
512  modify_finite_element_add_field_col(const std::string &fe_name,
513  const std::string &name_col);
515  modify_finite_element_off_field_data(const std::string &fe_name,
516  const std::string &name_filed);
518  modify_finite_element_off_field_row(const std::string &fe_name,
519  const std::string &name_row);
521  modify_finite_element_off_field_col(const std::string &fe_name,
522  const std::string &name_col);
524  const EntityHandle meshset, const EntityType type,
525  const std::string &name, const bool recursive = true);
527  const int dim,
528  const std::string &name,
529  const bool recursive = true);
531  const EntityType type,
532  const std::string &name);
534  const int dim,
535  const std::string &name);
537  const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name,
538  EntityType type, int verb = DEFAULT_VERBOSITY);
541  const std::string &name,
542  const bool recursive = false);
544  const Range &vert, const std::string &name);
546  const Range &vert, const std::string &name);
548  const EntityHandle meshset, const std::string &name,
549  const bool recursive = false);
551  const Range &tris, const std::string &name);
553  const EntityHandle meshset, const std::string &name,
554  const bool recursive = false);
556  const Range &tets, const std::string &name);
558  const EntityHandle meshset, const std::string &name,
559  const bool recursive = false);
561  add_ents_to_finite_element_by_PRISMs(const Range &prims, const BitFEId id);
563  const Range &prims, const std::string &name);
565  const EntityHandle meshset, const std::string &name,
566  const bool recursive = false);
568  const BitRefLevel &bit, const std::string &name, EntityType type,
569  int verb = DEFAULT_VERBOSITY);
571  const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name,
572  EntityType type, int verb = DEFAULT_VERBOSITY);
573 
576  const BitRefLevel mask,
577  int verb = DEFAULT_VERBOSITY);
578  MoFEMErrorCode remove_ents_from_finite_element(const std::string name,
579  const EntityHandle meshset,
580  const EntityType type,
581  int verb = DEFAULT_VERBOSITY);
582  MoFEMErrorCode remove_ents_from_finite_element(const std::string name,
583  const Range ents,
584  int verb = DEFAULT_VERBOSITY);
586  int verb = DEFAULT_VERBOSITY);
587  MoFEMErrorCode delete_finite_element(const std::string name,
588  int verb = DEFAULT_VERBOSITY);
589 
590  // \name Other auxiliary functions for finite element
591 
592  /**
593  * \brief Get field Id
594  * @param name field name
595  * @return field id
596  */
597  BitFEId getBitFEId(const std::string &name) const;
598 
599  /**
600  * \brief Get field name
601  * @param id field id
602  * @return field name
603  */
604  std::string getBitFEIdName(const BitFEId id) const;
606  EntityHandle get_finite_element_meshset(const std::string &name) const;
608  get_finite_element_entities_by_dimension(const std::string name, int dim,
609  Range &ents) const;
611  EntityType type,
612  Range &ents) const;
614  Range &ents) const;
616 
617  /**@}*/
618 
619  /** \name Problems */
620 
621  /**@{*/
622 
623  MoFEMErrorCode add_problem(const std::string &name,
624  enum MoFEMTypes bh = MF_EXCL,
625  int verb = DEFAULT_VERBOSITY);
626  bool check_problem(const std::string name);
627  MoFEMErrorCode delete_problem(const std::string name);
629  modify_problem_add_finite_element(const std::string &name_problem,
630  const std::string &MoFEMFiniteElement_name);
632  const std::string &name_problem,
633  const std::string &MoFEMFiniteElement_name);
635  modify_problem_ref_level_add_bit(const std::string &name_problem,
636  const BitRefLevel &bit);
638  modify_problem_ref_level_set_bit(const std::string &name_problem,
639  const BitRefLevel &bit);
641  modify_problem_mask_ref_level_add_bit(const std::string &name_problem,
642  const BitRefLevel &bit);
644  modify_problem_mask_ref_level_set_bit(const std::string &name_problem,
645  const BitRefLevel &bit);
646  BitProblemId getBitProblemId(const std::string &name) const;
648  MoFEMErrorCode clear_problem(const std::string name,
649  int verb = DEFAULT_VERBOSITY);
653  int verb = DEFAULT_VERBOSITY);
654  MoFEMErrorCode build_finite_elements(const string fe_name,
655  const Range *const ents_ptr = nullptr,
656  int verb = DEFAULT_VERBOSITY);
657  MoFEMErrorCode buildFiniteElements(const boost::shared_ptr<FiniteElement> &fe,
658  const Range *ents_ptr = NULL,
659  int verb = DEFAULT_VERBOSITY);
661  const BitRefLevel mask,
662  int verb = DEFAULT_VERBOSITY);
663  MoFEMErrorCode clear_finite_elements(const Range ents,
664  int verb = DEFAULT_VERBOSITY);
665  MoFEMErrorCode clear_finite_elements(const std::string name, const Range ents,
666  int verb = DEFAULT_VERBOSITY);
667 
669  get_problem_finite_elements_entities(const std::string &name,
670  const std::string &fe_name,
671  const EntityHandle meshset);
672 
673  // \name Problem building (deprecated)
674 
678 
679  /**@}*/
680 
681  /** \name Adjacencies */
682 
683  /**@{*/
684 
685  MoFEMErrorCode build_adjacencies(const Range &ents,
686  int verb = DEFAULT_VERBOSITY);
688  int verb = DEFAULT_VERBOSITY);
690  const BitRefLevel &mask,
691  int verb = DEFAULT_VERBOSITY);
693  const BitRefLevel mask,
694  int verb = DEFAULT_VERBOSITY);
696  int verb = DEFAULT_VERBOSITY);
697  MoFEMErrorCode clear_adjacencies_entities(const std::string name,
698  const Range ents,
699  int verb = DEFAULT_VERBOSITY);
702  const BitRefLevel mask,
703  int verb = DEFAULT_VERBOSITY);
705  clear_adjacencies_finite_elements(const Range ents,
706  int verb = DEFAULT_VERBOSITY);
708  clear_adjacencies_finite_elements(const std::string name, const Range ents,
709  int verb = DEFAULT_VERBOSITY);
710 
711  /**@}*/
712 
713  /** \name Methods for preforming operations on elements */
714 
715  /**@{*/
716 
718  BasicMethod &method,
719  int verb = DEFAULT_VERBOSITY);
721  problem_basic_method_preProcess(const std::string &problem_name,
722  BasicMethod &method,
723  int verb = DEFAULT_VERBOSITY);
725  BasicMethod &method,
726  int verb = DEFAULT_VERBOSITY);
728  problem_basic_method_postProcess(const std::string &problem_name,
729  BasicMethod &method,
730  int verb = DEFAULT_VERBOSITY);
731 
733  const Problem *problem_ptr, const std::string &fe_name, FEMethod &method,
734  int lower_rank, int upper_rank,
735  boost::shared_ptr<NumeredEntFiniteElement_multiIndex> fe_ptr = nullptr,
736  MoFEMTypes bh = MF_EXIST, int verb = DEFAULT_VERBOSITY);
738  const std::string &problem_name, const std::string &fe_name,
739  FEMethod &method, int lower_rank, int upper_rank,
740  boost::shared_ptr<NumeredEntFiniteElement_multiIndex> fe_ptr = nullptr,
741  MoFEMTypes bh = MF_EXIST, int verb = DEFAULT_VERBOSITY);
743  const std::string &problem_name, const std::string &fe_name,
744  FEMethod &method,
745  boost::shared_ptr<NumeredEntFiniteElement_multiIndex> fe_ptr = nullptr,
746  MoFEMTypes bh = MF_EXIST, int verb = DEFAULT_VERBOSITY);
747 
748  MoFEMErrorCode loop_dofs(const Problem *problem_ptr,
749  const std::string &field_name, RowColData rc,
750  DofMethod &method, int lower_rank, int upper_rank,
751  int verb = DEFAULT_VERBOSITY);
752  MoFEMErrorCode loop_dofs(const std::string &problem_name,
753  const std::string &field_name, RowColData rc,
754  DofMethod &method, int lower_rank, int upper_rank,
755  int verb = DEFAULT_VERBOSITY);
756  MoFEMErrorCode loop_dofs(const std::string &problem_name,
757  const std::string &field_name, RowColData rc,
758  DofMethod &method, int verb = DEFAULT_VERBOSITY);
759  MoFEMErrorCode loop_dofs(const std::string &field_name, DofMethod &method,
760  int verb = DEFAULT_VERBOSITY);
761  MoFEMErrorCode loop_entities(const Problem *problem_ptr,
762  const std::string field_name, RowColData rc,
763  EntityMethod &method, int lower_rank,
764  int upper_rank, int verb = DEFAULT_VERBOSITY);
765  MoFEMErrorCode loop_entities(const std::string problem_name,
766  const std::string field_name, RowColData rc,
767  EntityMethod &method, int lower_rank,
768  int upper_rank, int verb = DEFAULT_VERBOSITY);
769  MoFEMErrorCode loop_entities(const std::string problem_name,
770  const std::string field_name, RowColData rc,
771  EntityMethod &method,
772  int verb = DEFAULT_VERBOSITY);
773  MoFEMErrorCode loop_entities(const std::string field_name,
774  EntityMethod &method,
775  Range const *const ents = nullptr,
776  int verb = DEFAULT_VERBOSITY);
777 
778  /**@}*/
779 
780  /** \name Accessing multi-indices */
781 
782  /**@{*/
783 
784  MoFEMErrorCode get_fields(const Field_multiIndex **fields_ptr) const;
786  get_ref_ents(const RefEntity_multiIndex **refined_entities_ptr) const;
788  const RefElement_multiIndex **refined_finite_elements_ptr) const;
790  get_finite_elements(const FiniteElement_multiIndex **fe_ptr) const;
792  const EntFiniteElement_multiIndex **fe_ent_ptr) const;
794  get_field_ents(const FieldEntity_multiIndex **field_ents) const;
795  MoFEMErrorCode get_dofs(const DofEntity_multiIndex **dofs_ptr) const;
796  MoFEMErrorCode get_problem(const std::string &problem_name,
797  const Problem **problem_ptr) const;
798  MoFEMErrorCode get_problems(const Problem_multiIndex **problems_ptr) const;
799 
800  const Field_multiIndex *get_fields() const;
801  const RefEntity_multiIndex *get_ref_ents() const;
805  const FieldEntity_multiIndex *get_field_ents() const;
806  const DofEntity_multiIndex *get_dofs() const;
807  const Problem *get_problem(const std::string &problem_name) const;
808  const Problem_multiIndex *get_problems() const;
809 
810  FieldEntityByFieldName::iterator
811  get_ent_field_by_name_begin(const std::string &field_name) const;
812  FieldEntityByFieldName::iterator
813  get_ent_field_by_name_end(const std::string &field_name) const;
814  DofEntityByFieldName::iterator
815  get_dofs_by_name_begin(const std::string &field_name) const;
816  DofEntityByFieldName::iterator
817  get_dofs_by_name_end(const std::string &field_name) const;
818  DofEntityByNameAndEnt::iterator
819  get_dofs_by_name_and_ent_begin(const std::string &field_name,
820  const EntityHandle ent) const;
821  DofEntityByNameAndEnt::iterator
822  get_dofs_by_name_and_ent_end(const std::string &field_name,
823  const EntityHandle ent) const;
824  DofEntityByNameAndType::iterator
825  get_dofs_by_name_and_type_begin(const std::string &field_name,
826  const EntityType type) const;
827  DofEntityByNameAndType::iterator
828  get_dofs_by_name_and_type_end(const std::string &field_name,
829  const EntityType ent) const;
830  EntFiniteElementByName::iterator
831  get_fe_by_name_begin(const std::string &fe_name) const;
832  EntFiniteElementByName::iterator
833  get_fe_by_name_end(const std::string &fe_name) const;
834 
835  /**@}*/
836 
837  /** \name Log events */
838 
839  /**@{*/
840 
841  // Events are are using for logging and hailed by PETSc
842 
843  PetscLogEvent MOFEM_EVENT_preProcess; ///< Event for preProcess finite element
844  PetscLogEvent
845  MOFEM_EVENT_operator; ///< Event for evaluating operator of finite element
846  PetscLogEvent
847  MOFEM_EVENT_postProcess; ///< Event for postProcess finite element
848  PetscLogEvent MOFEM_EVENT_createMat;
849 
850  /**@}*/
851 
852  /** \name Communicator */
853 
854  /**@{*/
855 
856  mutable MPI_Comm cOmm; ///< MoFEM communicator
857  mutable ParallelComm *pComm; ///< MOAB communicator structure
858 
859  int sIze; ///< MoFEM communicator size
860  int rAnk; ///< MOFEM communicator rank
861 
862  /**
863  * @return return communicator
864  */
865  inline MPI_Comm &get_comm() const { return cOmm; }
866 
867  /**
868  * @return return communicator size
869  */
870  inline int get_comm_size() const { return sIze; }
871 
872  /**
873  * @return return communicator rank/processor
874  */
875  inline int get_comm_rank() const { return rAnk; }
876 
877 private:
878  struct WrapMPIComm {
879  WrapMPIComm(MPI_Comm &comm, MPI_Comm &duplicated_comm)
880  : comm(comm), duplicatedComm(duplicated_comm) {
881  ierr = PetscCommDuplicate(comm, &duplicated_comm, NULL);
882  CHKERRABORT(comm, ierr);
883  }
885  ierr = PetscCommDestroy(&duplicatedComm);
886  CHKERRABORT(comm, ierr);
887  }
888 
889  private:
890  MPI_Comm &comm;
891  MPI_Comm &duplicatedComm;
892  };
893  boost::shared_ptr<WrapMPIComm> wrapMPIComm;
894 
895  int verbose; ///< Verbosity level
896 
897  int *fShift; ///< Ptr to tag handle storing last set bit in field ID
898  int *feShift; ///< Ptr to tag handle storing last set bit in finite element ID
899  int *pShift; ///< Ptr to tag handle storing last set bit in problem ID
900 
901  /**
902  * \brief Hash map of pointers to interfaces
903  */
904  mutable boost::ptr_map<unsigned long, UnknownInterface> iFaces;
905 
906  mutable int *buildMoFEM; ///< keeps flags/semaphores for different stages
907  static bool isGloballyInitialised; ///< Core base globally initialized
908 
909  std::string optionsPrefix; ///< Prefix for options on command line
910 
911  PetscBool initaliseAndBuildField; ///< If true build field on database
912  ///< initialisation
913 
914  PetscBool initaliseAndBuildFiniteElements; // If true build finite elements on
915  // database initialisation
916 
917  /**
918  * @brief add problem
919  *
920  * @param id problem id
921  * @param name problem name
922  * @param verb verbosity level
923  * @return MoFEMErrorCode
924  */
925  MoFEMErrorCode addProblem(const BitProblemId id, const std::string &name,
926  int verb = DEFAULT_VERBOSITY);
927 
928  /**
929  * \brief Get tag handles
930  * @param verb verbosity level
931  * @return error code
932  */
934 
935  /**
936  * \brief Cleaning database
937  */
939 
940  /**
941  * @brief Register insterfaces
942  *
943  * @return MoFEMErrorCode
944  */
946 
947  /**
948  * \brief Return unique field Id.
949  *
950  * Each time this function is called, it gives new unit field Id for bit.
951  *
952  */
954 
955  /**
956  * \brief Return unique finite element Id
957  *
958  * Each time this function is called, it gives new unit finite Id for bit.
959  *
960  */
962 
963  /**
964  * \brief Return unique problem Id
965  *
966  * Each time this function is called, it gives new unit problem Id for bit.
967  *
968  */
970 
971  /**
972  * \brief Initialize database getting information on mesh
973  */
975 
976  /**
977  * @brief Get core options from command line
978  *
979  * @return MoFEMErrorCode
980  */
982 
983  /**
984  * @brief Register subinterfac in core interface
985  *
986  * @tparam IFACE
987  * @param uid
988  * @return MoFEMErrorCode
989  */
990  template <class IFACE> MoFEMErrorCode regSubInterface(const MOFEMuuid &uid);
991 };
992 
993 } // namespace MoFEM
994 
995 #endif // __CORE_HPP__
MoFEMErrorCode modify_problem_mask_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)
set dof mask ref level for problem
const DofEntity_multiIndex * get_dofs() const
Get the dofs object.
Definition: Core.cpp:851
Tag th_ProblemNbDofsCol
Definition: Core.hpp:209
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:249
MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string &name_filed)
set finite element field data
Definition: FECore.cpp:126
structure for User Loop Methods on finite elementsIt can be used to calculate stiffness matrices,...
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:270
WrapMPIComm(MPI_Comm &comm, MPI_Comm &duplicated_comm)
Definition: Core.hpp:879
Tag th_FieldSpace
Definition: Core.hpp:204
Deprecated interface functions.
MoFEM interface unique ID.
int sIze
MoFEM communicator size.
Definition: Core.hpp:859
MoFEMErrorCode get_problem_finite_elements_entities(const std::string &name, const std::string &fe_name, const EntityHandle meshset)
add finite elements to the meshset
Definition: FieldCore.cpp:1179
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition: Core.cpp:598
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:261
Tag get_th_RefParentHandle() const
Definition: Core.hpp:150
Tag th_FieldName_DataNamePrefix
Definition: Core.hpp:204
MoFEMErrorCode delete_finite_element(const std::string name, int verb=DEFAULT_VERBOSITY)
delete finite element from mofem database
Definition: DeleteCore.cpp:610
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
MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)
Add entities to field meshset.
Definition: FieldCore.cpp:323
boost::shared_ptr< WrapMPIComm > wrapMPIComm
Definition: Core.hpp:893
Tag get_th_RefBitLevel() const
Definition: Core.hpp:151
MoFEMErrorCode clear_adjacencies_entities(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:211
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
DofEntityByNameAndEnt::iterator get_dofs_by_name_and_ent_begin(const std::string &field_name, const EntityHandle ent) const
get begin iterator of filed dofs of given name and ent(instead you can use IT_GET_DOFS_FIELD_BY_NAME_...
Definition: FieldCore.cpp:1218
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.
MoFEMErrorCode create_vertices_and_add_to_field(const std::string name, const double coords[], int size, int verb=DEFAULT_VERBOSITY)
Create a vertices and add to field object.
Definition: FieldCore.cpp:361
MoFEMErrorCode check_number_of_ents_in_ents_finite_element() const
check data consistency in entsFiniteElements
Definition: FECore.cpp:1005
MoFEMErrorCode add_ents_to_finite_element_by_MESHSET(const EntityHandle meshset, const std::string &name, const bool recursive=false)
add MESHSET element to finite element database given by name
Definition: FECore.cpp:498
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
MoFEMErrorCode add_ents_to_finite_element_by_dim(const EntityHandle meshset, const int dim, const std::string &name, const bool recursive=true)
add entities to finite element
Definition: FECore.cpp:343
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.
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_VERTICEs(const Range &vert, const std::string &name)
add VERTICES entities from range to finite element database given by name
Definition: FECore.cpp:396
MoFEMErrorCode rebuild_database(int verb=DEFAULT_VERBOSITY)
Clear database and initialize it once again.
Definition: Core.cpp:529
MoFEMErrorCode check_number_of_ents_in_ents_field() const
check data consistency in entitiesPtr
Definition: FieldCore.cpp:1261
int ApproximationOrder
Approximation on the entity.
Definition: Types.hpp:37
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_EDGEs(const Range &vert, const std::string &name)
add EDGES entities from range to finite element database given by name
Definition: FECore.cpp:389
moab::Interface & get_moab()
Definition: Core.hpp:266
Data structure to exchange data between mofem and User Loop Methods on entities.It allows to exchange...
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
DofEntityByNameAndType::iterator get_dofs_by_name_and_type_begin(const std::string &field_name, const EntityType type) const
get begin iterator of filed dofs of given name and ent type (instead you can use IT_GET_DOFS_FIELD_BY...
Definition: FieldCore.cpp:1230
MoFEMErrorCode remove_parents_by_ents(const Range &ents, int verb=DEFAULT_VERBOSITY)
Remove parents from entities.
Definition: DeleteCore.cpp:506
DofEntityByFieldName::iterator get_dofs_by_name_end(const std::string &field_name) const
get begin iterator of filed dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOO...
Definition: FieldCore.cpp:1214
MoFEMErrorCode remove_parents_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
Remove parent from entities on bit level.
Definition: DeleteCore.cpp:494
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
MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
Make a loop over dofs.
MoFEMErrorCode add_ents_to_field_by_dim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Add entities to field meshset.
Definition: FieldCore.cpp:316
MoFEMErrorCode get_finite_element_entities_by_dimension(const std::string name, int dim, Range &ents) const
get entities in the finite element by dimension
Definition: FECore.cpp:276
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)
build adjacencies
Definition: FECore.cpp:877
MoFEMErrorCode clear_problem(const std::string name, int verb=DEFAULT_VERBOSITY)
clear problem
DEPRECATED MoFEMErrorCode build_problem_on_distributed_mesh(int verb=DEFAULT_VERBOSITY)
build problem data structures, assuming that mesh is distributed (collective)
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
MoFEMErrorCode clear_inactive_dofs(int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:40
int & getBuildMoFEM() const
Get flags/semaphores for different stages.
Definition: Core.hpp:179
Tag th_ProblemFEId
Definition: Core.hpp:208
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.
BitProblemId getBitProblemId(const std::string &name) const
MoFEMErrorCode list_finite_elements() const
list finite elements in database
Definition: FECore.cpp:310
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:848
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
Tag get_th_RefBitEdge() const
Definition: Core.hpp:152
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition: Types.hpp:54
Tag th_Part
Tag for partition number.
Definition: Core.hpp:200
Core(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE, const bool distributed_mesh=true)
Definition: Core.cpp:115
Core (interface) class.
Definition: Core.hpp:50
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
Data structure to exchange data between mofem and User Loop Methods on entities.It allows to exchange...
MoFEMErrorCode list_dofs_by_field_name(const std::string &name) const
Definition: FieldCore.cpp:1156
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
Tag th_RefFEMeshset
Definition: Core.hpp:201
MoFEMErrorCode remove_ents_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
remove entities form mofem database
Definition: DeleteCore.cpp:483
MoFEMErrorCode get_field_entities_by_dimension(const std::string name, int dim, Range &ents) const
get entities in the field by dimension
Definition: FieldCore.cpp:71
const Problem_multiIndex * get_problems() const
Get the problems object.
Definition: Core.cpp:859
MoFEMErrorCode add_ents_to_finite_element_by_bit_ref(const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
add TET entities from given refinement level to finite element database given by name
Definition: FECore.cpp:462
MeshsetsManager & get_meshsets_manager()
get MeshsetsManager pointer
Definition: Core.hpp:303
RowColData
RowColData.
Definition: definitions.h:192
MoFEMErrorCode list_fields() const
list entities in the field
Definition: FieldCore.cpp:1168
MoFEMErrorCode modify_finite_element_off_field_data(const std::string &fe_name, const std::string &name_filed)
unset finite element field data
Definition: FECore.cpp:188
const Field * get_field_structure(const std::string &name)
get field structure
Definition: FieldCore.cpp:58
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
MoFEMErrorCode get_finite_element_entities_by_type(const std::string name, EntityType type, Range &ents) const
get entities in the finite element by type
Definition: FECore.cpp:286
const FieldEntity_multiIndex * get_field_ents() const
Get the field ents object.
Definition: Core.cpp:848
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_PRISMs(const Range &prims, const BitFEId id)
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 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
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TRIs(const Range &tris, const std::string &name)
add TRI entities from range to finite element database given by name
Definition: FECore.cpp:403
Tag th_FieldId
Definition: Core.hpp:204
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:239
Tag th_RefBitEdge
Definition: Core.hpp:201
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:53
const int dim
Tag th_ProblemName
Definition: Core.hpp:208
PetscBool initaliseAndBuildField
Definition: Core.hpp:911
std::string getBitFEIdName(const BitFEId id) const
Get field name.
Definition: FECore.cpp:252
DofEntityByFieldName::iterator get_dofs_by_name_begin(const std::string &field_name) const
get begin iterator of filed dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOO...
Definition: FieldCore.cpp:1210
EntFiniteElementByName::iterator get_fe_by_name_end(const std::string &fe_name) const
get end iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(MF...
Definition: FECore.cpp:977
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
MoFEMErrorCode add_field(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
Add filed.
Definition: FieldCore.cpp:98
Tag th_ProblemNbDofsRow
Definition: Core.hpp:209
MoFEMErrorCode clear_dofs_fields_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:56
FieldEntityByFieldName::iterator get_ent_field_by_name_end(const std::string &field_name) const
get begin iterator of filed dofs of given name (instead you can use IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP...
Definition: FieldCore.cpp:1206
DEPRECATED MoFEMErrorCode build_problems(int verb=DEFAULT_VERBOSITY)
build problem data structures
MoFEMErrorCode modify_finite_element_off_field_col(const std::string &fe_name, const std::string &name_col)
unset field col which finite element use
Definition: FECore.cpp:223
MoFEMErrorCode clear_ents_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:121
MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
add finite element
Definition: FECore.cpp:39
BitFEId getFEShift()
Return unique finite element Id.
Definition: Core.cpp:260
bool check_finite_element(const std::string &name) const
Check if finite element is in database.
Definition: FECore.cpp:29
const MeshsetsManager & get_meshsets_manager() const
get MeshsetsManager pointer
Definition: Core.hpp:306
FieldApproximationBase
approximation base
Definition: definitions.h:150
MoFEMErrorCode clear_ents_fields_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:108
Tag th_ProblemGhostNbDofRow
Definition: Core.hpp:210
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
Definition: Core.cpp:573
MoFEMErrorCode modify_finite_element_off_field_row(const std::string &fe_name, const std::string &name_row)
unset field row which finite element use
Definition: FECore.cpp:205
int get_comm_rank() const
Definition: Core.hpp:875
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.
Tag th_FieldBase
Definition: Core.hpp:204
MoFEMErrorCode modify_problem_add_finite_element(const std::string &name_problem, const std::string &MoFEMFiniteElement_name)
add finite element to problem, this add entities assigned to finite element to a particular problem
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
MoFEMErrorCode loop_entities(const Problem *problem_ptr, const std::string field_name, RowColData rc, EntityMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
Loop over field entities in the problem.
MoFEMErrorCode build_field(const std::string field_name, int verb=DEFAULT_VERBOSITY)
build field by name
Definition: FieldCore.cpp:1125
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:67
Tag th_MoFEMBuild
Definition: Core.hpp:214
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:245
int get_comm_size() const
Definition: Core.hpp:870
int * feShift
Ptr to tag handle storing last set bit in finite element ID.
Definition: Core.hpp:898
MoFEMErrorCode addProblem(const BitProblemId id, const std::string &name, int verb=DEFAULT_VERBOSITY)
add problem
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition: Core.cpp:821
Tag th_ProblemLocalNbDofRow
Definition: Core.hpp:210
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
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
MoFEMErrorCode list_problem() const
list problems
Tag th_FieldName
Definition: Core.hpp:204
MoFEMErrorCode get_field_entities_by_handle(const std::string name, Range &ents) const
get entities in the field by handle
Definition: FieldCore.cpp:90
FieldSpace
approximation spaces
Definition: definitions.h:174
Tag th_FEShift
Definition: Core.hpp:212
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition: Types.hpp:52
MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string &name_col)
set field col which finite element use
Definition: FECore.cpp:168
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
MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
add entities to finite element
Definition: FECore.cpp:326
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
MoFEMErrorCode buildField(const boost::shared_ptr< Field > &field, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1039
constexpr int order
static char help[]
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:225
MoFEMErrorCode remove_ents_from_field(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
remove entities from field
Definition: DeleteCore.cpp:162
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:237
MoFEMErrorCode get_problem(const std::string &problem_name, const Problem **problem_ptr) const
Get problem database (data structure)
Definition: Core.cpp:773
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
#define DEPRECATED
Definition: definitions.h:29
MoFEMErrorCode clear_finite_elements(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:299
MoFEMErrorCode set_field_order(const Range &ents, const BitFieldId id, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:400
BitFieldId getBitFieldId(const std::string &name) const
Definition: FieldCore.cpp:28
MoFEMErrorCode remove_parents_by_parents(const Range &ents, int verb=DEFAULT_VERBOSITY)
Remove paremts from entities having parents in passed range.
Definition: DeleteCore.cpp:540
Tag th_ProblemShift
Definition: Core.hpp:212
ParallelComm * pComm
MOAB communicator structure.
Definition: Core.hpp:857
MoFEMErrorCode buildFieldForL2H1HcurlHdiv(const BitFieldId id, std::map< EntityType, int > &dof_counter, std::map< EntityType, int > &inactive_dof_counter, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:926
MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string &name_row)
set field row which finite element use
Definition: FECore.cpp:147
int FieldCoefficientsNumber
Number of field coefficients.
Definition: Types.hpp:38
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1879
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_EntType_by_bit_ref(const BitRefLevel &bit, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
add TET elements from given refinement level to finite element database given by name
Definition: FECore.cpp:443
MoFEMErrorCode modify_finite_element_adjacency_table(const std::string &fe_name, const EntityType type, ElementAdjacencyFunct function)
modify finite element table, only for advanced user
Definition: FECore.cpp:105
int verbose
Verbosity level.
Definition: Core.hpp:895
boost::function< MoFEMErrorCode(Interface &moab, const Field &field, const EntFiniteElement &fe, Range &adjacency)> ElementAdjacencyFunct
user adjacency function
MoFEMErrorCode clear_adjacencies_finite_elements(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
clear adjacency map for finite elements on given bit level
Definition: DeleteCore.cpp:340
Tag th_RefBitLevel_Mask
Definition: Core.hpp:201
MoFEMErrorCode buildFieldForNoField(const BitFieldId id, std::map< EntityType, int > &dof_counter, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:817
Tag th_FEId
Definition: Core.hpp:206
FieldEntityByFieldName::iterator get_ent_field_by_name_begin(const std::string &field_name) const
get begin iterator of filed ents of given name (instead you can use IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP...
Definition: FieldCore.cpp:1202
boost::ptr_map< unsigned long, UnknownInterface > iFaces
Hash map of pointers to interfaces.
Definition: Core.hpp:904
EntityHandle get_field_meshset(const BitFieldId id) const
Definition: FieldCore.cpp:38
MoFEMErrorCode buildFiniteElements(const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
Definition: FECore.cpp:557
Tag get_th_RefType() const
Definition: Core.hpp:153
std::string optionsPrefix
Prefix for options on command line.
Definition: Core.hpp:909
MoFEMErrorCode delete_ents_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, const bool remove_parent=false, int verb=DEFAULT_VERBOSITY)
delete entities form mofem and moab database
Definition: DeleteCore.cpp:557
MoFEMErrorCode problem_basic_method_postProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
Set data for BasicMethodThis function set data about problem, adjacencies and other multi-indices in ...
MoFEMErrorCode remove_ents_from_field_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
remove entities from field
Definition: DeleteCore.cpp:199
MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
Add problem.
Tag th_RefBitLevel
Definition: Core.hpp:201
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:252
boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()
Get pointer to basic entity data.
Definition: Core.hpp:234
const moab::Interface & get_moab() const
Definition: Core.hpp:267
MoFEMErrorCode remove_ents(const Range ents, int verb=DEFAULT_VERBOSITY)
remove entities form mofem database
Definition: DeleteCore.cpp:457
MoFEMErrorCode modify_problem_mask_ref_level_set_bit(const std::string &name_problem, const BitRefLevel &bit)
set dof mask ref level for problem
SemaphoresBuildMofem
Definition: Core.hpp:165
DofEntityByNameAndType::iterator get_dofs_by_name_and_type_end(const std::string &field_name, const EntityType ent) const
get begin iterator of filed dofs of given name end ent type(instead you can use IT_GET_DOFS_FIELD_BY_...
Definition: FieldCore.cpp:1236
MoFEMErrorCode set_field_order_by_entity_type_and_bit_ref(const BitRefLevel &bit, const BitRefLevel &mask, const EntityType type, const BitFieldId id, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:788
Tag th_FEIdData
Definition: Core.hpp:207
MPI_Comm & get_comm() const
Definition: Core.hpp:865
MoFEMErrorCode clear_problems(int verb=DEFAULT_VERBOSITY)
clear problems
DofEntityByNameAndEnt::iterator get_dofs_by_name_and_ent_end(const std::string &field_name, const EntityHandle ent) const
get begin iterator of filed dofs of given name and ent (instead you can use IT_GET_DOFS_FIELD_BY_NAME...
Definition: FieldCore.cpp:1224
bool check_field(const std::string &name) const
check if field is in database
Definition: FieldCore.cpp:50
MoFEMErrorCode clear_finite_elements_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:287
MoFEMErrorCode modify_problem_unset_finite_element(const std::string &name_problem, const std::string &MoFEMFiniteElement_name)
unset finite element from problem, this remove entities assigned to finite element to a particular pr...
MPI_Comm & duplicatedComm
Definition: Core.hpp:891
Data structure to exchange data between mofem and User Loop Methods.It allows to exchange data betwee...
MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)
add ref level to problem
MoFEMErrorCode delete_problem(const std::string name)
Delete problem.
MoFEMErrorCode remove_ents_from_finite_element(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
remove entities from given refinement level to finite element database
Definition: DeleteCore.cpp:407
MoFEMErrorCode get_finite_element_entities_by_handle(const std::string name, Range &ents) const
get entities in the finite element by handle
Definition: FECore.cpp:299
DEPRECATED IFace * query_interface() const
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
Definition: definitions.h:189
MoFEMErrorCode remove_ents_from_finite_element_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
remove elements from given refinement level to finite element database
Definition: DeleteCore.cpp:446
BitFieldId getFieldShift()
Return unique field Id.
Definition: Core.cpp:248
MoFEMErrorCode get_field_entities_by_type(const std::string name, EntityType type, Range &ents) const
get entities in the field by type
Definition: FieldCore.cpp:81
Tag th_FEIdRow
Definition: Core.hpp:207
MoFEMErrorCode problem_basic_method_preProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
Set data for BasicMethod.
MoFEMErrorCode modify_problem_ref_level_set_bit(const std::string &name_problem, const BitRefLevel &bit)
set ref level for problem
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:69
EntFiniteElementByName::iterator get_fe_by_name_begin(const std::string &fe_name) const
get begin iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(...
Definition: FECore.cpp:972
MoFEMErrorCode loop_finite_elements(const Problem *problem_ptr, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, int verb=DEFAULT_VERBOSITY)
Make a loop over finite elements on partitions from upper to lower rank.
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TETs(const Range &tets, const std::string &name)
add TET entities from range to finite element database given by name
Definition: FECore.cpp:416
bool check_problem(const std::string name)
check if problem exist
const FiniteElement_multiIndex * get_finite_elements() const
Get the finite elements object.
Definition: Core.cpp:842