v0.13.1
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 const int getValue () const =0
 Get the core. More...
 
virtual boost::shared_ptr< RefEntityTmp< 0 > > make_shared_ref_entity (const EntityHandle ent)=0
 Get RefEntity. More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
virtual MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const =0
 
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce 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 subinterfac in core interface. 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...
 

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_RefType
 
Tag th_FieldId
 
Tag th_FieldName
 
Tag th_FieldName_DataNamePrefix
 
Tag th_FieldSpace
 
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)
 

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
 

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
 
Tag get_th_RefType () const
 

Global initialisation and finalisation <br>

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)
 

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_field (const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 Add filed. 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 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...
 
Fieldget_field_structure (const std::string &name)
 get field structure More...
 

Finite elements

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 &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 &MoFEMFiniteElement_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 &MoFEMFiniteElement_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 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 filed 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 filed 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 filed 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 filed 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 filed 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 filed 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 filed 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 filed dofs of given name end ent type(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT) More...
 
EntFiniteElementByName::iterator get_fe_by_name_begin (const std::string &fe_name) const
 get begin iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) More...
 
EntFiniteElementByName::iterator get_fe_by_name_end (const std::string &fe_name) const
 get end iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) More...
 

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, 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, contact.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, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.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_divergence_operator.cpp, heat_equation.cpp, heat_method.cpp, hello_world.cpp, helmholtz.cpp, hertz_surface.cpp, higher_derivatives.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, nonlinear_dynamics.cpp, nonlinear_elastic.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, shallow_wave.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, simple_interface.cpp, simple_l2_only.cpp, split_sideset.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_plastic.cpp, unsaturated_transport.cpp, wave_equation.cpp, and wavy_surface.cpp.

Definition at line 92 of file Core.hpp.

Member Enumeration Documentation

◆ SemaphoresBuildMofem

enum MoFEM::CoreTmp< 0 >::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 222 of file Core.hpp.

222 {
223 BUILD_FIELD = 1 << 0,
224 BUILD_FE = 1 << 1,
225 BUILD_ADJ = 1 << 2,
226 BUILD_PROBLEM = 1 << 3,
227 PARTITION_PROBLEM = 1 << 4,
228 PARTITION_FE = 1 << 5,
229 PARTITION_GHOST_DOFS = 1 << 6,
230 PARTITION_MESH = 1 << 7
231 };

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 222 of file Core.cpp.

227 : CoreTmp(moab, comm, verbose, CoreValue<0>()) {
228
229 // Register sub-interfaces
230 ierr = this->registerSubInterfaces();
231 CHKERRABORT(comm, ierr);
232 ierr = this->clearMap();
233 CHKERRABORT(comm, ierr);
234 ierr = this->getTags();
235 CHKERRABORT(comm, ierr);
236 ierr = this->getOptions(verbose);
237 CHKERRABORT(comm, ierr);
238
239 this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
241
243 CHKERRABORT(comm, ierr);
244}
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:488
static void setRefEntBasicDataPtr(MoFEM::Interface &m_field, boost::shared_ptr< BasicEntityData > &ptr)
Definition: Core.cpp:888
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition: Core.cpp:281
MoFEMErrorCode registerSubInterfaces()
Register insterfaces.
Definition: Core.cpp:452
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
Definition: Core.cpp:734
int verbose
Verbosity level.
Definition: Core.hpp:995
MoFEMErrorCode getTags(int verb=DEFAULT_VERBOSITY)
Get tag handles.
Definition: Core.cpp:536
CoreTmp(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
Definition: Core.cpp:222
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:293
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:333

◆ ~CoreTmp()

MoFEM::Core::~CoreTmp ( )

Definition at line 270 of file Core.cpp.

270 {
271 PetscBool is_finalized;
272 PetscFinalized(&is_finalized);
273 // Destroy interfaces
274 iFaces.clear();
275 // This is deprecated ONE should use MoFEM::Core::Initialize
276 if (isGloballyInitialised && is_finalized) {
277 isGloballyInitialised = false;
278 }
279}
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:1012
boost::ptr_map< boost::typeindex::type_index, UnknownInterface > iFaces
Hash map of pointers to interfaces.
Definition: Core.hpp:1000

◆ 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 42 of file CoreTemplates.hpp.

44 : moab(moab), mofemComm(comm), verbose(verbose),
45 initaliseAndBuildField(PETSC_FALSE),
47
49 CHKERRABORT(comm, ierr);
50
51 MOFEM_LOG_CHANNEL("WORLD");
52 if (verbose > QUIET) {
53 MOFEM_LOG_C("WORLD", Sev::verbose, "Core number < %d >", V);
54 }
55}
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:314
@ QUIET
Definition: definitions.h:221
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:287
PetscBool initaliseAndBuildFiniteElements
Definition: Core.hpp:1009
MoFEMErrorCode coreGenericConstructor(moab::Interface &moab, MPI_Comm comm, const int verbose)
Definition: Core.cpp:184
PetscBool initaliseAndBuildField
Definition: Core.hpp:1006
MPI_Comm mofemComm
MoFEM communicator.
Definition: Core.hpp:968

Member Function Documentation

◆ 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 391 of file FieldCore.cpp.

394 {
396 Range ents;
397 CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
398 CHKERR addEntsToFieldByDim(ents, dim, name, verb);
400}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
#define CHKERR
Inline error check.
Definition: definitions.h:548
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
const int dim
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:297
moab::Interface & get_moab()
Definition: Core.hpp:334

◆ 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 371 of file FieldCore.cpp.

373 {
374 Range ents_dim = ents.subset_by_dimension(dim);
375 return addEntsToFieldByDim(ents_dim, dim, name, verb);
376}

◆ 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 402 of file FieldCore.cpp.

405 {
407 Range ents;
408 CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
409 if (!ents.empty()) {
410 const int dim = get_moab().dimension_from_handle(ents[0]);
411 CHKERR addEntsToFieldByDim(ents, dim, name, verb);
412 }
414}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429

◆ 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 378 of file FieldCore.cpp.

381 {
383 Range ents_type = ents.subset_by_type(type);
384 if (!ents_type.empty()) {
385 const int dim = get_moab().dimension_from_handle(ents_type[0]);
386 CHKERR addEntsToFieldByDim(ents_type, dim, name, verb);
387 }
389}

◆ 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 406 of file FECore.cpp.

408 {
410
411 if (verb == -1)
412 verb = verbose;
413 *buildMoFEM &= 1 << 0;
414 const BitFEId id = getBitFEId(name);
415 const EntityHandle idm = get_finite_element_meshset(id);
416
417 auto &ref_MoFEMFiniteElement = refinedFiniteElements.get<Ent_mi_tag>();
418 auto miit = ref_MoFEMFiniteElement.lower_bound(get_id_for_min_type(type));
419 auto hi_miit = ref_MoFEMFiniteElement.upper_bound(get_id_for_max_type(type));
420
421 int nb_add_fes = 0;
422 for (; miit != hi_miit; miit++) {
423 const auto &bit2 = miit->get()->getBitRefLevel();
424 if ((bit2 & mask) != bit2)
425 continue;
426 if ((bit2 & bit).any()) {
427 EntityHandle ent = miit->get()->getEnt();
428 CHKERR get_moab().add_entities(idm, &ent, 1);
429 nb_add_fes++;
430 }
431 }
432
433 MOFEM_LOG("SYNC", Sev::inform)
434 << "Finite element " << name << " added. Nb. of elements added "
435 << nb_add_fes << " out of " << std::distance(miit, hi_miit);
436
438
440}
#define FECoreFunctionBegin
Definition: FECore.cpp:21
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:348
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:311
auto bit
set bit
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:54
EntityHandle get_id_for_max_type()
EntityHandle get_id_for_min_type()
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:274
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:313
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:1002
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:256

◆ 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
namename of field
recursivetake entities from meshsets in meshset
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 347 of file FECore.cpp.

349 {
350 EntityHandle idm = no_handle;
351 *buildMoFEM &= 1 << 0;
354 Range ents;
355 CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
356 CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
357 CHKERR get_moab().add_entities(idm, ents);
359}
const EntityHandle no_handle
No entity handle is indicated by zero handle, i.e. root meshset.
Definition: Common.hpp:23

◆ 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 374 of file FECore.cpp.

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

◆ 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 442 of file FECore.cpp.

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

◆ 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
namename of field
recursivetake entities from meshsets in meshset
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 330 of file FECore.cpp.

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

◆ 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 361 of file FECore.cpp.

362 {
363 EntityHandle idm = no_handle;
364 *buildMoFEM &= 1 << 0;
367 CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
368 ents.subset_by_type(type));
369 CHKERR get_moab().add_entities(idm, ents.subset_by_type(type));
371} // 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 397 of file FECore.cpp.

399 {
402
404}
MoFEMErrorCode add_ents_to_finite_element_by_bit_ref(const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
add TET entities from given refinement level to finite element database given by name
Definition: FECore.cpp:406

◆ 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 387 of file FECore.cpp.

389 {
392 type, verb);
393
395}
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51

◆ 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 filed.

Parameters
nameField name
spaceSpace L2,H1,Hdiv,Hcurl
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 288 of file FieldCore.cpp.

292 {
293 return this->addField(name, space, base, nb_of_coefficients, tag_type, bh,
294 verb);
295}
MoFEMErrorCode addField(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type, const enum MoFEMTypes bh, int verb)
Template for add_field.
Definition: FieldCore.cpp:118

◆ 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 41 of file FECore.cpp.

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

◆ 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 97 of file ProblemsCore.cpp.

98 {
100 if (verb == -1)
101 verb = verbose;
102 auto miit = pRoblems.get<Problem_mi_tag>().find(name);
103 if (miit == pRoblems.get<Problem_mi_tag>().end()) {
104
105 int p_shift = 0;
106 for (; pRoblems.get<BitProblemId_mi_tag>().find(BitProblemId().set(
107 p_shift)) != pRoblems.get<BitProblemId_mi_tag>().end();
108 ++p_shift) {
109 }
110
111 auto id = BitProblemId().set(p_shift);
112 CHKERR addProblem(id, name, verb);
113
114 } else if (bh == MF_EXCL) {
115 SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem is in database %s",
116 name.c_str());
117 }
119}
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition: Types.hpp:55
MoFEMErrorCode addProblem(const BitProblemId id, const std::string &name, int verb=DEFAULT_VERBOSITY)
add problem
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:325

