v0.13.1
Loading...
Searching...
No Matches
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_elastic.cpp, unsaturated_transport.cpp, wave_equation.cpp, and wavy_surface.cpp.

Definition at line 82 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 212 of file Core.hpp.

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

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

214 : CoreTmp(moab, comm, verbose, CoreValue<0>()) {
215
216 // Register sub-interfaces
217 ierr = this->registerSubInterfaces();
218 CHKERRABORT(comm, ierr);
219 ierr = this->clearMap();
220 CHKERRABORT(comm, ierr);
221 ierr = this->getTags();
222 CHKERRABORT(comm, ierr);
223 ierr = this->getOptions(verbose);
224 CHKERRABORT(comm, ierr);
225
226 this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
228
230 CHKERRABORT(comm, ierr);
231}
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:475
static void setRefEntBasicDataPtr(MoFEM::Interface &m_field, boost::shared_ptr< BasicEntityData > &ptr)
Definition: Core.cpp:875
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition: Core.cpp:268
MoFEMErrorCode registerSubInterfaces()
Register insterfaces.
Definition: Core.cpp:439
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
Definition: Core.cpp:721
int verbose
Verbosity level.
Definition: Core.hpp:985
MoFEMErrorCode getTags(int verb=DEFAULT_VERBOSITY)
Get tag handles.
Definition: Core.cpp:523
CoreTmp(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
Definition: Core.cpp:209
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:283
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:323

◆ ~CoreTmp()

MoFEM::Core::~CoreTmp ( )

Definition at line 257 of file Core.cpp.

257 {
258 PetscBool is_finalized;
259 PetscFinalized(&is_finalized);
260 // Destroy interfaces
261 iFaces.clear();
262 // This is deprecated ONE should use MoFEM::Core::Initialize
263 if (isGloballyInitialised && is_finalized) {
264 isGloballyInitialised = false;
265 }
266}
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:1002
boost::ptr_map< boost::typeindex::type_index, UnknownInterface > iFaces
Hash map of pointers to interfaces.
Definition: Core.hpp:990

◆ CoreTmp() [2/2]

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

Construct core database

Parameters
moabMoAB interface
commMPI communicator

Definition at line 32 of file CoreTemplates.hpp.

34 : moab(moab), mofemComm(comm), verbose(verbose),
35 initaliseAndBuildField(PETSC_FALSE),
37
39 CHKERRABORT(comm, ierr);
40
41 MOFEM_LOG_CHANNEL("WORLD");
42 if (verbose > QUIET) {
43 MOFEM_LOG_C("WORLD", Sev::verbose, "Core number < %d >", V);
44 }
45}
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:304
@ QUIET
Definition: definitions.h:208
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:277
PetscBool initaliseAndBuildFiniteElements
Definition: Core.hpp:999
MoFEMErrorCode coreGenericConstructor(moab::Interface &moab, MPI_Comm comm, const int verbose)
Definition: Core.cpp:171
PetscBool initaliseAndBuildField
Definition: Core.hpp:996
MPI_Comm mofemComm
MoFEM communicator.
Definition: Core.hpp:958

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

384 {
386 Range ents;
387 CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
388 CHKERR addEntsToFieldByDim(ents, dim, name, verb);
391}
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:338
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define CHKERR
Inline error check.
Definition: definitions.h:535
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
const int dim
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:284
moab::Interface & get_moab()
Definition: Core.hpp:324

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

359 {
361 Range ents_dim = ents.subset_by_dimension(dim);
362 CHKERR addEntsToFieldByDim(ents_dim, dim, name, verb);
365}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416

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

396 {
398 Range ents;
399 CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
400 if (!ents.empty()) {
401 const int dim = get_moab().dimension_from_handle(ents[0]);
402 CHKERR addEntsToFieldByDim(ents, dim, name, verb);
403 }
406}

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

370 {
372 Range ents_type = ents.subset_by_type(type);
373 if (!ents_type.empty()) {
374 const int dim = get_moab().dimension_from_handle(ents_type[0]);
375 CHKERR addEntsToFieldByDim(ents_type, dim, name, verb);
376 }
379}

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

395 {
397
398 if (verb == -1)
399 verb = verbose;
400 *buildMoFEM &= 1 << 0;
401 const BitFEId id = getBitFEId(name);
403
404 auto &ref_MoFEMFiniteElement = refinedFiniteElements.get<Ent_mi_tag>();
405 auto miit = ref_MoFEMFiniteElement.lower_bound(get_id_for_min_type(type));
406 auto hi_miit = ref_MoFEMFiniteElement.upper_bound(get_id_for_max_type(type));
407
408 int nb_add_fes = 0;
409 for (; miit != hi_miit; miit++) {
410 const auto &bit2 = miit->get()->getBitRefLevel();
411 if ((bit2 & mask) != bit2)
412 continue;
413 if ((bit2 & bit).any()) {
414 EntityHandle ent = miit->get()->getEnt();
415 CHKERR get_moab().add_entities(idm, &ent, 1);
416 nb_add_fes++;
417 }
418 }
419
420 MOFEM_LOG("SYNC", Sev::inform)
421 << "Finite element " << name << " added. Nb. of elements added "
422 << nb_add_fes << " out of " << std::distance(miit, hi_miit);
423
425
427}
#define FECoreFunctionBegin
Definition: FECore.cpp:8
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:301
auto bit
set bit
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:43
EntityHandle get_id_for_max_type()
EntityHandle get_id_for_min_type()
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:261
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:303
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:992
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:243

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

