v0.14.0
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
MoFEM::CoreTmp< 0 > Struct Reference

Core (interface) class. More...

#include <src/interfaces/Core.hpp>

Inheritance diagram for MoFEM::CoreTmp< 0 >:
[legend]
Collaboration diagram for MoFEM::CoreTmp< 0 >:
[legend]

Public Member Functions

const int getValue () const
 Get the core. More...
 
RefEntityTmp< 0 > getRefEntity (const EntityHandle ent)
 
virtual boost::shared_ptr< RefEntityTmp< 0 > > make_shared_ref_entity (const EntityHandle ent)
 Get RefEntity. More...
 
 CoreTmp (moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
 
 ~CoreTmp ()
 
- Public Member Functions inherited from MoFEM::DeprecatedCoreInterface
virtual DEPRECATED MoFEMErrorCode seed_ref_level_2D (const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
 seed 2D entities (Triangles entities only) in the meshset and their adjacencies (only TRIs adjacencies) in a particular BitRefLevel More...
 
DEPRECATED MoFEMErrorCode seed_ref_level_3D (const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
 seed 2D entities in the meshset and their adjacencies (only TETs adjacencies) in a particular BitRefLevel More...
 
DEPRECATED MoFEMErrorCode seed_ref_level (const Range &ents, const BitRefLevel &bit, const bool only_tets=true, int verb=-1)
 seed entities in the range and their adjacencies in a particular BitRefLevel More...
 
DEPRECATED MoFEMErrorCode partition_mesh (const Range &ents, const int dim, const int adj_dim, const int n_parts, int verb=-1)
 Set partition tag to each finite element in the problem. More...
 
DEPRECATED MoFEMErrorCode synchronise_entities (Range &ent, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode synchronise_field_entities (const std::string &name, int verb=DEFAULT_VERBOSITY)
 
- Public Member Functions inherited from MoFEM::CoreInterface
virtual ~CoreInterface ()=default
 
virtual MoFEMErrorCode add_broken_field (const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const std::vector< std::pair< EntityType, std::function< MoFEMErrorCode(BaseFunction::DofsSideMap &)>> > list_dof_side_map, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
 Add field. More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 

Static Public Attributes

static constexpr int value = 0
 

Protected Member Functions

template<int V>
 CoreTmp (moab::Interface &moab, MPI_Comm comm, const int verbose, CoreValue< V >)
 
MoFEMErrorCode coreGenericConstructor (moab::Interface &moab, MPI_Comm comm, const int verbose)
 
MoFEMErrorCode addProblem (const BitProblemId id, const std::string &name, int verb=DEFAULT_VERBOSITY)
 add problem More...
 
MoFEMErrorCode getTags (int verb=DEFAULT_VERBOSITY)
 Get tag handles. More...
 
MoFEMErrorCode clearMap ()
 Cleaning database. More...
 
MoFEMErrorCode registerSubInterfaces ()
 Register insterfaces. More...
 
BitProblemId getProblemShift ()
 Return unique problem Id. More...
 
MoFEMErrorCode initialiseDatabaseFromMesh (int verb=DEFAULT_VERBOSITY)
 Initialize database getting information on mesh. More...
 
MoFEMErrorCode getOptions (int verb=DEFAULT_VERBOSITY)
 Get core options from command line. More...
 
template<class IFACE >
MoFEMErrorCode regSubInterface ()
 Register sub-interfaces in core interface. More...
 
template<class IFACE >
MoFEMErrorCode regEvents ()
 Register petsc events. More...
 

Protected Attributes

boost::shared_ptr< WrapMPICommwrapMPIMOABComm
 manage creation and destruction of MOAB communicator More...
 
int verbose
 Verbosity level. More...
 
boost::ptr_map< boost::typeindex::type_index, UnknownInterfaceiFaces
 Hash map of pointers to interfaces. More...
 
int * buildMoFEM
 keeps flags/semaphores for different stages More...
 
std::string optionsPrefix
 Prefix for options on command line. More...
 
PetscBool initaliseAndBuildField
 
PetscBool initaliseAndBuildFiniteElements
 

Static Protected Attributes

static bool isGloballyInitialised = false
 Core base globally initialized. More...
 
static int mpiInitialised
 mpi was initialised by other agent More...
 
static PetscBool isInitialized
 petsc was initialised by other agent More...
 

Global initialisation and finalisation


static MoFEMErrorCode Initialize (int *argc, char ***args, const char file[], const char help[])
 Initializes the MoFEM database PETSc, MOAB and MPI. More...
 
static MoFEMErrorCode Finalize ()
 Checks for options to be called at the conclusion of the program. More...
 

Static functions

static void setRefEntBasicDataPtr (MoFEM::Interface &m_field, boost::shared_ptr< BasicEntityData > &ptr)
 
static boost::shared_ptr< RefEntityTmp< 0 > > makeSharedRefEntity (MoFEM::Interface &m_field, const EntityHandle ent)
 

Assessing interfaces

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Getting interface of core database. More...
 

Get tag handles to data on the mesh

Tag get_th_RefParentHandle () const
 
Tag get_th_RefBitLevel () const
 
Tag get_th_RefBitEdge () const
 

Auxiliary data and functions

enum  SemaphoresBuildMofem {
  BUILD_FIELD = 1 << 0, BUILD_FE = 1 << 1, BUILD_ADJ = 1 << 2, BUILD_PROBLEM = 1 << 3,
  PARTITION_PROBLEM = 1 << 4, PARTITION_FE = 1 << 5, PARTITION_GHOST_DOFS = 1 << 6, PARTITION_MESH = 1 << 7
}
 
int & getBuildMoFEM () const
 Get flags/semaphores for different stages. More...
 
MoFEMErrorCode addPrismToDatabase (const EntityHandle prism, int verb=DEFAULT_VERBOSITY)
 add prim element More...
 

Tags to data on mesh and entities

Tag th_Part
 Tag for partition number. More...
 
Tag th_RefParentHandle
 
Tag th_RefBitLevel
 
Tag th_RefBitLevel_Mask
 
Tag th_RefBitEdge
 
Tag th_RefFEMeshset
 
Tag th_FieldId
 
Tag th_FieldName
 
Tag th_FieldName_DataNamePrefix
 
Tag th_FieldSpace
 
Tag th_FieldContinuity
 
Tag th_FieldBase
 
Tag th_FEId
 
Tag th_FEName
 
Tag th_FEIdCol
 
Tag th_FEIdRow
 
Tag th_FEIdData
 
Tag th_ProblemId
 
Tag th_ProblemName
 
Tag th_ProblemFEId
 
Tag th_ProblemNbDofsRow
 
Tag th_ProblemNbDofsCol
 
Tag th_ProblemLocalNbDofRow
 
Tag th_ProblemGhostNbDofRow
 
Tag th_ProblemLocalNbDofCol
 
Tag th_ProblemGhostNbDofCol
 
Tag th_ProblemShift
 
Tag th_ElemType
 Needed for VTK files. More...
 
Tag th_MoFEMBuild
 
boost::shared_ptr< BasicEntityDatabasicEntityDataPtr
 
boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr ()
 Get pointer to basic entity data. More...
 

Multi-Indices accessing data on the mesh

RefEntity_multiIndex refinedEntities
 refined entities More...
 
RefElement_multiIndex refinedFiniteElements
 refined elements More...
 
Field_multiIndex fIelds
 fields More...
 
FieldEntity_multiIndex entsFields
 entities on fields More...
 
DofEntity_multiIndex dofsField
 dofs on fields More...
 
FiniteElement_multiIndex finiteElements
 finite elements More...
 
EntFiniteElement_multiIndex entsFiniteElements
 finite element entities More...
 
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
 adjacencies of elements to dofs More...
 
Problem_multiIndex pRoblems
 problems multi-index More...
 

Get moab database

std::reference_wrapper< moab::Interface > moab
 moab database More...
 
moab::Interface & get_moab ()
 
const moab::Interface & get_moab () const
 
MoFEMErrorCode set_moab_interface (moab::Interface &new_moab, int verb=VERBOSE)
 Set the moab interface object. More...
 
MoFEMErrorCode setMoabInterface (moab::Interface &new_moab, int verb=VERBOSE)
 

Check database consistency

MoFEMErrorCode check_number_of_ents_in_ents_field (const std::string &name) const
 check data consistency in entitiesPtr More...
 
MoFEMErrorCode check_number_of_ents_in_ents_field () const
 check data consistency in entitiesPtr More...
 
MoFEMErrorCode check_number_of_ents_in_ents_finite_element (const std::string &name) const
 check data consistency in entsFiniteElements More...
 
MoFEMErrorCode check_number_of_ents_in_ents_finite_element () const
 check data consistency in entsFiniteElements More...
 

Clear database

MoFEMErrorCode clear_database (int verb=DEFAULT_VERBOSITY)
 Clear database. More...
 
MoFEMErrorCode rebuild_database (int verb=DEFAULT_VERBOSITY)
 Clear database and initialize it once again. More...
 

Getting access to meshset manager

MeshsetsManagerget_meshsets_manager_ptr ()
 get MeshsetsManager pointer More...
 
const MeshsetsManagerget_meshsets_manager_ptr () const
 get MeshsetsManager pointer More...
 
MeshsetsManagerget_meshsets_manager ()
 get MeshsetsManager pointer More...
 
const MeshsetsManagerget_meshsets_manager () const
 get MeshsetsManager pointer More...
 

Remove and delete entities

MoFEMErrorCode remove_parents_by_ents (const Range &ents, int verb=DEFAULT_VERBOSITY)
 Remove parents from entities. More...
 
MoFEMErrorCode remove_parents_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 Remove parent from entities on bit level. More...
 
MoFEMErrorCode remove_parents_by_parents (const Range &ents, int verb=DEFAULT_VERBOSITY)
 Remove paremts from entities having parents in passed range. More...
 
MoFEMErrorCode remove_ents (const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities form mofem database More...
 
MoFEMErrorCode remove_ents_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 remove entities form mofem database More...
 
MoFEMErrorCode delete_ents_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, const bool remove_parent=false, int verb=DEFAULT_VERBOSITY, MoFEMTypes mf=MF_ZERO)
 delete entities form mofem and moab database More...
 

Fields

virtual MoFEMErrorCode add_broken_field (const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, std::vector< std::pair< EntityType, std::function< MoFEMErrorCode(BaseFunction::DofsSideMap &)> >> list_dof_side_map, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 Add field. More...
 
virtual 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 field. More...
 
MoFEMErrorCode delete_field (const std::string name, int verb=DEFAULT_VERBOSITY)
 Delete field. More...
 
MoFEMErrorCode addField (const std::string &name, const FieldSpace space, const FieldContinuity continuity, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type, const enum MoFEMTypes bh, int verb)
 Template for add_field. More...
 
MoFEMErrorCode addEntsToFieldByDim (const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
 
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. More...
 
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. More...
 
MoFEMErrorCode add_ents_to_field_by_dim (const EntityHandle meshset, const int dim, const std::string &name, const bool recursive=true, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. More...
 
MoFEMErrorCode add_ents_to_field_by_type (const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. More...
 
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. More...
 

Set approximation order

MoFEMErrorCode setFieldOrder (const Range &ents, const BitFieldId id, const ApproximationOrder order, int ver)
 
MoFEMErrorCode setFieldOrderImpl (boost::shared_ptr< Field > field_ptr, const Range &ents, const ApproximationOrder order, int verb)
 
MoFEMErrorCode set_field_order (const Range &ents, const BitFieldId id, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode set_field_order (const EntityHandle meshset, const EntityType type, const BitFieldId id, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode set_field_order (const Range &ents, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
 Set order approximation of the entities in the field. More...
 
MoFEMErrorCode set_field_order (const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
 Set order approximation of the entities in the field. More...
 
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)
 
MoFEMErrorCode set_field_order_by_entity_type_and_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
 Set order approximation of the entities in the field. More...
 

Build fields

MoFEMErrorCode buildFieldForNoFieldImpl (boost::shared_ptr< Field > field_ptr, std::map< EntityType, int > &dof_counter, int verb)
 
MoFEMErrorCode buildFieldForNoField (const BitFieldId id, std::map< EntityType, int > &dof_counter, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode buildFieldForL2H1HcurlHdiv (const BitFieldId id, std::map< EntityType, int > &dof_counter, std::map< EntityType, int > &inactive_dof_counter, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode buildField (const boost::shared_ptr< Field > &field, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode build_fields (int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode build_field (const std::string field_name, int verb=DEFAULT_VERBOSITY)
 build field by name More...
 

Clear DOFs

MoFEMErrorCode clear_inactive_dofs (int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_dofs_fields_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_dofs_fields (const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_dofs_fields (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 

Clear ENTs

MoFEMErrorCode clear_ents_fields_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_ents_fields (const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_ents_fields (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 

Remove field entities

MoFEMErrorCode remove_ents_from_field_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 remove entities from field More...
 
MoFEMErrorCode remove_ents_from_field (const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
 remove entities from field More...
 
MoFEMErrorCode remove_ents_from_field (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from field More...
 
MoFEMErrorCode remove_ents_from_field (const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from all fields More...
 

Other auxiliary functions for fields

MoFEMErrorCode list_dofs_by_field_name (const std::string &name) const
 
MoFEMErrorCode list_fields () const
 list entities in the field More...
 
BitFieldId get_field_id (const std::string &name) const
 Get field Id. More...
 
FieldBitNumber get_field_bit_number (const std::string name) const
 get field bit number More...
 
std::string get_field_name (const BitFieldId id) const
 get field name from id More...
 
EntityHandle get_field_meshset (const BitFieldId id) const
 
EntityHandle get_field_meshset (const std::string name) const
 get field meshset More...
 
MoFEMErrorCode get_field_entities_by_dimension (const std::string name, int dim, Range &ents) const
 get entities in the field by dimension More...
 
MoFEMErrorCode get_field_entities_by_type (const std::string name, EntityType type, Range &ents) const
 get entities in the field by type More...
 
MoFEMErrorCode get_field_entities_by_handle (const std::string name, Range &ents) const
 get entities in the field by handle More...
 
bool check_field (const std::string &name) const
 check if field is in database More...
 
const Fieldget_field_structure (const std::string &name, enum MoFEMTypes bh=MF_EXIST) const
 get field structure More...
 

Finite elements

const FiniteElementget_finite_element_structure (const std::string &name, enum MoFEMTypes bh=MF_EXCL) const
 get finite element struture More...
 
bool check_finite_element (const std::string &name) const
 Check if finite element is in database. More...
 
MoFEMErrorCode add_finite_element (const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 add finite element More...
 
MoFEMErrorCode modify_finite_element_adjacency_table (const std::string &fe_name, const EntityType type, ElementAdjacencyFunct function)
 modify finite element table, only for advanced user More...
 
MoFEMErrorCode modify_finite_element_add_field_data (const std::string &fe_name, const std::string name_filed)
 set finite element field data More...
 
MoFEMErrorCode modify_finite_element_add_field_row (const std::string &fe_name, const std::string name_row)
 set field row which finite element use More...
 
MoFEMErrorCode modify_finite_element_add_field_col (const std::string &fe_name, const std::string name_col)
 set field col which finite element use More...
 
MoFEMErrorCode modify_finite_element_off_field_data (const std::string &fe_name, const std::string name_filed)
 unset finite element field data More...
 
MoFEMErrorCode modify_finite_element_off_field_row (const std::string &fe_name, const std::string name_row)
 unset field row which finite element use More...
 
MoFEMErrorCode modify_finite_element_off_field_col (const std::string &fe_name, const std::string name_col)
 unset field col which finite element use More...
 
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 More...
 
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 More...
 
MoFEMErrorCode add_ents_to_finite_element_by_type (const Range &ents, const EntityType type, const std::string &name)
 add entities to finite elements More...
 
MoFEMErrorCode add_ents_to_finite_element_by_dim (const Range &ents, const int dim, const std::string &name)
 add entities to finite elements More...
 
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 More...
 
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 More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_EntType_by_bit_ref (const BitRefLevel &bit, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_EntType_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
 
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 More...
 
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 More...
 
MoFEMErrorCode remove_ents_from_finite_element (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from finite element database More...
 
MoFEMErrorCode remove_ents_from_finite_element (const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from finite elements in database More...
 
MoFEMErrorCode delete_finite_element (const std::string name, int verb=DEFAULT_VERBOSITY)
 delete finite element from mofem database More...
 
BitFEId getBitFEId (const std::string &fe_name) const
 Get field Id. More...
 
std::string getBitFEIdName (const BitFEId id) const
 Get field name. More...
 
EntityHandle get_finite_element_meshset (const BitFEId id) const
 
EntityHandle get_finite_element_meshset (const std::string name) const
 
MoFEMErrorCode get_finite_element_entities_by_dimension (const std::string name, int dim, Range &ents) const
 get entities in the finite element by dimension More...
 
MoFEMErrorCode get_finite_element_entities_by_type (const std::string name, EntityType type, Range &ents) const
 get entities in the finite element by type More...
 
MoFEMErrorCode get_finite_element_entities_by_handle (const std::string name, Range &ents) const
 get entities in the finite element by handle More...
 
MoFEMErrorCode list_finite_elements () const
 list finite elements in database More...
 

Problems

MoFEMErrorCode add_problem (const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 Add problem. More...
 
bool check_problem (const std::string name)
 check if problem exist More...
 
MoFEMErrorCode delete_problem (const std::string name)
 Delete problem. More...
 
MoFEMErrorCode modify_problem_add_finite_element (const std::string name_problem, const std::string &fe_name)
 add finite element to problem, this add entities assigned to finite element to a particular problem More...
 
MoFEMErrorCode modify_problem_unset_finite_element (const std::string name_problem, const std::string &fe_name)
 unset finite element from problem, this remove entities assigned to finite element to a particular problem More...
 
MoFEMErrorCode modify_problem_ref_level_add_bit (const std::string &name_problem, const BitRefLevel &bit)
 add ref level to problem More...
 
MoFEMErrorCode modify_problem_ref_level_set_bit (const std::string &name_problem, const BitRefLevel &bit)
 set ref level for problem More...
 
MoFEMErrorCode modify_problem_mask_ref_level_add_bit (const std::string &name_problem, const BitRefLevel &bit)
 set dof mask ref level for problem More...
 
MoFEMErrorCode modify_problem_mask_ref_level_set_bit (const std::string &name_problem, const BitRefLevel &bit)
 set dof mask ref level for problem More...
 
BitProblemId getBitProblemId (const std::string &name) const
 
MoFEMErrorCode list_problem () const
 list problems More...
 
MoFEMErrorCode clear_problem (const std::string name, int verb=DEFAULT_VERBOSITY)
 clear problem More...
 
MoFEMErrorCode clear_problems (int verb=DEFAULT_VERBOSITY)
 clear problems More...
 
MoFEMErrorCode build_finite_elements (int verb=DEFAULT_VERBOSITY)
 Build finite elements. More...
 
MoFEMErrorCode build_finite_elements (const BitRefLevel &bit, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode build_finite_elements (const string fe_name, const Range *const ents_ptr=nullptr, int verb=DEFAULT_VERBOSITY)
 Build finite elements. More...
 
MoFEMErrorCode buildFiniteElements (const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_finite_elements_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_finite_elements (const Range &ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_finite_elements (const std::string &fe_name, const Range &ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode get_problem_finite_elements_entities (const std::string name, const std::string &fe_name, const EntityHandle meshset)
 add finite elements to the meshset More...
 
DEPRECATED MoFEMErrorCode build_problem_on_distributed_mesh (int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode build_problems (int verb=DEFAULT_VERBOSITY)
 

Adjacencies

MoFEMErrorCode build_adjacencies (const Range &ents, int verb=DEFAULT_VERBOSITY)
 build adjacencies More...
 
MoFEMErrorCode build_adjacencies (const BitRefLevel &bit, int verb=DEFAULT_VERBOSITY)
 build adjacencies More...
 
MoFEMErrorCode build_adjacencies (const BitRefLevel &bit, const BitRefLevel &mask, int verb=DEFAULT_VERBOSITY)
 build adjacencies More...
 
MoFEMErrorCode clear_adjacencies_entities (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 clear adjacency map for entities on given bit level More...
 
MoFEMErrorCode clear_adjacencies_entities (const Range ents, int verb=DEFAULT_VERBOSITY)
 clear adjacencies for field entities by entities More...
 
MoFEMErrorCode clear_adjacencies_entities (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 clear adjacencies for field entities by entities and field namd More...
 
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 More...
 
MoFEMErrorCode clear_adjacencies_finite_elements (const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_adjacencies_finite_elements (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 

Methods for preforming operations on elements

MoFEMErrorCode problem_basic_method_preProcess (const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethod. More...
 
MoFEMErrorCode problem_basic_method_preProcess (const std::string &problem_name, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethod. More...
 
MoFEMErrorCode problem_basic_method_postProcess (const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethod. More...
 
MoFEMErrorCode problem_basic_method_postProcess (const std::string &problem_name, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethod. More...
 
MoFEMErrorCode cache_problem_entities (const std::string prb_name, CacheTupleWeakPtr cache_ptr)
 Cache variables. More...
 
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, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)
 Make a loop over finite elements on partitions from upper to lower rank. More...
 
MoFEMErrorCode loop_finite_elements (const std::string problem_name, 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, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)
 Make a loop over finite elements on partitions from upper to lower rank. More...
 
MoFEMErrorCode loop_finite_elements (const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)
 Make a loop over finite elements. More...
 
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. More...
 
MoFEMErrorCode loop_dofs (const std::string &problem_name, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs. More...
 
MoFEMErrorCode loop_dofs (const std::string &problem_name, const std::string &field_name, RowColData rc, DofMethod &method, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs. More...
 
MoFEMErrorCode loop_dofs (const std::string &field_name, DofMethod &method, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs. More...
 
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. More...
 
MoFEMErrorCode loop_entities (const std::string problem_name, 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. More...
 
MoFEMErrorCode loop_entities (const std::string problem_name, const std::string field_name, RowColData rc, EntityMethod &method, int verb=DEFAULT_VERBOSITY)
 Loop over field entities in the problem. More...
 
MoFEMErrorCode loop_entities (const std::string field_name, EntityMethod &method, Range const *const ents=nullptr, int verb=DEFAULT_VERBOSITY)
 Loop over field entities. More...
 

Accessing multi-indices

MoFEMErrorCode get_fields (const Field_multiIndex **fields_ptr) const
 Get fields multi-index from database. More...
 
MoFEMErrorCode get_ref_ents (const RefEntity_multiIndex **refined_entities_ptr) const
 Get ref entities multi-index from database. More...
 
MoFEMErrorCode get_ref_finite_elements (const RefElement_multiIndex **refined_finite_elements_ptr) const
 Get ref finite elements multi-index form database. More...
 
MoFEMErrorCode get_finite_elements (const FiniteElement_multiIndex **fe_ptr) const
 Get finite elements multi-index. More...
 
MoFEMErrorCode get_ents_finite_elements (const EntFiniteElement_multiIndex **fe_ent_ptr) const
 Get entities finite elements multi-index. More...
 
MoFEMErrorCode get_field_ents (const FieldEntity_multiIndex **field_ents) const
 Get field multi index. More...
 
MoFEMErrorCode get_dofs (const DofEntity_multiIndex **dofs_ptr) const
 Get dofs multi index. More...
 
MoFEMErrorCode get_problem (const std::string &problem_name, const Problem **problem_ptr) const
 Get problem database (data structure) More...
 
MoFEMErrorCode get_problems (const Problem_multiIndex **problems_ptr) const
 Get pointer to problems multi-index. More...
 
MoFEMErrorCode get_ents_elements_adjacency (const FieldEntityEntFiniteElementAdjacencyMap_multiIndex **dofs_elements_adjacency) const
 Get the dofs elements adjacency object. More...
 
const Field_multiIndexget_fields () const
 Get the fields object. More...
 
const RefEntity_multiIndexget_ref_ents () const
 Get the ref ents object. More...
 
const RefElement_multiIndexget_ref_finite_elements () const
 Get the ref finite elements object. More...
 
const FiniteElement_multiIndexget_finite_elements () const
 Get the finite elements object. More...
 
const EntFiniteElement_multiIndexget_ents_finite_elements () const
 Get the ents finite elements object. More...
 
const FieldEntity_multiIndexget_field_ents () const
 Get the field ents object. More...
 
const DofEntity_multiIndexget_dofs () const
 Get the dofs object. More...
 
const Problemget_problem (const std::string problem_name) const
 Get the problem object. More...
 
const Problem_multiIndexget_problems () const
 Get the problems object. More...
 
const FieldEntityEntFiniteElementAdjacencyMap_multiIndexget_ents_elements_adjacency () const
 Get the dofs elements adjacency object. More...
 
FieldEntityByUId::iterator get_ent_field_by_name_begin (const std::string &field_name) const
 get begin iterator of field ents of given name (instead you can use IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) More...
 
FieldEntityByUId::iterator get_ent_field_by_name_end (const std::string &field_name) const
 get begin iterator of field dofs of given name (instead you can use IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) More...
 
DofEntityByUId::iterator get_dofs_by_name_begin (const std::string &field_name) const
 get begin iterator of field dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) More...
 
DofEntityByUId::iterator get_dofs_by_name_end (const std::string &field_name) const
 get begin iterator of field dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) More...
 
DofEntityByUId::iterator get_dofs_by_name_and_ent_begin (const std::string &field_name, const EntityHandle ent) const
 get begin iterator of field dofs of given name and ent(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,ENT,IT) More...
 
DofEntityByUId::iterator get_dofs_by_name_and_ent_end (const std::string &field_name, const EntityHandle ent) const
 get begin iterator of field dofs of given name and ent (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,ENT,IT) More...
 
DofEntityByUId::iterator get_dofs_by_name_and_type_begin (const std::string &field_name, const EntityType type) const
 get begin iterator of field dofs of given name and ent type (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT) More...
 
DofEntityByUId::iterator get_dofs_by_name_and_type_end (const std::string &field_name, const EntityType ent) const
 get begin iterator of field dofs of given name end ent type(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT) More...
 
EntFiniteElement_multiIndex::index< Unique_mi_tag >::type::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(MFIELD,NAME,IT) More...
 
EntFiniteElement_multiIndex::index< Unique_mi_tag >::type::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(MFIELD,NAME,IT) More...
 

Log events

PetscLogEvent MOFEM_EVENT_preProcess
 Event for preProcess finite element. More...
 
PetscLogEvent MOFEM_EVENT_operator
 Event for evaluating operator of finite element. More...
 
PetscLogEvent MOFEM_EVENT_postProcess
 Event for postProcess finite element. More...
 
PetscLogEvent MOFEM_EVENT_createMat
 

Communicator

MPI_Comm mofemComm
 MoFEM communicator. More...
 
ParallelComm * pComm
 MOAB communicator structure. More...
 
int sIze
 MoFEM communicator size. More...
 
int rAnk
 MOFEM communicator rank. More...
 
MPI_Comm & get_comm () const
 
int get_comm_size () const
 
int get_comm_rank () const
 

Additional Inherited Members

- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 

Detailed Description

Core (interface) class.

This is the implementation of abstract MoFEM::Interface class. Similarly to the convention used in MoAB, we use small letters to name function of purely abstract classes. This is an exception used only here. For more details about naming functions see Coding practice

This class is not used directly by the user. For internal use only. It is database with basic functions to access data. Abstraction of this is MoFEM Interface structure.

Such deign to hide complexities for users and allow low development without interfering with users modules programmer work.

Todo:
Implement static functions for Initialization and Finalization of MoFEM. Those functions should keep all static variables and initialize/finalize other libs like PETSc. Moreover initialization functions should set error handlers, etc.
Examples
add_blockset.cpp, add_cubit_meshsets.cpp, adolc_plasticity.cpp, analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, approx_sphere.cpp, bernstein_bezier_generate_base.cpp, bone_adaptation.cpp, boundary_marker.cpp, build_large_problem.cpp, build_problems.cpp, cell_forces.cpp, child_and_parent.cpp, continuity_check_on_contact_prism_side_ele.cpp, continuity_check_on_skeleton_3d.cpp, continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, cubit_bc_test.cpp, delete_ho_nodes.cpp, dg_projection.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, dynamic_first_order_con_law.cpp, edge_and_bubble_shape_functions_on_quad.cpp, eigen_elastic.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, ep.cpp, field_evaluator.cpp, field_to_vertices.cpp, forces_and_sources_testing_edge_element.cpp, forces_and_sources_testing_flat_prism_element.cpp, forces_and_sources_testing_users_base.cpp, free_surface.cpp, gauss_points_on_outer_product.cpp, hanging_node_approx.cpp, hcurl_check_approx_in_2d.cpp, hcurl_curl_operator.cpp, hcurl_divergence_operator_2d.cpp, hdiv_check_approx_in_3d.cpp, hdiv_divergence_operator.cpp, heat_equation.cpp, heat_method.cpp, hello_world.cpp, helmholtz.cpp, hertz_surface.cpp, higher_derivatives.cpp, level_set.cpp, log.cpp, loop_entities.cpp, lorentz_force.cpp, magnetostatic.cpp, mesh_cut.cpp, mesh_insert_interface_atom.cpp, mesh_smoothing.cpp, meshset_to_vtk.cpp, minimal_surface_area.cpp, mixed_poisson.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, node_merge.cpp, nonlinear_dynamics.cpp, nonlinear_elastic.cpp, operators_tests.cpp, partition_mesh.cpp, phase.cpp, photon_diffusion.cpp, plastic.cpp, plate.cpp, plot_base.cpp, poisson_2d_dis_galerkin.cpp, poisson_2d_homogeneous.cpp, prism_elements_from_surface.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, reaction_diffusion.cpp, remove_entities_from_problem.cpp, remove_entities_from_problem_not_partitioned.cpp, scalar_check_approximation.cpp, schur_test_diag_mat.cpp, seepage.cpp, shallow_wave.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, simple_interface.cpp, simple_l2_only.cpp, split_sideset.cpp, tensor_divergence_operator.cpp, test_broken_space.cpp, test_cache_on_entities.cpp, test_jacobian_of_simple_contact_element.cpp, testing_jacobian_of_hook_element.cpp, testing_jacobian_of_hook_scaled_with_density_element.cpp, thermo_elastic.cpp, unsaturated_transport.cpp, wave_equation.cpp, and wavy_surface.cpp.

Definition at line 82 of file Core.hpp.

Member Enumeration Documentation

◆ SemaphoresBuildMofem

Is used to check consistency. I n future properly this will be removed and replaced by other solution. It is only for internal use.

Enumerator
BUILD_FIELD 
BUILD_FE 
BUILD_ADJ 
BUILD_PROBLEM 
PARTITION_PROBLEM 
PARTITION_FE 
PARTITION_GHOST_DOFS 
PARTITION_MESH 

Definition at line 211 of file Core.hpp.

211  {
212  BUILD_FIELD = 1 << 0,
213  BUILD_FE = 1 << 1,
214  BUILD_ADJ = 1 << 2,
215  BUILD_PROBLEM = 1 << 3,
216  PARTITION_PROBLEM = 1 << 4,
217  PARTITION_FE = 1 << 5,
218  PARTITION_GHOST_DOFS = 1 << 6,
219  PARTITION_MESH = 1 << 7
220  };

Constructor & Destructor Documentation

◆ CoreTmp() [1/2]

MoFEM::Core::CoreTmp ( moab::Interface &  moab,
MPI_Comm  comm = PETSC_COMM_WORLD,
const int  verbose = VERBOSE 
)

Construct core database

Parameters
moabMoAB interface
commMPI communicator
verboseVerbosity level

Definition at line 235 of file Core.cpp.

240  : CoreTmp(moab, comm, verbose, CoreValue<0>()) {
241 
242  // Register sub-interfaces
243  ierr = this->registerSubInterfaces();
244  CHKERRABORT(comm, ierr);
245  ierr = this->clearMap();
246  CHKERRABORT(comm, ierr);
247  ierr = this->getTags();
248  CHKERRABORT(comm, ierr);
249  ierr = this->getOptions(verbose);
250  CHKERRABORT(comm, ierr);
251 
252  this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
254 
256  CHKERRABORT(comm, ierr);
257 }

◆ ~CoreTmp()

MoFEM::Core::~CoreTmp ( )

Definition at line 283 of file Core.cpp.

283  {
284  PetscBool is_finalized;
285  PetscFinalized(&is_finalized);
286  // Destroy interfaces
287  iFaces.clear();
288  // This is deprecated ONE should use MoFEM::Core::Initialize
289  if (isGloballyInitialised && is_finalized) {
290  isGloballyInitialised = false;
291  }
292 }

◆ CoreTmp() [2/2]

template<int V>
MoFEM::CoreTmp< 0 >::CoreTmp ( moab::Interface &  moab,
MPI_Comm  comm,
const int  verbose,
CoreValue< V >   
)
protected

Construct core database

Parameters
moabMoAB interface
commMPI communicator

Definition at line 32 of file CoreTemplates.hpp.

34  : moab(moab), mofemComm(comm), verbose(verbose),
35  initaliseAndBuildField(PETSC_FALSE),
36  initaliseAndBuildFiniteElements(PETSC_FALSE) {
37 
39  CHKERRABORT(comm, ierr);
40 
41  MOFEM_LOG_CHANNEL("WORLD");
42  if (verbose > QUIET) {
43  MOFEM_LOG_C("WORLD", Sev::verbose, "Core number < %d >", V);
44  }
45 }

Member Function Documentation

◆ add_broken_field()

MoFEMErrorCode MoFEM::Core::add_broken_field ( const std::string  name,
const FieldSpace  space,
const FieldApproximationBase  base,
const FieldCoefficientsNumber  nb_coefficients,
std::vector< std::pair< EntityType, std::function< MoFEMErrorCode(BaseFunction::DofsSideMap &)> >>  list_dof_side_map,
const TagType  tag_type = MB_TAG_SPARSE,
const enum MoFEMTypes  bh = MF_EXCL,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Add field.

Parameters
nameField name
spaceSpace L2,H1,Hdiv,Hcurl
continuityField continuity (you can set broken space)
baseApproximation base AINSWORTH_LEGENDRE_BASE, AINSWORTH_BERNSTEIN_BEZIER_BASE ...
nb_coefficientsNumber of field coefficients @param type_dof_side_map Map of entity type to function returning DofsSideMap
tag_typeTag type, MB_TAG_DENSE or MB_TAG_SPARSE (default)
bhControl behavior, if MF_EXCL throws error if exist
verbVerbosity level
Returns
Return error code

TODO:

Todo:
MB_TAG_DENSE will not work properly in general case. It is need to separate field tags for each entity separately. That will allow for HO orders but homogenous approx. order on each entity. Need some discussion what is optimal solution. MB_TAG_SPARSE gives flexibility, but it not memory efficient. MB_TAG_DENSE uses memory more efficient and in principle allow for better efficiency if properly utilized.

FIXME:

Bug:
Need to resolve problem of dense tags at this stage of development will make only problems

Definition at line 284 of file FieldCore.cpp.

297  {
299  CHKERR this->addField(name, space, DISCONTINUOUS, base, nb_of_coefficients,
300  tag_type, bh, verb);
301 
302  auto fit = fIelds.get<FieldName_mi_tag>().find(name);
303  if (fit == fIelds.get<FieldName_mi_tag>().end())
304  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
305  "field <%s> not in database", name.c_str());
306 
307  for(auto &p : list_dof_side_map) {
308  auto &data_side_map = (*fit)->getDofSideMap()[p.first];
309  CHKERR p.second(data_side_map);
310  }
311 
313 }

◆ add_ents_to_field_by_dim() [1/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_field_by_dim ( const EntityHandle  meshset,
const int  dim,
const std::string &  name,
const bool  recursive = true,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Add entities to field meshset.

\not collective

The lower dimension entities are added depending on the space type

Parameters
meshset
dimdimension
namename of field
recursivetake entities recursively from embedded entities
verbverbosity level
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 440 of file FieldCore.cpp.

443  {
445  Range ents;
446  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
447  CHKERR addEntsToFieldByDim(ents, dim, name, verb);
450 }

◆ add_ents_to_field_by_dim() [2/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_field_by_dim ( const Range ents,
const int  dim,
const std::string &  name,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Add entities to field meshset.

Note
not collective

The lower dimension entities are added depending on the space type

Parameters
entsrange of entities
dimdimension of entities
namename of field
verbverbosity level
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 416 of file FieldCore.cpp.

418  {
420  Range ents_dim = ents.subset_by_dimension(dim);
421  CHKERR addEntsToFieldByDim(ents_dim, dim, name, verb);
424 }

◆ add_ents_to_field_by_type() [1/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_field_by_type ( const EntityHandle  meshset,
const EntityType  type,
const std::string &  name,
const bool  recursive = true,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Add entities to field meshset.

Note
not collective

The lower dimension entities are added depending on the space type

Parameters
meshset
typeof entities
namename of field
recursivetake entities recursively from embedded entities
verbverbosity level
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 452 of file FieldCore.cpp.

455  {
457  Range ents;
458  CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
459  if (!ents.empty()) {
460  const int dim = get_moab().dimension_from_handle(ents[0]);
461  CHKERR addEntsToFieldByDim(ents, dim, name, verb);
462  }
465 }

◆ add_ents_to_field_by_type() [2/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_field_by_type ( const Range ents,
const EntityType  type,
const std::string &  name,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Add entities to field meshset.

Note
not collective

The lower dimension entities are added depending on the space type

Parameters
entsrange of entities
typetype of entities
namename of field
verbverbosity level
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 426 of file FieldCore.cpp.

429  {
431  Range ents_type = ents.subset_by_type(type);
432  if (!ents_type.empty()) {
433  const int dim = get_moab().dimension_from_handle(ents_type[0]);
434  CHKERR addEntsToFieldByDim(ents_type, dim, name, verb);
435  }
438 }

◆ add_ents_to_finite_element_by_bit_ref()

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_bit_ref ( const BitRefLevel bit,
const BitRefLevel mask,
const std::string &  name,
EntityType  type,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

add TET entities from given refinement level to finite element database given by name

Note
not collective
Parameters
BitRefLevelbit
BitRefLevelmask
finiteelement name
finiteelement type
verboselevel

Implements MoFEM::CoreInterface.

Definition at line 405 of file FECore.cpp.

407  {
409 
410  if (verb == -1)
411  verb = verbose;
412  *buildMoFEM &= 1 << 0;
413  const BitFEId id = getBitFEId(name);
415 
416  auto &ref_MoFEMFiniteElement = refinedFiniteElements.get<Ent_mi_tag>();
417  auto miit = ref_MoFEMFiniteElement.lower_bound(get_id_for_min_type(type));
418  auto hi_miit = ref_MoFEMFiniteElement.upper_bound(get_id_for_max_type(type));
419 
420  int nb_add_fes = 0;
421  for (; miit != hi_miit; miit++) {
422  const auto &bit2 = miit->get()->getBitRefLevel();
423  if ((bit2 & mask) != bit2)
424  continue;
425  if ((bit2 & bit).any()) {
426  EntityHandle ent = miit->get()->getEnt();
427  CHKERR get_moab().add_entities(idm, &ent, 1);
428  nb_add_fes++;
429  }
430  }
431 
432  MOFEM_LOG("SYNC", Sev::inform)
433  << "Finite element " << name << " added. Nb. of elements added "
434  << nb_add_fes << " out of " << std::distance(miit, hi_miit);
435 
437 
439 }

◆ add_ents_to_finite_element_by_dim() [1/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_dim ( const EntityHandle  entities,
const int  dim,
const std::string &  name,
const bool  recursive = true 
)
protectedvirtual

add entities to finite element

Note
not collective
Parameters
entitiesmeshset or range form were entities taken
dimdimension
namefinite element name
recursivetake entities from meshsets in meshset
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 346 of file FECore.cpp.

348  {
349  EntityHandle idm = no_handle;
350  *buildMoFEM &= 1 << 0;
353  Range ents;
354  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
355  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
356  CHKERR get_moab().add_entities(idm, ents);
358 }

◆ add_ents_to_finite_element_by_dim() [2/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_dim ( const Range ents,
const int  dim,
const std::string &  name 
)
protectedvirtual

add entities to finite elements

Note
not collective
Parameters
entsrange of entities
dimdimension of entities
namename of finite element
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 373 of file FECore.cpp.

374  {
375  EntityHandle idm = no_handle;
376  *buildMoFEM &= 1 << 0;
379  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
380  ents.subset_by_dimension(dim));
381  CHKERR get_moab().add_entities(idm, ents.subset_by_dimension(dim));
383 }

◆ add_ents_to_finite_element_by_MESHSET()

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_MESHSET ( const EntityHandle  meshset,
const std::string &  name,
const bool  recursive = false 
)
protectedvirtual

add MESHSET element to finite element database given by name

Note
not collective
Parameters
meshsetcontains all entities that could be used for finite element
nameFinite Element name

Implements MoFEM::CoreInterface.

Definition at line 441 of file FECore.cpp.

442  {
444  *buildMoFEM &= 1 << 0;
445  const BitFEId id = getBitFEId(name);
447  if (recursive == false) {
448  CHKERR get_moab().add_entities(idm, &meshset, 1);
449  } else {
450  Range meshsets;
451  CHKERR get_moab().get_entities_by_type(meshset, MBENTITYSET, meshsets,
452  false);
453  CHKERR get_moab().add_entities(idm, meshsets);
454  }
456 }

◆ add_ents_to_finite_element_by_type() [1/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_type ( const EntityHandle  entities,
const EntityType  type,
const std::string &  name,
const bool  recursive = true 
)
protectedvirtual

add entities to finite element

Note
not collective
Parameters
entitiesmeshset or range form were entities taken
typetype of entity
namefinite element name
recursivetake entities from meshsets in meshset
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 329 of file FECore.cpp.

331  {
332  *buildMoFEM &= 1 << 0;
333  EntityHandle idm = no_handle;
335 
337  Range ents;
338  CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
339  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
340  CHKERR get_moab().add_entities(idm, ents);
341 
343 }

◆ add_ents_to_finite_element_by_type() [2/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_type ( const Range ents,
const EntityType  type,
const std::string &  name 
)
protectedvirtual

add entities to finite elements

Note
not collective
Parameters
entsrange of entities
typetype of entity (MBVERTEX, MBEDGE, MBTRI, ...)
namename of finite element
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 360 of file FECore.cpp.

361  {
362  EntityHandle idm = no_handle;
363  *buildMoFEM &= 1 << 0;
366  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
367  ents.subset_by_type(type));
368  CHKERR get_moab().add_entities(idm, ents.subset_by_type(type));
370 } // namespace MoFEM

◆ add_ents_to_finite_element_EntType_by_bit_ref() [1/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_EntType_by_bit_ref ( const BitRefLevel bit,
const BitRefLevel mask,
const std::string &  name,
EntityType  type,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 396 of file FECore.cpp.

398  {
401 
403 }

◆ add_ents_to_finite_element_EntType_by_bit_ref() [2/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_EntType_by_bit_ref ( const BitRefLevel bit,
const std::string &  name,
EntityType  type,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 386 of file FECore.cpp.

388  {
391  type, verb);
392 
394 }

◆ add_field()

MoFEMErrorCode MoFEM::Core::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 
)
protectedvirtual

Add field.

Parameters
nameField name
spaceSpace L2,H1,Hdiv,Hcurl
continuityField continuity (you can set broken space)
baseApproximation base AINSWORTH_LEGENDRE_BASE, AINSWORTH_BERNSTEIN_BEZIER_BASE ...
nb_coefficientsNumber of field coefficients
tag_typeTag type, MB_TAG_DENSE or MB_TAG_SPARSE (default)
bhControl behavior, if MF_EXCL throws error if exist
verbVerbosity level
Returns
Return error code

TODO:

Todo:
MB_TAG_DENSE will not work properly in general case. It is need to separate field tags for each entity separately. That will allow for HO orders but homogenous approx. order on each entity. Need some discussion what is optimal solution. MB_TAG_SPARSE gives flexibility, but it not memory efficient. MB_TAG_DENSE uses memory more efficient and in principle allow for better efficiency if properly utilized.

FIXME:

Bug:
Need to resolve problem of dense tags at this stage of development will make only problems

Implements MoFEM::CoreInterface.

Definition at line 315 of file FieldCore.cpp.

319  {
320  return this->addField(name, space, CONTINUOUS, base, nb_of_coefficients,
321  tag_type, bh, verb);
322 }

◆ add_finite_element()

MoFEMErrorCode MoFEM::Core::add_finite_element ( const std::string &  fe_name,
enum MoFEMTypes  bh = MF_EXCL,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

add finite element

Parameters
namefinite element name
Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.

Example

CHKERR mField.add_finite_element("ELASTIC");
CHKERR mField.add_finite_element("PLASTIC");

Implements MoFEM::CoreInterface.

Definition at line 43 of file FECore.cpp.

44  {
46  *buildMoFEM &= 1 << 0;
47  if (verb == -1) {
48  verb = verbose;
49  }
50 
51  // Add finite element meshset to partion meshset. In case of no elements
52  // on processor part, when mesh file is read, finite element meshset is
53  // prevented from deletion by moab reader.
54  auto add_meshset_to_partition = [&](auto meshset) {
56  const void *tag_vals[] = {&rAnk};
57  ParallelComm *pcomm = ParallelComm::get_pcomm(
58  &get_moab(), get_basic_entity_data_ptr()->pcommID);
59  Tag part_tag = pcomm->part_tag();
60  Range tagged_sets;
61  CHKERR get_moab().get_entities_by_type_and_tag(0, MBENTITYSET, &part_tag,
62  tag_vals, 1, tagged_sets,
63  moab::Interface::UNION);
64  for (auto s : tagged_sets)
65  CHKERR get_moab().add_entities(s, &meshset, 1);
67  };
68 
69  auto &finite_element_name_set =
70  finiteElements.get<FiniteElement_name_mi_tag>();
71  auto it_fe = finite_element_name_set.find(fe_name);
72 
73  if (bh == MF_EXCL) {
74  if (it_fe != finite_element_name_set.end()) {
75  SETERRQ1(mofemComm, MOFEM_NOT_FOUND, "this < %s > is there",
76  fe_name.c_str());
77  }
78 
79  } else {
80  if (it_fe != finite_element_name_set.end())
82  }
83  EntityHandle meshset;
84  CHKERR get_moab().create_meshset(MESHSET_SET, meshset);
85  CHKERR add_meshset_to_partition(meshset);
86 
87  // id
88  int fe_shift = 0;
89  for (; finiteElements.get<BitFEId_mi_tag>().find(BitFEId().set(fe_shift)) !=
90  finiteElements.get<BitFEId_mi_tag>().end();
91  ++fe_shift) {
92  }
93 
94  auto id = BitFEId().set(fe_shift);
95  CHKERR get_moab().tag_set_data(th_FEId, &meshset, 1, &id);
96 
97  // id name
98  void const *tag_data[] = {fe_name.c_str()};
99  int tag_sizes[1];
100  tag_sizes[0] = fe_name.size();
101  CHKERR get_moab().tag_set_by_ptr(th_FEName, &meshset, 1, tag_data, tag_sizes);
102 
103  // add FiniteElement
104  auto p = finiteElements.insert(
105  boost::shared_ptr<FiniteElement>(new FiniteElement(moab, meshset)));
106  if (!p.second)
108  "FiniteElement not inserted");
109 
110  if (verb > QUIET)
111  MOFEM_LOG("WORLD", Sev::inform) << "Add finite element " << fe_name;
112 
114 }

◆ add_problem()

MoFEMErrorCode MoFEM::Core::add_problem ( const std::string &  name,
enum MoFEMTypes  bh = MF_EXCL,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Add problem.

Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.

Implements MoFEM::CoreInterface.

Definition at line 84 of file ProblemsCore.cpp.

85  {
87  if (verb == -1)
88  verb = verbose;
89  auto miit = pRoblems.get<Problem_mi_tag>().find(name);
90  if (miit == pRoblems.get<Problem_mi_tag>().end()) {
91 
92  int p_shift = 0;
93  for (; pRoblems.get<BitProblemId_mi_tag>().find(BitProblemId().set(
94  p_shift)) != pRoblems.get<BitProblemId_mi_tag>().end();
95  ++p_shift) {
96  }
97 
98  auto id = BitProblemId().set(p_shift);
99  CHKERR addProblem(id, name, verb);
100 
101  } else if (bh == MF_EXCL) {
102  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem is in database %s",
103  name.c_str());
104  }
106 }

◆ addEntsToFieldByDim()

MoFEMErrorCode MoFEM::Core::addEntsToFieldByDim ( const Range ents,
const int  dim,
const std::string &  name,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 324 of file FieldCore.cpp.

325  {
326 
327  *buildMoFEM = 0;
328  EntityHandle idm = no_handle;
329  if (verb == -1)
330  verb = verbose;
331 
332  MOFEM_LOG_CHANNEL("SYNC");
333  MOFEM_LOG_TAG("SYNC", "FieldCore");
335 
337  idm = get_field_meshset(name);
338  FieldSpace space;
339  CHKERR get_moab().tag_get_data(th_FieldSpace, &idm, 1, &space);
340  FieldContinuity continuity;
341  CHKERR get_moab().tag_get_data(th_FieldContinuity, &idm, 1, &continuity);
342 
343  switch (continuity) {
344  case CONTINUOUS:
345  case DISCONTINUOUS:
346  break;
347  default:
348  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
349  "sorry, unknown continuity added to entity");
350  }
351 
352  std::vector<int> nb_ents_on_dim(3, 0);
353  switch (space) {
354  case L2:
355  CHKERR get_moab().add_entities(idm, ents);
356  break;
357  case H1:
358  CHKERR get_moab().add_entities(idm, ents);
359  if (continuity == DISCONTINUOUS)
360  break;
361  for (int dd = 0; dd != dim; ++dd) {
362  Range adj_ents;
363  CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
364  moab::Interface::UNION);
365  if (dd == 0) {
366  Range topo_nodes;
367  CHKERR get_moab().get_connectivity(ents, topo_nodes, true);
368  Range mid_nodes;
369  CHKERR get_moab().get_connectivity(ents, mid_nodes, false);
370  mid_nodes = subtract(mid_nodes, topo_nodes);
371  adj_ents = subtract(adj_ents, mid_nodes);
372  }
373  CHKERR get_moab().add_entities(idm, adj_ents);
374  nb_ents_on_dim[dd] = adj_ents.size();
375  }
376  break;
377  case HCURL:
378  CHKERR get_moab().add_entities(idm, ents);
379  if (continuity == DISCONTINUOUS)
380  break;
381  for (int dd = 1; dd != dim; ++dd) {
382  Range adj_ents;
383  CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
384  moab::Interface::UNION);
385  CHKERR get_moab().add_entities(idm, adj_ents);
386  nb_ents_on_dim[dd] = adj_ents.size();
387  }
388  break;
389  case HDIV:
390  CHKERR get_moab().add_entities(idm, ents);
391  if (continuity == DISCONTINUOUS)
392  break;
393  if (dim > 2) {
394  Range adj_ents;
395  CHKERR get_moab().get_adjacencies(ents, 2, false, adj_ents,
396  moab::Interface::UNION);
397  CHKERR get_moab().add_entities(idm, adj_ents);
398  nb_ents_on_dim[2] = adj_ents.size();
399  }
400  break;
401  default:
402  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
403  "sorry, unknown space added to entity");
404  }
405 
406  if (verb >= VERBOSE) {
407  MOFEM_LOG("SYNC", Sev::noisy) << "add entities to field " << name;
408  MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add ents " << ents.size();
409  MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add faces " << nb_ents_on_dim[2];
410  MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add edges " << nb_ents_on_dim[1];
411  MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add nodes " << nb_ents_on_dim[0];
412  }
414 }

◆ addField()

MoFEMErrorCode MoFEM::Core::addField ( const std::string &  name,
const FieldSpace  space,
const FieldContinuity  continuity,
const FieldApproximationBase  base,
const FieldCoefficientsNumber  nb_coefficients,
const TagType  tag_type,
const enum MoFEMTypes  bh,
int  verb 
)
protected

Template for add_field.

Template Parameters
CoreN
Parameters
name
space
continuity
base
nb_coefficients
tag_type
bh
verb
Returns
MoFEMErrorCode

Definition at line 108 of file FieldCore.cpp.

113  {
114  MOFEM_LOG_CHANNEL("WORLD");
115  MOFEM_LOG_TAG("WORLD", "FieldCore");
116  MOFEM_LOG_CHANNEL("SYNC");
117  MOFEM_LOG_TAG("SYNC", "FieldCore");
120 
121  // Add field mesh set to partion meshset. In case of no elements
122  // on processor part, when mesh file is read, finite element meshset is
123  // prevented from deletion by moab reader.
124  auto add_meshset_to_partition = [&](auto meshset) {
126  const void *tag_vals[] = {&rAnk};
127  ParallelComm *pcomm = ParallelComm::get_pcomm(
128  &get_moab(), get_basic_entity_data_ptr()->pcommID);
129  Tag part_tag = pcomm->part_tag();
130  Range tagged_sets;
131  CHKERR get_moab().get_entities_by_type_and_tag(0, MBENTITYSET, &part_tag,
132  tag_vals, 1, tagged_sets,
133  moab::Interface::UNION);
134  for (auto s : tagged_sets)
135  CHKERR get_moab().add_entities(s, &meshset, 1);
137  };
138 
139  auto create_tags = [&](auto meshset, auto id) {
141  CHKERR get_moab().tag_set_data(th_FieldId, &meshset, 1, &id);
142  // space
143  CHKERR get_moab().tag_set_data(th_FieldSpace, &meshset, 1, &space);
144  // continuity
145  CHKERR get_moab().tag_set_data(th_FieldContinuity, &meshset, 1,
146  &continuity);
147  // base
148  CHKERR get_moab().tag_set_data(th_FieldBase, &meshset, 1, &base);
149 
150  // name
151  void const *tag_data[] = {name.c_str()};
152  int tag_sizes[1];
153  tag_sizes[0] = name.size();
154  CHKERR get_moab().tag_set_by_ptr(th_FieldName, &meshset, 1, tag_data,
155  tag_sizes);
156  // rank
157  Tag th_rank;
158  int def_rank = 1;
159  const std::string tag_rank_name = "_Field_Rank_" + name;
160  CHKERR get_moab().tag_get_handle(tag_rank_name.c_str(), 1, MB_TYPE_INTEGER,
161  th_rank, MB_TAG_CREAT | MB_TAG_SPARSE,
162  &def_rank);
163  CHKERR get_moab().tag_set_data(th_rank, &meshset, 1, &nb_of_coefficients);
164 
165  Version file_ver;
167  CHK_THROW_MESSAGE(ierr, "Not known file version");
168  if (file_ver.majorVersion >= 0 && file_ver.minorVersion >= 12 &&
169  file_ver.buildVersion >= 1) {
170 
171  // Change tag names comparing to older versions
172 
173  const std::string name_data_prefix("_App_Data_");
174  void const *tag_prefix_data[] = {name_data_prefix.c_str()};
175  int tag_prefix_sizes[1];
176  tag_prefix_sizes[0] = name_data_prefix.size();
177  CHKERR get_moab().tag_set_by_ptr(th_FieldName_DataNamePrefix, &meshset, 1,
178  tag_prefix_data, tag_prefix_sizes);
179  Tag th_app_order, th_field_data, th_field_data_vert;
180 
181  // order
182  ApproximationOrder def_approx_order = -1;
183  const std::string tag_approx_order_name = "_App_Order_" + name;
184  CHKERR get_moab().tag_get_handle(
185  tag_approx_order_name.c_str(), 1, MB_TYPE_INTEGER, th_app_order,
186  MB_TAG_CREAT | MB_TAG_SPARSE, &def_approx_order);
187 
188  // data
189  std::string tag_data_name = name_data_prefix + name;
190  const int def_len = 0;
191  CHKERR get_moab().tag_get_handle(
192  tag_data_name.c_str(), def_len, MB_TYPE_DOUBLE, th_field_data,
193  MB_TAG_CREAT | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
194  std::string tag_data_name_verts = name_data_prefix + name + "_V";
195  VectorDouble def_vert_data(nb_of_coefficients);
196  def_vert_data.clear();
197  CHKERR get_moab().tag_get_handle(
198  tag_data_name_verts.c_str(), nb_of_coefficients, MB_TYPE_DOUBLE,
199  th_field_data_vert, MB_TAG_CREAT | tag_type, &*def_vert_data.begin());
200  } else {
201  // Deprecated names
202  const std::string name_data_prefix("_App_Data");
203  void const *tag_prefix_data[] = {name_data_prefix.c_str()};
204  int tag_prefix_sizes[1];
205  tag_prefix_sizes[0] = name_data_prefix.size();
206  CHKERR get_moab().tag_set_by_ptr(th_FieldName_DataNamePrefix, &meshset, 1,
207  tag_prefix_data, tag_prefix_sizes);
208  Tag th_app_order, th_field_data, th_field_data_vert;
209 
210  // order
211  ApproximationOrder def_approx_order = -1;
212  const std::string tag_approx_order_name = "_App_Order_" + name;
213  CHKERR get_moab().tag_get_handle(
214  tag_approx_order_name.c_str(), 1, MB_TYPE_INTEGER, th_app_order,
215  MB_TAG_CREAT | MB_TAG_SPARSE, &def_approx_order);
216 
217  // data
218  std::string tag_data_name = name_data_prefix + name;
219  const int def_len = 0;
220  CHKERR get_moab().tag_get_handle(
221  tag_data_name.c_str(), def_len, MB_TYPE_DOUBLE, th_field_data,
222  MB_TAG_CREAT | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
223  std::string tag_data_name_verts = name_data_prefix + name + "V";
224  VectorDouble def_vert_data(nb_of_coefficients);
225  def_vert_data.clear();
226  CHKERR get_moab().tag_get_handle(
227  tag_data_name_verts.c_str(), nb_of_coefficients, MB_TYPE_DOUBLE,
228  th_field_data_vert, MB_TAG_CREAT | tag_type, &*def_vert_data.begin());
229  }
230 
232  };
233 
234  if (verb == -1)
235  verb = verbose;
236  *buildMoFEM = 0;
237  auto fit = fIelds.get<FieldName_mi_tag>().find(name);
238  if (fit != fIelds.get<FieldName_mi_tag>().end()) {
239  if (bh == MF_EXCL)
240  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
241  "field is <%s> in database", name.c_str());
242 
243  } else {
244 
245  EntityHandle meshset;
246  CHKERR get_moab().create_meshset(MESHSET_SET, meshset);
247  CHKERR add_meshset_to_partition(meshset);
248 
249  // id
250  int field_shift = 0;
251  for (;
252  fIelds.get<BitFieldId_mi_tag>().find(BitFieldId().set(field_shift)) !=
253  fIelds.get<BitFieldId_mi_tag>().end();
254  ++field_shift) {
255  if (field_shift == BITFEID_SIZE)
256  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE,
257  "Maximal number of fields exceeded");
258  }
259 
260  auto id = BitFieldId().set(field_shift);
261  CHKERR create_tags(meshset, id);
262 
263  auto p = fIelds.insert(boost::make_shared<Field>(moab, meshset));
264  if (verb > QUIET) {
265  MOFEM_LOG("WORLD", Sev::inform) << "Add field " << **p.first;
266  MOFEM_LOG("WORLD", Sev::noisy)
267  << "Field " << (*p.first)->getName() << " core value < "
268  << this->getValue() << " > field value ( "
269  << static_cast<int>((*p.first)->getBitNumber()) << " )";
270  }
271 
272  if (!p.second)
273  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND,
274  "field not inserted %s (top tip, it could be already "
275  "there)",
276  Field(moab, meshset).getName().c_str());
277  }
278 
279  MOFEM_LOG_CHANNEL("WORLD");
280  MOFEM_LOG_CHANNEL("SYNC");
282 }

◆ addPrismToDatabase()

MoFEMErrorCode MoFEM::Core::addPrismToDatabase ( const EntityHandle  prism,
int  verb = DEFAULT_VERBOSITY 
)

add prim element

FIXME: This is dirt solution, need to be fixed

Parameters
prismprim handle
verbverbosity level
Returns
error code

Definition at line 522 of file Core.cpp.

522  {
524  if (verb == -1)
525  verb = verbose;
526  std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
527  p_ent = refinedEntities.insert(
528  boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
529  if (p_ent.second) {
530  std::pair<RefElement_multiIndex::iterator, bool> p;
531  p = refinedFiniteElements.insert(
532  boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)));
533  int num_nodes;
534  const EntityHandle *conn;
535  CHKERR get_moab().get_connectivity(prism, conn, num_nodes, true);
536  Range face_side3, face_side4;
537  CHKERR get_moab().get_adjacencies(conn, 3, 2, false, face_side3);
538  CHKERR get_moab().get_adjacencies(&conn[3], 3, 2, false, face_side4);
539  if (face_side3.size() != 1)
540  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
541  "prism don't have side face 3");
542  if (face_side4.size() != 1)
543  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
544  "prims don't have side face 4");
545  p.first->get()->getSideNumberPtr(*face_side3.begin());
546  p.first->get()->getSideNumberPtr(*face_side4.begin());
547  }
549 }

◆ addProblem()

MoFEMErrorCode MoFEM::Core::addProblem ( const BitProblemId  id,
const std::string &  name,
int  verb = DEFAULT_VERBOSITY 
)
protected

add problem

Parameters
idproblem id
nameproblem name
verbverbosity level
Returns
MoFEMErrorCode

Definition at line 27 of file ProblemsCore.cpp.

28  {
30 
31  if (verb == -1)
32  verb = verbose;
33  EntityHandle meshset;
34  CHKERR get_moab().create_meshset(MESHSET_SET, meshset);
35  CHKERR get_moab().tag_set_data(th_ProblemId, &meshset, 1, &id);
36 
37  // Add problem meshset to partion meshset. In case of no elements
38  // on processor part, when mesh file is read, finite element meshset is
39  // prevented from deletion by moab reader.
40  auto add_meshset_to_partition = [&](auto meshset) {
42  const void *tag_vals[] = {&rAnk};
43  ParallelComm *pcomm = ParallelComm::get_pcomm(
44  &get_moab(), get_basic_entity_data_ptr()->pcommID);
45  Tag part_tag = pcomm->part_tag();
46  Range tagged_sets;
47  CHKERR get_moab().get_entities_by_type_and_tag(0, MBENTITYSET, &part_tag,
48  tag_vals, 1, tagged_sets,
49  moab::Interface::UNION);
50  for (auto s : tagged_sets)
51  CHKERR get_moab().add_entities(s, &meshset, 1);
53  };
54  CHKERR add_meshset_to_partition(meshset);
55 
56  void const *tag_data[] = {name.c_str()};
57  int tag_sizes[1];
58  tag_sizes[0] = name.size();
59  CHKERR get_moab().tag_set_by_ptr(th_ProblemName, &meshset, 1, tag_data,
60  tag_sizes);
61  // create entry
62  auto p = pRoblems.insert(Problem(moab, meshset));
63  if (!p.second) {
66  MOFEM_LOG("SELF", Sev::error) << "Following problem can not be added:";
67  MOFEM_LOG("SELF", Sev::error)
68  << "Problem " << name << " id(" << id.to_ulong() << ") " << id
69  << " added meshset " << meshset;
70  MOFEM_LOG("SELF", Sev::error) << "List of problems already in databse:";
71  for (auto &p : pRoblems) {
72  MOFEM_LOG("SELF", Sev::error)
73  << p.getName() << " id(" << p.getId().to_ulong() << ") " << id
74  << " on meshset " << p.meshset;
75  }
76  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Problem not added");
77  }
78 
79  MOFEM_LOG("WORLD", Sev::inform) << "Add problem " << name;
80 
82 }

◆ build_adjacencies() [1/3]

MoFEMErrorCode MoFEM::Core::build_adjacencies ( const BitRefLevel bit,
const BitRefLevel mask,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

build adjacencies

Parameters
bitadjacencies for refine level
maskmask for bit level

This function will get information of adjacent finite elements and fields of all entities. If this is not executed, partitioning the problem is not possible. Adjacency map is based on degrees of freedom adjacent to elements. This linked to geometric element connectivity.

If new degrees of freedom or new finite elements are added to the database, adjacency map has to be rebuild.

Implements MoFEM::CoreInterface.

Definition at line 814 of file FECore.cpp.

815  {
817  if (verb == -1)
818  verb = verbose;
819  Range ents;
820  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents);
821 
822  CHKERR build_adjacencies(ents, verb);
823 
825 }

◆ build_adjacencies() [2/3]

MoFEMErrorCode MoFEM::Core::build_adjacencies ( const BitRefLevel bit,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

build adjacencies

Parameters
bitadjacencies for refine level

This function will get information of adjacent finite elements and fields of all entities. If this is not executed, partitioning the problem is not possible. Adjacency map is based on degrees of freedom adjacent to elements. This linked to geometric element connectivity.

If new degrees of freedom or new finite elements are added to the database, adjacency map has to be rebuild.

Implements MoFEM::CoreInterface.

Definition at line 826 of file FECore.cpp.

826  {
828  if (verb == -1)
829  verb = verbose;
830  CHKERR build_adjacencies(bit, BitRefLevel().set(), verb);
831 
833 }

◆ build_adjacencies() [3/3]

MoFEMErrorCode MoFEM::Core::build_adjacencies ( const Range ents,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

build adjacencies

Parameters
listof entities

This function will get information of adjacent finite elements and fields of all entities. If this is not executed, partitioning the problem is not possible. Adjacency map is based on degrees of freedom adjacent to elements. This linked to geometric element connectivity.

If new degrees of freedom or new finite elements are added to the database, adjacency map has to be rebuild.

Implements MoFEM::CoreInterface.

Definition at line 742 of file FECore.cpp.

742  {
744  if (verb == DEFAULT_VERBOSITY)
745  verb = verbose;
746 
747  if (!((*buildMoFEM) & BUILD_FIELD))
748  SETERRQ(mofemComm, MOFEM_NOT_FOUND, "field not build");
749  if (!((*buildMoFEM) & BUILD_FE))
750  SETERRQ(mofemComm, MOFEM_NOT_FOUND, "fe not build");
751  for (auto peit = ents.pair_begin(); peit != ents.pair_end(); ++peit) {
752  auto fit = entsFiniteElements.get<Ent_mi_tag>().lower_bound(peit->first);
753  auto hi_fit =
754  entsFiniteElements.get<Ent_mi_tag>().upper_bound(peit->second);
755  for (; fit != hi_fit; ++fit) {
756  if ((*fit)->getBitFieldIdRow().none() &&
757  (*fit)->getBitFieldIdCol().none() &&
758  (*fit)->getBitFieldIdData().none())
759  continue;
760  int by = BYROW;
761  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol())
762  by |= BYCOL;
763  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData())
764  by |= BYDATA;
765  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_row(by);
766  auto hint = entFEAdjacencies.end();
767  for (auto e : *(*fit)->getRowFieldEntsPtr()) {
768  hint = entFEAdjacencies.emplace_hint(hint, e.lock(), *fit);
769  bool success = entFEAdjacencies.modify(hint, modify_row);
770  if (!success)
771  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
772  "modification unsuccessful");
773  }
774  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol()) {
775  int by = BYCOL;
776  if ((*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData())
777  by |= BYDATA;
778  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_col(by);
779  auto hint = entFEAdjacencies.end();
780  for (auto e : *(*fit)->getColFieldEntsPtr()) {
781  hint = entFEAdjacencies.emplace_hint(hint, e.lock(), *fit);
782  bool success = entFEAdjacencies.modify(hint, modify_col);
783  if (!success)
784  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
785  "modification unsuccessful");
786  }
787  }
788  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData() ||
789  (*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData()) {
790  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_data(
791  BYDATA);
792  auto hint = entFEAdjacencies.end();
793  for (auto &e : (*fit)->getDataFieldEnts()) {
794  hint = entFEAdjacencies.emplace_hint(hint, e.lock(), *fit);
795  bool success = entFEAdjacencies.modify(hint, modify_data);
796  if (!success)
797  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
798  "modification unsuccessful");
799  }
800  }
801  }
802  }
803 
804  if (verb >= VERBOSE) {
805  MOFEM_LOG("WORLD", Sev::inform)
806  << "Number of adjacencies " << entFEAdjacencies.size();
808  }
809 
810  *buildMoFEM |= 1 << 2;
812 }

◆ build_field()

MoFEMErrorCode MoFEM::Core::build_field ( const std::string  field_name,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

build field by name

Parameters
field_name
verbm
Returns
MoFEMErrorCode

Implements MoFEM::CoreInterface.

Definition at line 1305 of file FieldCore.cpp.

1305  {
1307  auto field_it = fIelds.get<FieldName_mi_tag>().find(field_name);
1308  if (field_it == fIelds.get<FieldName_mi_tag>().end())
1309  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field < %s > not found",
1310  field_name.c_str());
1311 
1312  CHKERR this->buildField(*field_it, verb);
1313  if (verb > QUIET)
1316 }

◆ build_fields()

MoFEMErrorCode MoFEM::Core::build_fields ( int  verb = DEFAULT_VERBOSITY)
protectedvirtual

build fields

Implements MoFEM::CoreInterface.

Definition at line 1318 of file FieldCore.cpp.

1318  {
1320  if (verb == -1)
1321  verb = verbose;
1322 
1323  for (auto field : fIelds.get<BitFieldId_mi_tag>())
1324  CHKERR this->buildField(field, verb);
1325 
1326  *buildMoFEM = 1 << 0;
1327  if (verb > QUIET) {
1328  MOFEM_LOG("SYNC", Sev::verbose) << "Number of dofs " << dofsField.size();
1330  }
1331 
1333 }

◆ build_finite_elements() [1/3]

MoFEMErrorCode MoFEM::Core::build_finite_elements ( const BitRefLevel bit,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 705 of file FECore.cpp.

705  {
707  SETERRQ(mofemComm, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
709 }

◆ build_finite_elements() [2/3]

MoFEMErrorCode MoFEM::Core::build_finite_elements ( const string  fe_name,
const Range *const  ents_ptr = nullptr,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Build finite elements.

Build finite element data structures. Have to be run before problem and adjacencies are constructed.

Parameters
fe_nameName of finite element
ents_ptrPointer to range of finite elements
verbVerbosity level
Returns
Error code

Implements MoFEM::CoreInterface.

Definition at line 711 of file FECore.cpp.

713  {
715  if (verb == -1)
716  verb = verbose;
717 
718  auto fe_miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
719  if (fe_miit == finiteElements.get<FiniteElement_name_mi_tag>().end())
720  SETERRQ1(mofemComm, MOFEM_NOT_FOUND, "Finite element <%s> not found",
721  fe_name.c_str());
722 
723  CHKERR buildFiniteElements(*fe_miit, ents_ptr, verb);
724 
725  if (verb >= VERBOSE) {
726  auto &fe_ents = entsFiniteElements.get<Unique_mi_tag>();
727  auto miit = fe_ents.lower_bound(
728  EntFiniteElement::getLocalUniqueIdCalculate(0, (*fe_miit)->getFEUId()));
729  auto hi_miit =
731  get_id_for_max_type<MBENTITYSET>(), (*fe_miit)->getFEUId()));
732  const auto count = std::distance(miit, hi_miit);
733  MOFEM_LOG("SYNC", Sev::inform) << "Finite element " << fe_name
734  << " added. Nb. of elements added " << count;
736  }
737 
738  *buildMoFEM |= 1 << 1;
740 }

◆ build_finite_elements() [3/3]

MoFEMErrorCode MoFEM::Core::build_finite_elements ( int  verb = DEFAULT_VERBOSITY)
protectedvirtual

Build finite elements.

Build finite element data structures. Have to be run before problem and adjacencies are constructed.

Parameters
verbVerbosity level
Returns
Error code

Implements MoFEM::CoreInterface.

Definition at line 655 of file FECore.cpp.

655  {
657 
658  if (verb == DEFAULT_VERBOSITY)
659  verb = verbose;
660 
661  // loop Finite Elements
662  for (auto &fe : finiteElements)
663  CHKERR buildFiniteElements(fe, NULL, verb);
664 
665  if (verb > QUIET) {
666 
667  auto &fe_ents = entsFiniteElements.get<Unique_mi_tag>();
668  for (auto &fe : finiteElements) {
669  auto miit = fe_ents.lower_bound(
671  auto hi_miit =
673  get_id_for_max_type<MBENTITYSET>(), fe->getFEUId()));
674  const auto count = std::distance(miit, hi_miit);
675  MOFEM_LOG("SYNC", Sev::inform)
676  << "Finite element " << fe->getName()
677  << " added. Nb. of elements added " << count;
678  MOFEM_LOG("SYNC", Sev::noisy) << *fe;
679 
680  auto slg = MoFEM::LogManager::getLog("SYNC");
681  for (auto &field : fIelds) {
682  auto rec = slg.open_record(keywords::severity = Sev::verbose);
683  if (rec) {
684  logging::record_ostream strm(rec);
685  strm << "Field " << field->getName() << " on finite element: ";
686  if ((field->getId() & fe->getBitFieldIdRow()).any())
687  strm << "row ";
688  if ((field->getId() & fe->getBitFieldIdCol()).any())
689  strm << "columns ";
690  if ((field->getId() & fe->getBitFieldIdData()).any())
691  strm << "data";
692  strm.flush();
693  slg.push_record(boost::move(rec));
694  }
695  }
696  }
697 
699  }
700 
701  *buildMoFEM |= 1 << 1;
703 }

◆ build_problem_on_distributed_mesh()

MoFEMErrorCode MoFEM::Core::build_problem_on_distributed_mesh ( int  verb = DEFAULT_VERBOSITY)
protected

Definition at line 257 of file ProblemsCore.cpp.

257  {
259  if (verb == -1)
260  verb = verbose;
261  Problem_multiIndex::iterator p_miit = pRoblems.begin();
262  for (; p_miit != pRoblems.end(); p_miit++) {
263  CHKERR getInterface<ProblemsManager>()->buildProblemOnDistributedMesh(
264  const_cast<Problem *>(&*p_miit), verb);
265  }
267 }

◆ build_problems()

MoFEMErrorCode MoFEM::Core::build_problems ( int  verb = DEFAULT_VERBOSITY)
protected

Definition at line 317 of file ProblemsCore.cpp.

317  {
319  if (verb == -1)
320  verb = verbose;
321  if (!((*buildMoFEM) & BUILD_FIELD))
322  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "fields not build");
323  if (!((*buildMoFEM) & BUILD_FE))
324  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "FEs not build");
325  if (!((*buildMoFEM) & BUILD_ADJ))
326  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "adjacencies not build");
327  // iterate problems
328  Problem_multiIndex::iterator p_miit = pRoblems.begin();
329  for (; p_miit != pRoblems.end(); p_miit++) {
330  Problem *problem_ptr = const_cast<Problem *>(&*p_miit);
331  CHKERR getInterface<ProblemsManager>()->buildProblem(problem_ptr, false,
332  verb);
333  }
336 }

◆ buildField()

MoFEMErrorCode MoFEM::Core::buildField ( const boost::shared_ptr< Field > &  field,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 1256 of file FieldCore.cpp.

1257  {
1259  if (verb == -1)
1260  verb = verbose;
1261  if (verb > QUIET)
1262  MOFEM_LOG("SYNC", Sev::verbose) << "Build field " << field->getName();
1263 
1264  std::map<EntityType, int> dof_counter;
1265  std::map<EntityType, int> inactive_dof_counter;
1266 
1267  // Need to rebuild order table since number of dofs on each order when
1268  // field was created.
1269  if (field->getApproxBase() == USER_BASE)
1270  CHKERR field->rebuildDofsOrderMap();
1271 
1272  switch (field->getSpace()) {
1273  case NOFIELD:
1274  CHKERR this->buildFieldForNoField(field->getId(), dof_counter, verb);
1275  break;
1276  case L2:
1277  case H1:
1278  case HCURL:
1279  case HDIV:
1280  CHKERR this->buildFieldForL2H1HcurlHdiv(field->getId(), dof_counter,
1281  inactive_dof_counter, verb);
1282  break;
1283  default:
1284  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1285  }
1286 
1287  if (verb > QUIET) {
1288  int nb_added_dofs = 0;
1289  int nb_inactive_added_dofs = 0;
1290  for (auto const &it : dof_counter) {
1291  MOFEM_LOG("SYNC", Sev::verbose)
1292  << "Nb. of dofs (" << moab::CN::EntityTypeName(it.first) << ") "
1293  << it.second << " (inactive " << inactive_dof_counter[it.first]
1294  << ")";
1295  nb_added_dofs += it.second;
1296  nb_inactive_added_dofs += inactive_dof_counter[it.first];
1297  }
1298  MOFEM_LOG("SYNC", Sev::verbose)
1299  << "Nb. added dofs " << nb_added_dofs << " (number of inactive dofs "
1300  << nb_inactive_added_dofs << " )";
1301  }
1303 }

◆ buildFieldForL2H1HcurlHdiv()

MoFEMErrorCode MoFEM::Core::buildFieldForL2H1HcurlHdiv ( const BitFieldId  id,
std::map< EntityType, int > &  dof_counter,
std::map< EntityType, int > &  inactive_dof_counter,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 1144 of file FieldCore.cpp.

1146  {
1148  if (verb == -1)
1149  verb = verbose;
1150 
1151  // Find field
1152  auto &set_id = fIelds.get<BitFieldId_mi_tag>();
1153  auto field_it = set_id.find(id);
1154  if (field_it == set_id.end()) {
1155  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field not found");
1156  }
1157  const int bit_number = field_it->get()->getBitNumber();
1158  const int rank = field_it->get()->getNbOfCoeffs();
1159 
1160  // Ents in the field meshset
1161  Range ents_of_id_meshset;
1162  CHKERR get_moab().get_entities_by_handle((*field_it)->meshSet,
1163  ents_of_id_meshset, false);
1164  if (verb > VERY_NOISY) {
1165  MOFEM_LOG_C("SYNC", Sev::noisy, "Ents in field %s meshset %d",
1166  (*field_it)->getName().c_str(), ents_of_id_meshset.size());
1167  }
1168 
1169  for (auto p_eit = ents_of_id_meshset.pair_begin();
1170  p_eit != ents_of_id_meshset.pair_end(); ++p_eit) {
1171 
1172  const EntityHandle first = p_eit->first;
1173  const EntityHandle second = p_eit->second;
1174  const auto lo_uid =
1175  FieldEntity::getLoLocalEntityBitNumber(bit_number, first);
1176  const auto hi_uid =
1177  FieldEntity::getHiLocalEntityBitNumber(bit_number, second);
1178 
1179  auto feit = entsFields.get<Unique_mi_tag>().lower_bound(lo_uid);
1180  if (feit == entsFields.get<Unique_mi_tag>().end())
1181  continue;
1182  auto hi_feit = entsFields.get<Unique_mi_tag>().upper_bound(hi_uid);
1183 
1184  // If there are DOFs in that range is more pragmatic to remove them
1185  // rather than to find sub-ranges or make them inactive
1186  auto dit = dofsField.get<Unique_mi_tag>().lower_bound(lo_uid);
1187  auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(hi_uid);
1188  dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
1189 
1190  // Add vertices DOFs by bulk
1191  boost::shared_ptr<std::vector<DofEntity>> dofs_array =
1192  boost::make_shared<std::vector<DofEntity>>(std::vector<DofEntity>());
1193  // Add Sequence of DOFs to sequence container as weak_ptr
1194  int nb_dofs_on_ents = 0;
1195  for (auto tmp_feit = feit; tmp_feit != hi_feit; ++tmp_feit) {
1196  nb_dofs_on_ents += rank * tmp_feit->get()->getOrderNbDofs(
1197  tmp_feit->get()->getMaxOrder());
1198  }
1199 
1200  // Reserve memory
1201  dofs_array->reserve(nb_dofs_on_ents);
1202 
1203  // Create DOFs
1204  for (; feit != hi_feit; ++feit) {
1205  // Create dofs instances and shared pointers
1206  int DD = 0;
1207  // Loop orders (loop until max entity order is set)
1208  for (int oo = 0; oo <= feit->get()->getMaxOrder(); ++oo) {
1209  // Loop nb. dofs at order oo
1210  for (int dd = 0; dd < feit->get()->getOrderNbDofsDiff(oo); ++dd) {
1211  // Loop rank
1212  for (int rr = 0; rr < rank; ++rr, ++DD) {
1213  dofs_array->emplace_back(*feit, oo, rr, DD);
1214  ++dof_counter[feit->get()->getEntType()];
1215  }
1216  }
1217  }
1218  if (DD > feit->get()->getNbDofsOnEnt()) {
1219  std::ostringstream ss;
1220  ss << "rank " << rAnk << " ";
1221  ss << **feit << std::endl;
1222  SETERRQ3(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1223  "Expected number of DOFs on entity not equal to number added "
1224  "to database (DD = %d != %d = "
1225  "feit->get()->getNbDofsOnEnt())\n"
1226  "%s",
1227  DD, feit->get()->getNbDofsOnEnt(), ss.str().c_str());
1228  }
1229  }
1230 
1231  // Insert into Multi-Index container
1232  int dofs_field_size0 = dofsField.size();
1233  auto hint = dofsField.end();
1234  for (auto &v : *dofs_array)
1235  hint = dofsField.emplace_hint(hint, dofs_array, &v);
1236 
1237  // Add Sequence of DOFs to sequence container as weak_ptr
1238  field_it->get()->getDofSequenceContainer().push_back(dofs_array);
1239 
1240  // Check data consistency
1241  if (PetscUnlikely(static_cast<int>(dofs_array.use_count()) !=
1242  static_cast<int>(dofs_array->size() + 1))) {
1243  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1244  "Wrong use count %d != %d", dofs_array.use_count(),
1245  dofs_array->size() + 1);
1246  }
1247  if (dofs_field_size0 + dofs_array->size() != dofsField.size()) {
1248  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1249  "Wrong number of inserted DOFs %d != %d", dofs_array->size(),
1250  dofsField.size() - dofs_field_size0);
1251  }
1252  }
1254 }

◆ buildFieldForNoField()

MoFEMErrorCode MoFEM::Core::buildFieldForNoField ( const BitFieldId  id,
std::map< EntityType, int > &  dof_counter,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 1121 of file FieldCore.cpp.

1122  {
1124 
1125  if (verb == -1)
1126  verb = verbose;
1127 
1128  // find fields
1129  auto field_it = fIelds.get<BitFieldId_mi_tag>().find(id);
1130  if (field_it == fIelds.get<BitFieldId_mi_tag>().end())
1131  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field not found");
1132 
1133  if (verb > QUIET)
1134  MOFEM_LOG("WORLD", Sev::noisy)
1135  << "Field " << (*field_it)->getName() << " core value < "
1136  << this->getValue() << " > field value () "
1137  << (*field_it)->getBitNumber() << " )";
1138 
1139  CHKERR this->buildFieldForNoFieldImpl(*field_it, dof_counter, verb);
1140 
1142 }

◆ buildFieldForNoFieldImpl()

MoFEMErrorCode MoFEM::Core::buildFieldForNoFieldImpl ( boost::shared_ptr< Field field_ptr,
std::map< EntityType, int > &  dof_counter,
int  verb 
)
protected

Definition at line 1016 of file FieldCore.cpp.

1018  {
1020 
1021  const auto bit_number = field_ptr->getBitNumber();
1022 
1023  // ents in the field meshset
1024  Range ents;
1025  CHKERR get_moab().get_entities_by_handle(field_ptr->getMeshset(), ents,
1026  false);
1027  if (verb > VERBOSE)
1028  MOFEM_LOG_C("SYNC", Sev::noisy, "Ents in field %s meshset %d\n",
1029  field_ptr->getName().c_str(), ents.size());
1030 
1031  // ent view by field id (in set all MoabEnts has the same FieldId)
1032  auto eiit = entsFields.get<Unique_mi_tag>().lower_bound(
1033  FieldEntity::getLoBitNumberUId(field_ptr->getBitNumber()));
1034  FieldEntity_multiIndex_ent_view ents_id_view;
1035  if (eiit != entsFields.get<Unique_mi_tag>().end()) {
1036  auto hi_eiit = entsFields.get<Unique_mi_tag>().upper_bound(
1037  FieldEntity::getHiBitNumberUId(field_ptr->getBitNumber()));
1038  std::copy(eiit, hi_eiit, std::back_inserter(ents_id_view));
1039  }
1040 
1041  boost::shared_ptr<const int> zero_order(new const int(0));
1042 
1043  for (auto ent : ents) {
1044  // search if field meshset is in database
1045  auto ref_ent_it = refinedEntities.get<Ent_mi_tag>().find(ent);
1046  if (ref_ent_it == refinedEntities.get<Ent_mi_tag>().end())
1047  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1048  "Entity is not in MoFEM database, entities in field meshset need "
1049  "to be seeded (i.e. bit ref level add to them)");
1050 
1051  auto add_dofs = [&](auto field_eit) {
1053  // create dofs on this entity (nb. of dofs is equal to rank)
1054  for (FieldCoefficientsNumber rank = 0; rank < field_ptr->getNbOfCoeffs();
1055  rank++) {
1056  // insert dof
1057  auto p = dofsField.insert(
1058  boost::make_shared<DofEntity>(field_eit, 0, rank, rank));
1059  if (p.second) {
1060  dof_counter[MBENTITYSET]++; // Count entities in the meshset
1061  } else
1062  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
1063  "Dof expected to be created");
1064  }
1066  };
1067 
1068  // create database entity
1069  auto field_ent_it = ents_id_view.get<1>().find(ent);
1070  if (field_ent_it == ents_id_view.get<1>().end()) {
1071 
1072  auto p = entsFields.insert(
1073 
1074  boost::make_shared<FieldEntity>(
1075  field_ptr, *ref_ent_it,
1077  *ref_ent_it),
1078  boost::shared_ptr<const int>(zero_order, zero_order.get()))
1079 
1080  );
1081 
1082  if ((*p.first)->getFieldRawPtr() != field_ptr.get())
1083  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1084  "Get field ent poiter and field pointer do not match for "
1085  "field %s",
1086  field_ptr->getName().c_str());
1087 
1088  if (!p.second)
1089  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1090  "Entity should be created");
1091 
1092  CHKERR add_dofs(*(p.first));
1093 
1094  } else {
1095 
1096  // If there are DOFs in that range is more pragmatic to remove them
1097  // rather than to find sub-ranges or make them inactive
1098  auto dit = dofsField.get<Unique_mi_tag>().lower_bound(
1099  FieldEntity::getLoLocalEntityBitNumber(bit_number, ent));
1100  auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(
1101  FieldEntity::getHiLocalEntityBitNumber(bit_number, ent));
1102  dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
1103  CHKERR add_dofs(*field_ent_it);
1104  }
1105  }
1106 
1107  if (verb > VERBOSE) {
1108  auto lo_dof = dofsField.get<Unique_mi_tag>().lower_bound(
1109  FieldEntity::getLoBitNumberUId(field_ptr->getBitNumber()));
1110  auto hi_dof = dofsField.get<Unique_mi_tag>().upper_bound(
1111  FieldEntity::getHiBitNumberUId(field_ptr->getBitNumber()));
1112  for (; lo_dof != hi_dof; lo_dof++)
1113  MOFEM_LOG("SYNC", Sev::noisy) << **lo_dof;
1114  MOFEM_LOG_SEVERITY_SYNC(mofemComm, Sev::noisy);
1115  }
1116 
1118 }

◆ buildFiniteElements()

MoFEMErrorCode MoFEM::Core::buildFiniteElements ( const boost::shared_ptr< FiniteElement > &  fe,
const Range ents_ptr = NULL,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 459 of file FECore.cpp.

460  {
462  if (verb == DEFAULT_VERBOSITY)
463  verb = verbose;
464 
465  if (verb > QUIET)
466  MOFEM_LOG("SYNC", Sev::verbose)
467  << "Build Finite Elements " << fe->getName();
468 
469  auto &fields_by_id = fIelds.get<BitFieldId_mi_tag>();
470 
471  // Get id of mofem fields for row, col and data
472  enum IntLoop { ROW = 0, COL, DATA, LAST };
473  std::array<BitFieldId, LAST> fe_fields = {fe.get()->getBitFieldIdRow(),
474  fe.get()->getBitFieldIdCol(),
475  fe.get()->getBitFieldIdData()};
476 
477  // Get finite element meshset
478  EntityHandle meshset = get_finite_element_meshset(fe.get()->getId());
479 
480  // Get entities from finite element meshset // if meshset
481  Range fe_ents;
482  CHKERR get_moab().get_entities_by_handle(meshset, fe_ents, false);
483 
484  if (ents_ptr)
485  fe_ents = intersect(fe_ents, *ents_ptr);
486 
487  // Map entity uid to pointers
488  typedef std::vector<boost::weak_ptr<EntFiniteElement>> VecOfWeakFEPtrs;
489  VecOfWeakFEPtrs processed_fes;
490  processed_fes.reserve(fe_ents.size());
491 
492  int last_data_field_ents_view_size = 0;
493  int last_row_field_ents_view_size = 0;
494  int last_col_field_ents_view_size = 0;
495 
496  // Entities adjacent to entities
497  std::vector<EntityHandle> adj_ents;
498 
499  // Loop meshset finite element ents and add finite elements
500  for (Range::const_pair_iterator peit = fe_ents.const_pair_begin();
501  peit != fe_ents.const_pair_end(); peit++) {
502 
503  const auto first = peit->first;
504  const auto second = peit->second;
505 
506  // Find range of ref entities that is sequence
507  // note: iterator is a wrapper
508  // check if is in refinedFiniteElements database
509  auto ref_fe_miit =
510  refinedFiniteElements.get<Ent_mi_tag>().lower_bound(first);
511  if (ref_fe_miit == refinedFiniteElements.get<Ent_mi_tag>().end()) {
512  std::ostringstream ss;
513  ss << "refinedFiniteElements not in database ent = " << first << " type "
514  << type_from_handle(first) << " " << *fe;
515  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, ss.str().c_str());
516  }
517  auto hi_ref_fe_miit =
518  refinedFiniteElements.get<Ent_mi_tag>().upper_bound(second);
519 
520  EntFiniteElement_multiIndex::iterator hint_p = entsFiniteElements.end();
521  for (; ref_fe_miit != hi_ref_fe_miit; ref_fe_miit++) {
522 
523  // Add finite element to database
524  hint_p = entsFiniteElements.emplace_hint(
525  hint_p, boost::make_shared<EntFiniteElement>(*ref_fe_miit, fe));
526  processed_fes.emplace_back(*hint_p);
527  auto fe_raw_ptr = hint_p->get();
528 
529  // Allocate space for entities view
530  bool row_as_data = false, col_as_row = false;
531  if (fe_fields[DATA] == fe_fields[ROW])
532  row_as_data = true;
533  if (fe_fields[ROW] == fe_fields[COL])
534  col_as_row = true;
535 
536  fe_raw_ptr->getDataFieldEntsPtr()->reserve(
537  last_data_field_ents_view_size);
538 
539  if (row_as_data) {
540  fe_raw_ptr->getRowFieldEntsPtr() = fe_raw_ptr->getDataFieldEntsPtr();
541  } else {
542  // row and col are different
543  if (fe_raw_ptr->getRowFieldEntsPtr() ==
544  fe_raw_ptr->getDataFieldEntsPtr())
545  fe_raw_ptr->getRowFieldEntsPtr() =
546  boost::make_shared<FieldEntity_vector_view>();
547  fe_raw_ptr->getRowFieldEntsPtr()->reserve(
548  last_row_field_ents_view_size);
549  }
550 
551  if (row_as_data && col_as_row) {
552  fe_raw_ptr->getColFieldEntsPtr() = fe_raw_ptr->getDataFieldEntsPtr();
553  } else if (col_as_row) {
554  fe_raw_ptr->getColFieldEntsPtr() = fe_raw_ptr->getRowFieldEntsPtr();
555  } else {
556  if (
557 
558  fe_raw_ptr->getColFieldEntsPtr() ==
559  fe_raw_ptr->getRowFieldEntsPtr() ||
560  fe_raw_ptr->getColFieldEntsPtr() ==
561  fe_raw_ptr->getDataFieldEntsPtr()
562 
563  )
564  fe_raw_ptr->getColFieldEntsPtr() =
565  boost::make_shared<FieldEntity_vector_view>();
566  fe_raw_ptr->getColFieldEntsPtr()->reserve(
567  last_col_field_ents_view_size);
568  }
569 
570  // Iterate over all field and check which one is on the element
571  for (unsigned int ii = 0; ii != BitFieldId().size(); ++ii) {
572 
573  // Common field id for ROW, COL and DATA
574  BitFieldId id_common = 0;
575  // Check if the field (ii) is added to finite element
576  for (int ss = 0; ss < LAST; ss++) {
577  id_common |= fe_fields[ss] & BitFieldId().set(ii);
578  }
579  if (id_common.none())
580  continue;
581 
582  // Find in database data associated with the field (ii)
583  const BitFieldId field_id = BitFieldId().set(ii);
584  auto miit = fields_by_id.find(field_id);
585  if (miit == fields_by_id.end())
586  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Field not found");
587  auto field_bit_number = (*miit)->getBitNumber();
588 
589  // Loop over adjacencies of element and find field entities on those
590  // adjacencies, that create hash map map_uid_fe which is used later
591  const std::string field_name = miit->get()->getName();
592  const bool add_to_data = (field_id & fe_fields[DATA]).any();
593  const bool add_to_row = (field_id & fe_fields[ROW]).any();
594  const bool add_to_col = (field_id & fe_fields[COL]).any();
595 
596  // Resolve entities on element, those entities are used to build tag
597  // with dof uids on finite element tag
598  adj_ents.clear();
599  CHKERR fe_raw_ptr->getElementAdjacency(*miit, adj_ents);
600 
601  for (auto ent : adj_ents) {
602 
603  auto dof_it = entsFields.get<Unique_mi_tag>().find(
604  FieldEntity::getLocalUniqueIdCalculate(field_bit_number, ent));
605  if (dof_it != entsFields.get<Unique_mi_tag>().end()) {
606 
607  if (add_to_data) {
608  fe_raw_ptr->getDataFieldEntsPtr()->emplace_back(*dof_it);
609  }
610  if (add_to_row && !row_as_data) {
611  fe_raw_ptr->getRowFieldEntsPtr()->emplace_back(*dof_it);
612  }
613  if (add_to_col && !col_as_row) {
614  fe_raw_ptr->getColFieldEntsPtr()->emplace_back(*dof_it);
615  }
616 
617  }
618  }
619  }
620 
621  // Sort field ents by uid
622  auto uid_comp = [](const auto &a, const auto &b) {
623  return a.lock()->getLocalUniqueId() < b.lock()->getLocalUniqueId();
624  };
625 
626  // Sort all views
627 
628  // Data
629  sort(fe_raw_ptr->getDataFieldEntsPtr()->begin(),
630  fe_raw_ptr->getDataFieldEntsPtr()->end(), uid_comp);
631  last_data_field_ents_view_size =
632  fe_raw_ptr->getDataFieldEntsPtr()->size();
633 
634  // Row
635  if (!row_as_data) {
636  sort(fe_raw_ptr->getRowFieldEntsPtr()->begin(),
637  fe_raw_ptr->getRowFieldEntsPtr()->end(), uid_comp);
638  last_row_field_ents_view_size =
639  fe_raw_ptr->getRowFieldEntsPtr()->size();
640  }
641 
642  // Column
643  if (!col_as_row) {
644  sort(fe_raw_ptr->getColFieldEntsPtr()->begin(),
645  fe_raw_ptr->getColFieldEntsPtr()->end(), uid_comp);
646  last_col_field_ents_view_size =
647  fe_raw_ptr->getColFieldEntsPtr()->size();
648  }
649  }
650  }
651 
653 }

◆ cache_problem_entities()

MoFEMErrorCode MoFEM::Core::cache_problem_entities ( const std::string  prb_name,
CacheTupleWeakPtr  cache_ptr 
)
protectedvirtual

Cache variables.

Parameters
prb_name
cache_ptr
Returns
MoFEMErrorCode

Implements MoFEM::CoreInterface.

Definition at line 798 of file ProblemsCore.cpp.

799  {
801 
802  if (auto cache_ptr = cache_weak_ptr.lock()) {
803  auto p_miit = pRoblems.get<Problem_mi_tag>().find(prb_name);
804  if (p_miit == pRoblems.get<Problem_mi_tag>().end())
805  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem not in database %s",
806  prb_name.c_str());
807 
808  const BitRefLevel &prb_bit = p_miit->getBitRefLevel();
809  const BitRefLevel &prb_mask = p_miit->getBitRefLevelMask();
810  const BitFEId &prb_fe_id = p_miit->getBitFEId();
811 
812  auto &row_dofs = p_miit->numeredRowDofsPtr;
813  auto &col_dofs = p_miit->numeredColDofsPtr;
814 
815  auto &cache_data = std::get<0>(*cache_ptr);
816  auto &cache_row = std::get<1>(*cache_ptr);
817  auto &cache_col = std::get<2>(*cache_ptr);
818 
819  cache_row.resize(entsFields.size());
820  if (row_dofs != col_dofs)
821  cache_col.resize(entsFields.size());
822  cache_data.resize(entsFields.size());
823 
824  size_t idx = 0;
825  for (auto it = entsFields.begin(); it != entsFields.end(); ++it, ++idx) {
826 
827  const auto uid = (*it)->getLocalUniqueId();
828  auto r = entFEAdjacencies.get<Unique_mi_tag>().equal_range(uid);
829  for (auto lo = r.first; lo != r.second; ++lo) {
830 
831  if ((lo->getBitFEId() & prb_fe_id).any()) {
832 
833  const BitRefLevel &fe_bit = lo->entFePtr->getBitRefLevel();
834 
835  // if entity is not problem refinement level
836  if (((fe_bit & prb_mask) != fe_bit) || ((fe_bit & prb_bit).none()))
837  continue;
838 
839  auto cache_numered_dofs = [&](auto &numered_dofs, auto &cache_vec,
840  auto &ent_cache) {
841  auto dit = numered_dofs->lower_bound(uid);
842  decltype(dit) hi_dit;
843  if (dit != numered_dofs->end())
844  hi_dit = numered_dofs->upper_bound(
845  uid | static_cast<UId>(MAX_DOFS_ON_ENTITY - 1));
846  else
847  hi_dit = dit;
848 
849  ent_cache = boost::shared_ptr<EntityCacheNumeredDofs>(
850  cache_ptr, &(cache_vec[idx]));
851  cache_vec[idx].loHi = {dit, hi_dit};
852  };
853 
854  auto cache_dofs = [&](auto &dofs, auto &cache_vec, auto &ent_cache) {
855  auto dit = dofs.lower_bound(uid);
856  decltype(dit) hi_dit;
857  if (dit != dofs.end())
858  hi_dit = dofs.upper_bound(
859  uid | static_cast<UId>(MAX_DOFS_ON_ENTITY - 1));
860  else
861  hi_dit = dit;
862 
863  ent_cache = boost::shared_ptr<EntityCacheDofs>(cache_ptr,
864  &(cache_vec[idx]));
865  cache_vec[idx].loHi = {dit, hi_dit};
866  };
867 
868  cache_numered_dofs(row_dofs, cache_row, (*it)->entityCacheRowDofs);
869  if (row_dofs != col_dofs) {
870  if (cache_col.size() != entsFields.size())
871  cache_col.resize(entsFields.size());
872  cache_numered_dofs(col_dofs, cache_col, (*it)->entityCacheColDofs);
873  } else {
874  (*it)->entityCacheColDofs = (*it)->entityCacheRowDofs;
875  }
876 
877  cache_dofs(dofsField, cache_data, (*it)->entityCacheDataDofs);
878 
879  break;
880  }
881  }
882  }
883  } else {
884  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Cache not allocated");
885  }
886 
888 }

◆ check_field()

bool MoFEM::Core::check_field ( const std::string &  name) const
protectedvirtual

check if field is in database

Parameters
namefield name
Returns
true if field exist

Implements MoFEM::CoreInterface.

Definition at line 57 of file FieldCore.cpp.

57  {
58  auto miit = fIelds.get<FieldName_mi_tag>().find(name);
59  if (miit == fIelds.get<FieldName_mi_tag>().end())
60  return false;
61  else
62  return true;
63 }

◆ check_finite_element()

bool MoFEM::Core::check_finite_element ( const std::string &  name) const
protectedvirtual

Check if finite element is in database.

Parameters
nameName of finite element
Returns
true if element is declared

Implements MoFEM::CoreInterface.

Definition at line 35 of file FECore.cpp.

35  {
36  auto miit = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
37  if (miit == finiteElements.get<FiniteElement_name_mi_tag>().end())
38  return false;
39  else
40  return true;
41 }

◆ check_number_of_ents_in_ents_field() [1/2]

MoFEMErrorCode MoFEM::Core::check_number_of_ents_in_ents_field ( ) const
protectedvirtual

check data consistency in entitiesPtr

Implements MoFEM::CoreInterface.

Definition at line 1437 of file FieldCore.cpp.

1437  {
1439  for (auto &it : fIelds.get<FieldName_mi_tag>()) {
1440  if (it->getSpace() == NOFIELD)
1441  continue; // FIXME: should be treated properly, not test is just
1442  // skipped for this NOFIELD space
1443  EntityHandle meshset = it->getMeshset();
1444  int num_entities;
1445  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1446 
1447  auto count_field_ents = [&]() {
1448  auto bit_number = it->getBitNumber();
1449  auto low_eit = entsFields.get<Unique_mi_tag>().lower_bound(
1450  FieldEntity::getLoBitNumberUId(bit_number));
1451  auto hi_eit = entsFields.get<Unique_mi_tag>().upper_bound(
1452  FieldEntity::getHiBitNumberUId(bit_number));
1453  return std::distance(low_eit, hi_eit);
1454  };
1455 
1456  if (count_field_ents() > (unsigned int)num_entities) {
1457  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1458  "not equal number of entities in meshset and field "
1459  "multiindex < %s >",
1460  it->getName().c_str());
1461  }
1462  }
1464 }

◆ check_number_of_ents_in_ents_field() [2/2]

MoFEMErrorCode MoFEM::Core::check_number_of_ents_in_ents_field ( const std::string &  name) const
protectedvirtual

check data consistency in entitiesPtr

Implements MoFEM::CoreInterface.

Definition at line 1409 of file FieldCore.cpp.

1409  {
1411  auto it = fIelds.get<FieldName_mi_tag>().find(name);
1412  if (it == fIelds.get<FieldName_mi_tag>().end()) {
1413  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1414  "field not found < %s >", name.c_str());
1415  }
1416  EntityHandle meshset = (*it)->getMeshset();
1417  int num_entities;
1418  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1419 
1420  auto count_field_ents = [&]() {
1421  auto bit_number = (*it)->getBitNumber();
1422  auto low_eit = entsFields.get<Unique_mi_tag>().lower_bound(
1423  FieldEntity::getLoBitNumberUId(bit_number));
1424  auto hi_eit = entsFields.get<Unique_mi_tag>().upper_bound(
1425  FieldEntity::getHiBitNumberUId(bit_number));
1426  return std::distance(low_eit, hi_eit);
1427  };
1428 
1429  if (count_field_ents() > (unsigned int)num_entities) {
1430  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1431  "not equal number of entities in meshset and field multiindex "
1432  "< %s >",
1433  name.c_str());
1434  }
1436 }

◆ check_number_of_ents_in_ents_finite_element() [1/2]

MoFEMErrorCode MoFEM::Core::check_number_of_ents_in_ents_finite_element ( ) const
protectedvirtual

check data consistency in entsFiniteElements

Implements MoFEM::CoreInterface.

Definition at line 885 of file FECore.cpp.

885  {
887  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
888  it = finiteElements.get<FiniteElement_name_mi_tag>().begin();
889  for (; it != finiteElements.get<FiniteElement_name_mi_tag>().end(); it++) {
890  EntityHandle meshset = (*it)->getMeshset();
891 
892  int num_entities;
893  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
894 
895  auto counts_fes = [&]() {
896  return std::distance(get_fe_by_name_begin((*it)->getName()),
897  get_fe_by_name_end((*it)->getName()));
898  };
899 
900  if (counts_fes() != static_cast<size_t>(num_entities)) {
902  "not equal number of entities in meshset and finite elements "
903  "multiindex < %s >",
904  (*it)->getName().c_str());
905  }
906  }
908 }

◆ check_number_of_ents_in_ents_finite_element() [2/2]

MoFEMErrorCode MoFEM::Core::check_number_of_ents_in_ents_finite_element ( const std::string &  name) const
protectedvirtual

check data consistency in entsFiniteElements

Implements MoFEM::CoreInterface.

Definition at line 858 of file FECore.cpp.

859  {
861  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
862  it = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
863  if (it == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
864  SETERRQ1(mofemComm, 1, "finite element not found < %s >", name.c_str());
865  }
866  EntityHandle meshset = (*it)->getMeshset();
867 
868  int num_entities;
869  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
870 
871  auto counts_fes = [&]() {
872  return std::distance(get_fe_by_name_begin((*it)->getName()),
873  get_fe_by_name_end((*it)->getName()));
874  };
875 
876  if (counts_fes() != static_cast<size_t>(num_entities)) {
878  "not equal number of entities in meshset and finite elements "
879  "multiindex < %s >",
880  (*it)->getName().c_str());
881  }
883 }

◆ check_problem()

bool MoFEM::CoreTmp< 0 >::check_problem ( const std::string  name)
protectedvirtual

check if problem exist

Parameters
nameproblem name
Returns
true if problem is in database

Implements MoFEM::CoreInterface.

◆ clear_adjacencies_entities() [1/3]

MoFEMErrorCode MoFEM::Core::clear_adjacencies_entities ( const BitRefLevel  bit,
const BitRefLevel  mask,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

clear adjacency map for entities on given bit level

Parameters
bit
mask

Implements MoFEM::CoreInterface.

Definition at line 201 of file DeleteCore.cpp.

203  {
205  if (verb == -1)
206  verb = verbose;
207  Range ents;
208  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
211 }

◆ clear_adjacencies_entities() [2/3]

MoFEMErrorCode MoFEM::Core::clear_adjacencies_entities ( const Range  ents,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

clear adjacencies for field entities by entities

Implements MoFEM::CoreInterface.

Definition at line 213 of file DeleteCore.cpp.

213  {
215  if (verb == -1)
216  verb = verbose;
217  for (Range::const_pair_iterator p_eit = ents.pair_begin();
218  p_eit != ents.pair_end(); ++p_eit) {
219  const EntityHandle first = p_eit->first;
220  const EntityHandle second = p_eit->second;
221  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
222  Ent_mi_tag>::type::iterator ait,
223  hi_ait;
224  ait = entFEAdjacencies.get<Ent_mi_tag>().lower_bound(first);
225  hi_ait = entFEAdjacencies.get<Ent_mi_tag>().upper_bound(second);
226  entFEAdjacencies.get<Ent_mi_tag>().erase(ait, hi_ait);
227  }
229 }

◆ clear_adjacencies_entities() [3/3]

MoFEMErrorCode MoFEM::Core::clear_adjacencies_entities ( const std::string  name,
const Range  ents,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

clear adjacencies for field entities by entities and field namd

Implements MoFEM::CoreInterface.

Definition at line 231 of file DeleteCore.cpp.

232  {
234  if (verb == -1)
235  verb = verbose;
236 
237  const Field *field_ptr = get_field_structure(name);
238  int field_bit_number = field_ptr->getBitNumber();
239 
240  for (Range::const_pair_iterator p_eit = ents.pair_begin();
241  p_eit != ents.pair_end(); p_eit++) {
242 
243  // First and last handle
244  const EntityHandle first = p_eit->first;
245  const EntityHandle second = p_eit->second;
246 
247  // Get UId
248  UId first_uid =
249  FieldEntity::getLocalUniqueIdCalculate(field_bit_number, first);
250  UId second_uid =
251  FieldEntity::getLocalUniqueIdCalculate(field_bit_number, second);
252 
253  // Find adjacencies
254  auto ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound(first_uid);
255  auto hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound(second_uid);
256  entFEAdjacencies.get<Unique_mi_tag>().erase(ait, hi_ait);
257  }
259 }

◆ clear_adjacencies_finite_elements() [1/3]

MoFEMErrorCode MoFEM::Core::clear_adjacencies_finite_elements ( const BitRefLevel  bit,
const BitRefLevel  mask,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

clear adjacency map for finite elements on given bit level

Parameters
bit
mask

Implements MoFEM::CoreInterface.

Definition at line 312 of file DeleteCore.cpp.

314  {
316  Range ents;
317  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
320 }

◆ clear_adjacencies_finite_elements() [2/3]

MoFEMErrorCode MoFEM::Core::clear_adjacencies_finite_elements ( const Range  ents,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 322 of file DeleteCore.cpp.

323  {
325  if (verb == -1)
326  verb = verbose;
327  for (Range::const_pair_iterator p_eit = ents.pair_begin();
328  p_eit != ents.pair_end(); p_eit++) {
329  EntityHandle first = p_eit->first;
330  EntityHandle second = p_eit->second;
331  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
332  FEEnt_mi_tag>::type::iterator ait,
333  hi_ait;
334  ait = entFEAdjacencies.get<FEEnt_mi_tag>().lower_bound(first);
335  hi_ait = entFEAdjacencies.get<FEEnt_mi_tag>().upper_bound(second);
336  entFEAdjacencies.get<FEEnt_mi_tag>().erase(ait, hi_ait);
337  }
339 }

◆ clear_adjacencies_finite_elements() [3/3]

MoFEMErrorCode MoFEM::Core::clear_adjacencies_finite_elements ( const std::string  name,
const Range  ents,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 341 of file DeleteCore.cpp.

343  {
345  if (verb == -1)
346  verb = verbose;
347 
348  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator
349  it_fe = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
350  if (it_fe != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
351 
352  const auto fe_uid = (*it_fe)->getFEUId();
353 
354  for (Range::const_pair_iterator p_eit = ents.pair_begin();
355  p_eit != ents.pair_end(); p_eit++) {
356 
357  // First and last handle
358  const EntityHandle first = p_eit->first;
359  const EntityHandle second = p_eit->second;
360 
361  // Get UId
362  UId first_uid =
364  UId second_uid =
366 
367  // Find and remove adjacencies
368  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
369  FE_Unique_mi_tag>::type::iterator ait,
370  hi_ait;
371  ait = entFEAdjacencies.get<FE_Unique_mi_tag>().lower_bound(first_uid);
372  hi_ait = entFEAdjacencies.get<FE_Unique_mi_tag>().upper_bound(second_uid);
373  entFEAdjacencies.get<FE_Unique_mi_tag>().erase(ait, hi_ait);
374  }
375  }
377 }

◆ clear_database()

MoFEMErrorCode MoFEM::Core::clear_database ( int  verb = DEFAULT_VERBOSITY)
protectedvirtual

Clear database.

Parameters
verbVerbosity level
Returns
Error code

Implements MoFEM::CoreInterface.

Definition at line 728 of file Core.cpp.

728  {
730  if (verb == -1)
731  verb = verbose;
732  CHKERR clearMap();
734 }

◆ clear_dofs_fields() [1/2]

MoFEMErrorCode MoFEM::Core::clear_dofs_fields ( const Range  ents,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Clear dofs by ents

Implements MoFEM::CoreInterface.

Definition at line 57 of file DeleteCore.cpp.

57  {
59  if (verb == -1)
60  verb = verbose;
61 
62  for (Range::const_pair_iterator p_eit = ents.pair_begin();
63  p_eit != ents.pair_end(); p_eit++) {
64  EntityHandle first = p_eit->first;
65  EntityHandle second = p_eit->second;
66  // get dofs range
67  DofEntityByEnt::iterator dit, hi_dit;
68  dit = dofsField.get<Ent_mi_tag>().lower_bound(first);
69  if (dit == dofsField.get<Ent_mi_tag>().end())
70  continue;
71  hi_dit = dofsField.get<Ent_mi_tag>().upper_bound(second);
72  // finally clear dofs
73  dofsField.get<Ent_mi_tag>().erase(dit, hi_dit);
74  }
76 }

◆ clear_dofs_fields() [2/2]

MoFEMErrorCode MoFEM::Core::clear_dofs_fields ( const std::string  name,
const Range  ents,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Clear dofs by field name and ents

Implements MoFEM::CoreInterface.

Definition at line 78 of file DeleteCore.cpp.

79  {
81  if (verb == -1)
82  verb = verbose;
83 
84  const auto bit_number = get_field_bit_number(name);
85 
86  for (Range::const_pair_iterator p_eit = ents.pair_begin();
87  p_eit != ents.pair_end(); p_eit++) {
88  const auto first = p_eit->first;
89  const auto second = p_eit->second;
90  const auto lo_uid = DofEntity::getLoFieldEntityUId(bit_number, first);
91  const auto hi_uid = DofEntity::getHiFieldEntityUId(bit_number, second);
92  auto dit = dofsField.get<Unique_mi_tag>().lower_bound(lo_uid);
93  auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(hi_uid);
94  dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
95  }
97 }

◆ clear_dofs_fields_by_bit_ref()

MoFEMErrorCode MoFEM::Core::clear_dofs_fields_by_bit_ref ( const BitRefLevel  bit,
const BitRefLevel  mask,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Clear dofs by bit level

Implements MoFEM::CoreInterface.

Definition at line 45 of file DeleteCore.cpp.

47  {
49  if (verb == -1)
50  verb = verbose;
51  Range ents;
52  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
53  CHKERR clear_dofs_fields(ents, verb);
55 }

◆ clear_ents_fields() [1/2]

MoFEMErrorCode MoFEM::Core::clear_ents_fields ( const Range  ents,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Clear entities by field name

Implements MoFEM::CoreInterface.

Definition at line 113 of file DeleteCore.cpp.

113  {
115  if (verb == -1)
116  verb = verbose;
117  CHKERR clear_dofs_fields(ents, verb);
119  for (Range::const_pair_iterator p_eit = ents.pair_begin();
120  p_eit != ents.pair_end(); p_eit++) {
121  EntityHandle first = p_eit->first;
122  EntityHandle second = p_eit->second;
123  FieldEntity_multiIndex::index<Ent_mi_tag>::type::iterator dit, hi_dit;
124  dit = entsFields.get<Ent_mi_tag>().lower_bound(first);
125  hi_dit = entsFields.get<Ent_mi_tag>().upper_bound(second);
126  entsFields.get<Ent_mi_tag>().erase(dit, hi_dit);
127  }
129 }

◆ clear_ents_fields() [2/2]

MoFEMErrorCode MoFEM::Core::clear_ents_fields ( const std::string  name,
const Range  ents,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Clear entities by field name

Implements MoFEM::CoreInterface.

Definition at line 131 of file DeleteCore.cpp.

132  {
134  if (verb == -1)
135  verb = verbose;
136  const auto bit_number = get_field_bit_number(name);
137  CHKERR clear_dofs_fields(name, ents, verb);
138  CHKERR clear_adjacencies_entities(name, ents, verb);
139  for (Range::const_pair_iterator p_eit = ents.pair_begin();
140  p_eit != ents.pair_end(); p_eit++) {
141  const auto first = p_eit->first;
142  const auto second = p_eit->second;
143  auto dit = entsFields.get<Unique_mi_tag>().lower_bound(
144  FieldEntity::getLocalUniqueIdCalculate(bit_number, first));
145  auto hi_dit = entsFields.get<Unique_mi_tag>().upper_bound(
146  FieldEntity::getLocalUniqueIdCalculate(bit_number, second));
147  entsFields.get<Unique_mi_tag>().erase(dit, hi_dit);
148  }
150 }

◆ clear_ents_fields_by_bit_ref()

MoFEMErrorCode MoFEM::Core::clear_ents_fields_by_bit_ref ( const BitRefLevel  bit,
const BitRefLevel  mask,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Clear ents by bit level

Implements MoFEM::CoreInterface.

Definition at line 99 of file DeleteCore.cpp.

101  {
103  if (verb == -1)
104  verb = verbose;
105  Range ents;
106  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
107  CHKERR clear_dofs_fields(ents, verb);
109  CHKERR clear_ents_fields(ents, verb);
111 }

◆ clear_finite_elements() [1/2]

MoFEMErrorCode MoFEM::Core::clear_finite_elements ( const Range ents,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 273 of file DeleteCore.cpp.

273  {
275  if (verb == -1)
276  verb = verbose;
278  for (Range::const_pair_iterator p_eit = ents.pair_begin();
279  p_eit != ents.pair_end(); p_eit++) {
280  EntityHandle first = p_eit->first;
281  EntityHandle second = p_eit->second;
282  EntFiniteElement_multiIndex::index<Ent_mi_tag>::type::iterator fit, hi_fit;
283  fit = entsFiniteElements.get<Ent_mi_tag>().lower_bound(first);
284  hi_fit = entsFiniteElements.get<Ent_mi_tag>().upper_bound(second);
285  entsFiniteElements.get<Ent_mi_tag>().erase(fit, hi_fit);
286  }
288 }

◆ clear_finite_elements() [2/2]

MoFEMErrorCode MoFEM::Core::clear_finite_elements ( const std::string &  fe_name,
const Range ents,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 290 of file DeleteCore.cpp.

291  {
293  if (verb == -1)
294  verb = verbose;
295  CHKERR clear_adjacencies_finite_elements(fe_name, ents, verb);
296  auto fe_miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
297  if (fe_miit == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
298  for (Range::const_pair_iterator p_eit = ents.pair_begin();
299  p_eit != ents.pair_end(); p_eit++) {
300  auto fit = entsFiniteElements.get<Unique_mi_tag>().lower_bound(
302  (*fe_miit)->getFEUId()));
303  auto hi_fit = entsFiniteElements.get<Unique_mi_tag>().upper_bound(
305  (*fe_miit)->getFEUId()));
306  fit = entsFiniteElements.get<Unique_mi_tag>().erase(fit, hi_fit);
307  }
308  }
310 }

◆ clear_finite_elements_by_bit_ref()

MoFEMErrorCode MoFEM::Core::clear_finite_elements_by_bit_ref ( const BitRefLevel  bit,
const BitRefLevel  mask,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 261 of file DeleteCore.cpp.

263  {
265  if (verb == -1)
266  verb = verbose;
267  Range ents;
268  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
269  CHKERR clear_finite_elements(ents, verb);
271 }

◆ clear_inactive_dofs()

MoFEMErrorCode MoFEM::Core::clear_inactive_dofs ( int  verb = DEFAULT_VERBOSITY)
protectedvirtual

Clear inactive dofs

Implements MoFEM::CoreInterface.

Definition at line 29 of file DeleteCore.cpp.

29  {
31  if (verb == -1)
32  verb = verbose;
33  Range ents;
34  for (DofEntity_multiIndex::iterator dit = dofsField.begin();
35  dit != dofsField.end();) {
36  if (!dit->get()->getActive()) {
37  dit = dofsField.erase(dit);
38  } else {
39  ++dit;
40  }
41  }
43 }

◆ clear_problem()

MoFEMErrorCode MoFEM::Core::clear_problem ( const std::string  name,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

clear problem

Implements MoFEM::CoreInterface.

Definition at line 269 of file ProblemsCore.cpp.

269  {
271  if (verb == -1)
272  verb = verbose;
274  ProblemsByName &prob_by_name = pRoblems.get<Problem_mi_tag>();
275  ProblemsByName::iterator p_miit = prob_by_name.find(problem_name);
276  if (p_miit == prob_by_name.end()) {
277  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
278  "problem < %s > not found, (top tip: check spelling)",
279  problem_name.c_str());
280  }
281  // zero rows
282  bool success = prob_by_name.modify(p_miit, ProblemZeroNbRowsChange());
283  if (!success)
284  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
285  "modification unsuccessful");
286  // zero cols
287  success = prob_by_name.modify(p_miit, ProblemZeroNbColsChange());
288  if (!success)
289  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
290  "modification unsuccessful");
291  // clear finite elements
292  success =
293  prob_by_name.modify(p_miit, ProblemClearNumeredFiniteElementsChange());
294  if (!success)
295  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
296  "modification unsuccessful");
297  // clear data structures
298  success = prob_by_name.modify(p_miit, ProblemClearSubProblemData());
299  if (!success)
300  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
301  "modification unsuccessful");
302  success = prob_by_name.modify(p_miit, ProblemClearComposedProblemData());
303  if (!success)
304  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
305  "modification unsuccessful");
306  if (p_miit->getRowDofsSequence())
307  p_miit->getRowDofsSequence()->clear();
308  if (p_miit->getColDofsSequence())
309  p_miit->getColDofsSequence()->clear();
310  if (p_miit->getSubData())
311  p_miit->getSubData().reset();
312  if (p_miit->getComposedProblemsData())
313  p_miit->getComposedProblemsData().reset();
315 }

◆ clear_problems()

MoFEMErrorCode MoFEM::Core::clear_problems ( int  verb = DEFAULT_VERBOSITY)
protectedvirtual

clear problems

Implements MoFEM::CoreInterface.

Definition at line 338 of file ProblemsCore.cpp.

338  {
340  if (verb == -1)
341  verb = verbose;
342  // iterate problems
343  for (auto p_miit = pRoblems.begin(); p_miit != pRoblems.end(); p_miit++)
344  CHKERR clear_problem(p_miit->getName(), verb);
346 }

◆ clearMap()

MoFEMErrorCode MoFEM::Core::clearMap ( )
protected

Cleaning database.

Definition at line 503 of file Core.cpp.

503  {
505  // Cleaning databases in interfaces
506  CHKERR getInterface<SeriesRecorder>()->clearMap();
507  CHKERR getInterface<MeshsetsManager>()->clearMap();
508  CHKERR getInterface<CutMeshInterface>()->clearMap();
509  // Cleaning databases
510  refinedEntities.clear();
511  refinedFiniteElements.clear();
512  fIelds.clear();
513  entsFields.clear();
514  dofsField.clear();
515  finiteElements.clear();
516  entsFiniteElements.clear();
517  entFEAdjacencies.clear();
518  pRoblems.clear();
520 }

◆ coreGenericConstructor()

MoFEMErrorCode MoFEM::Core::coreGenericConstructor ( moab::Interface &  moab,
MPI_Comm  comm,
const int  verbose 
)
protected

Definition at line 197 of file Core.cpp.

198  {
200 
201  // This is deprecated ONE should use MoFEM::Core::Initialize
203  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
204  "MoFEM globally is not initialised, call MoFEM::Core::Initialize");
205 
206  // Create duplicate communicator
207  wrapMPIMOABComm = boost::make_shared<WrapMPIComm>(comm, false);
208 
209  MPI_Comm_size(mofemComm, &sIze);
210  MPI_Comm_rank(mofemComm, &rAnk);
211 
212  // CHeck if moab has set communicator if not set communicator interbally
213  ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
214  if (pComm == NULL)
215  pComm = new ParallelComm(&moab, wrapMPIMOABComm->get_comm());
216 
217  // Register interfaces for this implementation
218  CHKERR registerInterface<UnknownInterface>();
219  CHKERR registerInterface<CoreInterface>();
220  CHKERR registerInterface<DeprecatedCoreInterface>();
221 
222  // Register MOFEM events in PETSc
223  PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
224  PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
225  PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
226  PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
227 
228  MOFEM_LOG_CHANNEL("WORLD");
229  MOFEM_LOG_CHANNEL("SELF");
230  MOFEM_LOG_CHANNEL("SYNC");
231 
233 }

◆ create_vertices_and_add_to_field()

MoFEMErrorCode MoFEM::Core::create_vertices_and_add_to_field ( const std::string  name,
const double  coords[],
int  size,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Create a vertices and add to field object.

Create vertices and add them to field. Those vertices would be carring DOFs of the field.

Note
This function is typically used when NOFIELD is created, for example load factor in arc-length control.
Parameters
namename of the field
bitbit ref level of the created vertices
coordsof the vertices
sizenumber of vertices
verbverbosity level
Returns
MoFEMErrorCode

Implements MoFEM::CoreInterface.

Definition at line 467 of file FieldCore.cpp.

469  {
471 
472  if (verb == DEFAULT_VERBOSITY)
473  verb = verbose;
474 
475  Range verts;
476 
477  auto create_vertices = [&]() {
479 
480  vector<double *> arrays_coord;
481  EntityHandle startv = 0;
482  ReadUtilIface *iface;
483  CHKERR get_moab().query_interface(iface);
484  CHKERR iface->get_node_coords(3, size, 0, startv, arrays_coord);
485  verts.insert(startv, startv + size - 1);
486  for (int n = 0; n != size; ++n)
487  for (auto d : {0, 1, 2})
488  arrays_coord[d][n] = coords[3 * n + d];
489 
491  };
492 
493  auto add_verts_to_field = [&]() {
495  EntityHandle field_meshset = get_field_meshset(name);
496  CHKERR get_moab().add_entities(field_meshset, verts);
498  };
499 
500  CHKERR create_vertices();
501  CHKERR add_verts_to_field();
502 
504 }

◆ delete_ents_by_bit_ref()

MoFEMErrorCode MoFEM::Core::delete_ents_by_bit_ref ( const BitRefLevel  bit,
const BitRefLevel  mask,
const bool  remove_parent = false,
int  verb = DEFAULT_VERBOSITY,
MoFEMTypes  mf = MF_ZERO 
)
protectedvirtual

delete entities form mofem and moab database

Implements MoFEM::CoreInterface.

Definition at line 535 of file DeleteCore.cpp.

538  {
540  if (verb == -1)
541  verb = verbose;
542 
543  Range ents;
544  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
545  Range ents_meshsets = ents.subset_by_type(MBENTITYSET);
546  ents = subtract(ents, ents_meshsets);
547  if(ents.empty()) {
548  if (verb >= VERBOSE)
549  MOFEM_LOG("WORLD", Sev::verbose) << "Nb. of deleted entities 0";
551  }
552 
553  if (verb >= VERBOSE)
554  MOFEM_LOG("WORLD", Sev::noisy) << "Deleted ents:\n" << ents;
555 
556  CHKERR remove_ents(ents, verb);
557 
558  // remove parent
559  if (remove_parent) {
561  }
562 
563  Range meshsets;
564  CHKERR get_moab().get_entities_by_type(0, MBENTITYSET, meshsets, true);
565  for (auto m : meshsets) {
566  CHKERR get_moab().remove_entities(m, ents);
567 
568  }
569 
570  rval = get_moab().delete_entities(ents);
571  if (rval != MB_SUCCESS) {
573  if (verb == QUIET) {
574  MOFEM_LOG("SELF", Sev::noisy) << "Problem deleting:\n" << ents;
575  } else {
576  MOFEM_LOG("SELF", Sev::warning) << "Problem deleting:\n" << ents;
577  }
578  MOFEM_LOG_CHANNEL("WORLD");
579  MOFEM_LOG_TAG("WORLD", "DeleteCore");
580  if (!(mf & MF_NOT_THROW)) {
581  CHK_MOAB_THROW(rval, "Can not delete entities");
582  } else {
583  rval = MB_SUCCESS;
584  }
585  }
586 
587  MOFEM_LOG_C("SELF", Sev::noisy, "Nb. of deleted entities %d", ents.size());
588 
590 }

◆ delete_field()

MoFEMErrorCode MoFEM::Core::delete_field ( const std::string  name,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Delete field.

Parameters
namefield name
verbverbosity level
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 609 of file DeleteCore.cpp.

609  {
611  auto &f = fIelds.get<FieldName_mi_tag>();
612  auto mit = f.find(name);
613  if (mit == f.end()) {
614  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
615  "Finite element <%s> not found", name.c_str());
616  }
617  EntityHandle meshset = mit->get()->getMeshset();
618  Range ents;
619  CHKERR get_moab().get_entities_by_handle(meshset, ents, false);
620  CHKERR remove_ents_from_field(name, ents, verb);
621  CHKERR get_moab().tag_delete((*mit)->th_FieldDataVerts);
622  CHKERR get_moab().tag_delete((*mit)->th_FieldData);
623  CHKERR get_moab().tag_delete((*mit)->th_AppOrder);
624  f.erase(mit);
625  CHKERR get_moab().delete_entities(&meshset, 1);
627 }

◆ delete_finite_element()

MoFEMErrorCode MoFEM::Core::delete_finite_element ( const std::string  name,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

delete finite element from mofem database

Implements MoFEM::CoreInterface.

Definition at line 592 of file DeleteCore.cpp.

592  {
594  auto &fe = finiteElements.get<FiniteElement_name_mi_tag>();
595  auto mit = fe.find(name);
596  if (mit == fe.end()) {
597  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
598  "Finite element <%s> not found", name.c_str());
599  }
600  EntityHandle meshset = mit->get()->getMeshset();
601  Range ents;
602  CHKERR get_moab().get_entities_by_handle(meshset, ents, false);
603  CHKERR remove_ents_from_finite_element(name, ents, verb);
604  fe.erase(mit);
605  CHKERR get_moab().delete_entities(&meshset, 1);
607 }

◆ delete_problem()

MoFEMErrorCode MoFEM::Core::delete_problem ( const std::string  name)
protectedvirtual

Delete problem.

Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.

Implements MoFEM::CoreInterface.

Definition at line 108 of file ProblemsCore.cpp.

108  {
110  auto p_miit = pRoblems.get<Problem_mi_tag>().find(name);
111  if (p_miit == pRoblems.get<Problem_mi_tag>().end()) {
112  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "no such problem like < %s >",
113  name.c_str());
114  }
115  const EntityHandle meshset = p_miit->meshset;
116  pRoblems.get<Problem_mi_tag>().erase(p_miit);
117  CHKERR get_moab().delete_entities(&meshset, 1);
119 }

◆ Finalize()

MoFEMErrorCode MoFEM::Core::Finalize ( )
static

Checks for options to be called at the conclusion of the program.

MPI_Finalize() is called only if the user had not called MPI_Init() before calling Initialize.

Note
This function calls PetscInitialize, for more details see http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscFinalize.html
Returns
MoFEMErrorCode
Examples
add_blockset.cpp, add_cubit_meshsets.cpp, adolc_plasticity.cpp, analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, approx_sphere.cpp, bernstein_bezier_generate_base.cpp, bone_adaptation.cpp, boundary_marker.cpp, build_large_problem.cpp, build_problems.cpp, cell_forces.cpp, child_and_parent.cpp, continuity_check_on_contact_prism_side_ele.cpp, continuity_check_on_skeleton_3d.cpp, continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, cubit_bc_test.cpp, delete_ho_nodes.cpp, dg_projection.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, dynamic_first_order_con_law.cpp, edge_and_bubble_shape_functions_on_quad.cpp, eigen_elastic.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, ep.cpp, field_blas.cpp, field_evaluator.cpp, field_to_vertices.cpp, forces_and_sources_testing_edge_element.cpp, forces_and_sources_testing_flat_prism_element.cpp, forces_and_sources_testing_users_base.cpp, free_surface.cpp, gauss_points_on_outer_product.cpp, hanging_node_approx.cpp, hcurl_check_approx_in_2d.cpp, hcurl_curl_operator.cpp, hcurl_divergence_operator_2d.cpp, hdiv_check_approx_in_3d.cpp, hdiv_divergence_operator.cpp, heat_equation.cpp, heat_method.cpp, hello_world.cpp, helmholtz.cpp, hertz_surface.cpp, higher_derivatives.cpp, level_set.cpp, log.cpp, loop_entities.cpp, lorentz_force.cpp, magnetostatic.cpp, matrix_function.cpp, mesh_cut.cpp, mesh_insert_interface_atom.cpp, mesh_smoothing.cpp, meshset_to_vtk.cpp, minimal_surface_area.cpp, mixed_poisson.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, node_merge.cpp, nonlinear_dynamics.cpp, nonlinear_elastic.cpp, operators_tests.cpp, partition_mesh.cpp, petsc_smart_ptr_objects.cpp, phase.cpp, photon_diffusion.cpp, plastic.cpp, plate.cpp, plot_base.cpp, poisson_2d_dis_galerkin.cpp, poisson_2d_homogeneous.cpp, prism_elements_from_surface.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, reaction_diffusion.cpp, remove_entities_from_problem.cpp, remove_entities_from_problem_not_partitioned.cpp, scalar_check_approximation.cpp, schur_test_diag_mat.cpp, seepage.cpp, shallow_wave.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, simple_interface.cpp, simple_l2_only.cpp, split_sideset.cpp, tensor_divergence_operator.cpp, test_broken_space.cpp, test_cache_on_entities.cpp, test_jacobian_of_simple_contact_element.cpp, testing_jacobian_of_hook_element.cpp, testing_jacobian_of_hook_scaled_with_density_element.cpp, thermo_elastic.cpp, unsaturated_transport.cpp, wave_equation.cpp, and wavy_surface.cpp.

Definition at line 112 of file Core.cpp.

112  {
113  if (isGloballyInitialised) {
114  PetscPopErrorHandler();
115  isGloballyInitialised = false;
116 
117  if (isInitialized == PETSC_FALSE) {
118  PetscBool is_finalized;
119  PetscFinalized(&is_finalized);
120  if (!is_finalized)
121  PetscFinalize();
122  }
123 
124  if (!mpiInitialised) {
125  int mpi_finalized;
126  MPI_Finalized(&mpi_finalized);
127  if (!mpi_finalized)
128  MPI_Finalize();
129  }
130  }
131 
132  return 0;
133 }

◆ get_basic_entity_data_ptr()

boost::shared_ptr<BasicEntityData>& MoFEM::CoreTmp< 0 >::get_basic_entity_data_ptr ( )
inlineprotectedvirtual

Get pointer to basic entity data.

This structure keeps data like tags handlers and other data used to construct mofem entities, dofs and finite elements.

Implements MoFEM::CoreInterface.

Definition at line 290 of file Core.hpp.

290  {
291  return basicEntityDataPtr;
292  }

◆ get_comm()

MPI_Comm& MoFEM::CoreTmp< 0 >::get_comm ( ) const
inlineprotectedvirtual
Returns
return communicator

Implements MoFEM::CoreInterface.

Definition at line 1021 of file Core.hpp.

1021 { return mofemComm; }

◆ get_comm_rank()

int MoFEM::CoreTmp< 0 >::get_comm_rank ( ) const
inlineprotectedvirtual
Returns
return communicator rank/processor

Implements MoFEM::CoreInterface.

Definition at line 1031 of file Core.hpp.

1031 { return rAnk; }

◆ get_comm_size()

int MoFEM::CoreTmp< 0 >::get_comm_size ( ) const
inlineprotectedvirtual
Returns
return communicator size

Implements MoFEM::CoreInterface.

Definition at line 1026 of file Core.hpp.

1026 { return sIze; }

◆ get_dofs() [1/2]

const DofEntity_multiIndex * MoFEM::Core::get_dofs ( ) const
protectedvirtual

Get the dofs object.

Returns
const DofEntity_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 890 of file Core.cpp.

890 { return &dofsField; }

◆ get_dofs() [2/2]

MoFEMErrorCode MoFEM::Core::get_dofs ( const DofEntity_multiIndex **  dofs_ptr) const
protectedvirtual

Get dofs multi index.

Implements MoFEM::CoreInterface.

Definition at line 829 of file Core.cpp.

829  {
831  *dofs_ptr = &dofsField;
833 }

◆ get_dofs_by_name_and_ent_begin()

DofEntityByUId::iterator MoFEM::Core::get_dofs_by_name_and_ent_begin ( const std::string &  field_name,
const EntityHandle  ent 
) const
protectedvirtual

get begin iterator of field dofs of given name and ent(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,ENT,IT)

for(IT_GET_DOFS_FIELD_BY_NAME_AND_ENT_FOR_LOOP(MFIELD,NAME,ENT,IT)) { ... }

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1381 of file FieldCore.cpp.

1382  {
1383  return dofsField.get<Unique_mi_tag>().lower_bound(
1385  ent));
1386 }

◆ get_dofs_by_name_and_ent_end()

DofEntityByUId::iterator MoFEM::Core::get_dofs_by_name_and_ent_end ( const std::string &  field_name,
const EntityHandle  ent 
) const
protectedvirtual

get begin iterator of field dofs of given name and ent (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,ENT,IT)

for(IT_GET_DOFS_FIELD_BY_NAME_AND_ENT_FOR_LOOP(MFIELD,NAME,ENT,IT)) { ... }

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1388 of file FieldCore.cpp.

1389  {
1390  return dofsField.get<Unique_mi_tag>().upper_bound(
1392  ent));
1393 }

◆ get_dofs_by_name_and_type_begin()

DofEntityByUId::iterator MoFEM::Core::get_dofs_by_name_and_type_begin ( const std::string &  field_name,
const EntityType  type 
) const
protectedvirtual

get begin iterator of field dofs of given name and ent type (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT)

for(IT_GET_DOFS_FIELD_BY_NAME_AND_TYPE_FOR_LOOP(MFIELD,NAME,TYPE,IT)) { ... }

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1395 of file FieldCore.cpp.

1396  {
1397  return dofsField.get<Unique_mi_tag>().lower_bound(
1400 }

◆ get_dofs_by_name_and_type_end()

DofEntityByUId::iterator MoFEM::Core::get_dofs_by_name_and_type_end ( const std::string &  field_name,
const EntityType  type 
) const
protectedvirtual

get begin iterator of field dofs of given name end ent type(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT)

for(IT_GET_DOFS_FIELD_BY_NAME_AND_TYPE_FOR_LOOP(MFIELD,NAME,TYPE,IT)) { ... }

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1402 of file FieldCore.cpp.

1403  {
1404  return dofsField.get<Unique_mi_tag>().upper_bound(
1407 }

◆ get_dofs_by_name_begin()

DofEntityByUId::iterator MoFEM::Core::get_dofs_by_name_begin ( const std::string &  field_name) const
protectedvirtual

get begin iterator of field dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)

for(IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... }

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1371 of file FieldCore.cpp.

1371  {
1372  return dofsField.get<Unique_mi_tag>().lower_bound(
1374 }

◆ get_dofs_by_name_end()

DofEntityByUId::iterator MoFEM::Core::get_dofs_by_name_end ( const std::string &  field_name) const
protectedvirtual

get begin iterator of field dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)

for(IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... }

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1376 of file FieldCore.cpp.

1376  {
1377  return dofsField.get<Unique_mi_tag>().upper_bound(
1379 }

◆ get_ent_field_by_name_begin()

FieldEntityByUId::iterator MoFEM::Core::get_ent_field_by_name_begin ( const std::string &  field_name) const
protectedvirtual

get begin iterator of field ents of given name (instead you can use IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)

for(IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... }

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1361 of file FieldCore.cpp.

1361  {
1362  return entsFields.get<Unique_mi_tag>().lower_bound(
1364 }

◆ get_ent_field_by_name_end()

FieldEntityByUId::iterator MoFEM::Core::get_ent_field_by_name_end ( const std::string &  field_name) const
protectedvirtual

get begin iterator of field dofs of given name (instead you can use IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)

for(IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... }

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1366 of file FieldCore.cpp.

1366  {
1367  return entsFields.get<Unique_mi_tag>().upper_bound(
1369 }

◆ get_ents_elements_adjacency() [1/2]

const FieldEntityEntFiniteElementAdjacencyMap_multiIndex * MoFEM::Core::get_ents_elements_adjacency ( ) const
protectedvirtual

Get the dofs elements adjacency object.

Returns
const FieldEntityEntFiniteElementAdjacencyMap_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 870 of file Core.cpp.

870  {
871  return &entFEAdjacencies;
872 }

◆ get_ents_elements_adjacency() [2/2]

MoFEMErrorCode MoFEM::Core::get_ents_elements_adjacency ( const FieldEntityEntFiniteElementAdjacencyMap_multiIndex **  dofs_elements_adjacency) const
protectedvirtual

Get the dofs elements adjacency object.

Parameters
dofs_elements_adjacency
Returns
MoFEMErrorCode

Implements MoFEM::CoreInterface.

Definition at line 861 of file Core.cpp.

863  {
865  *dofs_elements_adjacency = &entFEAdjacencies;
867 }

◆ get_ents_finite_elements() [1/2]

const EntFiniteElement_multiIndex * MoFEM::Core::get_ents_finite_elements ( ) const
protectedvirtual

Get the ents finite elements object.

Returns
const EntFiniteElement_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 884 of file Core.cpp.

884  {
885  return &entsFiniteElements;
886 }

◆ get_ents_finite_elements() [2/2]

MoFEMErrorCode MoFEM::Core::get_ents_finite_elements ( const EntFiniteElement_multiIndex **  fe_ent_ptr) const
protectedvirtual

Get entities finite elements multi-index.

Implements MoFEM::CoreInterface.

Definition at line 842 of file Core.cpp.

843  {
845  *fe_ent_ptr = &entsFiniteElements;
847 }

◆ get_fe_by_name_begin()

EntFiniteElement_multiIndex::index< Unique_mi_tag >::type::iterator MoFEM::Core::get_fe_by_name_begin ( const std::string &  fe_name) const
protectedvirtual

get begin iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)

for(IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... }

Parameters
fe_name

Implements MoFEM::CoreInterface.

Definition at line 836 of file FECore.cpp.

836  {
837  auto miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
838  if (miit != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
839  return entsFiniteElements.get<Unique_mi_tag>().lower_bound(
840  EntFiniteElement::getLocalUniqueIdCalculate(0, (*miit)->getFEUId()));
841  } else {
842  return entsFiniteElements.get<Unique_mi_tag>().end();
843  }
844 }

◆ get_fe_by_name_end()

EntFiniteElement_multiIndex::index< Unique_mi_tag >::type::iterator MoFEM::Core::get_fe_by_name_end ( const std::string &  fe_name) const
protectedvirtual

get end iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)

for(IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... }

Parameters
fe_name

Implements MoFEM::CoreInterface.

Definition at line 847 of file FECore.cpp.

847  {
848  auto miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
849  if (miit != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
850  return entsFiniteElements.get<Unique_mi_tag>().upper_bound(
852  get_id_for_max_type<MBENTITYSET>(), (*miit)->getFEUId()));
853  } else {
854  return entsFiniteElements.get<Unique_mi_tag>().end();
855  }
856 }

◆ get_field_bit_number()

FieldBitNumber MoFEM::Core::get_field_bit_number ( const std::string  name) const
protectedvirtual

get field bit number

Parameters
nameof field Example:
auto field_number = mField.get_field_bit_number("DISPLACEMENT");

Implements MoFEM::CoreInterface.

Definition at line 28 of file FieldCore.cpp.

28  {
29  auto &set = fIelds.get<FieldName_mi_tag>();
30  auto miit = set.find(name);
31  if (miit == set.end())
32  THROW_MESSAGE("field < " + name +
33  " > not in database (top tip: check spelling)");
34  return (*miit)->getBitNumber();
35 }

◆ get_field_entities_by_dimension()

MoFEMErrorCode MoFEM::Core::get_field_entities_by_dimension ( const std::string  name,
int  dim,
Range ents 
) const
protectedvirtual

get entities in the field by dimension

Parameters
namefield name
dimdim
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 81 of file FieldCore.cpp.

83  {
84 
86  EntityHandle meshset = get_field_meshset(name);
87  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, true);
89 }

◆ get_field_entities_by_handle()

MoFEMErrorCode MoFEM::Core::get_field_entities_by_handle ( const std::string  name,
Range ents 
) const
protectedvirtual

get entities in the field by handle

Parameters
namefield name
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 100 of file FieldCore.cpp.

101  {
103  EntityHandle meshset = get_field_meshset(name);
104  CHKERR get_moab().get_entities_by_handle(meshset, ents, true);
106 }

◆ get_field_entities_by_type()

MoFEMErrorCode MoFEM::Core::get_field_entities_by_type ( const std::string  name,
EntityType  type,
Range ents 
) const
protectedvirtual

get entities in the field by type

Parameters
namefield name
typeentity type
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 91 of file FieldCore.cpp.

93  {
95  EntityHandle meshset = get_field_meshset(name);
96  CHKERR get_moab().get_entities_by_type(meshset, type, ents, true);
98 }

◆ get_field_ents() [1/2]

const FieldEntity_multiIndex * MoFEM::Core::get_field_ents ( ) const
protectedvirtual

Get the field ents object.

Returns
const FieldEntity_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 887 of file Core.cpp.

887  {
888  return &entsFields;
889 }

◆ get_field_ents() [2/2]

MoFEMErrorCode MoFEM::Core::get_field_ents ( const FieldEntity_multiIndex **  field_ents) const
protectedvirtual

Get field multi index.

Implements MoFEM::CoreInterface.

Definition at line 824 of file Core.cpp.

824  {
826  *field_ents = &entsFields;
828 }

◆ get_field_id()

BitFieldId MoFEM::Core::get_field_id ( const std::string &  name) const
protectedvirtual

Get field Id.

Parameters
nameof field
Returns
BitFieldId

Implements MoFEM::CoreInterface.

Definition at line 18 of file FieldCore.cpp.

18  {
19  auto &set = fIelds.get<FieldName_mi_tag>();
20  auto miit = set.find(name);
21  if (miit == set.end()) {
22  THROW_MESSAGE("field < " + name +
23  " > not in database (top tip: check spelling)");
24  }
25  return (*miit)->getId();
26 }

◆ get_field_meshset() [1/2]

EntityHandle MoFEM::Core::get_field_meshset ( const BitFieldId  id) const
protected

Definition at line 45 of file FieldCore.cpp.

45  {
46  auto &set = fIelds.get<BitFieldId_mi_tag>();
47  auto miit = set.find(id);
48  if (miit == set.end())
49  THROW_MESSAGE("field not in database (top tip: check spelling)");
50  return (*miit)->meshSet;
51 }

◆ get_field_meshset() [2/2]

EntityHandle MoFEM::Core::get_field_meshset ( const std::string  name) const
protectedvirtual

get field meshset

Parameters
nameof Field Example:
EntityHandle disp_files_meshset = mField.get_field_meshset("DISPLACEMENT");

Implements MoFEM::CoreInterface.

Definition at line 53 of file FieldCore.cpp.

53  {
54  return get_field_meshset(get_field_id(name));
55 }

◆ get_field_name()

std::string MoFEM::Core::get_field_name ( const BitFieldId  id) const
protectedvirtual

get field name from id

Parameters
id
Returns
std::string

Implements MoFEM::CoreInterface.

Definition at line 37 of file FieldCore.cpp.

37  {
38  auto &set = fIelds.get<BitFieldId_mi_tag>();
39  auto miit = set.find(id);
40  if (miit == set.end())
41  THROW_MESSAGE("field not in database (top tip: check spelling)");
42  return (*miit)->getName();
43 }

◆ get_field_structure()

const Field * MoFEM::Core::get_field_structure ( const std::string &  name,
enum MoFEMTypes  bh = MF_EXIST 
) const
protectedvirtual

get field structure

If field is not found throw error if bh == MF_EXIST, or return nullptr if bh == MF_ZERO, i.e. otherwise

Parameters
namefield name
bhcontrols behaviour
Returns
const Field*

Implements MoFEM::CoreInterface.

Definition at line 65 of file FieldCore.cpp.

66  {
67  auto miit = fIelds.get<FieldName_mi_tag>().find(name);
68  if (miit == fIelds.get<FieldName_mi_tag>().end()) {
69  if (bh == MF_EXIST)
70  throw MoFEMException(
72  std::string("field < " + name +
73  " > not in database (top tip: check spelling)")
74  .c_str());
75  else
76  return nullptr;
77  }
78  return miit->get();
79 }

◆ get_fields() [1/2]

const Field_multiIndex * MoFEM::Core::get_fields ( ) const
protectedvirtual

Get the fields object.

Returns
const Field_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 874 of file Core.cpp.

874 { return &fIelds; }

◆ get_fields() [2/2]

MoFEMErrorCode MoFEM::Core::get_fields ( const Field_multiIndex **  fields_ptr) const
protectedvirtual

Get fields multi-index from database.

Implements MoFEM::CoreInterface.

Definition at line 782 of file Core.cpp.

782  {
784  *fields_ptr = &fIelds;
786 }

◆ get_finite_element_entities_by_dimension()

MoFEMErrorCode MoFEM::Core::get_finite_element_entities_by_dimension ( const std::string  name,
int  dim,
Range ents 
) const
protectedvirtual

get entities in the finite element by dimension

Parameters
namefinite element name
dimdim
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 286 of file FECore.cpp.

287  {
288 
290 
292  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, true);
294 }

◆ get_finite_element_entities_by_handle()

MoFEMErrorCode MoFEM::Core::get_finite_element_entities_by_handle ( const std::string  name,
Range ents 
) const
protectedvirtual

get entities in the finite element by handle

Parameters
namefinite element name
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 309 of file FECore.cpp.

310  {
311 
313 
315  CHKERR get_moab().get_entities_by_handle(meshset, ents, true);
316 
318 }

◆ get_finite_element_entities_by_type()

MoFEMErrorCode MoFEM::Core::get_finite_element_entities_by_type ( const std::string  name,
EntityType  type,
Range ents 
) const
protectedvirtual

get entities in the finite element by type

Parameters
namefinite element name
typeentity type
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 296 of file FECore.cpp.

298  {
299 
301 
303  CHKERR get_moab().get_entities_by_type(meshset, type, ents, true);
304 
306 }

◆ get_finite_element_meshset() [1/2]

EntityHandle MoFEM::Core::get_finite_element_meshset ( const BitFEId  id) const
protected

Definition at line 273 of file FECore.cpp.

273  {
274  auto &fe_by_id = finiteElements.get<BitFEId_mi_tag>();
275  auto miit = fe_by_id.find(id);
276  if (miit == fe_by_id.end())
277  THROW_MESSAGE("finite element not found");
278  return (*miit)->meshset;
279 }

◆ get_finite_element_meshset() [2/2]

EntityHandle MoFEM::Core::get_finite_element_meshset ( const std::string  name) const
protectedvirtual

get finite element meshset

Implements MoFEM::CoreInterface.

Definition at line 281 of file FECore.cpp.

281  {
283 }

◆ get_finite_element_structure()

const FiniteElement * MoFEM::Core::get_finite_element_structure ( const std::string &  name,
enum MoFEMTypes  bh = MF_EXCL 
) const
protectedvirtual

get finite element struture

If finite element is not found throw error if bh == MF_EXIST, or return nullptr if bh == MF_ZERO, i.e. otherwise

Parameters
name
bh
Returns
FiniteElement*

Implements MoFEM::CoreInterface.

Definition at line 18 of file FECore.cpp.

19  {
20  auto miit = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
21  if (miit == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
22  if (bh == MF_EXIST) {
23  throw MoFEMException(
25  std::string("finite element < " + name +
26  " > not in database (top tip: check spelling)")
27  .c_str());
28  } else {
29  return nullptr;
30  }
31  }
32  return miit->get();
33 }

◆ get_finite_elements() [1/2]

const FiniteElement_multiIndex * MoFEM::Core::get_finite_elements ( ) const
protectedvirtual

Get the finite elements object.

Returns
const FiniteElement_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 881 of file Core.cpp.

881  {
882  return &finiteElements;
883 }

◆ get_finite_elements() [2/2]

MoFEMErrorCode MoFEM::Core::get_finite_elements ( const FiniteElement_multiIndex **  fe_ptr) const
protectedvirtual

Get finite elements multi-index.

Implements MoFEM::CoreInterface.

Definition at line 836 of file Core.cpp.

836  {
838  *fe_ptr = &finiteElements;
840 }

◆ get_meshsets_manager() [1/2]

MeshsetsManager& MoFEM::CoreTmp< 0 >::get_meshsets_manager ( )
inlineprotectedvirtual

get MeshsetsManager pointer

Implements MoFEM::CoreInterface.

Definition at line 361 of file Core.hpp.

361  {
362  return *get_meshsets_manager_ptr();
363  }

◆ get_meshsets_manager() [2/2]

const MeshsetsManager& MoFEM::CoreTmp< 0 >::get_meshsets_manager ( ) const
inlineprotectedvirtual

get MeshsetsManager pointer

Implements MoFEM::CoreInterface.

Definition at line 364 of file Core.hpp.

364  {
365  return *get_meshsets_manager_ptr();
366  }

◆ get_meshsets_manager_ptr() [1/2]

const MeshsetsManager * MoFEM::Core::get_meshsets_manager_ptr ( )
protectedvirtual

get MeshsetsManager pointer

Implements MoFEM::CoreInterface.

Definition at line 849 of file Core.cpp.

849  {
850  MeshsetsManager *meshsets_manager_ptr;
851  getInterface(meshsets_manager_ptr);
852  return meshsets_manager_ptr;
853 }

◆ get_meshsets_manager_ptr() [2/2]

const MeshsetsManager* MoFEM::CoreTmp< 0 >::get_meshsets_manager_ptr ( ) const
protectedvirtual

get MeshsetsManager pointer

Implements MoFEM::CoreInterface.

◆ get_moab() [1/2]

moab::Interface& MoFEM::CoreTmp< 0 >::get_moab ( )
inlineprotectedvirtual

get moab instance

Implements MoFEM::CoreInterface.

Definition at line 322 of file Core.hpp.

322 { return moab; }

◆ get_moab() [2/2]

const moab::Interface& MoFEM::CoreTmp< 0 >::get_moab ( ) const
inlineprotectedvirtual

get moab instance interface

Implements MoFEM::CoreInterface.

Definition at line 323 of file Core.hpp.

323 { return moab; }

◆ get_problem() [1/2]

MoFEMErrorCode MoFEM::Core::get_problem ( const std::string &  problem_name,
const Problem **  problem_ptr 
) const
protectedvirtual

Get problem database (data structure)

Implements MoFEM::CoreInterface.

Definition at line 801 of file Core.cpp.

802  {
805  const ProblemsByName &problems = pRoblems.get<Problem_mi_tag>();
806  ProblemsByName::iterator p_miit = problems.find(problem_name);
807  if (p_miit == problems.end()) {
808  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
809  "problem < %s > not found, (top tip: check spelling)",
810  problem_name.c_str());
811  }
812  *problem_ptr = &*p_miit;
814 }

◆ get_problem() [2/2]

const Problem * MoFEM::Core::get_problem ( const std::string  problem_name) const
protectedvirtual

Get the problem object.

Parameters
problem_name
Returns
const Problem*

Implements MoFEM::CoreInterface.

Definition at line 891 of file Core.cpp.

891  {
892  const Problem *prb;
893  CHK_THROW_MESSAGE(get_problem(problem_name, &prb),
894  "Problem of given name not found");
895  return prb;
896 }

◆ get_problem_finite_elements_entities()

MoFEMErrorCode MoFEM::Core::get_problem_finite_elements_entities ( const std::string  name,
const std::string &  fe_name,
const EntityHandle  meshset 
)
protectedvirtual

add finite elements to the meshset

Parameters
nameis problem name
fe_name
meshset

Implements MoFEM::CoreInterface.

Definition at line 911 of file FECore.cpp.

913  {
915  auto &prb = pRoblems.get<Problem_mi_tag>();
916  auto p_miit = prb.find(problem_name);
917  if (p_miit == prb.end())
918  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
919  "No such problem like < %s >", problem_name.c_str());
920 
921  auto fe_miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
922  if (fe_miit != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
923  auto miit =
924  p_miit->numeredFiniteElementsPtr->get<Unique_mi_tag>().lower_bound(
926  0, (*fe_miit)->getFEUId()));
927  auto hi_miit =
928  p_miit->numeredFiniteElementsPtr->get<Unique_mi_tag>().upper_bound(
930  get_id_for_max_type<MBENTITYSET>(), (*fe_miit)->getFEUId()));
931 
932  if (miit != hi_miit) {
933  std::vector<EntityHandle> ents;
934  ents.reserve(std::distance(miit, hi_miit));
935  for (; miit != hi_miit; ++miit)
936  ents.push_back((*miit)->getEnt());
937  int part = (*miit)->getPart();
938  CHKERR get_moab().tag_clear_data(th_Part, &*ents.begin(), ents.size(),
939  &part);
940  CHKERR get_moab().add_entities(meshset, &*ents.begin(), ents.size());
941  }
942  }
943 
945 }

◆ get_problems() [1/2]

const Problem_multiIndex * MoFEM::Core::get_problems ( ) const
protectedvirtual

Get the problems object.

Returns
const Problem_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 897 of file Core.cpp.

897 { return &pRoblems; }

◆ get_problems() [2/2]

MoFEMErrorCode MoFEM::Core::get_problems ( const Problem_multiIndex **  problems_ptr) const
protectedvirtual

Get pointer to problems multi-index.

Implements MoFEM::CoreInterface.

Definition at line 817 of file Core.cpp.

817  {
819  *problems_ptr = &pRoblems;
821 }

◆ get_ref_ents() [1/2]

const RefEntity_multiIndex * MoFEM::Core::get_ref_ents ( ) const
protectedvirtual

Get the ref ents object.

Returns
const RefEntity_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 875 of file Core.cpp.

875  {
876  return &refinedEntities;
877 }

◆ get_ref_ents() [2/2]

MoFEMErrorCode MoFEM::Core::get_ref_ents ( const RefEntity_multiIndex **  refined_ents_ptr) const
protectedvirtual

Get ref entities multi-index from database.

Implements MoFEM::CoreInterface.

Definition at line 789 of file Core.cpp.

789  {
791  *refined_entities_ptr = &refinedEntities;
793 }

◆ get_ref_finite_elements() [1/2]

const RefElement_multiIndex * MoFEM::Core::get_ref_finite_elements ( ) const
protectedvirtual

Get the ref finite elements object.

Returns
const RefElement_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 878 of file Core.cpp.

878  {
879  return &refinedFiniteElements;
880 }

◆ get_ref_finite_elements() [2/2]

MoFEMErrorCode MoFEM::Core::get_ref_finite_elements ( const RefElement_multiIndex **  refined_finite_elements_ptr) const
protectedvirtual

Get ref finite elements multi-index form database.

Implements MoFEM::CoreInterface.

Definition at line 794 of file Core.cpp.

795  {
797  *refined_finite_elements_ptr = &refinedFiniteElements;
799 }

◆ get_th_RefBitEdge()

Tag MoFEM::CoreTmp< 0 >::get_th_RefBitEdge ( ) const
inline

Definition at line 199 of file Core.hpp.

199 { return th_RefBitEdge; }

◆ get_th_RefBitLevel()

Tag MoFEM::CoreTmp< 0 >::get_th_RefBitLevel ( ) const
inline

Definition at line 198 of file Core.hpp.

198 { return th_RefBitLevel; }

◆ get_th_RefParentHandle()

Tag MoFEM::CoreTmp< 0 >::get_th_RefParentHandle ( ) const
inline

Definition at line 197 of file Core.hpp.

197 { return th_RefParentHandle; }

◆ getBitFEId()

BitFEId MoFEM::Core::getBitFEId ( const std::string &  fe_name) const
protected

Get field Id.

Parameters
namefield name
Returns
field id

Definition at line 255 of file FECore.cpp.

255  {
256  auto &fe_by_id = finiteElements.get<FiniteElement_name_mi_tag>();
257  auto miit = fe_by_id.find(fe_name);
258  if (miit == fe_by_id.end())
260  ("finite element < " + fe_name + " > not found (top tip: check spelling)")
261  .c_str());
262  return (*miit)->getId();
263 }

◆ getBitFEIdName()

std::string MoFEM::Core::getBitFEIdName ( const BitFEId  id) const
protected

Get field name.

Parameters
idfield id
Returns
field name

Definition at line 265 of file FECore.cpp.

265  {
266  auto &fe_by_id = finiteElements.get<BitFEId_mi_tag>();
267  auto miit = fe_by_id.find(id);
268  if (miit == fe_by_id.end())
269  THROW_MESSAGE("finite element not found");
270  return (*miit)->getName();
271 }

◆ getBitProblemId()

BitProblemId MoFEM::Core::getBitProblemId ( const std::string &  name) const
protected

Definition at line 121 of file ProblemsCore.cpp.

121  {
122  auto p_miit = pRoblems.get<Problem_mi_tag>().find(name);
123  if (p_miit == pRoblems.get<Problem_mi_tag>().end()) {
124  THROW_MESSAGE("no such problem like " + name + " >");
125  }
126  return p_miit->getId();
127 }

◆ getBuildMoFEM()

int& MoFEM::CoreTmp< 0 >::getBuildMoFEM ( ) const
inline

Get flags/semaphores for different stages.

Definition at line 225 of file Core.hpp.

225 { return *buildMoFEM; }

◆ getOptions()

MoFEMErrorCode MoFEM::Core::getOptions ( int  verb = DEFAULT_VERBOSITY)
protected

Get core options from command line.

Returns
MoFEMErrorCode

Definition at line 755 of file Core.cpp.

755  {
757  if (verb == -1)
758  verb = verbose;
759 
760  CHKERR PetscOptionsBegin(mofemComm, optionsPrefix.c_str(), "Mesh cut options",
761  "See MoFEM documentation");
762 
763  CHKERR PetscOptionsBool(
764  "-mofem_init_fields", "Initialise fields on construction", "",
766 
767  CHKERR PetscOptionsBool(
768  "-mofem_init_fields", "Initialise fields on construction", "",
770 
771  // TODO: Add read verbosity level
772  // TODO: Add option to initalise problems ??? - DO WE REALLY NEED THAT
773 
774  ierr = PetscOptionsEnd();
775  CHKERRG(ierr);
776 
778 }

◆ getProblemShift()

BitProblemId MoFEM::CoreTmp< 0 >::getProblemShift ( )
protected

Return unique problem Id.

Each time this function is called, it gives new unit problem Id for bit.

◆ getRefEntity()

RefEntityTmp<0> MoFEM::CoreTmp< 0 >::getRefEntity ( const EntityHandle  ent)
inline

Definition at line 86 of file Core.hpp.

86  {
87  return RefEntityTmp<0>(this->basicEntityDataPtr, ent);
88  }

◆ getTags()

MoFEMErrorCode MoFEM::Core::getTags ( int  verb = DEFAULT_VERBOSITY)
protected

Get tag handles.

Parameters
verbverbosity level
Returns
error code

Definition at line 551 of file Core.cpp.

551  {
553 
554  const EntityHandle root_meshset = get_moab().get_root_set();
555  if (root_meshset) {
556  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
557  "Root meshset should be 0");
558  }
559 
560  // Set version
561  {
562  Version version;
563  CHKERR getFileVersion(moab, version);
564  }
565 
566  // Global Variables
567  {
568 
569  auto check_tag_allocated = [](auto &rval) {
571  if (rval == MB_ALREADY_ALLOCATED)
572  rval = MB_SUCCESS;
573  else
574  CHKERRG(rval);
576  };
577 
578  // Safety nets
579  int def_bool = 0;
580  rval = get_moab().tag_get_handle("_MoFEMBuild", 1, MB_TYPE_INTEGER,
581  th_MoFEMBuild, MB_TAG_CREAT | MB_TAG_MESH,
582  &def_bool);
583  CHKERR check_tag_allocated(rval);
584 
585  CHKERR get_moab().tag_get_by_ptr(th_MoFEMBuild, &root_meshset, 1,
586  (const void **)&buildMoFEM);
587  }
588 
589  // Tags saved in vtk-files
590  {
591  const int def_part = -1;
592  CHKERR get_moab().tag_get_handle("PARTITION", 1, MB_TYPE_INTEGER, th_Part,
593  MB_TAG_CREAT | MB_TAG_SPARSE, &def_part);
594  }
595 
596  // Tags Ref
597  {
598 
599  // Fix size of bir ref level tags
601 
602  const int def_part = -1;
603  CHKERR get_moab().tag_get_handle("_MeshsetPartition", 1, MB_TYPE_INTEGER,
604  th_Part, MB_TAG_CREAT | MB_TAG_SPARSE,
605  &def_part);
606  EntityHandle def_handle = 0;
607  CHKERR get_moab().tag_get_handle("_RefParentHandle", 1, MB_TYPE_HANDLE,
609  MB_TAG_CREAT | MB_TAG_SPARSE, &def_handle);
610  BitRefLevel def_bit_level = 0;
611  CHKERR get_moab().tag_get_handle(
612  "_RefBitLevel", sizeof(BitRefLevel), MB_TYPE_OPAQUE, th_RefBitLevel,
613  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_bit_level);
614  BitRefLevel def_bit_level_mask = BitRefLevel().set();
615  CHKERR get_moab().tag_get_handle(
616  "_RefBitLevelMask", sizeof(BitRefLevel), MB_TYPE_OPAQUE,
617  th_RefBitLevel_Mask, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
618  &def_bit_level_mask);
619  BitRefEdges def_bit_edge = 0;
620  CHKERR get_moab().tag_get_handle(
621  "_RefBitEdge", sizeof(BitRefEdges), MB_TYPE_OPAQUE, th_RefBitEdge,
622  MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_bit_edge);
623  }
624 
625  // Tags Field
626  {
627  const unsigned long int def_id = 0;
628  CHKERR get_moab().tag_get_handle(
629  "_FieldId", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FieldId,
630  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
631  FieldSpace def_space = LASTSPACE;
632  CHKERR get_moab().tag_get_handle(
633  "_FieldSpace", sizeof(FieldSpace), MB_TYPE_OPAQUE, th_FieldSpace,
634  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_space);
635  FieldContinuity def_continuity = LASTCONTINUITY;
636  CHKERR get_moab().tag_get_handle(
637  "_FieldContinuity", sizeof(FieldContinuity), MB_TYPE_OPAQUE,
638  th_FieldContinuity, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
639  &def_continuity);
640  FieldApproximationBase def_base = LASTBASE;
641  CHKERR get_moab().tag_get_handle(
642  "_FieldBase", sizeof(FieldApproximationBase), MB_TYPE_OPAQUE,
643  th_FieldBase, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_base);
644  const int def_val_len = 0;
645  CHKERR get_moab().tag_get_handle(
646  "_FieldName", def_val_len, MB_TYPE_OPAQUE, th_FieldName,
647  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
648  CHKERR get_moab().tag_get_handle(
649  "_FieldName_DataNamePrefix", def_val_len, MB_TYPE_OPAQUE,
651  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
652  }
653 
654  // Tags FE
655  {
656  const unsigned long int def_id = 0;
657  const int def_val_len = 0;
658  CHKERR get_moab().tag_get_handle(
659  "_FEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_FEId,
660  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
661  CHKERR get_moab().tag_get_handle(
662  "_FEName", def_val_len, MB_TYPE_OPAQUE, th_FEName,
663  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
664  CHKERR get_moab().tag_get_handle(
665  "_FEIdCol", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdCol,
666  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
667  CHKERR get_moab().tag_get_handle(
668  "_FEIdRow", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdRow,
669  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
670  CHKERR get_moab().tag_get_handle(
671  "_FEIdData", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdData,
672  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
673  }
674 
675  // Tags Problem
676  {
677  const unsigned long int def_id = 0;
678  const int def_val_len = 0;
679  CHKERR get_moab().tag_get_handle(
680  "_ProblemId", sizeof(BitProblemId), MB_TYPE_OPAQUE, th_ProblemId,
681  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
682  CHKERR get_moab().tag_get_handle(
683  "_ProblemFEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_ProblemFEId,
684  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
685  CHKERR get_moab().tag_get_handle(
686  "_ProblemName", def_val_len, MB_TYPE_OPAQUE, th_ProblemName,
687  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
688  DofIdx def_nbdofs = 0;
689  CHKERR get_moab().tag_get_handle(
690  "_ProblemNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
691  th_ProblemNbDofsRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
692  &def_nbdofs);
693  CHKERR get_moab().tag_get_handle(
694  "_ProblemNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
695  th_ProblemNbDofsCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
696  &def_nbdofs);
697  CHKERR get_moab().tag_get_handle(
698  "_ProblemLocalNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
699  th_ProblemLocalNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
700  &def_nbdofs);
701  CHKERR get_moab().tag_get_handle(
702  "_ProblemGhostNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
703  th_ProblemGhostNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
704  &def_nbdofs);
705  CHKERR get_moab().tag_get_handle(
706  "_ProblemLocalNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
707  th_ProblemLocalNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
708  &def_nbdofs);
709  CHKERR get_moab().tag_get_handle(
710  "_ProblemGhostNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
711  th_ProblemGhostNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
712  &def_nbdofs);
713  }
714 
715  // Meshsets with boundary conditions and material sets
716  MeshsetsManager *meshsets_manager_ptr;
717  CHKERR getInterface(meshsets_manager_ptr);
718  CHKERR meshsets_manager_ptr->getTags(verb);
719 
720  // Series recorder
721  SeriesRecorder *series_recorder_ptr;
722  CHKERR getInterface(series_recorder_ptr);
723  CHKERR series_recorder_ptr->getTags(verb);
724 
726 }

◆ getValue()

const int MoFEM::CoreTmp< 0 >::getValue ( ) const
inlinevirtual

Get the core.

Returns
int

Implements MoFEM::CoreInterface.

Reimplemented in MoFEM::CoreTmp<-1 >.

Definition at line 85 of file Core.hpp.

85 { return value; }

◆ initialiseDatabaseFromMesh()

MoFEMErrorCode MoFEM::Core::initialiseDatabaseFromMesh ( int  verb = DEFAULT_VERBOSITY)
protected

Initialize database getting information on mesh.

Definition at line 294 of file Core.cpp.

294  {
295  MOFEM_LOG_CHANNEL("WORLD");
297  if (verb == -1)
298  verb = verbose;
299 
300  Range ref_elems_to_add;
301 
302  // Initialize database
303  Range meshsets;
304  CHKERR get_moab().get_entities_by_type(0, MBENTITYSET, meshsets, false);
305  Range special_meshsets;
306  for (auto mit : meshsets) {
307  BitFieldId field_id;
308  // Get bit id form field tag
309  CHKERR get_moab().tag_get_data(th_FieldId, &mit, 1, &field_id);
310  // Check if meshset if field meshset
311  if (field_id != 0) {
312 
313  const void *tag_name;
314  int tag_name_size;
315  CHKERR get_moab().tag_get_by_ptr(
316  th_FieldName, &mit, 1, (const void **)&tag_name, &tag_name_size);
317 
318  if (verb > QUIET)
319  MOFEM_LOG("WORLD", Sev::verbose)
320  << "Read field "
321  << boost::string_ref((char *)tag_name, tag_name_size);
322 
323  auto p = fIelds.insert(boost::make_shared<Field>(moab, mit));
324 
325  if (!p.second) {
326  // Field meshset exists, remove duplicate meshsets from other
327  // processors.
328  Range ents;
329  CHKERR get_moab().get_entities_by_handle(mit, ents, true);
330  CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
331  CHKERR get_moab().delete_entities(&mit, 1);
332  } else {
333  special_meshsets.insert(mit);
334  }
335  }
336  // Check for finite elements
337  BitFieldId fe_id;
338  // Get bit id from fe tag
339  CHKERR get_moab().tag_get_data(th_FEId, &mit, 1, &fe_id);
340  // check if meshset is finite element meshset
341  if (fe_id != 0) {
342  std::pair<FiniteElement_multiIndex::iterator, bool> p =