◆ addEntsToFieldByDim()

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

Definition at line 297 of file FieldCore.cpp.

298 {
299
300 *buildMoFEM = 0;
301 EntityHandle idm = no_handle;
302 if (verb == -1)
303 verb = verbose;
304
305 MOFEM_LOG_CHANNEL("SYNC");
306 MOFEM_LOG_TAG("SYNC", "FieldCore");
308
310 idm = get_field_meshset(name);
311 FieldSpace space;
312 CHKERR get_moab().tag_get_data(th_FieldSpace, &idm, 1, &space);
313 std::vector<int> nb_ents_on_dim(3, 0);
314 switch (space) {
315 case L2:
316 CHKERR get_moab().add_entities(idm, ents);
317 break;
318 case H1:
319 CHKERR get_moab().add_entities(idm, ents);
320 for (int dd = 0; dd != dim; ++dd) {
321 Range adj_ents;
322 CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
323 moab::Interface::UNION);
324 if (dd == 0) {
325 Range topo_nodes;
326 CHKERR get_moab().get_connectivity(ents, topo_nodes, true);
327 Range mid_nodes;
328 CHKERR get_moab().get_connectivity(ents, mid_nodes, false);
329 mid_nodes = subtract(mid_nodes, topo_nodes);
330 adj_ents = subtract(adj_ents, mid_nodes);
331 }
332 CHKERR get_moab().add_entities(idm, adj_ents);
333 nb_ents_on_dim[dd] = adj_ents.size();
334 }
335 break;
336 case HCURL:
337 CHKERR get_moab().add_entities(idm, ents);
338 for (int dd = 1; dd != dim; ++dd) {
339 Range adj_ents;
340 CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
341 moab::Interface::UNION);
342 CHKERR get_moab().add_entities(idm, adj_ents);
343 nb_ents_on_dim[dd] = adj_ents.size();
344 }
345 break;
346 case HDIV:
347 CHKERR get_moab().add_entities(idm, ents);
348 if (dim > 2) {
349 Range adj_ents;
350 CHKERR get_moab().get_adjacencies(ents, 2, false, adj_ents,
351 moab::Interface::UNION);
352 CHKERR get_moab().add_entities(idm, adj_ents);
353 nb_ents_on_dim[2] = adj_ents.size();
354 }
355 break;
356 default:
357 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
358 "sorry, unknown space added to entity");
359 }
360 if (verb >= VERBOSE) {
361 MOFEM_LOG("SYNC", Sev::noisy) << "add entities to field " << name;
362 MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add ents " << ents.size();
363 MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add faces " << nb_ents_on_dim[2];
364 MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add edges " << nb_ents_on_dim[1];
365 MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add nodes " << nb_ents_on_dim[0];
367 }
369}
@ VERBOSE
Definition: definitions.h:222
FieldSpace
approximation spaces
Definition: definitions.h:95
@ L2
field with C-1 continuity
Definition: definitions.h:101
@ H1
continuous field
Definition: definitions.h:98
@ HCURL
field with continuous tangents
Definition: definitions.h:99
@ HDIV
field with continuous normal traction
Definition: definitions.h:100
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:44
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:342
#define MOFEM_LOG_FUNCTION()
Set scope.
Definition: LogManager.hpp:328
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
EntityHandle get_field_meshset(const BitFieldId id) const
Definition: FieldCore.cpp:58

◆ addField()

MoFEMErrorCode MoFEM::Core::addField ( const std::string &  name,
const FieldSpace  space,
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
base
nb_coefficients
tag_type
bh
verb
Returns
MoFEMErrorCode

Definition at line 118 of file FieldCore.cpp.

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

◆ 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 507 of file Core.cpp.

507 {
509 if (verb == -1)
510 verb = verbose;
511 std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
512 p_ent = refinedEntities.insert(
513 boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
514 if (p_ent.second) {
515 std::pair<RefElement_multiIndex::iterator, bool> p;
516 p = refinedFiniteElements.insert(
517 boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)));
518 int num_nodes;
519 const EntityHandle *conn;
520 CHKERR get_moab().get_connectivity(prism, conn, num_nodes, true);
521 Range face_side3, face_side4;
522 CHKERR get_moab().get_adjacencies(conn, 3, 2, false, face_side3);
523 CHKERR get_moab().get_adjacencies(&conn[3], 3, 2, false, face_side4);
524 if (face_side3.size() != 1)
525 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
526 "prism don't have side face 3");
527 if (face_side4.size() != 1)
528 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
529 "prims don't have side face 4");
530 p.first->get()->getSideNumberPtr(*face_side3.begin());
531 p.first->get()->getSideNumberPtr(*face_side4.begin());
532 }
534}
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:312

◆ 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 40 of file ProblemsCore.cpp.

41 {
43
44 if (verb == -1)
45 verb = verbose;
46 EntityHandle meshset;
47 CHKERR get_moab().create_meshset(MESHSET_SET, meshset);
48 CHKERR get_moab().tag_set_data(th_ProblemId, &meshset, 1, &id);
49
50 // Add problem meshset to partion meshset. In case of no elements
51 // on processor part, when mesh file is read, finite element meshset is
52 // prevented from deletion by moab reader.
53 auto add_meshset_to_partition = [&](auto meshset) {
55 const void *tag_vals[] = {&rAnk};
56 ParallelComm *pcomm = ParallelComm::get_pcomm(
57 &get_moab(), get_basic_entity_data_ptr()->pcommID);
58 Tag part_tag = pcomm->part_tag();
59 Range tagged_sets;
60 CHKERR get_moab().get_entities_by_type_and_tag(0, MBENTITYSET, &part_tag,
61 tag_vals, 1, tagged_sets,
62 moab::Interface::UNION);
63 for (auto s : tagged_sets)
64 CHKERR get_moab().add_entities(s, &meshset, 1);
66 };
67 CHKERR add_meshset_to_partition(meshset);
68
69 void const *tag_data[] = {name.c_str()};
70 int tag_sizes[1];
71 tag_sizes[0] = name.size();
72 CHKERR get_moab().tag_set_by_ptr(th_ProblemName, &meshset, 1, tag_data,
73 tag_sizes);
74 // create entry
75 auto p = pRoblems.insert(Problem(moab, meshset));
76 if (!p.second) {
79 MOFEM_LOG("SELF", Sev::error) << "Following problem can not be added:";
80 MOFEM_LOG("SELF", Sev::error)
81 << "Problem " << name << " id(" << id.to_ulong() << ") " << id
82 << " added meshset " << meshset;
83 MOFEM_LOG("SELF", Sev::error) << "List of problems already in databse:";
84 for (auto &p : pRoblems) {
85 MOFEM_LOG("SELF", Sev::error)
86 << p.getName() << " id(" << p.getId().to_ulong() << ") " << id
87 << " on meshset " << p.meshset;
88 }
89 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Problem not added");
90 }
91
92 MOFEM_LOG("WORLD", Sev::inform) << "Add problem " << name;
93
95}
#define ProblemCoreFunctionBegin
#define MOFEM_LOG_ATTRIBUTES(channel, bit)
Add attributes to channel.
Definition: LogManager.hpp:299

◆ 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 821 of file FECore.cpp.

822 {
824 if (verb == -1)
825 verb = verbose;
826 Range ents;
827 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents);
828
829 CHKERR build_adjacencies(ents, verb);
830
832}
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)
build adjacencies
Definition: FECore.cpp:750

◆ 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 833 of file FECore.cpp.

833 {
835 if (verb == -1)
836 verb = verbose;
837 CHKERR build_adjacencies(bit, BitRefLevel().set(), verb);
838
840}

◆ 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 750 of file FECore.cpp.

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

◆ 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 1255 of file FieldCore.cpp.

1255 {
1257 auto field_it = fIelds.get<FieldName_mi_tag>().find(field_name);
1258 if (field_it == fIelds.get<FieldName_mi_tag>().end())
1259 SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field < %s > not found",
1260 field_name.c_str());
1261
1262 CHKERR this->buildField(*field_it, verb);
1263 if (verb > QUIET)
1266}
#define FieldCoreFunctionBegin
Definition: FieldCore.cpp:21
Field_multiIndex::index< FieldName_mi_tag >::type::iterator field_it
constexpr auto field_name
MoFEMErrorCode buildField(const boost::shared_ptr< Field > &field, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1204

◆ build_fields()

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

build fields

Implements MoFEM::CoreInterface.

Definition at line 1268 of file FieldCore.cpp.

1268 {
1270 if (verb == -1)
1271 verb = verbose;
1272
1273 for (auto field : fIelds.get<BitFieldId_mi_tag>())
1274 CHKERR this->buildField(field, verb);
1275
1276 *buildMoFEM = 1 << 0;
1277 if (verb > QUIET) {
1278 MOFEM_LOG("SYNC", Sev::inform) << "Number of dofs " << dofsField.size();
1280 }
1281
1283}
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:317

◆ build_finite_elements() [1/3]

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

Definition at line 716 of file FECore.cpp.

716 {
718 SETERRQ(mofemComm, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
720}
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:45

◆ build_finite_elements() [2/3]

MoFEMErrorCode MoFEM::CoreTmp< 0 >::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.

◆ 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 669 of file FECore.cpp.

669 {
671
672 if (verb == DEFAULT_VERBOSITY)
673 verb = verbose;
674
675 // loop Finite Elements
676 for (auto &fe : finiteElements)
677 CHKERR buildFiniteElements(fe, NULL, verb);
678
679 if (verb > QUIET) {
680
681 auto &fe_ents = entsFiniteElements.get<FiniteElement_name_mi_tag>();
682 for (auto &fe : finiteElements) {
683 auto miit = fe_ents.lower_bound(fe->getName());
684 auto hi_miit = fe_ents.upper_bound(fe->getName());
685 const auto count = std::distance(miit, hi_miit);
686 MOFEM_LOG("SYNC", Sev::inform)
687 << "Finite element " << fe->getName()
688 << " added. Nb. of elements added " << count;
689 MOFEM_LOG("SYNC", Sev::noisy) << *fe;
690
691 auto slg = MoFEM::LogManager::getLog("SYNC");
692 for (auto &field : fIelds) {
693 auto rec = slg.open_record(keywords::severity = Sev::verbose);
694 if (rec) {
695 logging::record_ostream strm(rec);
696 strm << "Field " << field->getName() << " on finite element: ";
697 if ((field->getId() & fe->getBitFieldIdRow()).any())
698 strm << "row ";
699 if ((field->getId() & fe->getBitFieldIdCol()).any())
700 strm << "columns ";
701 if ((field->getId() & fe->getBitFieldIdData()).any())
702 strm << "data";
703 strm.flush();
704 slg.push_record(boost::move(rec));
705 }
706 }
707 }
708
710 }
711
712 *buildMoFEM |= 1 << 1;
714}
static LoggerType & getLog(const std::string channel)
Get logger by channel.
Definition: LogManager.cpp:370
MoFEMErrorCode buildFiniteElements(const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
Definition: FECore.cpp:460

◆ build_problem_on_distributed_mesh()

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

Definition at line 270 of file ProblemsCore.cpp.

270 {
272 if (verb == -1)
273 verb = verbose;
274 Problem_multiIndex::iterator p_miit = pRoblems.begin();
275 for (; p_miit != pRoblems.end(); p_miit++) {
276 CHKERR getInterface<ProblemsManager>()->buildProblemOnDistributedMesh(
277 const_cast<Problem *>(&*p_miit), verb);
278 }
280}

◆ build_problems()

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

Definition at line 330 of file ProblemsCore.cpp.

330 {
332 if (verb == -1)
333 verb = verbose;
334 if (!((*buildMoFEM) & BUILD_FIELD))
335 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "fields not build");
336 if (!((*buildMoFEM) & BUILD_FE))
337 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "FEs not build");
338 if (!((*buildMoFEM) & BUILD_ADJ))
339 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "adjacencies not build");
340 // iterate problems
341 Problem_multiIndex::iterator p_miit = pRoblems.begin();
342 for (; p_miit != pRoblems.end(); p_miit++) {
343 Problem *problem_ptr = const_cast<Problem *>(&*p_miit);
344 CHKERR getInterface<ProblemsManager>()->buildProblem(problem_ptr, false,
345 verb);
346 }
349}