336 {
338 *buildMoFEM &= 1 << 0;
341 Range ents;
342 CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
343 CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
344 CHKERR get_moab().add_entities(idm, ents);
346}
const EntityHandle no_handle
No entity handle is indicated by zero handle, i.e. root meshset.
Definition: Common.hpp:12

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

362 {
364 *buildMoFEM &= 1 << 0;
367 CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
368 ents.subset_by_dimension(dim));
369 CHKERR get_moab().add_entities(idm, ents.subset_by_dimension(dim));
371}

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

430 {
432 *buildMoFEM &= 1 << 0;
433 const BitFEId id = getBitFEId(name);
435 if (recursive == false) {
436 CHKERR get_moab().add_entities(idm, &meshset, 1);
437 } else {
438 Range meshsets;
439 CHKERR get_moab().get_entities_by_type(meshset, MBENTITYSET, meshsets,
440 false);
441 CHKERR get_moab().add_entities(idm, meshsets);
442 }
444}

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

319 {
320 *buildMoFEM &= 1 << 0;
323
325 Range ents;
326 CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
327 CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
328 CHKERR get_moab().add_entities(idm, ents);
329
331}

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

349 {
351 *buildMoFEM &= 1 << 0;
354 CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
355 ents.subset_by_type(type));
356 CHKERR get_moab().add_entities(idm, ents.subset_by_type(type));
358} // 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 384 of file FECore.cpp.

386 {
388 CHKERR add_ents_to_finite_element_by_bit_ref(bit, mask, name, type, verb);
389
391}
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:393

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

376 {
379 type, verb);
380
382}
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40

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

279 {
280 return this->addField(name, space, base, nb_of_coefficients, tag_type, bh,
281 verb);
282}
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:105

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

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

◆ add_problem()

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

Add problem.

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

Implements MoFEM::CoreInterface.

Definition at line 84 of file ProblemsCore.cpp.

85 {
87 if (verb == -1)
88 verb = verbose;
89 auto miit = pRoblems.get<Problem_mi_tag>().find(name);
90 if (miit == pRoblems.get<Problem_mi_tag>().end()) {
91
92 int p_shift = 0;
93 for (; pRoblems.get<BitProblemId_mi_tag>().find(BitProblemId().set(
94 p_shift)) != pRoblems.get<BitProblemId_mi_tag>().end();
95 ++p_shift) {
96 }
97
98 auto id = BitProblemId().set(p_shift);
99 CHKERR addProblem(id, name, verb);
100
101 } else if (bh == MF_EXCL) {
102 SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem is in database %s",
103 name.c_str());
104 }
106}
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition: Types.hpp:44
MoFEMErrorCode addProblem(const BitProblemId id, const std::string &name, int verb=DEFAULT_VERBOSITY)
add problem
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:315

◆ addEntsToFieldByDim()

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

Definition at line 284 of file FieldCore.cpp.

285 {
286
287 *buildMoFEM = 0;
289 if (verb == -1)
290 verb = verbose;
291
292 MOFEM_LOG_CHANNEL("SYNC");
293 MOFEM_LOG_TAG("SYNC", "FieldCore");
295
297 idm = get_field_meshset(name);
298 FieldSpace space;
299 CHKERR get_moab().tag_get_data(th_FieldSpace, &idm, 1, &space);
300 std::vector<int> nb_ents_on_dim(3, 0);
301 switch (space) {
302 case L2:
303 CHKERR get_moab().add_entities(idm, ents);
304 break;
305 case H1:
306 CHKERR get_moab().add_entities(idm, ents);
307 for (int dd = 0; dd != dim; ++dd) {
308 Range adj_ents;
309 CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
310 moab::Interface::UNION);
311 if (dd == 0) {
312 Range topo_nodes;
313 CHKERR get_moab().get_connectivity(ents, topo_nodes, true);
314 Range mid_nodes;
315 CHKERR get_moab().get_connectivity(ents, mid_nodes, false);
316 mid_nodes = subtract(mid_nodes, topo_nodes);
317 adj_ents = subtract(adj_ents, mid_nodes);
318 }
319 CHKERR get_moab().add_entities(idm, adj_ents);
320 nb_ents_on_dim[dd] = adj_ents.size();
321 }
322 break;
323 case HCURL:
324 CHKERR get_moab().add_entities(idm, ents);
325 for (int dd = 1; dd != dim; ++dd) {
326 Range adj_ents;
327 CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
328 moab::Interface::UNION);
329 CHKERR get_moab().add_entities(idm, adj_ents);
330 nb_ents_on_dim[dd] = adj_ents.size();
331 }
332 break;
333 case HDIV:
334 CHKERR get_moab().add_entities(idm, ents);
335 if (dim > 2) {
336 Range adj_ents;
337 CHKERR get_moab().get_adjacencies(ents, 2, false, adj_ents,
338 moab::Interface::UNION);
339 CHKERR get_moab().add_entities(idm, adj_ents);
340 nb_ents_on_dim[2] = adj_ents.size();
341 }
342 break;
343 default:
344 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
345 "sorry, unknown space added to entity");
346 }
347 if (verb >= VERBOSE) {
348 MOFEM_LOG("SYNC", Sev::noisy) << "add entities to field " << name;
349 MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add ents " << ents.size();
350 MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add faces " << nb_ents_on_dim[2];
351 MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add edges " << nb_ents_on_dim[1];
352 MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add nodes " << nb_ents_on_dim[0];
353 }
355}
@ VERBOSE
Definition: definitions.h:209
FieldSpace
approximation spaces
Definition: definitions.h:82
@ L2
field with C-1 continuity
Definition: definitions.h:88
@ H1
continuous field
Definition: definitions.h:85
@ HCURL
field with continuous tangents
Definition: definitions.h:86
@ HDIV
field with continuous normal traction
Definition: definitions.h:87
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:332
#define MOFEM_LOG_FUNCTION()
Set scope.
Definition: LogManager.hpp:318
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:45

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

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

