v0.9.0
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 
269  MoFEMErrorCode set_moab_interface(moab::Interface &new_moab,
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,
399  const ApproximationOrder order,
400  int verb = DEFAULT_VERBOSITY);
402  const EntityType type, const BitFieldId id,
403  const ApproximationOrder order,
404  int verb = DEFAULT_VERBOSITY);
405  MoFEMErrorCode set_field_order(const Range &ents, const std::string &name,
406  const ApproximationOrder order,
407  int verb = DEFAULT_VERBOSITY);
409  const EntityType type, const std::string &name,
410  const ApproximationOrder order,
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);
711 
712  /**@}*/
713 
714  /** \name Methods for preforming operations on elements */
715 
716  /**@{*/
717 
719  BasicMethod &method,
720  int verb = DEFAULT_VERBOSITY);
722  problem_basic_method_preProcess(const std::string &problem_name,
723  BasicMethod &method,
724  int verb = DEFAULT_VERBOSITY);
726  BasicMethod &method,
727  int verb = DEFAULT_VERBOSITY);
729  problem_basic_method_postProcess(const std::string &problem_name,
730  BasicMethod &method,
731  int verb = DEFAULT_VERBOSITY);
732 
734  const Problem *problem_ptr, const std::string &fe_name, FEMethod &method,
735  int lower_rank, int upper_rank,
736  boost::shared_ptr<NumeredEntFiniteElement_multiIndex> fe_ptr = nullptr,
737  MoFEMTypes bh = MF_EXIST, int verb = DEFAULT_VERBOSITY);
739  const std::string &problem_name, const std::string &fe_name,
740  FEMethod &method, int lower_rank, int upper_rank,
741  boost::shared_ptr<NumeredEntFiniteElement_multiIndex> fe_ptr = nullptr,
742  MoFEMTypes bh = MF_EXIST, int verb = DEFAULT_VERBOSITY);
744  const std::string &problem_name, const std::string &fe_name,
745  FEMethod &method,
746  boost::shared_ptr<NumeredEntFiniteElement_multiIndex> fe_ptr = nullptr,
747  MoFEMTypes bh = MF_EXIST, int verb = DEFAULT_VERBOSITY);
748 
749  MoFEMErrorCode loop_dofs(const Problem *problem_ptr,
750  const std::string &field_name, RowColData rc,
751  DofMethod &method, int lower_rank, int upper_rank,
752  int verb = DEFAULT_VERBOSITY);
753  MoFEMErrorCode loop_dofs(const std::string &problem_name,
754  const std::string &field_name, RowColData rc,
755  DofMethod &method, int lower_rank, int upper_rank,
756  int verb = DEFAULT_VERBOSITY);
757  MoFEMErrorCode loop_dofs(const std::string &problem_name,
758  const std::string &field_name, RowColData rc,
759  DofMethod &method, int verb = DEFAULT_VERBOSITY);
760  MoFEMErrorCode loop_dofs(const std::string &field_name, DofMethod &method,
761  int verb = DEFAULT_VERBOSITY);
762  MoFEMErrorCode loop_entities(const Problem *problem_ptr,
763  const std::string field_name, RowColData rc,
764  EntityMethod &method, int lower_rank,
765  int upper_rank, int verb = DEFAULT_VERBOSITY);
766  MoFEMErrorCode loop_entities(const std::string problem_name,
767  const std::string field_name, RowColData rc,
768  EntityMethod &method, int lower_rank,
769  int upper_rank, int verb = DEFAULT_VERBOSITY);
770  MoFEMErrorCode loop_entities(const std::string problem_name,
771  const std::string field_name, RowColData rc,
772  EntityMethod &method,
773  int verb = DEFAULT_VERBOSITY);
774  MoFEMErrorCode loop_entities(const std::string field_name,
775  EntityMethod &method,
776  Range const *const ents = nullptr,
777  int verb = DEFAULT_VERBOSITY);
778 
779  /**@}*/
780 
781  /** \name Accessing multi-indices */
782 
783  /**@{*/
784 
785  MoFEMErrorCode get_fields(const Field_multiIndex **fields_ptr) const;
787  get_ref_ents(const RefEntity_multiIndex **refined_entities_ptr) const;
789  const RefElement_multiIndex **refined_finite_elements_ptr) const;
791  get_finite_elements(const FiniteElement_multiIndex **fe_ptr) const;
793  const EntFiniteElement_multiIndex **fe_ent_ptr) const;
795  get_field_ents(const FieldEntity_multiIndex **field_ents) const;
796  MoFEMErrorCode get_dofs(const DofEntity_multiIndex **dofs_ptr) const;
797  MoFEMErrorCode get_problem(const std::string &problem_name,
798  const Problem **problem_ptr) const;
799  MoFEMErrorCode get_problems(const Problem_multiIndex **problems_ptr) const;
800  FieldEntityByFieldName::iterator
801  get_ent_field_by_name_begin(const std::string &field_name) const;
802  FieldEntityByFieldName::iterator
803  get_ent_field_by_name_end(const std::string &field_name) const;
804  DofEntityByFieldName::iterator
805  get_dofs_by_name_begin(const std::string &field_name) const;
806  DofEntityByFieldName::iterator
807  get_dofs_by_name_end(const std::string &field_name) const;
808  DofEntityByNameAndEnt::iterator
809  get_dofs_by_name_and_ent_begin(const std::string &field_name,
810  const EntityHandle ent) const;
811  DofEntityByNameAndEnt::iterator
812  get_dofs_by_name_and_ent_end(const std::string &field_name,
813  const EntityHandle ent) const;
814  DofEntityByNameAndType::iterator
815  get_dofs_by_name_and_type_begin(const std::string &field_name,
816  const EntityType type) const;
817  DofEntityByNameAndType::iterator
818  get_dofs_by_name_and_type_end(const std::string &field_name,
819  const EntityType ent) const;
820  EntFiniteElementByName::iterator
821  get_fe_by_name_begin(const std::string &fe_name) const;
822  EntFiniteElementByName::iterator
823  get_fe_by_name_end(const std::string &fe_name) const;
824 
825  /**@}*/
826 
827  /** \name Log events */
828 
829  /**@{*/
830 
831  // Events are are using for logging and hailed by PETSc
832 
833  PetscLogEvent MOFEM_EVENT_preProcess; ///< Event for preProcess finite element
834  PetscLogEvent
835  MOFEM_EVENT_operator; ///< Event for evaluating operator of finite element
836  PetscLogEvent
837  MOFEM_EVENT_postProcess; ///< Event for postProcess finite element
838  PetscLogEvent MOFEM_EVENT_createMat;
839 
840  /**@}*/
841 
842  /** \name Communicator */
843 
844  /**@{*/
845 
846  mutable MPI_Comm cOmm; ///< MoFEM communicator
847  mutable ParallelComm *pComm; ///< MOAB communicator structure
848 
849  int sIze; ///< MoFEM communicator size
850  int rAnk; ///< MOFEM communicator rank
851 
852  /**
853  * @return return communicator
854  */
855  inline MPI_Comm &get_comm() const { return cOmm; }
856 
857  /**
858  * @return return communicator size
859  */
860  inline int get_comm_size() const { return sIze; }
861 
862  /**
863  * @return return communicator rank/processor
864  */
865  inline int get_comm_rank() const { return rAnk; }
866 
867 private:
868  struct WrapMPIComm {
869  WrapMPIComm(MPI_Comm &comm, MPI_Comm &duplicated_comm)
870  : comm(comm), duplicatedComm(duplicated_comm) {
871  ierr = PetscCommDuplicate(comm, &duplicated_comm, NULL);
872  CHKERRABORT(comm, ierr);
873  }
875  ierr = PetscCommDestroy(&duplicatedComm);
876  CHKERRABORT(comm, ierr);
877  }
878 
879  private:
880  MPI_Comm &comm;
881  MPI_Comm &duplicatedComm;
882  };
883  boost::shared_ptr<WrapMPIComm> wrapMPIComm;
884 
885  int verbose; ///< Verbosity level
886 
887  int *fShift; ///< Ptr to tag handle storing last set bit in field ID
888  int *feShift; ///< Ptr to tag handle storing last set bit in finite element ID
889  int *pShift; ///< Ptr to tag handle storing last set bit in problem ID
890 
891  /**
892  * \brief Hash map of pointers to interfaces
893  */
894  mutable boost::ptr_map<unsigned long, UnknownInterface> iFaces;
895 
896  mutable int *buildMoFEM; ///< keeps flags/semaphores for different stages
897  static bool isGloballyInitialised; ///< Core base globally initialized
898 
899  std::string optionsPrefix; ///< Prefix for options on command line
900 
901  PetscBool initaliseAndBuildField; ///< If true build field on database
902  ///< initialisation
903 
904  PetscBool initaliseAndBuildFiniteElements; // If true build finite elements on
905  // database initialisation
906 
907  /**
908  * @brief add problem
909  *
910  * @param id problem id
911  * @param name problem name
912  * @param verb verbosity level
913  * @return MoFEMErrorCode
914  */
915  MoFEMErrorCode addProblem(const BitProblemId id, const std::string &name,
916  int verb = DEFAULT_VERBOSITY);
917 
918  /**
919  * \brief Get tag handles
920  * @param verb verbosity level
921  * @return error code
922  */
924 
925  /**
926  * \brief Cleaning database
927  */
929 
930  /**
931  * @brief Register insterfaces
932  *
933  * @return MoFEMErrorCode
934  */
936 
937  /**
938  * \brief Return unique field Id.
939  *
940  * Each time this function is called, it gives new unit field Id for bit.
941  *
942  */
944 
945  /**
946  * \brief Return unique finite element Id
947  *
948  * Each time this function is called, it gives new unit finite Id for bit.
949  *
950  */
952 
953  /**
954  * \brief Return unique problem Id
955  *
956  * Each time this function is called, it gives new unit problem Id for bit.
957  *
958  */
960 
961  /**
962  * \brief Initialize database getting information on mesh
963  */
965 
966  /**
967  * @brief Get core options from command line
968  *
969  * @return MoFEMErrorCode
970  */
972 
973  /**
974  * @brief Register subinterfac in core interface
975  *
976  * @tparam IFACE
977  * @param uid
978  * @return MoFEMErrorCode
979  */
980  template <class IFACE> MoFEMErrorCode regSubInterface(const MOFEMuuid &uid);
981 };
982 
983 } // namespace MoFEM
984 
985 #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
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:133
structure for User Loop Methods on finite elementsIt can be used to calculate stiffness matrices,...
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:248
WrapMPIComm(MPI_Comm &comm, MPI_Comm &duplicated_comm)
Definition: Core.hpp:869
Tag th_FieldSpace
Definition: Core.hpp:204
MoFEM interface unique ID.
int sIze
MoFEM communicator size.
Definition: Core.hpp:849
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:1195
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition: Core.cpp:576
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:280
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:594
PetscLogEvent MOFEM_EVENT_postProcess
Event for postProcess finite element.
Definition: Core.hpp:837
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:320
boost::shared_ptr< WrapMPIComm > wrapMPIComm
Definition: Core.hpp:883
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:205
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:1234
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:358
MoFEMErrorCode check_number_of_ents_in_ents_finite_element() const
check data consistency in entsFiniteElements
Definition: FECore.cpp:1016
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:522
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
int * fShift
Ptr to tag handle storing last set bit in field ID.
Definition: Core.hpp:887
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:362
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:415
MoFEMErrorCode rebuild_database(int verb=DEFAULT_VERBOSITY)
Clear database and initialize it once again.
Definition: Core.cpp:507
MoFEMErrorCode check_number_of_ents_in_ents_field() const
check data consistency in entitiesPtr
Definition: FieldCore.cpp:1277
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:408
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:85
PetscLogEvent MOFEM_EVENT_operator
Event for evaluating operator of finite element.
Definition: Core.hpp:835
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:1246
MoFEMErrorCode remove_parents_by_ents(const Range &ents, int verb=DEFAULT_VERBOSITY)
Remove parents from entities.
Definition: DeleteCore.cpp:500
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:1230
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:313
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:295
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)
build adjacencies
Definition: FECore.cpp:888
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:517
MoFEMErrorCode clear_inactive_dofs(int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:34
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.
MoFEMErrorCode get_fields(const Field_multiIndex **fields_ptr) const
Get fields multi-index from database.
Definition: Core.cpp:732
BitProblemId getBitProblemId(const std::string &name) const
MoFEMErrorCode list_finite_elements() const
list finite elements in database
Definition: FECore.cpp:329
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:838
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:820
Tag get_th_RefBitEdge() const
Definition: Core.hpp:152
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition: Types.hpp:55
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:106
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:189
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:1158
BitProblemId getProblemShift()
Return unique problem Id.
Definition: Core.cpp:243
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:833
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:477
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:64
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:481
MeshsetsManager & get_meshsets_manager()
get MeshsetsManager pointer
Definition: Core.hpp:303
RowColData
RowColData.
Definition: definitions.h:190
MoFEMErrorCode list_fields() const
list entities in the field
Definition: FieldCore.cpp:1171
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:194
const Field * get_field_structure(const std::string &name)
get field structure
Definition: FieldCore.cpp:51
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:305
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_PRISMs(const Range &prims, const BitFEId id)
MoFEMErrorCode get_ref_finite_elements(const RefElement_multiIndex **refined_finite_elements_ptr) const
Get ref finite elements multi-index form database.
Definition: Core.cpp:744
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:268
MoFEMErrorCode clear_database(int verb=DEFAULT_VERBOSITY)
Clear database.
Definition: Core.cpp:499
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:422
Tag th_FieldId
Definition: Core.hpp:204
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:258
Tag th_RefBitEdge
Definition: Core.hpp:201
MoFEMErrorCode remove_parents_by_by_bit_ref(const BitRefLevel &bit, const BitRefLevel &mask, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:488
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:54
Tag th_ProblemName
Definition: Core.hpp:208
PetscBool initaliseAndBuildField
Definition: Core.hpp:901
std::string getBitFEIdName(const BitFEId id) const
Get field name.
Definition: FECore.cpp:271
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:1226
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:988
Tag th_ProblemGhostNbDofCol
Definition: Core.hpp:211
Tag th_ProblemId
Definition: Core.hpp:208
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:850
Tag th_RefType
Definition: Core.hpp:203
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:91
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:50
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:1222
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:235
MoFEMErrorCode clear_ents_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:115
MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
add finite element
Definition: FECore.cpp:45
BitFEId getFEShift()
Return unique finite element Id.
Definition: Core.cpp:238
bool check_finite_element(const std::string &name) const
Check if finite element is in database.
Definition: FECore.cpp:35
const MeshsetsManager & get_meshsets_manager() const
get MeshsetsManager pointer
Definition: Core.hpp:306
FieldApproximationBase
approximation base
Definition: definitions.h:148
MoFEMErrorCode clear_ents_fields_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:102
Tag th_ProblemGhostNbDofRow
Definition: Core.hpp:210
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
Definition: Core.cpp:551
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:214
int get_comm_rank() const
Definition: Core.hpp:865
MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1140
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
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
boost::function< MoFEMErrorCode(Interface &moab, const Field &field_ptr, const EntFiniteElement &fe_ptr, Range &adjacency)> ElementAdjacencyFunct
user adjacency function
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
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:1128
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:61
Tag th_MoFEMBuild
Definition: Core.hpp:214
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:245
int get_comm_size() const
Definition: Core.hpp:860
int * feShift
Ptr to tag handle storing last set bit in finite element ID.
Definition: Core.hpp:888
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:785
MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_entities_ptr) const
Get ref entities multi-index from database.
Definition: Core.cpp:739
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:297
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:897
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:83
FieldSpace
approximation spaces
Definition: definitions.h:172
Tag th_FEShift
Definition: Core.hpp:212
MoFEMErrorCode get_field_ents(const FieldEntity_multiIndex **field_ents) const
Get field multi index.
Definition: Core.cpp:774
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition: Types.hpp:53
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:174
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:904
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:345
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
int * pShift
Ptr to tag handle storing last set bit in problem ID.
Definition: Core.hpp:889
MoFEMErrorCode buildField(const boost::shared_ptr< Field > &field, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1042
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:156
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:234
MoFEMErrorCode get_problem(const std::string &problem_name, const Problem **problem_ptr) const
Get problem database (data structure)
Definition: Core.cpp:751
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 get_problems(const Problem_multiIndex **problems_ptr) const
Get pointer to problems multi-index.
Definition: Core.cpp:767
MoFEMErrorCode clear_finite_elements(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:293
MoFEMErrorCode set_field_order(const Range &ents, const BitFieldId id, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:397
BitFieldId getBitFieldId(const std::string &name) const
Definition: FieldCore.cpp:21
MoFEMErrorCode remove_parents_by_parents(const Range &ents, int verb=DEFAULT_VERBOSITY)
Remove paremts from entities having parents in passed range.
Definition: DeleteCore.cpp:524
MoFEMErrorCode get_dofs(const DofEntity_multiIndex **dofs_ptr) const
Get dofs multi index.
Definition: Core.cpp:779
Tag th_ProblemShift
Definition: Core.hpp:212
ParallelComm * pComm
MOAB communicator structure.
Definition: Core.hpp:847
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:929
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:153
int FieldCoefficientsNumber
Number of field coefficients.
Definition: Types.hpp:38
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:462
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:112
int verbose
Verbosity level.
Definition: Core.hpp:885
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:334
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:819
Tag th_FEId
Definition: Core.hpp:206
MoFEMErrorCode get_finite_elements(const FiniteElement_multiIndex **fe_ptr) const
Get finite elements multi-index.
Definition: FECore.cpp:22
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:1218
boost::ptr_map< unsigned long, UnknownInterface > iFaces
Hash map of pointers to interfaces.
Definition: Core.hpp:894
EntityHandle get_field_meshset(const BitFieldId id) const
Definition: FieldCore.cpp:31
MoFEMErrorCode buildFiniteElements(const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
Definition: FECore.cpp:581
Tag get_th_RefType() const
Definition: Core.hpp:153
std::string optionsPrefix
Prefix for options on command line.
Definition: Core.hpp:899
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:541
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:193
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
MoFEMErrorCode get_ents_finite_elements(const EntFiniteElement_multiIndex **fe_ent_ptr) const
Get entities finite elements multi-index.
Definition: FECore.cpp:28
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 list_adjacencies() const
list adjacencies
Definition: FieldCore.cpp:1183
MoFEMErrorCode remove_ents(const Range ents, int verb=DEFAULT_VERBOSITY)
remove entities form mofem database
Definition: DeleteCore.cpp:451
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:1252
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:790
Tag th_FEIdData
Definition: Core.hpp:207
MPI_Comm & get_comm() const
Definition: Core.hpp:855
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:1240
bool check_field(const std::string &name) const
check if field is in database
Definition: FieldCore.cpp:43
MoFEMErrorCode clear_finite_elements_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:281
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:881
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:401
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:318
DEPRECATED IFace * query_interface() const
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
Definition: definitions.h:187
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:440
BitFieldId getFieldShift()
Return unique field Id.
Definition: Core.cpp:226
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:74
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:61
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:983
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:435
bool check_problem(const std::string name)
check if problem exist