◆ buildField()

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

Definition at line 1204 of file FieldCore.cpp.

1205 {
1207 if (verb == -1)
1208 verb = verbose;
1209 if (verb > QUIET)
1210 MOFEM_LOG("SYNC", Sev::verbose) << "Build field " << field->getName();
1211
1212 std::map<EntityType, int> dof_counter;
1213 std::map<EntityType, int> inactive_dof_counter;
1214
1215 // Need to rebuild order table since number of dofs on each order when
1216 // field was created.
1217 if (field->getApproxBase() == USER_BASE)
1218 CHKERR field->rebuildDofsOrderMap();
1219
1220 switch (field->getSpace()) {
1221 case NOFIELD:
1222 CHKERR this->buildFieldForNoField(field->getId(), dof_counter, verb);
1223 break;
1224 case L2:
1225 case H1:
1226 case HCURL:
1227 case HDIV:
1228 CHKERR this->buildFieldForL2H1HcurlHdiv(field->getId(), dof_counter,
1229 inactive_dof_counter, verb);
1230 break;
1231 default:
1232 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1233 }
1234
1235 if (verb > QUIET) {
1236 int nb_added_dofs = 0;
1237 int nb_inactive_added_dofs = 0;
1238 for (auto const &it : dof_counter) {
1239 MOFEM_LOG("SYNC", Sev::verbose)
1240 << "Nb. of dofs (" << moab::CN::EntityTypeName(it.first) << ") "
1241 << it.second << " (inactive " << inactive_dof_counter[it.first]
1242 << ")";
1243 nb_added_dofs += it.second;
1244 nb_inactive_added_dofs += inactive_dof_counter[it.first];
1245 }
1246 if (verb > QUIET) {
1247 MOFEM_LOG("SYNC", Sev::verbose)
1248 << "Nb. added dofs " << nb_added_dofs << " (number of inactive dofs "
1249 << nb_inactive_added_dofs << " )";
1250 }
1251 }
1253}
@ USER_BASE
user implemented approximation base
Definition: definitions.h:81
@ NOFIELD
scalar or vector of scalars describe (no true field)
Definition: definitions.h:97
MoFEMErrorCode buildFieldForNoField(const BitFieldId id, std::map< EntityType, int > &dof_counter, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1067
MoFEMErrorCode buildFieldForL2H1HcurlHdiv(const BitFieldId id, std::map< EntityType, int > &dof_counter, std::map< EntityType, int > &inactive_dof_counter, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1090

◆ 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 1090 of file FieldCore.cpp.

1092 {
1094 if (verb == -1)
1095 verb = verbose;
1096
1097 // Find field
1098 auto &set_id = fIelds.get<BitFieldId_mi_tag>();
1099 auto field_it = set_id.find(id);
1100 if (field_it == set_id.end()) {
1101 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field not found");
1102 }
1103 const int bit_number = field_it->get()->getBitNumber();
1104 const int rank = field_it->get()->getNbOfCoeffs();
1105 const boost::string_ref &field_name = field_it->get()->getNameRef();
1106
1107 // Ents in the field meshset
1108 Range ents_of_id_meshset;
1109 CHKERR get_moab().get_entities_by_handle((*field_it)->meshSet,
1110 ents_of_id_meshset, false);
1111 if (verb > VERY_NOISY) {
1112 PetscSynchronizedPrintf(PETSC_COMM_SELF, "Ents in field %s meshset %d\n",
1113 (*field_it)->getName().c_str(),
1114 ents_of_id_meshset.size());
1115 }
1116
1117 for (auto p_eit = ents_of_id_meshset.pair_begin();
1118 p_eit != ents_of_id_meshset.pair_end(); ++p_eit) {
1119
1120 const EntityHandle first = p_eit->first;
1121 const EntityHandle second = p_eit->second;
1122 const auto lo_uid =
1123 FieldEntity::getLoLocalEntityBitNumber(bit_number, first);
1124 const auto hi_uid =
1125 FieldEntity::getHiLocalEntityBitNumber(bit_number, second);
1126
1127 auto feit = entsFields.get<Unique_mi_tag>().lower_bound(lo_uid);
1128 if (feit == entsFields.get<Unique_mi_tag>().end())
1129 continue;
1130 auto hi_feit = entsFields.get<Unique_mi_tag>().upper_bound(hi_uid);
1131
1132 // If there are DOFs in that range is more pragmatic to remove them
1133 // rather than to find sub-ranges or make them inactive
1134 auto dit = dofsField.get<Unique_mi_tag>().lower_bound(lo_uid);
1135 auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(hi_uid);
1136 dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
1137
1138 // Add vertices DOFs by bulk
1139 boost::shared_ptr<std::vector<DofEntity>> dofs_array =
1140 boost::make_shared<std::vector<DofEntity>>(std::vector<DofEntity>());
1141 // Add Sequence of DOFs to sequence container as weak_ptr
1142 int nb_dofs_on_ents = 0;
1143 for (auto tmp_feit = feit; tmp_feit != hi_feit; ++tmp_feit) {
1144 nb_dofs_on_ents += rank * tmp_feit->get()->getOrderNbDofs(
1145 tmp_feit->get()->getMaxOrder());
1146 }
1147
1148 // Reserve memory
1149 dofs_array->reserve(nb_dofs_on_ents);
1150
1151 // Create DOFs
1152 for (; feit != hi_feit; ++feit) {
1153 // Create dofs instances and shared pointers
1154 int DD = 0;
1155 // Loop orders (loop until max entity order is set)
1156 for (int oo = 0; oo <= feit->get()->getMaxOrder(); ++oo) {
1157 // Loop nb. dofs at order oo
1158 for (int dd = 0; dd < feit->get()->getOrderNbDofsDiff(oo); ++dd) {
1159 // Loop rank
1160 for (int rr = 0; rr < rank; ++rr, ++DD) {
1161 dofs_array->emplace_back(*feit, oo, rr, DD);
1162 ++dof_counter[feit->get()->getEntType()];
1163 }
1164 }
1165 }
1166 if (DD > feit->get()->getNbDofsOnEnt()) {
1167 std::ostringstream ss;
1168 ss << "rank " << rAnk << " ";
1169 ss << **feit << std::endl;
1170 SETERRQ3(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1171 "Expected number of DOFs on entity not equal to number added "
1172 "to database (DD = %d != %d = "
1173 "feit->get()->getNbDofsOnEnt())\n"
1174 "%s",
1175 DD, feit->get()->getNbDofsOnEnt(), ss.str().c_str());
1176 }
1177 }
1178
1179 // Insert into Multi-Index container
1180 int dofs_field_size0 = dofsField.size();
1181 auto hint = dofsField.end();
1182 for (auto &v : *dofs_array)
1183 hint = dofsField.emplace_hint(hint, dofs_array, &v);
1184
1185 // Add Sequence of DOFs to sequence container as weak_ptr
1186 field_it->get()->getDofSequenceContainer().push_back(dofs_array);
1187
1188 // Check data consistency
1189 if (PetscUnlikely(static_cast<int>(dofs_array.use_count()) !=
1190 static_cast<int>(dofs_array->size() + 1))) {
1191 SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1192 "Wrong use count %d != %d", dofs_array.use_count(),
1193 dofs_array->size() + 1);
1194 }
1195 if (dofs_field_size0 + dofs_array->size() != dofsField.size()) {
1196 SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1197 "Wrong number of inserted DOFs %d != %d", dofs_array->size(),
1198 dofsField.size() - dofs_field_size0);
1199 }
1200 }
1202}
@ VERY_NOISY
Definition: definitions.h:225
double v
phase velocity of light in medium (cm/ns)
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:316
static UId getLoLocalEntityBitNumber(const char bit_number, const EntityHandle ent)
static UId getHiLocalEntityBitNumber(const char bit_number, const EntityHandle ent)

◆ buildFieldForNoField()

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

Definition at line 1067 of file FieldCore.cpp.