494 {
496 if (verb == -1)
497 verb = verbose;
498 std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
499 p_ent = refinedEntities.insert(
500 boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
501 if (p_ent.second) {
502 std::pair<RefElement_multiIndex::iterator, bool> p;
503 p = refinedFiniteElements.insert(
504 boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)));
505 int num_nodes;
506 const EntityHandle *conn;
507 CHKERR get_moab().get_connectivity(prism, conn, num_nodes, true);
508 Range face_side3, face_side4;
509 CHKERR get_moab().get_adjacencies(conn, 3, 2, false, face_side3);
510 CHKERR get_moab().get_adjacencies(&conn[3], 3, 2, false, face_side4);
511 if (face_side3.size() != 1)
512 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
513 "prism don't have side face 3");
514 if (face_side4.size() != 1)
515 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
516 "prims don't have side face 4");
517 p.first->get()->getSideNumberPtr(*face_side3.begin());
518 p.first->get()->getSideNumberPtr(*face_side4.begin());
519 }
521}
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:302

◆ addProblem()

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

add problem

Parameters
idproblem id
nameproblem name
verbverbosity level
Returns
MoFEMErrorCode

Definition at line 27 of file ProblemsCore.cpp.

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

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

809 {
811 if (verb == -1)
812 verb = verbose;
813 Range ents;
814 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents);
815
816 CHKERR build_adjacencies(ents, verb);
817
819}
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)
build adjacencies
Definition: FECore.cpp:737

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

820 {
822 if (verb == -1)
823 verb = verbose;
824 CHKERR build_adjacencies(bit, BitRefLevel().set(), verb);
825
827}

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

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

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

1247 {
1249 auto field_it = fIelds.get<FieldName_mi_tag>().find(field_name);
1250 if (field_it == fIelds.get<FieldName_mi_tag>().end())
1251 SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field < %s > not found",
1252 field_name.c_str());
1253
1254 CHKERR this->buildField(*field_it, verb);
1255 if (verb > QUIET)
1258}
#define FieldCoreFunctionBegin
Definition: FieldCore.cpp:8
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:1196

◆ build_fields()

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

build fields

Implements MoFEM::CoreInterface.

Definition at line 1260 of file FieldCore.cpp.

1260 {
1262 if (verb == -1)
1263 verb = verbose;
1264
1265 for (auto field : fIelds.get<BitFieldId_mi_tag>())
1266 CHKERR this->buildField(field, verb);
1267
1268 *buildMoFEM = 1 << 0;
1269 if (verb > QUIET) {
1270 MOFEM_LOG("SYNC", Sev::inform) << "Number of dofs " << dofsField.size();
1272 }
1273
1275}
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:307

◆ build_finite_elements() [1/3]

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

Definition at line 703 of file FECore.cpp.

703 {
705 SETERRQ(mofemComm, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
707}
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32

◆ build_finite_elements() [2/3]

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

Build finite elements.

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

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

Implements MoFEM::CoreInterface.

Definition at line 709 of file FECore.cpp.

711 {
713 if (verb == -1)
714 verb = verbose;
715
716 auto fe_miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
717 if (fe_miit == finiteElements.get<FiniteElement_name_mi_tag>().end())
718 SETERRQ1(mofemComm, MOFEM_NOT_FOUND, "Finite element <%s> not found",
719 fe_name.c_str());
720
721 CHKERR buildFiniteElements(*fe_miit, ents_ptr, verb);
722
723 if (verb >= VERBOSE) {
724 auto &fe_ents = entsFiniteElements.get<FiniteElement_name_mi_tag>();
725 auto miit = fe_ents.lower_bound((*fe_miit)->getName());
726 auto hi_miit = fe_ents.upper_bound((*fe_miit)->getName());
727 const auto count = std::distance(miit, hi_miit);
728 MOFEM_LOG("SYNC", Sev::inform) << "Finite element " << fe_name
729 << " added. Nb. of elements added " << count;
731 }
732
733 *buildMoFEM |= 1 << 1;
735}
MoFEMErrorCode buildFiniteElements(const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
Definition: FECore.cpp:447

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

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

◆ build_problem_on_distributed_mesh()

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

Definition at line 257 of file ProblemsCore.cpp.

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

◆ build_problems()

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

Definition at line 317 of file ProblemsCore.cpp.

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

◆ buildField()

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

Definition at line 1196 of file FieldCore.cpp.

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

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

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

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

◆ buildFieldForNoFieldImpl()

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

Definition at line 954 of file FieldCore.cpp.

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

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

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

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

◆ check_finite_element()

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

Check if finite element is in database.

Parameters
nameName of finite element
Returns
true if element is declared

Implements MoFEM::CoreInterface.

Definition at line 18 of file FECore.cpp.

18 {
19 typedef FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type
20 FeSetByName;
21 const FeSetByName &set = finiteElements.get<FiniteElement_name_mi_tag>();
22 FeSetByName::iterator miit = set.find(name);
23 if (miit == set.end())
24 return false;
25 return true;
26}

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

1402 {
1404 for (auto &it : fIelds.get<FieldName_mi_tag>()) {
1405 if (it->getSpace() == NOFIELD)
1406 continue; // FIXME: should be treated properly, not test is just
1407 // skipped for this NOFIELD space
1408 EntityHandle meshset = it->getMeshset();
1409 int num_entities;
1410 CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1411
1412 auto count_field_ents = [&]() {
1413 auto bit_number = it->getBitNumber();
1414 auto low_eit = entsFields.get<Unique_mi_tag>().lower_bound(
1415 FieldEntity::getLoBitNumberUId(bit_number));
1416 auto hi_eit = entsFields.get<Unique_mi_tag>().upper_bound(
1417 FieldEntity::getHiBitNumberUId(bit_number));
1418 return std::distance(low_eit, hi_eit);
1419 };
1420
1421 if (count_field_ents() > (unsigned int)num_entities) {
1422 SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1423 "not equal number of entities in meshset and field "
1424 "multiindex < %s >",
1425 it->getName().c_str());
1426 }
1427 }
1429}

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

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

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

863 {
865 FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
866 it = finiteElements.get<FiniteElement_name_mi_tag>().begin();
867 for (; it != finiteElements.get<FiniteElement_name_mi_tag>().end(); it++) {
868 EntityHandle meshset = (*it)->getMeshset();
869
870 int num_entities;
871 CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
872
873 if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
874 (*it)->getName().c_str()) != (unsigned int)num_entities) {
875 SETERRQ1(mofemComm, 1,
876 "not equal number of entities in meshset and finite elements "
877 "multiindex < %s >",
878 (*it)->getName().c_str());
879 }
880 }
882}

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