1068 {
1070
1071 if (verb == -1)
1072 verb = verbose;
1073
1074 // find fields
1075 auto field_it = fIelds.get<BitFieldId_mi_tag>().find(id);
1076 if (field_it == fIelds.get<BitFieldId_mi_tag>().end())
1077 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field not found");
1078
1079 if (verb > QUIET)
1080 MOFEM_LOG("WORLD", Sev::noisy)
1081 << "Field " << (*field_it)->getName() << " core value < "
1082 << this->getValue() << " > field value () "
1083 << (*field_it)->getBitNumber() << " )";
1084
1085 CHKERR this->buildFieldForNoFieldImpl(*field_it, dof_counter, verb);
1086
1088}
MoFEMErrorCode buildFieldForNoFieldImpl(boost::shared_ptr< Field > field_ptr, std::map< EntityType, int > &dof_counter, int verb)
Definition: FieldCore.cpp:962

◆ buildFieldForNoFieldImpl()

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

Definition at line 962 of file FieldCore.cpp.

964 {
966
967 const auto bit_number = field_ptr->getBitNumber();
968
969 // ents in the field meshset
970 Range ents;
971 CHKERR get_moab().get_entities_by_handle(field_ptr->getMeshset(), ents,
972 false);
973 if (verb > VERBOSE)
974 MOFEM_LOG_C("SYNC", Sev::noisy, "Ents in field %s meshset %d\n",
975 field_ptr->getName().c_str(), ents.size());
976
977 // ent view by field id (in set all MoabEnts has the same FieldId)
978 auto eiit = entsFields.get<Unique_mi_tag>().lower_bound(
979 FieldEntity::getLoBitNumberUId(field_ptr->getBitNumber()));
981 if (eiit != entsFields.get<Unique_mi_tag>().end()) {
982 auto hi_eiit = entsFields.get<Unique_mi_tag>().upper_bound(
983 FieldEntity::getHiBitNumberUId(field_ptr->getBitNumber()));
984 std::copy(eiit, hi_eiit, std::back_inserter(ents_id_view));
985 }
986
987 boost::shared_ptr<const int> zero_order(new const int(0));
988
989 for (auto ent : ents) {
990 // search if field meshset is in database
991 auto ref_ent_it = refinedEntities.get<Ent_mi_tag>().find(ent);
992 if (ref_ent_it == refinedEntities.get<Ent_mi_tag>().end())
993 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
994 "Entity is not in MoFEM database, entities in field meshset need "
995 "to be seeded (i.e. bit ref level add to them)");
996
997 auto add_dofs = [&](auto field_eit) {
999 // create dofs on this entity (nb. of dofs is equal to rank)
1000 for (FieldCoefficientsNumber rank = 0; rank < field_ptr->getNbOfCoeffs();
1001 rank++) {
1002 // insert dof
1003 auto p = dofsField.insert(
1004 boost::make_shared<DofEntity>(field_eit, 0, rank, rank));
1005 if (p.second) {
1006 dof_counter[MBENTITYSET]++; // Count entities in the meshset
1007 } else
1008 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
1009 "Dof expected to be created");
1010 }
1012 };
1013
1014 // create database entity
1015 auto field_ent_it = ents_id_view.get<1>().find(ent);
1016 if (field_ent_it == ents_id_view.get<1>().end()) {
1017
1018 auto p = entsFields.insert(
1019
1020 boost::make_shared<FieldEntity>(
1021 field_ptr, *ref_ent_it,
1023 *ref_ent_it),
1024 boost::shared_ptr<const int>(zero_order, zero_order.get()))
1025
1026 );
1027
1028 if ((*p.first)->getFieldRawPtr() != field_ptr.get())
1029 SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1030 "Get field ent poiter and field pointer do not match for "
1031 "field %s",
1032 field_ptr->getName().c_str());
1033
1034 if (!p.second)
1035 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1036 "Entity should be created");
1037
1038 CHKERR add_dofs(*(p.first));
1039
1040 } else {
1041
1042 // If there are DOFs in that range is more pragmatic to remove them
1043 // rather than to find sub-ranges or make them inactive
1044 auto dit = dofsField.get<Unique_mi_tag>().lower_bound(
1046 auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(
1048 dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
1049 CHKERR add_dofs(*field_ent_it);
1050 }
1051 }
1052
1053 if (verb > VERBOSE) {
1054 auto lo_dof = dofsField.get<Unique_mi_tag>().lower_bound(
1055 FieldEntity::getLoBitNumberUId(field_ptr->getBitNumber()));
1056 auto hi_dof = dofsField.get<Unique_mi_tag>().upper_bound(
1057 FieldEntity::getHiBitNumberUId(field_ptr->getBitNumber()));
1058 for (; lo_dof != hi_dof; lo_dof++)
1059 MOFEM_LOG("SYNC", Sev::noisy) << **lo_dof;
1061 }
1062
1064}
int FieldCoefficientsNumber
Number of field coefficients.
Definition: Types.hpp:38
multi_index_container< boost::shared_ptr< FieldEntity >, indexed_by< sequenced<>, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FieldEntity::interface_type_RefEntity, EntityHandle, &FieldEntity::getEnt > > > > FieldEntity_multiIndex_ent_view
static UId getHiBitNumberUId(const FieldBitNumber bit_number)
static boost::shared_ptr< FieldData *const > makeSharedFieldDataAdaptorPtr(const boost::shared_ptr< Field > &field_ptr, const boost::shared_ptr< RefEntity > &ref_ents_ptr)
Return shared pointer to entity field data vector adaptor.
static UId getLoBitNumberUId(const FieldBitNumber bit_number)

◆ buildFiniteElements()

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

Definition at line 460 of file FECore.cpp.

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

◆ 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 811 of file ProblemsCore.cpp.

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

◆ 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 70 of file FieldCore.cpp.

70 {
71 auto &set = fIelds.get<FieldName_mi_tag>();
72 auto miit = set.find(name);
73 if (miit == set.end())
74 return false;
75 return true;
76}

◆ 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 31 of file FECore.cpp.

31 {
33 FeSetByName;
34 const FeSetByName &set = finiteElements.get<FiniteElement_name_mi_tag>();
35 FeSetByName::iterator miit = set.find(name);
36 if (miit == set.end())
37 return false;
38 return true;
39}

◆ 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 1410 of file FieldCore.cpp.

1410 {
1412 for (auto &it : fIelds.get<FieldName_mi_tag>()) {
1413 if (it->getSpace() == NOFIELD)
1414 continue; // FIXME: should be treated properly, not test is just
1415 // skipped for this NOFIELD space
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 "
1432 "multiindex < %s >",
1433 it->getName().c_str());
1434 }
1435 }
1437}

◆ 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 1382 of file FieldCore.cpp.

1382 {
1384 auto it = fIelds.get<FieldName_mi_tag>().find(name);
1385 if (it == fIelds.get<FieldName_mi_tag>().end()) {
1386 SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1387 "field not found < %s >", name.c_str());
1388 }
1389 EntityHandle meshset = (*it)->getMeshset();
1390 int num_entities;
1391 CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1392
1393 auto count_field_ents = [&]() {
1394 auto bit_number = (*it)->getBitNumber();
1395 auto low_eit = entsFields.get<Unique_mi_tag>().lower_bound(
1396 FieldEntity::getLoBitNumberUId(bit_number));
1397 auto hi_eit = entsFields.get<Unique_mi_tag>().upper_bound(
1398 FieldEntity::getHiBitNumberUId(bit_number));
1399 return std::distance(low_eit, hi_eit);
1400 };
1401
1402 if (count_field_ents() > (unsigned int)num_entities) {
1403 SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1404 "not equal number of entities in meshset and field multiindex "
1405 "< %s >",
1406 name.c_str());
1407 }
1409}

◆ 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 876 of file FECore.cpp.

876 {
878 FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
879 it = finiteElements.get<FiniteElement_name_mi_tag>().begin();
880 for (; it != finiteElements.get<FiniteElement_name_mi_tag>().end(); it++) {
881 EntityHandle meshset = (*it)->getMeshset();
882
883 int num_entities;
884 CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
885
886 if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
887 (*it)->getName().c_str()) != (unsigned int)num_entities) {
888 SETERRQ1(mofemComm, 1,
889 "not equal number of entities in meshset and finite elements "
890 "multiindex < %s >",
891 (*it)->getName().c_str());
892 }
893 }
895}

◆ 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 853 of file FECore.cpp.

854 {
856 FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
857 it = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
858 if (it == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
859 SETERRQ1(mofemComm, 1, "finite element not found < %s >", name.c_str());
860 }
861 EntityHandle meshset = (*it)->getMeshset();
862
863 int num_entities;
864 CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
865
866 if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
867 (*it)->getName().c_str()) != (unsigned int)num_entities) {
868 SETERRQ1(mofemComm, 1,
869 "not equal number of entities in meshset and finite elements "
870 "multiindex < %s >",
871 (*it)->getName().c_str());
872 }
874}

◆ check_problem()

bool MoFEM::Core::check_problem ( const std::string  name)
protectedvirtual

check if problem exist

Parameters
nameproblem name
Returns
true if problem is in database

Implements MoFEM::CoreInterface.

Definition at line 31 of file ProblemsCore.cpp.

31 {
32 Problem_multiIndex::index<Problem_mi_tag>::type::iterator pit;
33 pit = pRoblems.get<Problem_mi_tag>().find(name);
34 if (pit == pRoblems.get<Problem_mi_tag>().end()) {
35 return false;
36 }
37 return true;
38}

◆ 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 214 of file DeleteCore.cpp.