841 {
843 FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
844 it = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
845 if (it == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
846 SETERRQ1(mofemComm, 1, "finite element not found < %s >", name.c_str());
847 }
848 EntityHandle meshset = (*it)->getMeshset();
849
850 int num_entities;
851 CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
852
853 if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
854 (*it)->getName().c_str()) != (unsigned int)num_entities) {
855 SETERRQ1(mofemComm, 1,
856 "not equal number of entities in meshset and finite elements "
857 "multiindex < %s >",
858 (*it)->getName().c_str());
859 }
861}

◆ check_problem()

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

check if problem exist

Parameters
nameproblem name
Returns
true if problem is in database

Implements MoFEM::CoreInterface.

◆ clear_adjacencies_entities() [1/3]

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

clear adjacency map for entities on given bit level

Parameters
bit
mask

Implements MoFEM::CoreInterface.

Definition at line 201 of file DeleteCore.cpp.

203 {
205 if (verb == -1)
206 verb = verbose;
207 Range ents;
208 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
211}
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:201

◆ clear_adjacencies_entities() [2/3]

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

clear adjacencies for field entities by entities

Implements MoFEM::CoreInterface.

Definition at line 213 of file DeleteCore.cpp.

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

◆ clear_adjacencies_entities() [3/3]

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

clear adjacencies for field entities by entities and field namd

Implements MoFEM::CoreInterface.

Definition at line 231 of file DeleteCore.cpp.

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

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

318 {
320 Range ents;
321 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
324}
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:316

◆ clear_adjacencies_finite_elements() [2/3]

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

Definition at line 326 of file DeleteCore.cpp.

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

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

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

694 {
696 if (verb == -1)
697 verb = verbose;
700}

◆ clear_dofs_fields() [1/2]

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

Clear dofs by ents

Implements MoFEM::CoreInterface.

Definition at line 57 of file DeleteCore.cpp.

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

◆ clear_dofs_fields() [2/2]

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

Clear dofs by field name and ents

Implements MoFEM::CoreInterface.

Definition at line 78 of file DeleteCore.cpp.

79 {
81 if (verb == -1)
82 verb = verbose;
83
84 const auto bit_number = get_field_bit_number(name);
85
86 for (Range::const_pair_iterator p_eit = ents.pair_begin();
87 p_eit != ents.pair_end(); p_eit++) {
88 const auto first = p_eit->first;
89 const auto second = p_eit->second;
90 const auto lo_uid = DofEntity::getLoFieldEntityUId(bit_number, first);
91 const auto hi_uid = DofEntity::getHiFieldEntityUId(bit_number, second);
92 auto dit = dofsField.get<Unique_mi_tag>().lower_bound(lo_uid);
93 auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(hi_uid);
94 dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
95 }
97}
FieldBitNumber get_field_bit_number(const std::string name) const
get field bit number
Definition: FieldCore.cpp:28
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 45 of file DeleteCore.cpp.

47 {
49 if (verb == -1)
50 verb = verbose;
51 Range ents;
52 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
53 CHKERR clear_dofs_fields(ents, verb);
55}
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:57

◆ clear_ents_fields() [1/2]

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

Clear entities by field name

Implements MoFEM::CoreInterface.

Definition at line 113 of file DeleteCore.cpp.

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

◆ clear_ents_fields() [2/2]

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

Clear entities by field name

Implements MoFEM::CoreInterface.

Definition at line 131 of file DeleteCore.cpp.

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

◆ clear_ents_fields_by_bit_ref()

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

Clear ents by bit level

Implements MoFEM::CoreInterface.

Definition at line 99 of file DeleteCore.cpp.

101 {
103 if (verb == -1)
104 verb = verbose;
105 Range ents;
106 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
107 CHKERR clear_dofs_fields(ents, verb);
109 CHKERR clear_ents_fields(ents, verb);
111}
MoFEMErrorCode clear_ents_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:113

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

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

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

293 {
295 if (verb == -1)
296 verb = verbose;
298 for (Range::const_pair_iterator p_eit = ents.pair_begin();
299 p_eit != ents.pair_end(); p_eit++) {
300 EntityHandle first = p_eit->first;
301 EntityHandle second = p_eit->second;
302 EntFiniteElement_multiIndex::index<
303 Composite_Name_And_Ent_mi_tag>::type::iterator fit,
304 hi_fit;
305 fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
306 boost::make_tuple(name, first));
307 hi_fit =
308 entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
309 boost::make_tuple(name, second));
310 fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().erase(fit,
311 hi_fit);
312 }
314}

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