216 {
218 if (verb == -1)
219 verb = verbose;
220 Range ents;
221 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
224}
MoFEMErrorCode clear_adjacencies_entities(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:214

◆ 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 226 of file DeleteCore.cpp.

226 {
228 if (verb == -1)
229 verb = verbose;
230 for (Range::const_pair_iterator p_eit = ents.pair_begin();
231 p_eit != ents.pair_end(); ++p_eit) {
232 const EntityHandle first = p_eit->first;
233 const EntityHandle second = p_eit->second;
235 Ent_mi_tag>::type::iterator ait,
236 hi_ait;
237 ait = entFEAdjacencies.get<Ent_mi_tag>().lower_bound(first);
238 hi_ait = entFEAdjacencies.get<Ent_mi_tag>().upper_bound(second);
239 entFEAdjacencies.get<Ent_mi_tag>().erase(ait, hi_ait);
240 }
242}

◆ 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 244 of file DeleteCore.cpp.

245 {
247 if (verb == -1)
248 verb = verbose;
249
250 const Field *field_ptr = get_field_structure(name);
251 int field_bit_number = field_ptr->getBitNumber();
252 ParallelComm *pcomm =
253 ParallelComm::get_pcomm(&get_moab(), basicEntityDataPtr->pcommID);
254
255 for (Range::const_pair_iterator p_eit = ents.pair_begin();
256 p_eit != ents.pair_end(); p_eit++) {
257
258 // First and last handle
259 const EntityHandle first = p_eit->first;
260 const EntityHandle second = p_eit->second;
261
262 // Get UId
263 UId first_uid =
264 FieldEntity::getLocalUniqueIdCalculate(field_bit_number, first);
265 UId second_uid =
266 FieldEntity::getLocalUniqueIdCalculate(field_bit_number, second);
267
268 // Find adjacencies
269 auto ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound(first_uid);
270 auto hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound(second_uid);
271 entFEAdjacencies.get<Unique_mi_tag>().erase(ait, hi_ait);
272 }
274}
Field * get_field_structure(const std::string &name)
get field structure
Definition: FieldCore.cpp:78

◆ 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 329 of file DeleteCore.cpp.

331 {
333 Range ents;
334 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
337}
MoFEMErrorCode clear_adjacencies_finite_elements(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
clear adjacency map for finite elements on given bit level
Definition: DeleteCore.cpp:329

◆ clear_adjacencies_finite_elements() [2/3]

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

Definition at line 339 of file DeleteCore.cpp.

340 {
342 if (verb == -1)
343 verb = verbose;
344 for (Range::const_pair_iterator p_eit = ents.pair_begin();
345 p_eit != ents.pair_end(); p_eit++) {
346 EntityHandle first = p_eit->first;
347 EntityHandle second = p_eit->second;
349 FEEnt_mi_tag>::type::iterator ait,
350 hi_ait;
351 ait = entFEAdjacencies.get<FEEnt_mi_tag>().lower_bound(first);
352 hi_ait = entFEAdjacencies.get<FEEnt_mi_tag>().upper_bound(second);
353 entFEAdjacencies.get<FEEnt_mi_tag>().erase(ait, hi_ait);
354 }
356}

◆ 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 358 of file DeleteCore.cpp.

360 {
362 if (verb == -1)
363 verb = verbose;
364
365 FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator
366 it_fe = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
367 if (it_fe != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
368
369 const auto fe_uid = (*it_fe)->getFEUId();
370
371 for (Range::const_pair_iterator p_eit = ents.pair_begin();
372 p_eit != ents.pair_end(); p_eit++) {
373
374 // First and last handle
375 const EntityHandle first = p_eit->first;
376 const EntityHandle second = p_eit->second;
377
378 // Get UId
379 UId first_uid =
381 UId second_uid =
383
384 // Find and remove adjacencies
386 FE_Unique_mi_tag>::type::iterator ait,
387 hi_ait;
388 ait = entFEAdjacencies.get<FE_Unique_mi_tag>().lower_bound(first_uid);
389 hi_ait = entFEAdjacencies.get<FE_Unique_mi_tag>().upper_bound(second_uid);
390 entFEAdjacencies.get<FE_Unique_mi_tag>().erase(ait, hi_ait);
391 }
392 }
394}
UId getLocalUniqueIdCalculate() const
Generate UId for finite element entity.

◆ 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 707 of file Core.cpp.

707 {
709 if (verb == -1)
710 verb = verbose;
713}

◆ 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 70 of file DeleteCore.cpp.

70 {
72 if (verb == -1)
73 verb = verbose;
74
75 for (Range::const_pair_iterator p_eit = ents.pair_begin();
76 p_eit != ents.pair_end(); p_eit++) {
77 EntityHandle first = p_eit->first;
78 EntityHandle second = p_eit->second;
79 // get dofs range
80 DofEntityByEnt::iterator dit, hi_dit;
81 dit = dofsField.get<Ent_mi_tag>().lower_bound(first);
82 if (dit == dofsField.get<Ent_mi_tag>().end())
83 continue;
84 hi_dit = dofsField.get<Ent_mi_tag>().upper_bound(second);
85 // finally clear dofs
86 dofsField.get<Ent_mi_tag>().erase(dit, hi_dit);
87 }
89}

◆ 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 91 of file DeleteCore.cpp.

92 {
94 if (verb == -1)
95 verb = verbose;
96
97 const auto bit_number = get_field_bit_number(name);
98
99 for (Range::const_pair_iterator p_eit = ents.pair_begin();
100 p_eit != ents.pair_end(); p_eit++) {
101 const auto first = p_eit->first;
102 const auto second = p_eit->second;
103 const auto lo_uid = DofEntity::getLoFieldEntityUId(bit_number, first);
104 const auto hi_uid = DofEntity::getHiFieldEntityUId(bit_number, second);
105 auto dit = dofsField.get<Unique_mi_tag>().lower_bound(lo_uid);
106 auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(hi_uid);
107 dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
108 }
110}
FieldBitNumber get_field_bit_number(const std::string name) const
get field bit number
Definition: FieldCore.cpp:41
static UId getLoFieldEntityUId(const FieldBitNumber bit, const EntityHandle ent)
static UId getHiFieldEntityUId(const FieldBitNumber bit, const EntityHandle ent)

◆ 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 58 of file DeleteCore.cpp.

60 {
62 if (verb == -1)
63 verb = verbose;
64 Range ents;
65 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
66 CHKERR clear_dofs_fields(ents, verb);
68}
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:70

◆ 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 126 of file DeleteCore.cpp.

126 {
128 if (verb == -1)
129 verb = verbose;
130 CHKERR clear_dofs_fields(ents, verb);
132 for (Range::const_pair_iterator p_eit = ents.pair_begin();
133 p_eit != ents.pair_end(); p_eit++) {
134 EntityHandle first = p_eit->first;
135 EntityHandle second = p_eit->second;
136 FieldEntity_multiIndex::index<Ent_mi_tag>::type::iterator dit, hi_dit;
137 dit = entsFields.get<Ent_mi_tag>().lower_bound(first);
138 hi_dit = entsFields.get<Ent_mi_tag>().upper_bound(second);
139 entsFields.get<Ent_mi_tag>().erase(dit, hi_dit);
140 }
142}

◆ 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 144 of file DeleteCore.cpp.

145 {
147 if (verb == -1)
148 verb = verbose;
149 const auto bit_number = get_field_bit_number(name);
150 CHKERR clear_dofs_fields(name, ents, verb);
151 CHKERR clear_adjacencies_entities(name, ents, verb);
152 for (Range::const_pair_iterator p_eit = ents.pair_begin();
153 p_eit != ents.pair_end(); p_eit++) {
154 const auto first = p_eit->first;
155 const auto second = p_eit->second;
156 auto dit = entsFields.get<Unique_mi_tag>().lower_bound(
157 FieldEntity::getLocalUniqueIdCalculate(bit_number, first));
158 auto hi_dit = entsFields.get<Unique_mi_tag>().upper_bound(
159 FieldEntity::getLocalUniqueIdCalculate(bit_number, second));
160 entsFields.get<Unique_mi_tag>().erase(dit, hi_dit);
161 }
163}

◆ 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 112 of file DeleteCore.cpp.

114 {
116 if (verb == -1)
117 verb = verbose;
118 Range ents;
119 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
120 CHKERR clear_dofs_fields(ents, verb);
122 CHKERR clear_ents_fields(ents, verb);
124}
MoFEMErrorCode clear_ents_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:126

◆ 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 288 of file DeleteCore.cpp.

288 {
290 if (verb == -1)
291 verb = verbose;
293 for (Range::const_pair_iterator p_eit = ents.pair_begin();
294 p_eit != ents.pair_end(); p_eit++) {
295 EntityHandle first = p_eit->first;
296 EntityHandle second = p_eit->second;
297 EntFiniteElement_multiIndex::index<Ent_mi_tag>::type::iterator fit, hi_fit;
298 fit = entsFiniteElements.get<Ent_mi_tag>().lower_bound(first);
299 hi_fit = entsFiniteElements.get<Ent_mi_tag>().upper_bound(second);
300 entsFiniteElements.get<Ent_mi_tag>().erase(fit, hi_fit);
301 }
303}

◆ clear_finite_elements() [2/2]

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 305 of file DeleteCore.cpp.

306 {
308 if (verb == -1)
309 verb = verbose;
311 for (Range::const_pair_iterator p_eit = ents.pair_begin();
312 p_eit != ents.pair_end(); p_eit++) {
313 EntityHandle first = p_eit->first;
314 EntityHandle second = p_eit->second;
316 Composite_Name_And_Ent_mi_tag>::type::iterator fit,
317 hi_fit;
318 fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
319 boost::make_tuple(name, first));
320 hi_fit =
321 entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
322 boost::make_tuple(name, second));
323 fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().erase(fit,
324 hi_fit);
325 }
327}

◆ 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 276 of file DeleteCore.cpp.

278 {
280 if (verb == -1)
281 verb = verbose;
282 Range ents;
283 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
284 CHKERR clear_finite_elements(ents, verb);
286}
MoFEMErrorCode clear_finite_elements(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:288

◆ clear_inactive_dofs()

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

Clear inactive dofs

Implements MoFEM::CoreInterface.

Definition at line 42 of file DeleteCore.cpp.

42 {
44 if (verb == -1)
45 verb = verbose;
46 Range ents;
47 for (DofEntity_multiIndex::iterator dit = dofsField.begin();
48 dit != dofsField.end();) {
49 if (!dit->get()->getActive()) {
50 dit = dofsField.erase(dit);
51 } else {
52 ++dit;
53 }
54 }
56}

◆ clear_problem()

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

clear problem

Implements MoFEM::CoreInterface.

Definition at line 282 of file ProblemsCore.cpp.

282 {
284 if (verb == -1)
285 verb = verbose;
287 ProblemsByName &prob_by_name = pRoblems.get<Problem_mi_tag>();
288 ProblemsByName::iterator p_miit = prob_by_name.find(problem_name);
289 if (p_miit == prob_by_name.end()) {
290 SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
291 "problem < %s > not found, (top tip: check spelling)",
292 problem_name.c_str());
293 }
294 // zero rows
295 bool success = prob_by_name.modify(p_miit, ProblemZeroNbRowsChange());
296 if (!success)
297 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
298 "modification unsuccessful");
299 // zero cols
300 success = prob_by_name.modify(p_miit, ProblemZeroNbColsChange());
301 if (!success)
302 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
303 "modification unsuccessful");
304 // clear finite elements
305 success =
306 prob_by_name.modify(p_miit, ProblemClearNumeredFiniteElementsChange());
307 if (!success)
308 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
309 "modification unsuccessful");
310 // clear data structures
311 success = prob_by_name.modify(p_miit, ProblemClearSubProblemData());
312 if (!success)
313 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
314 "modification unsuccessful");
315 success = prob_by_name.modify(p_miit, ProblemClearComposedProblemData());
316 if (!success)
317 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
318 "modification unsuccessful");
319 if (p_miit->getRowDofsSequence())
320 p_miit->getRowDofsSequence()->clear();
321 if (p_miit->getColDofsSequence())
322 p_miit->getColDofsSequence()->clear();
323 if (p_miit->getSubData())
324 p_miit->getSubData().reset();
325 if (p_miit->getComposedProblemsData())
326 p_miit->getComposedProblemsData().reset();
328}