265 {
267 if (verb == -1)
268 verb = verbose;
269 Range ents;
270 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
271 CHKERR clear_finite_elements(ents, verb);
273}
MoFEMErrorCode clear_finite_elements(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:275

◆ clear_inactive_dofs()

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

Clear inactive dofs

Implements MoFEM::CoreInterface.

Definition at line 29 of file DeleteCore.cpp.

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

◆ clear_problem()

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

clear problem

Implements MoFEM::CoreInterface.

Definition at line 269 of file ProblemsCore.cpp.

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

◆ clear_problems()

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

clear problems

Implements MoFEM::CoreInterface.

Definition at line 338 of file ProblemsCore.cpp.

338 {
340 if (verb == -1)
341 verb = verbose;
342 // iterate problems
343 for (auto p_miit = pRoblems.begin(); p_miit != pRoblems.end(); p_miit++)
344 CHKERR clear_problem(p_miit->getName(), verb);
346}
MoFEMErrorCode clear_problem(const std::string name, int verb=DEFAULT_VERBOSITY)
clear problem

◆ clearMap()

MoFEMErrorCode MoFEM::Core::clearMap ( )
protected

Cleaning database.

Definition at line 475 of file Core.cpp.

475 {
477 // Cleaning databases in interfaces
478 CHKERR getInterface<SeriesRecorder>()->clearMap();
479 CHKERR getInterface<MeshsetsManager>()->clearMap();
480 CHKERR getInterface<CutMeshInterface>()->clearMap();
481 // Cleaning databases
482 refinedEntities.clear();
483 refinedFiniteElements.clear();
484 fIelds.clear();
485 entsFields.clear();
486 dofsField.clear();
487 finiteElements.clear();
488 entsFiniteElements.clear();
489 entFEAdjacencies.clear();
490 pRoblems.clear();
492}

◆ coreGenericConstructor()

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

Definition at line 171 of file Core.cpp.

172 {
174
175 // This is deprecated ONE should use MoFEM::Core::Initialize
177 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
178 "MoFEM globally is not initialised, call MoFEM::Core::Initialize");
179
180 // Create duplicate communicator
181 wrapMPIMOABComm = boost::make_shared<WrapMPIComm>(comm, false);
182
183 MPI_Comm_size(mofemComm, &sIze);
184 MPI_Comm_rank(mofemComm, &rAnk);
185
186 // CHeck if moab has set communicator if not set communicator interbally
187 ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
188 if (pComm == NULL)
189 pComm = new ParallelComm(&moab, wrapMPIMOABComm->get_comm());
190
191 // Register interfaces for this implementation
192 CHKERR registerInterface<UnknownInterface>();
193 CHKERR registerInterface<CoreInterface>();
194 CHKERR registerInterface<DeprecatedCoreInterface>();
195
196 // Register MOFEM events in PETSc
197 PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
198 PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
199 PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
200 PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
201
202 MOFEM_LOG_CHANNEL("WORLD");
203 MOFEM_LOG_CHANNEL("SELF");
204 MOFEM_LOG_CHANNEL("SYNC");
205
207}
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:215
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:950
PetscLogEvent MOFEM_EVENT_preProcess
Event for preProcess finite element.
Definition: Core.hpp:945
int sIze
MoFEM communicator size.
Definition: Core.hpp:961
ParallelComm * pComm
MOAB communicator structure.
Definition: Core.hpp:959
PetscLogEvent MOFEM_EVENT_operator
Event for evaluating operator of finite element.
Definition: Core.hpp:947
PetscLogEvent MOFEM_EVENT_postProcess
Event for postProcess finite element.
Definition: Core.hpp:949
boost::shared_ptr< WrapMPIComm > wrapMPIMOABComm
manage creation and destruction of MOAB communicator
Definition: Core.hpp:983

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

410 {
412
413 if (verb == DEFAULT_VERBOSITY)
414 verb = verbose;
415
416 Range verts;
417
418 auto create_vertices = [&]() {
420
421 vector<double *> arrays_coord;
422 EntityHandle startv = 0;
423 ReadUtilIface *iface;
424 CHKERR get_moab().query_interface(iface);
425 CHKERR iface->get_node_coords(3, size, 0, startv, arrays_coord);
426 verts.insert(startv, startv + size - 1);
427 for (int n = 0; n != size; ++n)
428 for (auto d : {0, 1, 2})
429 arrays_coord[d][n] = coords[3 * n + d];
430
432 };
433
434 auto add_verts_to_field = [&]() {
436 EntityHandle field_meshset = get_field_meshset(name);
437 CHKERR get_moab().add_entities(field_meshset, verts);
439 };
440
441 CHKERR create_vertices();
442 CHKERR add_verts_to_field();
443
445}
FTensor::Index< 'n', SPACE_DIM > n

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

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

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

613 {
615 auto &f = fIelds.get<FieldName_mi_tag>();
616 auto mit = f.find(name);
617 if (mit == f.end()) {
618 SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
619 "Finite element <%s> not found", name.c_str());
620 }
621 EntityHandle meshset = mit->get()->getMeshset();
622 Range ents;
623 CHKERR get_moab().get_entities_by_handle(meshset, ents, false);
624 CHKERR remove_ents_from_field(name, ents, verb);
625 CHKERR get_moab().tag_delete((*mit)->th_FieldDataVerts);
626 CHKERR get_moab().tag_delete((*mit)->th_FieldData);
627 CHKERR get_moab().tag_delete((*mit)->th_AppOrder);
628 f.erase(mit);
629 CHKERR get_moab().delete_entities(&meshset, 1);
631}
auto f
Definition: HenckyOps.hpp:5
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:152

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

596 {
598 auto &fe = finiteElements.get<FiniteElement_name_mi_tag>();
599 auto mit = fe.find(name);
600 if (mit == fe.end()) {
601 SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
602 "Finite element <%s> not found", name.c_str());
603 }
604 EntityHandle meshset = mit->get()->getMeshset();
605 Range ents;
606 CHKERR get_moab().get_entities_by_handle(meshset, ents, false);
607 CHKERR remove_ents_from_finite_element(name, ents, verb);
608 fe.erase(mit);
609 CHKERR get_moab().delete_entities(&meshset, 1);
611}
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:383

◆ delete_problem()

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

Delete problem.

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

Implements MoFEM::CoreInterface.

Definition at line 108 of file ProblemsCore.cpp.

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

◆ Finalize()

MoFEMErrorCode MoFEM::Core::Finalize ( )
static

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

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

Note
This function calls PetscInitialize, for more details see http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscFinalize.html
Returns
MoFEMErrorCode
Examples
add_blockset.cpp, add_cubit_meshsets.cpp, 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_elastic.cpp, unsaturated_transport.cpp, wave_equation.cpp, and wavy_surface.cpp.

Definition at line 112 of file Core.cpp.

112 {
114 PetscPopErrorHandler();
115 isGloballyInitialised = false;
116
117 if (isInitialized == PETSC_FALSE) {
118 PetscBool is_finalized;
119 PetscFinalized(&is_finalized);
120 if (!is_finalized)
121 PetscFinalize();
122 }
123
124 if (!mpiInitialised) {
125 int mpi_finalized;
126 MPI_Finalized(&mpi_finalized);
127 if (!mpi_finalized)
128 MPI_Finalize();
129 }
130 }
131
132 return 0;
133}
static PetscBool isInitialized
petsc was initialised by other agent
Definition: Core.hpp:1004
static int mpiInitialised
mpi was initialised by other agent
Definition: Core.hpp:1003

◆ get_basic_entity_data_ptr()

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

Get pointer to basic entity data.

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

Implements MoFEM::CoreInterface.

Definition at line 292 of file Core.hpp.

292 {
293 return basicEntityDataPtr;
294 }

◆ get_comm()

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

Implements MoFEM::CoreInterface.

Definition at line 967 of file Core.hpp.

967{ return mofemComm; }

◆ get_comm_rank()

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

Implements MoFEM::CoreInterface.

Definition at line 977 of file Core.hpp.

977{ return rAnk; }

◆ get_comm_size()

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

Implements MoFEM::CoreInterface.

Definition at line 972 of file Core.hpp.

972{ 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 856 of file Core.cpp.

856{ 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 795 of file Core.cpp.

795 {
797 *dofs_ptr = &dofsField;
799}

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

1347 {
1348 return dofsField.get<Unique_mi_tag>().lower_bound(
1350 ent));
1351}

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

1354 {
1355 return dofsField.get<Unique_mi_tag>().upper_bound(
1357 ent));
1358}

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

1361 {
1362 return dofsField.get<Unique_mi_tag>().lower_bound(
1364 get_id_for_min_type(type)));
1365}

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

1368 {
1369 return dofsField.get<Unique_mi_tag>().upper_bound(
1371 get_id_for_max_type(type)));
1372}

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