◆ clear_problems()

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

clear problems

Implements MoFEM::CoreInterface.

Definition at line 351 of file ProblemsCore.cpp.

351 {
353 if (verb == -1)
354 verb = verbose;
355 // iterate problems
356 for (auto p_miit = pRoblems.begin(); p_miit != pRoblems.end(); p_miit++)
357 CHKERR clear_problem(p_miit->getName(), verb);
359}
MoFEMErrorCode clear_problem(const std::string name, int verb=DEFAULT_VERBOSITY)
clear problem

◆ clearMap()

MoFEMErrorCode MoFEM::Core::clearMap ( )
protected

Cleaning database.

Definition at line 488 of file Core.cpp.

488 {
490 // Cleaning databases in interfaces
491 CHKERR getInterface<SeriesRecorder>()->clearMap();
492 CHKERR getInterface<MeshsetsManager>()->clearMap();
493 CHKERR getInterface<CutMeshInterface>()->clearMap();
494 // Cleaning databases
495 refinedEntities.clear();
496 refinedFiniteElements.clear();
497 fIelds.clear();
498 entsFields.clear();
499 dofsField.clear();
500 finiteElements.clear();
501 entsFiniteElements.clear();
502 entFEAdjacencies.clear();
503 pRoblems.clear();
505}

◆ coreGenericConstructor()

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

Definition at line 184 of file Core.cpp.

185 {
187
188 // This is deprecated ONE should use MoFEM::Core::Initialize
190 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
191 "MoFEM globally is not initialised, call MoFEM::Core::Initialize");
192
193 // Create duplicate communicator
194 wrapMPIMOABComm = boost::make_shared<WrapMPIComm>(comm, false);
195
196 MPI_Comm_size(mofemComm, &sIze);
197 MPI_Comm_rank(mofemComm, &rAnk);
198
199 // CHeck if moab has set communicator if not set communicator interbally
200 ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
201 if (pComm == NULL)
202 pComm = new ParallelComm(&moab, wrapMPIMOABComm->get_comm());
203
204 // Register interfaces for this implementation
205 CHKERR registerInterface<UnknownInterface>();
206 CHKERR registerInterface<CoreInterface>();
207 CHKERR registerInterface<DeprecatedCoreInterface>();
208
209 // Register MOFEM events in PETSc
210 PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
211 PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
212 PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
213 PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
214
215 MOFEM_LOG_CHANNEL("WORLD");
216 MOFEM_LOG_CHANNEL("SELF");
217 MOFEM_LOG_CHANNEL("SYNC");
218
220}
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:228
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:960
PetscLogEvent MOFEM_EVENT_preProcess
Event for preProcess finite element.
Definition: Core.hpp:955
int sIze
MoFEM communicator size.
Definition: Core.hpp:971
ParallelComm * pComm
MOAB communicator structure.
Definition: Core.hpp:969
PetscLogEvent MOFEM_EVENT_operator
Event for evaluating operator of finite element.
Definition: Core.hpp:957
PetscLogEvent MOFEM_EVENT_postProcess
Event for postProcess finite element.
Definition: Core.hpp:959
boost::shared_ptr< WrapMPIComm > wrapMPIMOABComm
manage creation and destruction of MOAB communicator
Definition: Core.hpp:993

◆ 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 filed.

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 416 of file FieldCore.cpp.

418 {
420
421 if (verb == DEFAULT_VERBOSITY)
422 verb = verbose;
423
424 Range verts;
425
426 auto create_vertices = [&]() {
428
429 vector<double *> arrays_coord;
430 EntityHandle startv = 0;
431 ReadUtilIface *iface;
432 CHKERR get_moab().query_interface(iface);
433 CHKERR iface->get_node_coords(3, size, 0, startv, arrays_coord);
434 verts.insert(startv, startv + size - 1);
435 for (int n = 0; n != size; ++n)
436 for (auto d : {0, 1, 2})
437 arrays_coord[d][n] = coords[3 * n + d];
438
440 };
441
442 auto add_verts_to_field = [&]() {
444 EntityHandle field_meshset = get_field_meshset(name);
445 CHKERR get_moab().add_entities(field_meshset, verts);
447 };
448
449 CHKERR create_vertices();
450 CHKERR add_verts_to_field();
451
453}
static Index< 'n', 3 > n
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: dTensor0.hpp:27

◆ 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 552 of file DeleteCore.cpp.

555 {
557 if (verb == -1)
558 verb = verbose;
559
560 Range ents;
561 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
562 Range ents_meshsets = ents.subset_by_type(MBENTITYSET);
563 ents = subtract(ents, ents_meshsets);
564 if(ents.empty()) {
565 if (verb >= VERBOSE)
566 MOFEM_LOG("WORLD", Sev::verbose) << "Nb. of deleted entities 0";
568 }
569
570 if (verb >= VERBOSE)
571 MOFEM_LOG("WORLD", Sev::noisy) << "Deleted ents:\n" << ents;
572
573 CHKERR remove_ents(ents, verb);
574
575 // remove parent
576 if (remove_parent) {
578 }
579
580 Range meshsets;
581 CHKERR get_moab().get_entities_by_type(0, MBENTITYSET, meshsets, true);
582 for (auto m : meshsets) {
583 CHKERR get_moab().remove_entities(m, ents);
584
585 }
586
587 rval = get_moab().delete_entities(ents);
588 if (rval != MB_SUCCESS) {
590 if (verb == QUIET) {
591 MOFEM_LOG("SELF", Sev::noisy) << "Problem deleting:\n" << ents;
592 } else {
593 MOFEM_LOG("SELF", Sev::warning) << "Problem deleting:\n" << ents;
594 }
595 MOFEM_LOG_CHANNEL("WORLD");
596 MOFEM_LOG_TAG("WORLD", "DeleteCore");
597 if (!(mf & MF_NOT_THROW)) {
598 CHK_MOAB_THROW(rval, "Can not delete entities");
599 } else {
600 rval = MB_SUCCESS;
601 }
602 }
603
604 MOFEM_LOG_C("SELF", Sev::noisy, "Nb. of deleted entities %d", ents.size());
605
607}
#define DeleteCoreFunctionBegin
Definition: DeleteCore.cpp:34
@ MF_NOT_THROW
Definition: definitions.h:114
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:589
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
FTensor::Index< 'm', 3 > m
MoFEMErrorCode remove_parents_by_parents(const Range &ents, int verb=DEFAULT_VERBOSITY)
Remove paremts from entities having parents in passed range.
Definition: DeleteCore.cpp:535
MoFEMErrorCode remove_ents(const Range ents, int verb=DEFAULT_VERBOSITY)
remove entities form mofem database
Definition: DeleteCore.cpp:446

◆ 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 626 of file DeleteCore.cpp.