1336 {
1337 return dofsField.get<Unique_mi_tag>().lower_bound(
1339}

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

1341 {
1342 return dofsField.get<Unique_mi_tag>().upper_bound(
1344}

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

1326 {
1327 return entsFields.get<Unique_mi_tag>().lower_bound(
1329}

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

1331 {
1332 return entsFields.get<Unique_mi_tag>().upper_bound(
1334}

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

836 {
837 return &entFEAdjacencies;
838}

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

829 {
831 *dofs_elements_adjacency = &entFEAdjacencies;
833}

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

850 {
851 return &entsFiniteElements;
852}

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

809 {
811 *fe_ent_ptr = &entsFiniteElements;
813}

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

830 {
831 return entsFiniteElements.get<FiniteElement_name_mi_tag>().lower_bound(
832 fe_name);
833}

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

835 {
836 return entsFiniteElements.get<FiniteElement_name_mi_tag>().upper_bound(
837 fe_name);
838}

◆ get_field_bit_number()

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

get field bit number

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

Implements MoFEM::CoreInterface.

Definition at line 28 of file FieldCore.cpp.

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

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

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

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

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

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

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

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

853 {
854 return &entsFields;
855}

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

790 {
792 *field_ents = &entsFields;
794}

◆ get_field_id()

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

Get field Id.

Parameters
nameof field
Returns
BitFieldId

Implements MoFEM::CoreInterface.

Definition at line 18 of file FieldCore.cpp.

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

◆ get_field_meshset() [1/2]

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

Definition at line 45 of file FieldCore.cpp.

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

◆ get_field_meshset() [2/2]

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

get field meshset

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

Implements MoFEM::CoreInterface.

Definition at line 53 of file FieldCore.cpp.

53 {
54 return get_field_meshset(get_field_id(name));
55}
BitFieldId get_field_id(const std::string &name) const
Get field Id.
Definition: FieldCore.cpp:18

◆ get_field_name()

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

get field name from id

Parameters
id
Returns
std::string

Implements MoFEM::CoreInterface.

Definition at line 37 of file FieldCore.cpp.

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

◆ get_field_structure()

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

65 {
66 auto &set = fIelds.get<FieldName_mi_tag>();
67 auto miit = set.find(name);
68 if (miit == set.end()) {
69 throw MoFEMException(
71 std::string("field < " + name +
72 " > not in database (top tip: check spelling)")
73 .c_str());
74 }
75 return miit->get();
76}

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

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

748 {
750 *fields_ptr = &fIelds;
752}

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

275 {
276
278
280 CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, true);
282}

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

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

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

286 {
287
289
291 CHKERR get_moab().get_entities_by_type(meshset, type, ents, true);
292
294}

◆ get_finite_element_meshset() [1/2]

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

Definition at line 261 of file FECore.cpp.

261 {
262 auto &fe_by_id = finiteElements.get<BitFEId_mi_tag>();
263 auto miit = fe_by_id.find(id);
264 if (miit == fe_by_id.end())
265 THROW_MESSAGE("finite element not found");
266 return (*miit)->meshset;
267}

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

269 {
271}

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

847 {
848 return &finiteElements;
849}

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

802 {
804 *fe_ptr = &finiteElements;
806}

◆ get_meshsets_manager() [1/2]

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

get MeshsetsManager pointer

Implements MoFEM::CoreInterface.

Definition at line 363 of file Core.hpp.

363 {
364 return *get_meshsets_manager_ptr();
365 }
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition: Core.cpp:815

◆ get_meshsets_manager() [2/2]

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

get MeshsetsManager pointer

Implements MoFEM::CoreInterface.

Definition at line 366 of file Core.hpp.

366 {
367 return *get_meshsets_manager_ptr();
368 }

◆ get_meshsets_manager_ptr() [1/2]

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

get MeshsetsManager pointer

Implements MoFEM::CoreInterface.

Definition at line 815 of file Core.cpp.

815 {
816 MeshsetsManager *meshsets_manager_ptr;
817 getInterface(meshsets_manager_ptr);
818 return meshsets_manager_ptr;
819}
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 821 of file Core.cpp.

821 {
822 MeshsetsManager *meshsets_manager_ptr;
823 getInterface(meshsets_manager_ptr);
824 return meshsets_manager_ptr;
825}

◆ get_moab() [1/2]

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

get moab instance

Implements MoFEM::CoreInterface.

Definition at line 324 of file Core.hpp.

324{ return moab; }

◆ get_moab() [2/2]

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

get moab instance interface

Implements MoFEM::CoreInterface.

Definition at line 325 of file Core.hpp.

325{ 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 767 of file Core.cpp.

768 {
770 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
771 const ProblemsByName &problems = pRoblems.get<Problem_mi_tag>();
772 ProblemsByName::iterator p_miit = problems.find(problem_name);
773 if (p_miit == problems.end()) {
774 SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
775 "problem < %s > not found, (top tip: check spelling)",
776 problem_name.c_str());
777 }
778 *problem_ptr = &*p_miit;
780}

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

857 {
858 const Problem *prb;
859 CHK_THROW_MESSAGE(get_problem(problem_name, &prb),
860 "Problem of given name not found");
861 return prb;
862}
MoFEMErrorCode get_problem(const std::string &problem_name, const Problem **problem_ptr) const
Get problem database (data structure)
Definition: Core.cpp:767

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

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

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

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

783 {
785 *problems_ptr = &pRoblems;
787}

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

841 {
842 return &refinedEntities;
843}

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

755 {
757 *refined_entities_ptr = &refinedEntities;
759}

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

844 {
845 return &refinedFiniteElements;
846}

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

761 {
763 *refined_finite_elements_ptr = &refinedFiniteElements;
765}

◆ get_th_RefBitEdge()

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

Definition at line 199 of file Core.hpp.

199{ return th_RefBitEdge; }

◆ get_th_RefBitLevel()

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

Definition at line 198 of file Core.hpp.

198{ return th_RefBitLevel; }

◆ get_th_RefParentHandle()

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

Definition at line 197 of file Core.hpp.

197{ return th_RefParentHandle; }
Tag th_RefParentHandle
Definition: Core.hpp:259

◆ get_th_RefType()

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

Definition at line 200 of file Core.hpp.

200{ 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 243 of file FECore.cpp.

243 {
244 auto &fe_by_id = finiteElements.get<FiniteElement_name_mi_tag>();
245 auto miit = fe_by_id.find(name);
246 if (miit == fe_by_id.end())
248 ("finite element < " + name + " > not found (top tip: check spelling)")
249 .c_str());
250 return (*miit)->getId();
251}

◆ getBitFEIdName()

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

Get field name.

Parameters
idfield id
Returns
field name

Definition at line 253 of file FECore.cpp.

253 {
254 auto &fe_by_id = finiteElements.get<BitFEId_mi_tag>();
255 auto miit = fe_by_id.find(id);
256 if (miit == fe_by_id.end())
257 THROW_MESSAGE("finite element not found");
258 return (*miit)->getName();
259}

◆ getBitProblemId()

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

Definition at line 121 of file ProblemsCore.cpp.

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

◆ getBuildMoFEM()

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

Get flags/semaphores for different stages.

Definition at line 226 of file Core.hpp.

226{ return *buildMoFEM; }

◆ getOptions()

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

Get core options from command line.

Returns
MoFEMErrorCode

Definition at line 721 of file Core.cpp.

721 {
723 if (verb == -1)
724 verb = verbose;
725
726 CHKERR PetscOptionsBegin(mofemComm, optionsPrefix.c_str(), "Mesh cut options",
727 "See MoFEM documentation");
728
729 CHKERR PetscOptionsBool(
730 "-mofem_init_fields", "Initialise fields on construction", "",
732
733 CHKERR PetscOptionsBool(
734 "-mofem_init_fields", "Initialise fields on construction", "",
736
737 // TODO: Add read verbosity level
738 // TODO: Add option to initalise problems ??? - DO WE REALLY NEED THAT
739
740 ierr = PetscOptionsEnd();
741 CHKERRG(ierr);
742
744}
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:483
std::string optionsPrefix
Prefix for options on command line.
Definition: Core.hpp:994

◆ getProblemShift()

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

Return unique problem Id.

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

◆ getRefEntity()

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

Definition at line 86 of file Core.hpp.

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

◆ getTags()

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

Get tag handles.

Parameters
verbverbosity level
Returns
error code

Definition at line 523 of file Core.cpp.

523 {
525
526 const EntityHandle root_meshset = get_moab().get_root_set();
527 if (root_meshset) {
528 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
529 "Root meshset should be 0");
530 }
531
532 // Set version
533 {
534 Version version;
535 CHKERR getFileVersion(moab, version);
536 }
537
538 // Global Variables
539 {
540
541 auto check_tag_allocated = [](auto &rval) {
543 if (rval == MB_ALREADY_ALLOCATED)
544 rval = MB_SUCCESS;
545 else
546 CHKERRG(rval);
548 };
549
550 // Safety nets
551 int def_bool = 0;
552 rval = get_moab().tag_get_handle("_MoFEMBuild", 1, MB_TYPE_INTEGER,
553 th_MoFEMBuild, MB_TAG_CREAT | MB_TAG_MESH,
554 &def_bool);
555 CHKERR check_tag_allocated(rval);
556
557 CHKERR get_moab().tag_get_by_ptr(th_MoFEMBuild, &root_meshset, 1,
558 (const void **)&buildMoFEM);
559 }
560
561 // Tags saved in vtk-files
562 {
563 const int def_part = -1;
564 CHKERR get_moab().tag_get_handle("PARTITION", 1, MB_TYPE_INTEGER, th_Part,
565 MB_TAG_CREAT | MB_TAG_SPARSE, &def_part);
566 }
567
568 // Tags Ref
569 {
570 const int def_part = -1;
571 CHKERR get_moab().tag_get_handle("_MeshsetPartition", 1, MB_TYPE_INTEGER,
572 th_Part, MB_TAG_CREAT | MB_TAG_SPARSE,
573 &def_part);
574 EntityHandle def_handle = 0;
575 CHKERR get_moab().tag_get_handle("_RefParentHandle", 1, MB_TYPE_HANDLE,
577 MB_TAG_CREAT | MB_TAG_SPARSE, &def_handle);
578 BitRefLevel def_bit_level = 0;
579 CHKERR get_moab().tag_get_handle(
580 "_RefBitLevel", sizeof(BitRefLevel), MB_TYPE_OPAQUE, th_RefBitLevel,
581 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_bit_level);
582 BitRefLevel def_bit_level_mask = BitRefLevel().set();
583 CHKERR get_moab().tag_get_handle(
584 "_RefBitLevelMask", sizeof(BitRefLevel), MB_TYPE_OPAQUE,
585 th_RefBitLevel_Mask, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
586 &def_bit_level_mask);
587 BitRefEdges def_bit_edge = 0;
588 CHKERR get_moab().tag_get_handle(
589 "_RefBitEdge", sizeof(BitRefEdges), MB_TYPE_OPAQUE, th_RefBitEdge,
590 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_bit_edge);
591 const int def_type[] = {0, 0};
592 CHKERR get_moab().tag_get_handle("_RefType", 2, MB_TYPE_INTEGER, th_RefType,
593 MB_TAG_CREAT | MB_TAG_SPARSE, def_type);
594 }
595
596 // Tags Field
597 {
598 const unsigned long int def_id = 0;
599 CHKERR get_moab().tag_get_handle(
600 "_FieldId", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FieldId,
601 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
602 FieldSpace def_space = LASTSPACE;
603 CHKERR get_moab().tag_get_handle(
604 "_FieldSpace", sizeof(FieldSpace), MB_TYPE_OPAQUE, th_FieldSpace,
605 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_space);
607 CHKERR get_moab().tag_get_handle(
608 "_FieldBase", sizeof(FieldApproximationBase), MB_TYPE_OPAQUE,
609 th_FieldBase, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_base);
610 const int def_val_len = 0;
611 CHKERR get_moab().tag_get_handle(
612 "_FieldName", def_val_len, MB_TYPE_OPAQUE, th_FieldName,
613 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
614 CHKERR get_moab().tag_get_handle(
615 "_FieldName_DataNamePrefix", def_val_len, MB_TYPE_OPAQUE,
617 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
618 }
619
620 // Tags FE
621 {
622 const unsigned long int def_id = 0;
623 const int def_val_len = 0;
624 CHKERR get_moab().tag_get_handle(
625 "_FEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_FEId,
626 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
627 CHKERR get_moab().tag_get_handle(
628 "_FEName", def_val_len, MB_TYPE_OPAQUE, th_FEName,
629 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
630 CHKERR get_moab().tag_get_handle(
631 "_FEIdCol", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdCol,
632 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
633 CHKERR get_moab().tag_get_handle(
634 "_FEIdRow", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdRow,
635 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
636 CHKERR get_moab().tag_get_handle(
637 "_FEIdData", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdData,
638 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
639 }
640
641 // Tags Problem