626 {
628 auto &f = fIelds.get<FieldName_mi_tag>();
629 auto mit = f.find(name);
630 if (mit == f.end()) {
631 SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
632 "Finite element <%s> not found", name.c_str());
633 }
634 EntityHandle meshset = mit->get()->getMeshset();
635 Range ents;
636 CHKERR get_moab().get_entities_by_handle(meshset, ents, false);
637 CHKERR remove_ents_from_field(name, ents, verb);
638 CHKERR get_moab().tag_delete((*mit)->th_FieldDataVerts);
639 CHKERR get_moab().tag_delete((*mit)->th_FieldData);
640 CHKERR get_moab().tag_delete((*mit)->th_AppOrder);
641 f.erase(mit);
642 CHKERR get_moab().delete_entities(&meshset, 1);
644}
MoFEMErrorCode remove_ents_from_field(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
remove entities from field
Definition: DeleteCore.cpp:165

◆ 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 609 of file DeleteCore.cpp.

609 {
611 auto &fe = finiteElements.get<FiniteElement_name_mi_tag>();
612 auto mit = fe.find(name);
613 if (mit == fe.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_finite_element(name, ents, verb);
621 fe.erase(mit);
622 CHKERR get_moab().delete_entities(&meshset, 1);
624}
MoFEMErrorCode remove_ents_from_finite_element(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
remove entities from given refinement level to finite element database
Definition: DeleteCore.cpp:396

◆ 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 121 of file ProblemsCore.cpp.

121 {
123 auto p_miit = pRoblems.get<Problem_mi_tag>().find(name);
124 if (p_miit == pRoblems.get<Problem_mi_tag>().end()) {
125 SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "no such problem like < %s >",
126 name.c_str());
127 }
128 const EntityHandle meshset = p_miit->meshset;
129 pRoblems.get<Problem_mi_tag>().erase(p_miit);
130 CHKERR get_moab().delete_entities(&meshset, 1);
132}

◆ 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, 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, contact.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, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.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_divergence_operator.cpp, heat_equation.cpp, heat_method.cpp, hello_world.cpp, helmholtz.cpp, hertz_surface.cpp, higher_derivatives.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, nonlinear_dynamics.cpp, nonlinear_elastic.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, shallow_wave.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, simple_interface.cpp, simple_l2_only.cpp, split_sideset.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_plastic.cpp, unsaturated_transport.cpp, wave_equation.cpp, and wavy_surface.cpp.

Definition at line 125 of file Core.cpp.

125 {
127 PetscPopErrorHandler();
128 isGloballyInitialised = false;
129
130 if (isInitialized == PETSC_FALSE) {
131 PetscBool is_finalized;
132 PetscFinalized(&is_finalized);
133 if (!is_finalized)
134 PetscFinalize();
135 }
136
137 if (!mpiInitialised) {
138 int mpi_finalized;
139 MPI_Finalized(&mpi_finalized);
140 if (!mpi_finalized)
141 MPI_Finalize();
142 }
143 }
144
145 return 0;
146}
static PetscBool isInitialized
petsc was initialised by other agent
Definition: Core.hpp:1014
static int mpiInitialised
mpi was initialised by other agent
Definition: Core.hpp:1013

◆ get_basic_entity_data_ptr()

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

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 302 of file Core.hpp.

302 {
303 return basicEntityDataPtr;
304 }

◆ get_comm()

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

Implements MoFEM::CoreInterface.

Definition at line 977 of file Core.hpp.

977{ return mofemComm; }

◆ get_comm_rank()

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

Implements MoFEM::CoreInterface.

Definition at line 987 of file Core.hpp.

987{ return rAnk; }

◆ get_comm_size()

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

Implements MoFEM::CoreInterface.

Definition at line 982 of file Core.hpp.

982{ 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 869 of file Core.cpp.

869{ 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 808 of file Core.cpp.

808 {
810 *dofs_ptr = &dofsField;
812}

◆ 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 filed 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 1354 of file FieldCore.cpp.

1355 {
1356 return dofsField.get<Unique_mi_tag>().lower_bound(
1358 ent));
1359}

◆ 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 filed 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 1361 of file FieldCore.cpp.

1362 {
1363 return dofsField.get<Unique_mi_tag>().upper_bound(
1365 ent));
1366}

◆ 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 filed 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 1368 of file FieldCore.cpp.

1369 {
1370 return dofsField.get<Unique_mi_tag>().lower_bound(
1373}

◆ 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 filed 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 1375 of file FieldCore.cpp.

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

◆ 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 filed 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 1344 of file FieldCore.cpp.

1344 {
1345 return dofsField.get<Unique_mi_tag>().lower_bound(
1347}

◆ 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 filed 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 1349 of file FieldCore.cpp.

1349 {
1350 return dofsField.get<Unique_mi_tag>().upper_bound(
1352}

◆ 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 filed 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 1334 of file FieldCore.cpp.

1334 {
1335 return entsFields.get<Unique_mi_tag>().lower_bound(
1337}

◆ 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 filed 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 1339 of file FieldCore.cpp.

1339 {
1340 return entsFields.get<Unique_mi_tag>().upper_bound(
1342}

◆ 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 849 of file Core.cpp.

849 {
850 return &entFEAdjacencies;
851}

◆ 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 840 of file Core.cpp.

842 {
844 *dofs_elements_adjacency = &entFEAdjacencies;
846}

◆ 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 863 of file Core.cpp.

863 {
864 return &entsFiniteElements;
865}

◆ 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 821 of file Core.cpp.

822 {
824 *fe_ent_ptr = &entsFiniteElements;
826}

◆ get_fe_by_name_begin()

EntFiniteElementByName::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 843 of file FECore.cpp.

843 {
844 return entsFiniteElements.get<FiniteElement_name_mi_tag>().lower_bound(
845 fe_name);
846}

◆ get_fe_by_name_end()

EntFiniteElementByName::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 848 of file FECore.cpp.

848 {
849 return entsFiniteElements.get<FiniteElement_name_mi_tag>().upper_bound(
850 fe_name);
851}

◆ 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 41 of file FieldCore.cpp.

41 {
42 auto &set = fIelds.get<FieldName_mi_tag>();
43 auto miit = set.find(name);
44 if (miit == set.end())
45 THROW_MESSAGE("field < " + name +
46 " > not in database (top tip: check spelling)");
47 return (*miit)->getBitNumber();
48}
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:574

◆ 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 91 of file FieldCore.cpp.

93 {
94
96 EntityHandle meshset = get_field_meshset(name);
97 CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, true);
99}

◆ 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 110 of file FieldCore.cpp.

111 {
113 EntityHandle meshset = get_field_meshset(name);
114 CHKERR get_moab().get_entities_by_handle(meshset, ents, true);
116}

◆ 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 101 of file FieldCore.cpp.

103 {
105 EntityHandle meshset = get_field_meshset(name);
106 CHKERR get_moab().get_entities_by_type(meshset, type, ents, true);
108}

◆ 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 866 of file Core.cpp.

866 {
867 return &entsFields;
868}

◆ 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 803 of file Core.cpp.

803 {
805 *field_ents = &entsFields;
807}

◆ 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 31 of file FieldCore.cpp.

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

◆ get_field_meshset() [1/2]

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

Definition at line 58 of file FieldCore.cpp.

58 {
59 auto &set = fIelds.get<BitFieldId_mi_tag>();
60 auto miit = set.find(id);
61 if (miit == set.end())
62 THROW_MESSAGE("field not in database (top tip: check spelling)");
63 return (*miit)->meshSet;
64}

◆ 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 66 of file FieldCore.cpp.

66 {
67 return get_field_meshset(get_field_id(name));
68}
BitFieldId get_field_id(const std::string &name) const
Get field Id.
Definition: FieldCore.cpp:31

◆ 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 50 of file FieldCore.cpp.

50 {
51 auto &set = fIelds.get<BitFieldId_mi_tag>();
52 auto miit = set.find(id);
53 if (miit == set.end())
54 THROW_MESSAGE("field not in database (top tip: check spelling)");
55 return (*miit)->getName();
56}

◆ get_field_structure()

Field * MoFEM::Core::get_field_structure ( const std::string &  name)
protectedvirtual

get field structure

Parameters
namefield name
Returns
const Field*

Implements MoFEM::CoreInterface.

Definition at line 78 of file FieldCore.cpp.

78 {
79 auto &set = fIelds.get<FieldName_mi_tag>();
80 auto miit = set.find(name);
81 if (miit == set.end()) {
82 throw MoFEMException(
84 std::string("field < " + name +
85 " > not in database (top tip: check spelling)")
86 .c_str());
87 }
88 return miit->get();
89}

◆ 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 853 of file Core.cpp.

853{ 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 761 of file Core.cpp.

761 {
763 *fields_ptr = &fIelds;
765}

◆ 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 287 of file FECore.cpp.

288 {
289
291
292 EntityHandle meshset = get_finite_element_meshset(name);
293 CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, true);
295}

◆ 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 310 of file FECore.cpp.

311 {
312
314
315 EntityHandle meshset = get_finite_element_meshset(name);
316 CHKERR get_moab().get_entities_by_handle(meshset, ents, true);
317
319}

◆ 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 297 of file FECore.cpp.

299 {
300
302
303 EntityHandle meshset = get_finite_element_meshset(name);
304 CHKERR get_moab().get_entities_by_type(meshset, type, ents, true);
305
307}

◆ get_finite_element_meshset() [1/2]

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

Definition at line 274 of file FECore.cpp.

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

◆ 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 282 of file FECore.cpp.

282 {
284}

◆ 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 860 of file Core.cpp.

860 {
861 return &finiteElements;
862}

◆ 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 815 of file Core.cpp.

815 {
817 *fe_ptr = &finiteElements;
819}

◆ get_meshsets_manager() [1/2]

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

get MeshsetsManager pointer

Implements MoFEM::CoreInterface.

Definition at line 373 of file Core.hpp.

373 {
374 return *get_meshsets_manager_ptr();
375 }
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition: Core.cpp:828

◆ get_meshsets_manager() [2/2]

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

get MeshsetsManager pointer

Implements MoFEM::CoreInterface.

Definition at line 376 of file Core.hpp.

376 {
377 return *get_meshsets_manager_ptr();
378 }

◆ get_meshsets_manager_ptr() [1/2]

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

get MeshsetsManager pointer

Implements MoFEM::CoreInterface.

Definition at line 828 of file Core.cpp.

828 {
829 MeshsetsManager *meshsets_manager_ptr;
830 getInterface(meshsets_manager_ptr);
831 return meshsets_manager_ptr;
832}
IFACE getInterface() const
Get interface pointer to pointer of interface.

◆ get_meshsets_manager_ptr() [2/2]

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

get MeshsetsManager pointer

Implements MoFEM::CoreInterface.

Definition at line 834 of file Core.cpp.

834 {
835 MeshsetsManager *meshsets_manager_ptr;
836 getInterface(meshsets_manager_ptr);
837 return meshsets_manager_ptr;
838}

◆ get_moab() [1/2]

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

get moab instance

Implements MoFEM::CoreInterface.

Definition at line 334 of file Core.hpp.

334{ return moab; }

◆ get_moab() [2/2]

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

get moab instance interface

Implements MoFEM::CoreInterface.

Definition at line 335 of file Core.hpp.

335{ 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 780 of file Core.cpp.

781 {
784 const ProblemsByName &problems = pRoblems.get<Problem_mi_tag>();
785 ProblemsByName::iterator p_miit = problems.find(problem_name);
786 if (p_miit == problems.end()) {
787 SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
788 "problem < %s > not found, (top tip: check spelling)",
789 problem_name.c_str());
790 }
791 *problem_ptr = &*p_miit;
793}

◆ 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 870 of file Core.cpp.

870 {
871 const Problem *prb;
872 CHK_THROW_MESSAGE(get_problem(problem_name, &prb),
873 "Problem of given name not found");
874 return prb;
875}
MoFEMErrorCode get_problem(const std::string &problem_name, const Problem **problem_ptr) const
Get problem database (data structure)
Definition: Core.cpp:780

◆ 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 1311 of file FieldCore.cpp.

1313 {
1315 auto &prb = pRoblems.get<Problem_mi_tag>();
1316 auto p_miit = prb.find(problem_name);
1317 if (p_miit == prb.end())
1318 SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1319 "No such problem like < %s >", problem_name.c_str());
1320 auto miit = p_miit->numeredFiniteElementsPtr->get<FiniteElement_name_mi_tag>()
1321 .lower_bound(fe_name);
1322 auto hi_miit = p_miit->numeredFiniteElementsPtr->get<FiniteElement_name_mi_tag>()
1323 .upper_bound(fe_name);
1324 for (; miit != hi_miit; miit++) {
1325 EntityHandle ent = (*miit)->getEnt();
1326 CHKERR get_moab().add_entities(meshset, &ent, 1);
1327 const int part = (*miit)->getPart();
1328 CHKERR get_moab().tag_set_data(th_Part, &ent, 1, &part);
1329 }
1331}
Tag th_Part
Tag for partition number.
Definition: Core.hpp:268

◆ 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 876 of file Core.cpp.

876{ 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 796 of file Core.cpp.

796 {
798 *problems_ptr = &pRoblems;
800}

◆ 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 854 of file Core.cpp.

854 {
855 return &refinedEntities;
856}

◆ 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 768 of file Core.cpp.

768 {
770 *refined_entities_ptr = &refinedEntities;
772}

◆ 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 857 of file Core.cpp.

857 {
858 return &refinedFiniteElements;
859}

◆ 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 773 of file Core.cpp.

774 {
776 *refined_finite_elements_ptr = &refinedFiniteElements;
778}

◆ get_th_RefBitEdge()

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

Definition at line 209 of file Core.hpp.

209{ return th_RefBitEdge; }

◆ get_th_RefBitLevel()

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

Definition at line 208 of file Core.hpp.

208{ return th_RefBitLevel; }

◆ get_th_RefParentHandle()

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

Definition at line 207 of file Core.hpp.

207{ return th_RefParentHandle; }
Tag th_RefParentHandle
Definition: Core.hpp:269

◆ get_th_RefType()

Tag MoFEM::CoreTmp< 0 >::get_th_RefType ( ) const

Definition at line 210 of file Core.hpp.

210{ return th_RefType; }

◆ getBitFEId()

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

Get field Id.

Parameters
namefield name
Returns
field id

Definition at line 256 of file FECore.cpp.

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

◆ getBitFEIdName()

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

Get field name.

Parameters
idfield id
Returns
field name

Definition at line 266 of file FECore.cpp.

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

◆ getBitProblemId()

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

Definition at line 134 of file ProblemsCore.cpp.

134 {
135 auto p_miit = pRoblems.get<Problem_mi_tag>().find(name);
136 if (p_miit == pRoblems.get<Problem_mi_tag>().end()) {
137 THROW_MESSAGE("no such problem like " + name + " >");
138 }
139 return p_miit->getId();
140}

◆ getBuildMoFEM()

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

Get flags/semaphores for different stages.

Definition at line 236 of file Core.hpp.

236{ return *buildMoFEM; }

◆ getOptions()

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

Get core options from command line.

Returns
MoFEMErrorCode

Definition at line 734 of file Core.cpp.

734 {
736 if (verb == -1)
737 verb = verbose;
738
739 CHKERR PetscOptionsBegin(mofemComm, optionsPrefix.c_str(), "Mesh cut options",
740 "See MoFEM documentation");
741
742 CHKERR PetscOptionsBool(
743 "-mofem_init_fields", "Initialise fields on construction", "",
745
746 CHKERR PetscOptionsBool(
747 "-mofem_init_fields", "Initialise fields on construction", "",
749
750 // TODO: Add read verbosity level
751 // TODO: Add option to initalise problems ??? - DO WE REALLY NEED THAT
752
753 ierr = PetscOptionsEnd();
754 CHKERRG(ierr);
755
757}
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:496
std::string optionsPrefix
Prefix for options on command line.
Definition: Core.hpp:1004

◆ 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)

Definition at line 96 of file Core.hpp.

96 {
97 return RefEntityTmp<0>(this->basicEntityDataPtr, ent);
98 }

◆ getTags()

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

Get tag handles.

Parameters
verbverbosity level
Returns
error code

Definition at line 536 of file Core.cpp.

536 {
538
539 const EntityHandle root_meshset = get_moab().get_root_set();
540 if (root_meshset) {
541 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
542 "Root meshset should be 0");
543 }
544
545 // Set version
546 {
547 Version version;
548 CHKERR getFileVersion(moab, version);
549 }
550
551 // Global Variables
552 {
553
554 auto check_tag_allocated = [](auto &rval) {
556 if (rval == MB_ALREADY_ALLOCATED)
557 rval = MB_SUCCESS;
558 else
559 CHKERRG(rval);
561 };
562
563 // Safety nets
564 int def_bool = 0;
565 rval = get_moab().tag_get_handle("_MoFEMBuild", 1, MB_TYPE_INTEGER,
566 th_MoFEMBuild, MB_TAG_CREAT | MB_TAG_MESH,
567 &def_bool);
568 CHKERR check_tag_allocated(rval);
569
570 CHKERR get_moab().tag_get_by_ptr(th_MoFEMBuild, &root_meshset, 1,
571 (const void **)&buildMoFEM);
572 }
573
574 // Tags saved in vtk-files
575 {
576 const int def_part = -1;
577 CHKERR get_moab().tag_get_handle("PARTITION", 1, MB_TYPE_INTEGER, th_Part,
578 MB_TAG_CREAT | MB_TAG_SPARSE, &def_part);
579 }
580
581 // Tags Ref
582 {
583 const int def_part = -1;
584 CHKERR get_moab().tag_get_handle("_MeshsetPartition", 1, MB_TYPE_INTEGER,
585 th_Part, MB_TAG_CREAT | MB_TAG_SPARSE,
586 &def_part);
587 EntityHandle def_handle = 0;
588 CHKERR get_moab().tag_get_handle("_RefParentHandle", 1, MB_TYPE_HANDLE,
590 MB_TAG_CREAT | MB_TAG_SPARSE, &def_handle);
591 BitRefLevel def_bit_level = 0;
592 CHKERR get_moab().tag_get_handle(
593 "_RefBitLevel", sizeof(BitRefLevel), MB_TYPE_OPAQUE, th_RefBitLevel,
594 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_bit_level);
595 BitRefLevel def_bit_level_mask = BitRefLevel().set();
596 CHKERR get_moab().tag_get_handle(
597 "_RefBitLevelMask", sizeof(BitRefLevel), MB_TYPE_OPAQUE,
598 th_RefBitLevel_Mask, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
599 &def_bit_level_mask);
600 BitRefEdges def_bit_edge = 0;
601 CHKERR get_moab().tag_get_handle(
602 "_RefBitEdge", sizeof(BitRefEdges), MB_TYPE_OPAQUE, th_RefBitEdge,
603 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_bit_edge);
604 const int def_type[] = {0, 0};
605 CHKERR get_moab().tag_get_handle("_RefType", 2, MB_TYPE_INTEGER, th_RefType,
606 MB_TAG_CREAT | MB_TAG_SPARSE, def_type);
607 }
608
609 // Tags Field
610 {
611 const unsigned long int def_id = 0;
612 CHKERR get_moab().tag_get_handle(
613 "_FieldId", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FieldId,
614 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
615 FieldSpace def_space = LASTSPACE;
616 CHKERR get_moab().tag_get_handle(
617 "_FieldSpace", sizeof(FieldSpace), MB_TYPE_OPAQUE, th_FieldSpace,
618 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_space);
620 CHKERR get_moab().tag_get_handle(
621 "_FieldBase", sizeof(FieldApproximationBase), MB_TYPE_OPAQUE,
622 th_FieldBase, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_base);
623 const int def_val_len = 0;
624 CHKERR get_moab().tag_get_handle(
625 "_FieldName", def_val_len, MB_TYPE_OPAQUE, th_FieldName,
626 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
627 CHKERR get_moab().tag_get_handle(
628 "_FieldName_DataNamePrefix", def_val_len, MB_TYPE_OPAQUE,
630 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
631 }
632
633 // Tags FE
634 {
635 const unsigned long int def_id = 0;
636 const int def_val_len = 0;
637 CHKERR get_moab().tag_get_handle(
638 "_FEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_FEId,
639 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
640 CHKERR get_moab().tag_get_handle(
641 "_FEName", def_val_len, MB_TYPE_OPAQUE, th_FEName,
642 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
643 CHKERR get_moab().tag_get_handle(
644 "_FEIdCol", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdCol,
645 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
646 CHKERR get_moab().tag_get_handle(
647 "_FEIdRow", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdRow,
648 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
649 CHKERR get_moab().tag_get_handle(
650 "_FEIdData", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdData,
651 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
652 }
653
654 // Tags Problem
655 {
656 const unsigned long int def_id = 0;
657 const int def_val_len = 0;
658 CHKERR get_moab().tag_get_handle(
659 "_ProblemId", sizeof(BitProblemId), MB_TYPE_OPAQUE, th_ProblemId,
660 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
661 CHKERR get_moab().tag_get_handle(
662 "_ProblemFEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_ProblemFEId,
663 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
664 CHKERR get_moab().tag_get_handle(
665 "_ProblemName", def_val_len, MB_TYPE_OPAQUE, th_ProblemName,
666 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
667 DofIdx def_nbdofs = 0;
668 CHKERR get_moab().tag_get_handle(
669 "_ProblemNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
670 th_ProblemNbDofsRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
671 &def_nbdofs);
672 CHKERR get_moab().tag_get_handle(
673 "_ProblemNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
674 th_ProblemNbDofsCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
675 &def_nbdofs);
676 CHKERR get_moab().tag_get_handle(
677 "_ProblemLocalNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
678 th_ProblemLocalNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
679 &def_nbdofs);
680 CHKERR get_moab().tag_get_handle(
681 "_ProblemGhostNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
682 th_ProblemGhostNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
683 &def_nbdofs);
684 CHKERR get_moab().tag_get_handle(
685 "_ProblemLocalNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
686 th_ProblemLocalNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
687 &def_nbdofs);
688 CHKERR get_moab().tag_get_handle(
689 "_ProblemGhostNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
690 th_ProblemGhostNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
691 &def_nbdofs);
692 }
693
694 // Meshsets with boundary conditions and material sets
695 MeshsetsManager *meshsets_manager_ptr;
696 CHKERR getInterface(meshsets_manager_ptr);
697 CHKERR meshsets_manager_ptr->getTags(verb);
698
699 // Series recorder
700 SeriesRecorder *series_recorder_ptr;
701 CHKERR getInterface(series_recorder_ptr);
702 CHKERR series_recorder_ptr->getTags(verb);
703
705}
FieldApproximationBase
approximation base
Definition: definitions.h:71
@ LASTBASE
Definition: definitions.h:82
@ LASTSPACE
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:102
int DofIdx
Index of DOF.
Definition: Types.hpp:29
std::bitset< BITREFEDGES_SIZE &g