v0.16.3
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

int getValue () const
 Get the core.
 
RefEntityTmp< 0 > getRefEntity (const EntityHandle ent)
 
virtual boost::shared_ptr< RefEntityTmp< 0 > > make_shared_ref_entity (const EntityHandle ent)
 Get RefEntity.
 
 CoreTmp (moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
 
virtual ~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
 
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
 
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
 
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.
 
DEPRECATED MoFEMErrorCode synchronise_entities (Range &ent, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode synchronise_field_entities (const std::string &name, int verb=DEFAULT_VERBOSITY)
 
- Public Member Functions inherited from MoFEM::CoreInterface
virtual ~CoreInterface ()=default
 
virtual MoFEMErrorCode add_broken_field (const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const std::vector< std::pair< EntityType, std::function< MoFEMErrorCode(BaseFunction::DofsSideMap &)> > > list_dof_side_map, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
 Add field.
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface.
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface.
 
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
 
MoFEMErrorCode getTags (int verb=DEFAULT_VERBOSITY)
 Get tag handles.
 
MoFEMErrorCode clearMap ()
 Cleaning database.
 
MoFEMErrorCode registerSubInterfaces ()
 Register insterfaces.
 
BitProblemId getProblemShift ()
 Return unique problem Id.
 
MoFEMErrorCode initialiseDatabaseFromMesh (int verb=DEFAULT_VERBOSITY)
 Initialize database getting information on mesh.
 
MoFEMErrorCode getOptions (int verb=DEFAULT_VERBOSITY)
 Get core options from command line.
 
template<class IFACE >
MoFEMErrorCode regSubInterface ()
 Register sub-interfaces in core interface.
 
template<class IFACE >
MoFEMErrorCode regEvents ()
 Register petsc events.
 

Protected Attributes

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

Static Protected Attributes

static bool isGloballyInitialised = false
 Core base globally initialized.
 
static int mpiInitialised = 0
 mpi was initialised by other agent
 
static PetscBool isInitialized = PETSC_FALSE
 petsc was initialised by other agent
 
static std::string petscOptionsFile = ""
 

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.
 
MoFEMErrorCode addPrismToDatabase (const EntityHandle prism, int verb=DEFAULT_VERBOSITY)
 add prim element
 

Tags to data on mesh and entities

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

Multi-Indices accessing data on the mesh

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

Get moab database

std::reference_wrapper< moab::Interface > moab
 moab database
 
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.
 
MoFEMErrorCode setMoabInterface (moab::Interface &new_moab, int verb=VERBOSE)
 

Log events

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

Communicator

MPI_Comm mofemComm
 MoFEM communicator.
 
ParallelComm * pComm
 MOAB communicator structure.
 
int sIze
 MoFEM communicator size.
 
int rAnk
 MOFEM communicator rank.
 
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.
 

Get tag handles to data on the mesh

Tag get_th_RefParentHandle () const
 
Tag get_th_RefBitLevel () const
 
Tag get_th_RefBitEdge () 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.
 
static const std::string & getPetscOptionsFile ()
 
static MoFEMErrorCode Finalize ()
 Checks for options to be called at the conclusion of the program.
 

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
 
MoFEMErrorCode check_number_of_ents_in_ents_field () const
 check data consistency in entitiesPtr
 
MoFEMErrorCode check_number_of_ents_in_ents_finite_element (const std::string &name) const
 check data consistency in entsFiniteElements
 
MoFEMErrorCode check_number_of_ents_in_ents_finite_element () const
 check data consistency in entsFiniteElements
 

Clear database

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

Getting access to meshset manager

MeshsetsManager * get_meshsets_manager_ptr ()
 get MeshsetsManager pointer
 
const MeshsetsManager * get_meshsets_manager_ptr () const
 get MeshsetsManager pointer
 
MeshsetsManager & get_meshsets_manager ()
 get MeshsetsManager reference
 
const MeshsetsManager & get_meshsets_manager () const
 get MeshsetsManager reference
 

Remove and delete entities

MoFEMErrorCode remove_parents_by_ents (const Range &ents, int verb=DEFAULT_VERBOSITY)
 Remove parents from entities.
 
MoFEMErrorCode remove_parents_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 Remove parent from entities on bit level.
 
MoFEMErrorCode remove_parents_by_parents (const Range &ents, int verb=DEFAULT_VERBOSITY)
 Remove parents from entities having parents in passed range.
 
MoFEMErrorCode remove_ents (const Range ents, int verb=DEFAULT_VERBOSITY)
 Remove entities from MoFEM database.
 
MoFEMErrorCode remove_ents_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 Remove entities from MoFEM database.
 
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 from MoFEM and MOAB database.
 

Fields

virtual MoFEMErrorCode add_broken_field (const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, std::vector< std::pair< EntityType, std::function< MoFEMErrorCode(BaseFunction::DofsSideMap &)> > > list_dof_side_map, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 Add field.
 
virtual MoFEMErrorCode add_field (const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 Add field.
 
MoFEMErrorCode delete_field (const std::string name, int verb=DEFAULT_VERBOSITY)
 Delete field.
 
MoFEMErrorCode addField (const std::string &name, const FieldSpace space, const FieldContinuity continuity, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type, const enum MoFEMTypes bh, int verb)
 Template for add_field.
 
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.
 
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.
 
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.
 
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.
 
MoFEMErrorCode create_vertices_and_add_to_field (const std::string name, const double coords[], int size, int verb=DEFAULT_VERBOSITY)
 Create vertices and add to the field object.
 

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

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, const Range *ents_ptr, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode buildField (const boost::shared_ptr< Field > &field, const Range *ents_ptr, 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
 
MoFEMErrorCode build_fields (const Range &ents, int verb=DEFAULT_VERBOSITY)
 Build DOFs of every field on the given entities only.
 
MoFEMErrorCode build_field (const std::string field_name, const Range &ents, int verb=DEFAULT_VERBOSITY)
 Build DOFs of one field on the given entities only.
 

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
 
MoFEMErrorCode remove_ents_from_field (const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
 remove entities from field
 
MoFEMErrorCode remove_ents_from_field (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from field
 
MoFEMErrorCode remove_ents_from_field (const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from all fields
 

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
 
BitFieldId get_field_id (const std::string &name) const
 Get field Id.
 
FieldBitNumber get_field_bit_number (const std::string name) const
 get field bit number
 
std::string get_field_name (const BitFieldId id) const
 get field name from id
 
EntityHandle get_field_meshset (const BitFieldId id) const
 
EntityHandle get_field_meshset (const std::string name) const
 get field meshset
 
MoFEMErrorCode get_field_entities_by_dimension (const std::string name, int dim, Range &ents) const
 get entities in the field by dimension
 
MoFEMErrorCode get_field_entities_by_type (const std::string name, EntityType type, Range &ents) const
 get entities in the field by type
 
MoFEMErrorCode get_field_entities_by_handle (const std::string name, Range &ents) const
 get entities in the field by handle
 
bool check_field (const std::string &name) const
 check if field is in database
 
const Field * get_field_structure (const std::string &name, enum MoFEMTypes bh=MF_EXIST) const
 get field structure
 

Finite elements

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

Problems

MoFEMErrorCode add_problem (const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 Add problem.
 
bool check_problem (const std::string name)
 check if problem exist
 
MoFEMErrorCode delete_problem (const std::string name)
 Delete problem.
 
MoFEMErrorCode modify_problem_add_finite_element (const std::string name_problem, const std::string &fe_name)
 add finite element to problem, this add entities assigned to finite element to a particular problem
 
MoFEMErrorCode modify_problem_unset_finite_element (const std::string name_problem, const std::string &fe_name)
 unset finite element from problem, this remove entities assigned to finite element to a particular problem
 
MoFEMErrorCode modify_problem_ref_level_add_bit (const std::string &name_problem, const BitRefLevel &bit)
 add ref level to problem
 
MoFEMErrorCode modify_problem_ref_level_set_bit (const std::string &name_problem, const BitRefLevel &bit)
 set ref level for problem
 
MoFEMErrorCode modify_problem_mask_ref_level_add_bit (const std::string &name_problem, const BitRefLevel &bit)
 set dof mask ref level for problem
 
MoFEMErrorCode modify_problem_mask_ref_level_set_bit (const std::string &name_problem, const BitRefLevel &bit)
 set dof mask ref level for problem
 
BitProblemId getBitProblemId (const std::string &name) const
 
MoFEMErrorCode list_problem () const
 list problems
 
MoFEMErrorCode clear_problem (const std::string name, int verb=DEFAULT_VERBOSITY)
 clear problem
 
MoFEMErrorCode clear_problems (int verb=DEFAULT_VERBOSITY)
 clear problems
 
MoFEMErrorCode build_finite_elements (int verb=DEFAULT_VERBOSITY)
 Build finite elements.
 
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.
 
MoFEMErrorCode buildFiniteElements (const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_finite_elements_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_finite_elements (const Range &ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_finite_elements (const std::string &fe_name, const Range &ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode get_problem_finite_elements_entities (const std::string name, const std::string &fe_name, const EntityHandle meshset)
 add finite elements to the meshset
 
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
 
MoFEMErrorCode build_adjacencies (const BitRefLevel &bit, int verb=DEFAULT_VERBOSITY)
 build adjacencies
 
MoFEMErrorCode build_adjacencies (const BitRefLevel &bit, const BitRefLevel &mask, int verb=DEFAULT_VERBOSITY)
 build adjacencies
 
MoFEMErrorCode clear_adjacencies_entities (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 clear adjacency map for entities on given bit level
 
MoFEMErrorCode clear_adjacencies_entities (const Range ents, int verb=DEFAULT_VERBOSITY)
 clear adjacencies for field entities by entities
 
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
 
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
 
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.
 
MoFEMErrorCode problem_basic_method_preProcess (const std::string &problem_name, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethod.
 
MoFEMErrorCode problem_basic_method_postProcess (const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethod.
 
MoFEMErrorCode problem_basic_method_postProcess (const std::string &problem_name, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethod.
 
MoFEMErrorCode cache_problem_entities (const std::string prb_name, CacheTupleWeakPtr cache_ptr)
 Cache variables.
 
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.
 
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.
 
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.
 
MoFEMErrorCode loop_dofs (const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs.
 
MoFEMErrorCode 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.
 
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.
 
MoFEMErrorCode loop_dofs (const std::string &field_name, DofMethod &method, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs.
 
MoFEMErrorCode loop_entities (const Problem *problem_ptr, const std::string field_name, RowColData rc, EntityMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
 Loop over field entities in the problem.
 
MoFEMErrorCode 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.
 
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.
 
MoFEMErrorCode loop_entities (const std::string field_name, EntityMethod &method, Range const *const ents=nullptr, int verb=DEFAULT_VERBOSITY)
 Loop over field entities.
 

Accessing multi-indices

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

Additional Inherited Members

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

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
mofem/atom_tests/add_blockset.cpp, mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/bernstein_bezier_generate_base.cpp, mofem/atom_tests/boundary_marker.cpp, mofem/atom_tests/build_composite_problem.cpp, mofem/atom_tests/build_large_problem.cpp, mofem/atom_tests/build_problems.cpp, mofem/atom_tests/child_and_parent.cpp, mofem/atom_tests/continuity_check_on_contact_prism_side_ele.cpp, mofem/atom_tests/continuity_check_on_skeleton_3d.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, mofem/atom_tests/cubit_bc_test.cpp, mofem/atom_tests/dg_projection.cpp, mofem/atom_tests/dm_build_partitioned_mesh.cpp, mofem/atom_tests/dm_create_subdm.cpp, mofem/atom_tests/dm_partitioned_no_field.cpp, mofem/atom_tests/edge_and_bubble_shape_functions_on_quad.cpp, mofem/atom_tests/field_evaluator.cpp, mofem/atom_tests/field_values_from_tags.cpp, mofem/atom_tests/forces_and_sources_testing_edge_element.cpp, mofem/atom_tests/forces_and_sources_testing_flat_prism_element.cpp, mofem/atom_tests/forces_and_sources_testing_users_base.cpp, mofem/atom_tests/gauss_points_on_outer_product.cpp, mofem/atom_tests/hanging_node_approx.cpp, mofem/atom_tests/hcurl_check_approx_in_2d.cpp, mofem/atom_tests/hcurl_curl_operator.cpp, mofem/atom_tests/hcurl_divergence_operator_2d.cpp, mofem/atom_tests/hdiv_check_approx_in_3d.cpp, mofem/atom_tests/hdiv_divergence_operator.cpp, mofem/atom_tests/higher_derivatives.cpp, mofem/atom_tests/log.cpp, mofem/atom_tests/loop_entities.cpp, mofem/atom_tests/mesh_insert_interface_atom.cpp, mofem/atom_tests/mesh_refine_atom.cpp, mofem/atom_tests/node_merge.cpp, mofem/atom_tests/operators_tester_direction.cpp, mofem/atom_tests/operators_tests.cpp, mofem/atom_tests/partition_mesh.cpp, mofem/atom_tests/prism_elements_from_surface.cpp, mofem/atom_tests/prism_polynomial_approximation.cpp, mofem/atom_tests/quad_polynomial_approximation.cpp, mofem/atom_tests/rebuild_problem.cpp, mofem/atom_tests/rebuild_problem_hybrid.cpp, mofem/atom_tests/remove_entities_from_problem.cpp, mofem/atom_tests/remove_entities_from_problem_not_partitioned.cpp, mofem/atom_tests/scalar_check_approximation.cpp, mofem/atom_tests/schur_test_diag_mat.cpp, mofem/atom_tests/simple_interface.cpp, mofem/atom_tests/simple_l2_only.cpp, mofem/atom_tests/tensor_divergence_operator.cpp, mofem/atom_tests/test_broken_space.cpp, mofem/atom_tests/test_cache_on_entities.cpp, mofem/tools/delete_ho_nodes.cpp, mofem/tools/extrude_prisms.cpp, mofem/tools/field_to_vertices.cpp, mofem/tools/mesh_cut.cpp, mofem/tools/mesh_smoothing.cpp, mofem/tools/meshset_to_vtk.cpp, mofem/tools/remove_mofem_meshsets.cpp, mofem/tools/split_sideset.cpp, mofem/tutorials/adv-0_plasticity/plastic.cpp, mofem/tutorials/adv-3_level_set/level_set.cpp, mofem/tutorials/adv-4_dynamic_first_order_con_law/dynamic_first_order_con_law.cpp, mofem/tutorials/adv-5_poroelasticity/seepage.cpp, mofem/tutorials/adv-6_dg_projection/between_meshes_dg_projection.cpp, mofem/tutorials/clx-0_acoustics/helmholtz.cpp, mofem/tutorials/cor-0to1_unsaturated_transport/unsaturated_transport.cpp, mofem/tutorials/cor-10_navier_stokes/navier_stokes.cpp, mofem/tutorials/cor-2to5_analytical_poisson/analytical_nonlinear_poisson.cpp, mofem/tutorials/cor-2to5_analytical_poisson/analytical_poisson.cpp, mofem/tutorials/cor-2to5_analytical_poisson/analytical_poisson_field_split.cpp, mofem/tutorials/cor-6_simple_elasticity/simple_elasticity.cpp, mofem/tutorials/cor-7_elasticity_mixed_formulation/elasticity_mixed_formulation.cpp, mofem/tutorials/cor-9_reaction_diffusion/reaction_diffusion.cpp, mofem/tutorials/fun-0_hello_world/hello_world.cpp, mofem/tutorials/fun-1_integration/integration.cpp, mofem/tutorials/fun-2_plot_base/plot_base.cpp, mofem/tutorials/max-0_magnetostatics/magnetostatic.cpp, mofem/tutorials/max-1_lorentz_force//lorentz_force.cpp, mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp, mofem/tutorials/mix-1_light_intensity_equation/phase.cpp, mofem/tutorials/scl-0_least_squares/approximation.cpp, mofem/tutorials/scl-12_electrostatics/electrostatics.cpp, mofem/tutorials/scl-1_poisson_2d_homogeneous/poisson_2d_homogeneous.cpp, mofem/tutorials/scl-6_heat_equation/heat_equation.cpp, mofem/tutorials/scl-7_wave_equation/wave_equation.cpp, mofem/tutorials/scl-8_heat_radiation/radiation.cpp, mofem/tutorials/scl-9_heat_method/heat_method.cpp, mofem/tutorials/vec-0_elasticity/elastic.cpp, mofem/tutorials/vec-10_elasticity_schur/schur_elastic.cpp, mofem/tutorials/vec-11_elastic_tie_mesh/elastic_tie_mesh.cpp, mofem/tutorials/vec-1_eigen_elasticity/eigen_elastic.cpp, mofem/tutorials/vec-2_nonlinear_elasticity/nonlinear_elastic.cpp, mofem/tutorials/vec-3_nonlinear_dynamics/nonlinear_dynamic_elastic.cpp, mofem/tutorials/vec-4_shallow_wave/approx_sphere.cpp, mofem/tutorials/vec-4_shallow_wave/shallow_wave.cpp, mofem/tutorials/vec-5_free_surface/free_surface.cpp, mofem/tutorials/vec-6_dg_kirchhoff_plate/plate.cpp, mofem/tutorials/vec-7_shape_optimisation/adjoint.cpp, mofem/tutorials/vec-9_arc_length/arc_length.cpp, mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp, mofem/users_modules/basic_finite_elements/atom_tests/testing_jacobian_of_hook_element.cpp, mofem/users_modules/basic_finite_elements/atom_tests/testing_jacobian_of_hook_scaled_with_density_element.cpp, mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp, mofem/users_modules/basic_finite_elements/nonlinear_elasticity/nonlinear_dynamics.cpp, mofem/users_modules/bone_remodelling/bone_adaptation.cpp, mofem/users_modules/minimal_surface_equation/minimal_surface_area.cpp, and project_roughness.cpp.

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

216 {
217 BUILD_FIELD = 1 << 0,
218 BUILD_FE = 1 << 1,
219 BUILD_ADJ = 1 << 2,
220 BUILD_PROBLEM = 1 << 3,
221 PARTITION_PROBLEM = 1 << 4,
222 PARTITION_FE = 1 << 5,
223 PARTITION_GHOST_DOFS = 1 << 6,
224 PARTITION_MESH = 1 << 7
225 };

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

251 : CoreTmp(moab, comm, verbose, CoreValue<0>()) {
252
253 // Register sub-interfaces
254 ierr = this->registerSubInterfaces();
255 CHKERRABORT(comm, ierr);
256 ierr = this->clearMap();
257 CHKERRABORT(comm, ierr);
258 ierr = this->getTags();
259 CHKERRABORT(comm, ierr);
260 ierr = this->getOptions(verbose);
261 CHKERRABORT(comm, ierr);
262
263 this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
265
267 CHKERRABORT(comm, ierr);
268}
MPI_Comm comm
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
MoFEMErrorCode clearMap()
Cleaning database.
Definition Core.cpp:546
static void setRefEntBasicDataPtr(MoFEM::Interface &m_field, boost::shared_ptr< BasicEntityData > &ptr)
Definition Core.cpp:951
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition Core.cpp:307
MoFEMErrorCode registerSubInterfaces()
Register insterfaces.
Definition Core.cpp:498
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
Definition Core.cpp:798
int verbose
Verbosity level.
Definition Core.hpp:1051
MoFEMErrorCode getTags(int verb=DEFAULT_VERBOSITY)
Get tag handles.
Definition Core.cpp:594
CoreTmp(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
Definition Core.cpp:246
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition Core.hpp:286
std::reference_wrapper< moab::Interface > moab
moab database
Definition Core.hpp:326

◆ ~CoreTmp()

MoFEM::Core::~CoreTmp ( )
virtual

Definition at line 294 of file Core.cpp.

294 {
295 PetscBool is_finalized = PETSC_FALSE;
296 PetscFinalized(&is_finalized);
297 if (!is_finalized && !iFaces.empty())
298 clearMap();
299 // Destroy interfaces
300 iFaces.clear();
301 // This is deprecated ONE should use MoFEM::Core::Initialize
302 if (isGloballyInitialised && is_finalized) {
303 isGloballyInitialised = false;
304 }
305}
static bool isGloballyInitialised
Core base globally initialized.
Definition Core.hpp:1068
boost::ptr_map< boost::typeindex::type_index, UnknownInterface > iFaces
Hash map of pointers to interfaces.
Definition Core.hpp:1056

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

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,...)
@ QUIET
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
PetscBool initaliseAndBuildFiniteElements
Definition Core.hpp:1065
MoFEMErrorCode coreGenericConstructor(moab::Interface &moab, MPI_Comm comm, const int verbose)
Definition Core.cpp:208
PetscBool initaliseAndBuildField
Definition Core.hpp:1062
MPI_Comm mofemComm
MoFEM communicator.
Definition Core.hpp:1024

Member Function Documentation

◆ add_broken_field()

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

Add field.

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

TODO:

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

FIXME:

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

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

447 {
449 Range ents;
450 CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
451 CHKERR addEntsToFieldByDim(ents, dim, name, verb);
454}
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
std::string name
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
moab::Interface & get_moab()
Definition Core.hpp:327

◆ add_ents_to_field_by_dim() [2/2]

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

Add entities to field meshset.

Note
not collective

The lower dimension entities are added depending on the space type

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

Implements MoFEM::CoreInterface.

Definition at line 416 of file FieldCore.cpp.

418 {
420 if (verb == -1)
421 verb = verbose;
422 Range ents_dim = ents.subset_by_dimension(dim);
423 CHKERR addEntsToFieldByDim(ents_dim, dim, name, verb);
424 // A quiet call may be made independently on one rank.
425 if (verb > QUIET)
428}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()

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

459 {
461 Range ents;
462 CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
463 if (!ents.empty()) {
464 const int dim = get_moab().dimension_from_handle(ents[0]);
465 CHKERR addEntsToFieldByDim(ents, dim, name, verb);
466 }
469}
std::string type

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

433 {
435 Range ents_type = ents.subset_by_type(type);
436 if (!ents_type.empty()) {
437 const int dim = get_moab().dimension_from_handle(ents_type[0]);
438 CHKERR addEntsToFieldByDim(ents_type, dim, name, verb);
439 }
442}

◆ add_ents_to_finite_element_by_bit_ref()

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

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

Note
not collective
Parameters
BitRefLevelbit
BitRefLevelmask
finiteelement name
finiteelement type
verboselevel

Implements MoFEM::CoreInterface.

Definition at line 405 of file FECore.cpp.

407 {
409
410 if (verb == -1)
411 verb = verbose;
412 *buildMoFEM &= 1 << 0;
413 const BitFEId id = getBitFEId(name);
414 const EntityHandle idm = get_finite_element_meshset(id);
415
416 auto &ref_MoFEMFiniteElement = refinedFiniteElements.get<Ent_mi_tag>();
417 auto miit = ref_MoFEMFiniteElement.lower_bound(get_id_for_min_type(type));
418 auto hi_miit = ref_MoFEMFiniteElement.upper_bound(get_id_for_max_type(type));
419
420 int nb_add_fes = 0;
421 for (; miit != hi_miit; miit++) {
422 const auto &bit2 = miit->get()->getBitRefLevel();
423 if ((bit2 & mask) != bit2)
424 continue;
425 if ((bit2 & bit).any()) {
426 EntityHandle ent = miit->get()->getEnt();
427 CHKERR get_moab().add_entities(idm, &ent, 1);
428 nb_add_fes++;
429 }
430 }
431
432 MOFEM_LOG("SYNC", Sev::inform)
433 << "Finite element " << name << " added. Nb. of elements added "
434 << nb_add_fes << " out of " << std::distance(miit, hi_miit);
435
437
439}
#define FECoreFunctionBegin
Definition FECore.cpp:7
#define MOFEM_LOG(channel, severity)
Log.
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:273
RefElement_multiIndex refinedFiniteElements
refined elements
Definition Core.hpp:306
int * buildMoFEM
keeps flags/semaphores for different stages
Definition Core.hpp:1058
BitFEId getBitFEId(const std::string &fe_name) const
Get field Id.
Definition FECore.cpp:255

◆ add_ents_to_finite_element_by_dim() [1/2]

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

add entities to finite element

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

Implements MoFEM::CoreInterface.

Definition at line 346 of file FECore.cpp.

348 {
349 EntityHandle idm = no_handle;
350 *buildMoFEM &= 1 << 0;
353 Range ents;
354 CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
355 CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
356 CHKERR get_moab().add_entities(idm, ents);
358}
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 373 of file FECore.cpp.

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

◆ add_ents_to_finite_element_by_MESHSET()

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

add MESHSET element to finite element database given by name

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

Implements MoFEM::CoreInterface.

Definition at line 441 of file FECore.cpp.

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

◆ add_ents_to_finite_element_by_type() [1/2]

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

add entities to finite element

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

Implements MoFEM::CoreInterface.

Definition at line 329 of file FECore.cpp.

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

◆ add_ents_to_finite_element_by_type() [2/2]

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

add entities to finite elements

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

Implements MoFEM::CoreInterface.

Definition at line 360 of file FECore.cpp.

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

◆ add_ents_to_finite_element_EntType_by_bit_ref() [1/2]

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

Definition at line 396 of file FECore.cpp.

398 {
401
403}
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:405

◆ add_ents_to_finite_element_EntType_by_bit_ref() [2/2]

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

Definition at line 386 of file FECore.cpp.

388 {
391 type, verb);
392
394}
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 field.

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

TODO:

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

FIXME:

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

Implements MoFEM::CoreInterface.

Definition at line 315 of file FieldCore.cpp.

319 {
320 return this->addField(name, space, CONTINUOUS, base, nb_of_coefficients,
321 tag_type, bh, verb);
322}
WorkMesh base
@ CONTINUOUS
Regular field.
MoFEMErrorCode addField(const std::string &name, const FieldSpace space, const FieldContinuity continuity, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type, const enum MoFEMTypes bh, int verb)
Template for add_field.

◆ 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
fe_nameFinite element name to add
bhControls behavior if finite element already exists (MF_EXCL throws error, MF_ZERO allows)
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure
Note
add_finite_element is a collective operation, should be executed on all processors. Otherwise could lead to deadlock.

Example

MoFEM::Interface & mField
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element

Implements MoFEM::CoreInterface.

Definition at line 43 of file FECore.cpp.

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

◆ 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 SETERRQ(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:318

◆ addEntsToFieldByDim()

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

Definition at line 324 of file FieldCore.cpp.

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

Template for add_field.

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

Definition at line 108 of file FieldCore.cpp.

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

565 {
567 if (verb == -1)
568 verb = verbose;
569 std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
570 p_ent = refinedEntities.insert(
571 boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
572 if (p_ent.second) {
573 std::pair<RefElement_multiIndex::iterator, bool> p;
574 p = refinedFiniteElements.insert(
575 boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)));
576 int num_nodes;
577 const EntityHandle *conn;
578 CHKERR get_moab().get_connectivity(prism, conn, num_nodes, true);
579 Range face_side3, face_side4;
580 CHKERR get_moab().get_adjacencies(conn, 3, 2, false, face_side3);
581 CHKERR get_moab().get_adjacencies(&conn[3], 3, 2, false, face_side4);
582 if (face_side3.size() != 1)
583 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
584 "prism don't have side face 3");
585 if (face_side4.size() != 1)
586 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
587 "prims don't have side face 4");
588 p.first->get()->getSideNumberPtr(*face_side3.begin());
589 p.first->get()->getSideNumberPtr(*face_side4.begin());
590 }
592}
RefEntity_multiIndex refinedEntities
refined entities
Definition Core.hpp:305

◆ 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
#define MOFEM_LOG_ATTRIBUTES(channel, bit)
Add attributes to channel.

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

836 {
838 if (verb == -1)
839 verb = verbose;
840 Range ents;
841 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents);
842
843 CHKERR build_adjacencies(ents, verb);
844
846}
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)
build adjacencies
Definition FECore.cpp:759

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

847 {
849 if (verb == -1)
850 verb = verbose;
851 CHKERR build_adjacencies(bit, BitRefLevel().set(), verb);
852
854}

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

759 {
761 if (verb == DEFAULT_VERBOSITY)
762 verb = verbose;
763
764 if (!((*buildMoFEM) & BUILD_FIELD))
765 SETERRQ(mofemComm, MOFEM_NOT_FOUND, "field not build");
766 if (!((*buildMoFEM) & BUILD_FE))
767 SETERRQ(mofemComm, MOFEM_NOT_FOUND, "fe not build");
768 for (auto peit = ents.pair_begin(); peit != ents.pair_end(); ++peit) {
769 auto fit = entsFiniteElements.get<Ent_mi_tag>().lower_bound(peit->first);
770 auto hi_fit =
771 entsFiniteElements.get<Ent_mi_tag>().upper_bound(peit->second);
772 for (; fit != hi_fit; ++fit) {
773 if ((*fit)->getBitFieldIdRow().none() &&
774 (*fit)->getBitFieldIdCol().none() &&
775 (*fit)->getBitFieldIdData().none())
776 continue;
777 int by = BYROW;
778 if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol())
779 by |= BYCOL;
780 if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData())
781 by |= BYDATA;
782 FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_row(by);
783 auto hint = entFEAdjacencies.end();
784 // Descending UID order makes the inserted node a successor hint.
785 const auto &row_ents = *(*fit)->getRowFieldEntsPtr();
786 for (auto it = row_ents.rbegin(); it != row_ents.rend(); ++it) {
787 hint = entFEAdjacencies.emplace_hint(hint, it->lock(), *fit);
788 bool success = entFEAdjacencies.modify(hint, modify_row);
789 if (!success)
790 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
791 "modification unsuccessful");
792 }
793 if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol()) {
794 int by = BYCOL;
795 if ((*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData())
796 by |= BYDATA;
797 FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_col(by);
798 auto hint = entFEAdjacencies.end();
799 const auto &col_ents = *(*fit)->getColFieldEntsPtr();
800 for (auto it = col_ents.rbegin(); it != col_ents.rend(); ++it) {
801 hint = entFEAdjacencies.emplace_hint(hint, it->lock(), *fit);
802 bool success = entFEAdjacencies.modify(hint, modify_col);
803 if (!success)
804 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
805 "modification unsuccessful");
806 }
807 }
808 if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData() ||
809 (*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData()) {
810 FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_data(
811 BYDATA);
812 auto hint = entFEAdjacencies.end();
813 const auto &data_ents = (*fit)->getDataFieldEnts();
814 for (auto it = data_ents.rbegin(); it != data_ents.rend(); ++it) {
815 hint = entFEAdjacencies.emplace_hint(hint, it->lock(), *fit);
816 bool success = entFEAdjacencies.modify(hint, modify_data);
817 if (!success)
818 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
819 "modification unsuccessful");
820 }
821 }
822 }
823 }
824
825 if (verb >= VERBOSE) {
826 MOFEM_LOG("WORLD", Sev::inform)
827 << "Number of adjacencies " << entFEAdjacencies.size();
829 }
830
831 *buildMoFEM |= 1 << 2;
833}
It it
Definition Schur.cpp:2568
@ DEFAULT_VERBOSITY
@ BYCOL
@ BYDATA
@ BYROW
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition Core.hpp:313
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition Core.hpp:316

◆ build_field() [1/2]

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

Build DOFs of one field on the given entities only.

Parameters
field_nameName of the field to build
entsEntities whose DOFs are (re)built; others are not visited
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 1333 of file FieldCore.cpp.

1334 {
1336 auto field_it = fIelds.get<FieldName_mi_tag>().find(field_name);
1337 if (field_it == fIelds.get<FieldName_mi_tag>().end())
1338 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field < %s > not found",
1339 field_name.c_str());
1340
1341 CHKERR this->buildField(*field_it, &ents, verb);
1342 if (verb > QUIET)
1345}
#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, const Range *ents_ptr, int verb=DEFAULT_VERBOSITY)

◆ build_field() [2/2]

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

build field by name

Parameters
field_nameName of the field to build
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 1320 of file FieldCore.cpp.

1320 {
1322 auto field_it = fIelds.get<FieldName_mi_tag>().find(field_name);
1323 if (field_it == fIelds.get<FieldName_mi_tag>().end())
1324 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field < %s > not found",
1325 field_name.c_str());
1326
1327 CHKERR this->buildField(*field_it, nullptr, verb);
1328 if (verb > QUIET)
1331}

◆ build_fields() [1/2]

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

Build DOFs of every field on the given entities only.

build_fields() erases and recreates the DOFs of every entity of every field. After adding entities to fields on an existing mesh, call this with the added entities: DOFs on other entities are left untouched.

Parameters
entsEntities whose DOFs are (re)built; others are not visited
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 1347 of file FieldCore.cpp.

1347 {
1349 if (verb == -1)
1350 verb = verbose;
1351
1352 for (auto field : fIelds.get<BitFieldId_mi_tag>())
1353 CHKERR this->buildField(field, &ents, verb);
1354
1355 *buildMoFEM = 1 << 0;
1356 if (verb > QUIET) {
1357 MOFEM_LOG("SYNC", Sev::verbose) << "Number of dofs " << dofsField.size();
1359 }
1361}
ProjectedField & field
DofEntity_multiIndex dofsField
dofs on fields
Definition Core.hpp:310

◆ build_fields() [2/2]

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

build fields

Parameters
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 1363 of file FieldCore.cpp.

1363 {
1365 if (verb == -1)
1366 verb = verbose;
1367
1368 for (auto field : fIelds.get<BitFieldId_mi_tag>())
1369 CHKERR this->buildField(field, nullptr, verb);
1370
1371 *buildMoFEM = 1 << 0;
1372 if (verb > QUIET) {
1373 MOFEM_LOG("SYNC", Sev::verbose) << "Number of dofs " << dofsField.size();
1375 }
1376
1378}

◆ build_finite_elements() [1/3]

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

Definition at line 722 of file FECore.cpp.

722 {
724 SETERRQ(mofemComm, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
726}
@ 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 728 of file FECore.cpp.

730 {
732 if (verb == -1)
733 verb = verbose;
734
735 auto fe_miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
736 if (fe_miit == finiteElements.get<FiniteElement_name_mi_tag>().end())
737 SETERRQ(mofemComm, MOFEM_NOT_FOUND, "Finite element <%s> not found",
738 fe_name.c_str());
739
740 CHKERR buildFiniteElements(*fe_miit, ents_ptr, verb);
741
742 if (verb >= VERBOSE) {
743 auto &fe_ents = entsFiniteElements.get<Unique_mi_tag>();
744 auto miit = fe_ents.lower_bound(
745 EntFiniteElement::getLocalUniqueIdCalculate(0, (*fe_miit)->getFEUId()));
746 auto hi_miit =
748 get_id_for_max_type<MBENTITYSET>(), (*fe_miit)->getFEUId()));
749 const auto count = std::distance(miit, hi_miit);
750 MOFEM_LOG("SYNC", Sev::inform) << "Finite element " << fe_name
751 << " added. Nb. of elements added " << count;
753 }
754
755 *buildMoFEM |= 1 << 1;
757}
MoFEMErrorCode buildFiniteElements(const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
Definition FECore.cpp:459
UId getLocalUniqueIdCalculate() const
Generate UId for finite element entity.

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

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

◆ build_problem_on_distributed_mesh()

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

Definition at line 261 of file ProblemsCore.cpp.

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

◆ build_problems()

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

Definition at line 321 of file ProblemsCore.cpp.

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

◆ buildField()

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

Definition at line 1270 of file FieldCore.cpp.

1271 {
1273 if (verb == -1)
1274 verb = verbose;
1275 if (verb > QUIET)
1276 MOFEM_LOG("SYNC", Sev::verbose) << "Build field " << field->getName();
1277
1278 std::map<EntityType, int> dof_counter;
1279 std::map<EntityType, int> inactive_dof_counter;
1280
1281 // Need to rebuild order table since number of dofs on each order when
1282 // field was created.
1283 if (field->getApproxBase() == USER_BASE)
1284 CHKERR field->rebuildDofsOrderMap();
1285
1286 switch (field->getSpace()) {
1287 case NOFIELD:
1288 CHKERR this->buildFieldForNoField(field->getId(), dof_counter, verb);
1289 break;
1290 case L2:
1291 case H1:
1292 case HCURL:
1293 case HDIV:
1294 CHKERR this->buildFieldForL2H1HcurlHdiv(field->getId(), dof_counter,
1295 inactive_dof_counter, ents_ptr,
1296 verb);
1297 break;
1298 default:
1299 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1300 }
1301
1302 if (verb > QUIET) {
1303 int nb_added_dofs = 0;
1304 int nb_inactive_added_dofs = 0;
1305 for (auto const &it : dof_counter) {
1306 MOFEM_LOG("SYNC", Sev::verbose)
1307 << "Nb. of dofs (" << moab::CN::EntityTypeName(it.first) << ") "
1308 << it.second << " (inactive " << inactive_dof_counter[it.first]
1309 << ")";
1310 nb_added_dofs += it.second;
1311 nb_inactive_added_dofs += inactive_dof_counter[it.first];
1312 }
1313 MOFEM_LOG("SYNC", Sev::verbose)
1314 << "Nb. added dofs " << nb_added_dofs << " (number of inactive dofs "
1315 << nb_inactive_added_dofs << " )";
1316 }
1318}
@ 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)
MoFEMErrorCode buildFieldForL2H1HcurlHdiv(const BitFieldId id, std::map< EntityType, int > &dof_counter, std::map< EntityType, int > &inactive_dof_counter, const Range *ents_ptr, int verb=DEFAULT_VERBOSITY)

◆ buildFieldForL2H1HcurlHdiv()

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

ents_ptr restricts the build to those entities; null means all entities of the field meshset.

Definition at line 1152 of file FieldCore.cpp.

1155 {
1157 if (verb == -1)
1158 verb = verbose;
1159
1160 // Find field
1161 auto &set_id = fIelds.get<BitFieldId_mi_tag>();
1162 auto field_it = set_id.find(id);
1163 if (field_it == set_id.end()) {
1164 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field not found");
1165 }
1166 const int bit_number = field_it->get()->getBitNumber();
1167 const int rank = field_it->get()->getNbOfCoeffs();
1168
1169 // Ents in the field meshset
1170 Range ents_of_id_meshset;
1171 CHKERR get_moab().get_entities_by_handle((*field_it)->meshSet,
1172 ents_of_id_meshset, false);
1173 // Every entity visited below has its DOFs erased and recreated, so an
1174 // incremental build must restrict the range to the entities that changed.
1175 if (ents_ptr)
1176 ents_of_id_meshset = intersect(ents_of_id_meshset, *ents_ptr);
1177 if (verb > VERY_NOISY) {
1178 MOFEM_LOG_C("SYNC", Sev::noisy, "Ents in field %s meshset %zu",
1179 (*field_it)->getName().c_str(), ents_of_id_meshset.size());
1180 }
1181
1182 for (auto p_eit = ents_of_id_meshset.pair_begin();
1183 p_eit != ents_of_id_meshset.pair_end(); ++p_eit) {
1184
1185 const EntityHandle first = p_eit->first;
1186 const EntityHandle second = p_eit->second;
1187 const auto lo_uid =
1188 FieldEntity::getLoLocalEntityBitNumber(bit_number, first);
1189 const auto hi_uid =
1190 FieldEntity::getHiLocalEntityBitNumber(bit_number, second);
1191
1192 auto feit = entsFields.get<Unique_mi_tag>().lower_bound(lo_uid);
1193 if (feit == entsFields.get<Unique_mi_tag>().end())
1194 continue;
1195 auto hi_feit = entsFields.get<Unique_mi_tag>().upper_bound(hi_uid);
1196
1197 // If there are DOFs in that range is more pragmatic to remove them
1198 // rather than to find sub-ranges or make them inactive
1199 auto dit = dofsField.get<Unique_mi_tag>().lower_bound(lo_uid);
1200 auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(hi_uid);
1201 dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
1202
1203 // Add vertices DOFs by bulk
1204 boost::shared_ptr<std::vector<DofEntity>> dofs_array =
1205 boost::make_shared<std::vector<DofEntity>>(std::vector<DofEntity>());
1206 // Add Sequence of DOFs to sequence container as weak_ptr
1207 int nb_dofs_on_ents = 0;
1208 for (auto tmp_feit = feit; tmp_feit != hi_feit; ++tmp_feit) {
1209 nb_dofs_on_ents += rank * tmp_feit->get()->getOrderNbDofs(
1210 tmp_feit->get()->getMaxOrder());
1211 }
1212
1213 // Reserve memory
1214 dofs_array->reserve(nb_dofs_on_ents);
1215
1216 // Create DOFs
1217 for (; feit != hi_feit; ++feit) {
1218 // Create dofs instances and shared pointers
1219 int DD = 0;
1220 // Loop orders (loop until max entity order is set)
1221 for (int oo = 0; oo <= feit->get()->getMaxOrder(); ++oo) {
1222 // Loop nb. dofs at order oo
1223 for (int dd = 0; dd < feit->get()->getOrderNbDofsDiff(oo); ++dd) {
1224 // Loop rank
1225 for (int rr = 0; rr < rank; ++rr, ++DD) {
1226 dofs_array->emplace_back(*feit, oo, rr, DD);
1227 ++dof_counter[feit->get()->getEntType()];
1228 }
1229 }
1230 }
1231 if (DD > feit->get()->getNbDofsOnEnt()) {
1232 std::ostringstream ss;
1233 ss << "rank " << rAnk << " ";
1234 ss << **feit << std::endl;
1235 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1236 "Expected number of DOFs on entity not equal to number added "
1237 "to database (DD = %d != %d = "
1238 "feit->get()->getNbDofsOnEnt())\n"
1239 "%s",
1240 DD, feit->get()->getNbDofsOnEnt(), ss.str().c_str());
1241 }
1242 }
1243
1244 // Insert into Multi-Index container
1245 int dofs_field_size0 = dofsField.size();
1246 // The old interval was erased above; hi_dit is its surviving successor.
1247 const auto hint = hi_dit;
1248 for (auto &v : *dofs_array)
1249 dofsField.emplace_hint(hint, dofs_array, &v);
1250
1251 // Add Sequence of DOFs to sequence container as weak_ptr
1252 field_it->get()->getDofSequenceContainer().push_back(dofs_array);
1253
1254 // Check data consistency
1255 if (PetscUnlikely(static_cast<int>(dofs_array.use_count()) !=
1256 static_cast<int>(dofs_array->size() + 1))) {
1257 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1258 "Wrong use count %ld != %zu", dofs_array.use_count(),
1259 dofs_array->size() + 1);
1260 }
1261 if (dofs_field_size0 + dofs_array->size() != dofsField.size()) {
1262 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1263 "Wrong number of inserted DOFs %zu != %zu", dofs_array->size(),
1264 dofsField.size() - dofs_field_size0);
1265 }
1266 }
1268}
@ VERY_NOISY
const double v
phase velocity of light in medium (cm/ns)
FieldEntity_multiIndex entsFields
entities on fields
Definition Core.hpp:309
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 1129 of file FieldCore.cpp.

1130 {
1132
1133 if (verb == -1)
1134 verb = verbose;
1135
1136 // find fields
1137 auto field_it = fIelds.get<BitFieldId_mi_tag>().find(id);
1138 if (field_it == fIelds.get<BitFieldId_mi_tag>().end())
1139 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field not found");
1140
1141 if (verb > QUIET)
1142 MOFEM_LOG("WORLD", Sev::noisy)
1143 << "Field " << (*field_it)->getName() << " core value < "
1144 << this->getValue() << " > field value () "
1145 << (*field_it)->getBitNumber() << " )";
1146
1147 CHKERR this->buildFieldForNoFieldImpl(*field_it, dof_counter, verb);
1148
1150}
MoFEMErrorCode buildFieldForNoFieldImpl(boost::shared_ptr< Field > field_ptr, std::map< EntityType, int > &dof_counter, int verb)

◆ buildFieldForNoFieldImpl()

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

Definition at line 1024 of file FieldCore.cpp.

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

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

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

◆ check_field()

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

check if field is in database

Parameters
nameField name to check
Returns
true If field exists in the database, false otherwise

Implements MoFEM::CoreInterface.

Definition at line 57 of file FieldCore.cpp.

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

◆ check_finite_element()

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

Check if finite element is in database.

Parameters
nameName of finite element to check
Returns
true if element is declared in the database, false otherwise

Implements MoFEM::CoreInterface.

Definition at line 35 of file FECore.cpp.

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

◆ check_number_of_ents_in_ents_field() [1/2]

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

check data consistency in entitiesPtr

Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 1482 of file FieldCore.cpp.

1482 {
1484 for (auto &it : fIelds.get<FieldName_mi_tag>()) {
1485 if (it->getSpace() == NOFIELD)
1486 continue; // FIXME: should be treated properly, not test is just
1487 // skipped for this NOFIELD space
1488 EntityHandle meshset = it->getMeshset();
1489 int num_entities;
1490 CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1491
1492 auto count_field_ents = [&]() {
1493 auto bit_number = it->getBitNumber();
1494 auto low_eit = entsFields.get<Unique_mi_tag>().lower_bound(
1495 FieldEntity::getLoBitNumberUId(bit_number));
1496 auto hi_eit = entsFields.get<Unique_mi_tag>().upper_bound(
1497 FieldEntity::getHiBitNumberUId(bit_number));
1498 return std::distance(low_eit, hi_eit);
1499 };
1500
1501 if (count_field_ents() > (unsigned int)num_entities) {
1502 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1503 "not equal number of entities in meshset and field "
1504 "multiindex < %s >",
1505 it->getName().c_str());
1506 }
1507 }
1509}

◆ 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

Parameters
nameField name to check consistency for
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 1454 of file FieldCore.cpp.

1454 {
1456 auto it = fIelds.get<FieldName_mi_tag>().find(name);
1457 if (it == fIelds.get<FieldName_mi_tag>().end()) {
1458 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1459 "field not found < %s >", name.c_str());
1460 }
1461 EntityHandle meshset = (*it)->getMeshset();
1462 int num_entities;
1463 CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1464
1465 auto count_field_ents = [&]() {
1466 auto bit_number = (*it)->getBitNumber();
1467 auto low_eit = entsFields.get<Unique_mi_tag>().lower_bound(
1468 FieldEntity::getLoBitNumberUId(bit_number));
1469 auto hi_eit = entsFields.get<Unique_mi_tag>().upper_bound(
1470 FieldEntity::getHiBitNumberUId(bit_number));
1471 return std::distance(low_eit, hi_eit);
1472 };
1473
1474 if (count_field_ents() > (unsigned int)num_entities) {
1475 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1476 "not equal number of entities in meshset and field multiindex "
1477 "< %s >",
1478 name.c_str());
1479 }
1481}

◆ 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

Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 906 of file FECore.cpp.

906 {
908 FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
909 it = finiteElements.get<FiniteElement_name_mi_tag>().begin();
910 for (; it != finiteElements.get<FiniteElement_name_mi_tag>().end(); it++) {
911 EntityHandle meshset = (*it)->getMeshset();
912
913 int num_entities;
914 CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
915
916 auto counts_fes = [&]() {
917 return std::distance(get_fe_by_name_begin((*it)->getName()),
918 get_fe_by_name_end((*it)->getName()));
919 };
920
921 if (counts_fes() != static_cast<size_t>(num_entities)) {
923 "not equal number of entities in meshset and finite elements "
924 "multiindex < %s >",
925 (*it)->getName().c_str());
926 }
927 }
929}
EntFiniteElement_multiIndex::index< Unique_mi_tag >::type::iterator get_fe_by_name_end(const std::string &fe_name) const
get end iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(MF...
Definition FECore.cpp:868
EntFiniteElement_multiIndex::index< Unique_mi_tag >::type::iterator get_fe_by_name_begin(const std::string &fe_name) const
get begin iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(...
Definition FECore.cpp:857

◆ 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

Parameters
nameFinite element name to check consistency for
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 879 of file FECore.cpp.

880 {
882 FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
883 it = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
884 if (it == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
885 SETERRQ(mofemComm, 1, "finite element not found < %s >", name.c_str());
886 }
887 EntityHandle meshset = (*it)->getMeshset();
888
889 int num_entities;
890 CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
891
892 auto counts_fes = [&]() {
893 return std::distance(get_fe_by_name_begin((*it)->getName()),
894 get_fe_by_name_end((*it)->getName()));
895 };
896
897 if (counts_fes() != static_cast<size_t>(num_entities)) {
899 "not equal number of entities in meshset and finite elements "
900 "multiindex < %s >",
901 (*it)->getName().c_str());
902 }
904}

◆ 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

◆ clear_adjacencies_entities() [2/3]

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

clear adjacencies for field entities by entities

Implements MoFEM::CoreInterface.

Definition at line 213 of file DeleteCore.cpp.

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

◆ clear_adjacencies_entities() [3/3]

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

clear adjacencies for field entities by entities and field namd

Implements MoFEM::CoreInterface.

Definition at line 231 of file DeleteCore.cpp.

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

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

◆ clear_adjacencies_finite_elements() [2/3]

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

Definition at line 322 of file DeleteCore.cpp.

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

◆ clear_adjacencies_finite_elements() [3/3]

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

Definition at line 341 of file DeleteCore.cpp.

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

◆ clear_database()

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

Clear database.

Parameters
verbVerbosity level
Returns
Error code

Implements MoFEM::CoreInterface.

Definition at line 771 of file Core.cpp.

771 {
773 if (verb == -1)
774 verb = verbose;
777}

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

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

◆ clear_finite_elements() [1/2]

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 273 of file DeleteCore.cpp.

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

◆ clear_finite_elements() [2/2]

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 290 of file DeleteCore.cpp.

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

◆ clear_finite_elements_by_bit_ref()

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 261 of file DeleteCore.cpp.

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

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

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

◆ clear_problems()

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

clear problems

Implements MoFEM::CoreInterface.

Definition at line 342 of file ProblemsCore.cpp.

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

◆ clearMap()

MoFEMErrorCode MoFEM::Core::clearMap ( )
protected

Cleaning database.

Definition at line 546 of file Core.cpp.

546 {
548 // Cleaning databases in interfaces
549 CHKERR getInterface<SeriesRecorder>()->clearMap();
550 CHKERR getInterface<MeshsetsManager>()->clearMap();
551 CHKERR getInterface<CutMeshInterface>()->clearMap();
552 // Cleaning databases
553 refinedEntities.clear();
554 refinedFiniteElements.clear();
555 fIelds.clear();
556 entsFields.clear();
557 dofsField.clear();
558 finiteElements.clear();
559 entsFiniteElements.clear();
560 entFEAdjacencies.clear();
561 pRoblems.clear();
563}

◆ coreGenericConstructor()

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

Definition at line 208 of file Core.cpp.

209 {
211
212 // This is deprecated ONE should use MoFEM::Core::Initialize
214 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
215 "MoFEM globally is not initialised, call MoFEM::Core::Initialize");
216
217 // Create duplicate communicator
218 wrapMPIMOABComm = boost::make_shared<WrapMPIComm>(comm, false);
219
220 MPI_Comm_size(mofemComm, &sIze);
221 MPI_Comm_rank(mofemComm, &rAnk);
222
223 // CHeck if moab has set communicator if not set communicator internally
224 ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
225 if (pComm == NULL)
226 pComm = new ParallelComm(&moab, wrapMPIMOABComm->get_comm());
227
228 // Register interfaces for this implementation
229 CHKERR registerInterface<UnknownInterface>();
230 CHKERR registerInterface<CoreInterface>();
231 CHKERR registerInterface<DeprecatedCoreInterface>();
232
233 // Register MOFEM events in PETSc
234 PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
235 PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
236 PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
237 PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
238
239 MOFEM_LOG_CHANNEL("WORLD");
240 MOFEM_LOG_CHANNEL("SELF");
241 MOFEM_LOG_CHANNEL("SYNC");
242
244}
#define MYPCOMM_INDEX
default communicator number PCOMM
PetscLogEvent MOFEM_EVENT_createMat
Definition Core.hpp:1016
PetscLogEvent MOFEM_EVENT_preProcess
Event for preProcess finite element.
Definition Core.hpp:1011
int sIze
MoFEM communicator size.
Definition Core.hpp:1027
ParallelComm * pComm
MOAB communicator structure.
Definition Core.hpp:1025
PetscLogEvent MOFEM_EVENT_operator
Event for evaluating operator of finite element.
Definition Core.hpp:1013
PetscLogEvent MOFEM_EVENT_postProcess
Event for postProcess finite element.
Definition Core.hpp:1015
boost::shared_ptr< WrapMPIComm > wrapMPIMOABComm
manage creation and destruction of MOAB communicator
Definition Core.hpp:1049

◆ 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 vertices and add to the field object.

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

Note
This function is typically used when NOFIELD is created, for example load factor in arc-length control.
Parameters
nameName of the field to add vertices to
coordsArray of coordinates for the vertices
sizeNumber of vertices to create
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 471 of file FieldCore.cpp.

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

◆ 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 from MoFEM and MOAB database.

Parameters
bitBit level to select entities
maskMask for bit level selection
remove_parentIf true, also remove parent relationships
verbVerbosity level (default: DEFAULT_VERBOSITY)
mfMoFEM type control (default: MF_ZERO)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 535 of file DeleteCore.cpp.

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

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

611 {
613 auto &f = fIelds.get<FieldName_mi_tag>();
614 auto mit = f.find(name);
615 if (mit == f.end()) {
616 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
617 "Finite element <%s> not found", name.c_str());
618 }
619 EntityHandle meshset = mit->get()->getMeshset();
620 Range ents;
621 CHKERR get_moab().get_entities_by_handle(meshset, ents, false);
623 CHKERR get_moab().tag_delete((*mit)->th_FieldDataVerts);
624 CHKERR get_moab().tag_delete((*mit)->th_FieldData);
625 CHKERR get_moab().tag_delete((*mit)->th_AppOrder);
626 f.erase(mit);
628 get_moab(), meshset, get_basic_entity_data_ptr()->pcommID);
629 CHKERR get_moab().delete_entities(&meshset, 1);
631}
static MoFEMErrorCode removeMeshsetFromPartition(moab::Interface &moab, const EntityHandle meshset, const int pcomm_id=MYPCOMM_INDEX)
Remove a meshset from all partition sets before it is deleted.
MoFEMErrorCode remove_ents_from_field(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
remove entities from field

◆ delete_finite_element()

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

Delete finite element from MoFEM database.

Parameters
nameName of finite element to delete
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 592 of file DeleteCore.cpp.

592 {
594 auto &fe = finiteElements.get<FiniteElement_name_mi_tag>();
595 auto mit = fe.find(name);
596 if (mit == fe.end()) {
597 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
598 "Finite element <%s> not found", name.c_str());
599 }
600 EntityHandle meshset = mit->get()->getMeshset();
601 Range ents;
602 CHKERR get_moab().get_entities_by_handle(meshset, ents, false);
604 fe.erase(mit);
606 get_moab(), meshset, get_basic_entity_data_ptr()->pcommID);
607 CHKERR get_moab().delete_entities(&meshset, 1);
609}
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

◆ 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 SETERRQ(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 // addProblem put the meshset into the partition set; do not leave a stale
118 // handle there.
120 get_moab(), meshset, get_basic_entity_data_ptr()->pcommID);
121 CHKERR get_moab().delete_entities(&meshset, 1);
123}

◆ 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
mesh_reconstruction.cpp, mofem/atom_tests/add_blockset.cpp, mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/bernstein_bezier_generate_base.cpp, mofem/atom_tests/boundary_marker.cpp, mofem/atom_tests/build_composite_problem.cpp, mofem/atom_tests/build_large_problem.cpp, mofem/atom_tests/build_problems.cpp, mofem/atom_tests/child_and_parent.cpp, mofem/atom_tests/continuity_check_on_contact_prism_side_ele.cpp, mofem/atom_tests/continuity_check_on_skeleton_3d.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, mofem/atom_tests/cubit_bc_test.cpp, mofem/atom_tests/dg_projection.cpp, mofem/atom_tests/dm_build_partitioned_mesh.cpp, mofem/atom_tests/dm_create_subdm.cpp, mofem/atom_tests/dm_partitioned_no_field.cpp, mofem/atom_tests/edge_and_bubble_shape_functions_on_quad.cpp, mofem/atom_tests/field_blas.cpp, mofem/atom_tests/field_blas_axpy.cpp, mofem/atom_tests/field_evaluator.cpp, mofem/atom_tests/field_values_from_tags.cpp, mofem/atom_tests/find_local_coordinates.cpp, mofem/atom_tests/forces_and_sources_testing_edge_element.cpp, mofem/atom_tests/forces_and_sources_testing_flat_prism_element.cpp, mofem/atom_tests/forces_and_sources_testing_users_base.cpp, mofem/atom_tests/gauss_points_on_outer_product.cpp, mofem/atom_tests/hanging_node_approx.cpp, mofem/atom_tests/hcurl_check_approx_in_2d.cpp, mofem/atom_tests/hcurl_curl_operator.cpp, mofem/atom_tests/hcurl_divergence_operator_2d.cpp, mofem/atom_tests/hdiv_check_approx_in_3d.cpp, mofem/atom_tests/hdiv_divergence_operator.cpp, mofem/atom_tests/higher_derivatives.cpp, mofem/atom_tests/log.cpp, mofem/atom_tests/loop_entities.cpp, mofem/atom_tests/matrix_function.cpp, mofem/atom_tests/mesh_insert_interface_atom.cpp, mofem/atom_tests/mesh_refine_atom.cpp, mofem/atom_tests/node_merge.cpp, mofem/atom_tests/operators_tester_direction.cpp, mofem/atom_tests/operators_tests.cpp, mofem/atom_tests/partition_mesh.cpp, mofem/atom_tests/petsc_smart_ptr_objects.cpp, mofem/atom_tests/prism_elements_from_surface.cpp, mofem/atom_tests/prism_polynomial_approximation.cpp, mofem/atom_tests/quad_polynomial_approximation.cpp, mofem/atom_tests/rebuild_problem.cpp, mofem/atom_tests/rebuild_problem_hybrid.cpp, mofem/atom_tests/remove_entities_from_problem.cpp, mofem/atom_tests/remove_entities_from_problem_not_partitioned.cpp, mofem/atom_tests/scalar_check_approximation.cpp, mofem/atom_tests/schur_test_diag_mat.cpp, mofem/atom_tests/simple_interface.cpp, mofem/atom_tests/simple_l2_only.cpp, mofem/atom_tests/tensor_divergence_operator.cpp, mofem/atom_tests/test_broken_space.cpp, mofem/atom_tests/test_cache_on_entities.cpp, mofem/tools/delete_ho_nodes.cpp, mofem/tools/extrude_prisms.cpp, mofem/tools/field_to_vertices.cpp, mofem/tools/mesh_cut.cpp, mofem/tools/mesh_smoothing.cpp, mofem/tools/meshset_to_vtk.cpp, mofem/tools/remove_mofem_meshsets.cpp, mofem/tools/split_sideset.cpp, mofem/tutorials/adv-0_plasticity/plastic.cpp, mofem/tutorials/adv-3_level_set/level_set.cpp, mofem/tutorials/adv-4_dynamic_first_order_con_law/dynamic_first_order_con_law.cpp, mofem/tutorials/adv-5_poroelasticity/seepage.cpp, mofem/tutorials/adv-6_dg_projection/between_meshes_dg_projection.cpp, mofem/tutorials/clx-0_acoustics/helmholtz.cpp, mofem/tutorials/cor-0to1_unsaturated_transport/unsaturated_transport.cpp, mofem/tutorials/cor-10_navier_stokes/navier_stokes.cpp, mofem/tutorials/cor-12_cohesive_interface/arc_length_interface.cpp, mofem/tutorials/cor-2to5_analytical_poisson/analytical_nonlinear_poisson.cpp, mofem/tutorials/cor-2to5_analytical_poisson/analytical_poisson.cpp, mofem/tutorials/cor-2to5_analytical_poisson/analytical_poisson_field_split.cpp, mofem/tutorials/cor-6_simple_elasticity/simple_elasticity.cpp, mofem/tutorials/cor-7_elasticity_mixed_formulation/elasticity_mixed_formulation.cpp, mofem/tutorials/cor-9_reaction_diffusion/reaction_diffusion.cpp, mofem/tutorials/fun-0_hello_world/hello_world.cpp, mofem/tutorials/fun-1_integration/integration.cpp, mofem/tutorials/fun-2_plot_base/plot_base.cpp, mofem/tutorials/max-0_magnetostatics/magnetostatic.cpp, mofem/tutorials/max-1_lorentz_force//lorentz_force.cpp, mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp, mofem/tutorials/mix-1_light_intensity_equation/phase.cpp, mofem/tutorials/scl-0_least_squares/approximation.cpp, mofem/tutorials/scl-12_electrostatics/electrostatics.cpp, mofem/tutorials/scl-1_poisson_2d_homogeneous/poisson_2d_homogeneous.cpp, mofem/tutorials/scl-6_heat_equation/heat_equation.cpp, mofem/tutorials/scl-7_wave_equation/wave_equation.cpp, mofem/tutorials/scl-8_heat_radiation/radiation.cpp, mofem/tutorials/scl-9_heat_method/heat_method.cpp, mofem/tutorials/vec-0_elasticity/elastic.cpp, mofem/tutorials/vec-10_elasticity_schur/schur_elastic.cpp, mofem/tutorials/vec-11_elastic_tie_mesh/elastic_tie_mesh.cpp, mofem/tutorials/vec-1_eigen_elasticity/eigen_elastic.cpp, mofem/tutorials/vec-2_nonlinear_elasticity/nonlinear_elastic.cpp, mofem/tutorials/vec-3_nonlinear_dynamics/nonlinear_dynamic_elastic.cpp, mofem/tutorials/vec-4_shallow_wave/approx_sphere.cpp, mofem/tutorials/vec-4_shallow_wave/shallow_wave.cpp, mofem/tutorials/vec-5_free_surface/free_surface.cpp, mofem/tutorials/vec-6_dg_kirchhoff_plate/plate.cpp, mofem/tutorials/vec-7_shape_optimisation/adjoint.cpp, mofem/tutorials/vec-9_arc_length/arc_length.cpp, mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp, mofem/users_modules/basic_finite_elements/atom_tests/testing_jacobian_of_hook_element.cpp, mofem/users_modules/basic_finite_elements/atom_tests/testing_jacobian_of_hook_scaled_with_density_element.cpp, mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp, mofem/users_modules/basic_finite_elements/nonlinear_elasticity/nonlinear_dynamics.cpp, mofem/users_modules/bone_remodelling/bone_adaptation.cpp, mofem/users_modules/minimal_surface_equation/minimal_surface_area.cpp, and project_roughness.cpp.

Definition at line 123 of file Core.cpp.

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

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

295 {
296 return basicEntityDataPtr;
297 }

◆ get_comm()

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

Implements MoFEM::CoreInterface.

Definition at line 1033 of file Core.hpp.

1033{ 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 1043 of file Core.hpp.

1043{ return rAnk; }

◆ get_comm_size()

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

Implements MoFEM::CoreInterface.

Definition at line 1038 of file Core.hpp.

1038{ return sIze; }

◆ get_dofs() [1/2]

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

Get the dofs object.

Returns
const DofEntity_multiIndex* Const pointer to DOF entities multi-index

Implements MoFEM::CoreInterface.

Definition at line 932 of file Core.cpp.

932{ 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 871 of file Core.cpp.

871 {
873 *dofs_ptr = &dofsField;
875}

◆ get_dofs_by_name_and_ent_begin()

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

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

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

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1426 of file FieldCore.cpp.

1427 {
1428 return dofsField.get<Unique_mi_tag>().lower_bound(
1430 ent));
1431}

◆ 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 end iterator of field dofs of given name and ent (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,ENT,IT)

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

Parameters
field_nameName of the field
entEntity handle to get DOFs for
Returns
DofEntityByUId::iterator End iterator for field DOFs on entity

Implements MoFEM::CoreInterface.

Definition at line 1433 of file FieldCore.cpp.

1434 {
1435 return dofsField.get<Unique_mi_tag>().upper_bound(
1437 ent));
1438}

◆ get_dofs_by_name_and_type_begin()

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

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

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

Parameters
field_nameName of the field
typeEntity type to filter DOFs by
Returns
DofEntityByUId::iterator Begin iterator for field DOFs of specified type

Implements MoFEM::CoreInterface.

Definition at line 1440 of file FieldCore.cpp.

1441 {
1442 return dofsField.get<Unique_mi_tag>().lower_bound(
1445}

◆ 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 end iterator of field dofs of given name and ent type(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT)

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

Parameters
field_nameName of the field
typeEntity type to filter DOFs by
Returns
DofEntityByUId::iterator End iterator for field DOFs of specified type

Implements MoFEM::CoreInterface.

Definition at line 1447 of file FieldCore.cpp.

1448 {
1449 return dofsField.get<Unique_mi_tag>().upper_bound(
1452}

◆ get_dofs_by_name_begin()

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

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

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

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1416 of file FieldCore.cpp.

1416 {
1417 return dofsField.get<Unique_mi_tag>().lower_bound(
1419}

◆ get_dofs_by_name_end()

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

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

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

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1421 of file FieldCore.cpp.

1421 {
1422 return dofsField.get<Unique_mi_tag>().upper_bound(
1424}

◆ get_ent_field_by_name_begin()

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

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

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

Parameters
field_nameName of the field to get iterator for
Returns
FieldEntityByUId::iterator Begin iterator for field entities

Implements MoFEM::CoreInterface.

Definition at line 1406 of file FieldCore.cpp.

1406 {
1407 return entsFields.get<Unique_mi_tag>().lower_bound(
1409}

◆ get_ent_field_by_name_end()

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

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

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

Parameters
field_nameName of the field to get iterator for
Returns
FieldEntityByUId::iterator End iterator for field entities

Implements MoFEM::CoreInterface.

Definition at line 1411 of file FieldCore.cpp.

1411 {
1412 return entsFields.get<Unique_mi_tag>().upper_bound(
1414}

◆ 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* Const pointer to adjacency map multi-index

Implements MoFEM::CoreInterface.

Definition at line 912 of file Core.cpp.

912 {
913 return &entFEAdjacencies;
914}

◆ 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_adjacencyPointer to store the adjacency map multi-index
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 903 of file Core.cpp.

905 {
907 *dofs_elements_adjacency = &entFEAdjacencies;
909}

◆ 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* Const pointer to entity-finite element multi-index

Implements MoFEM::CoreInterface.

Definition at line 926 of file Core.cpp.

926 {
927 return &entsFiniteElements;
928}

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

885 {
887 *fe_ent_ptr = &entsFiniteElements;
889}

◆ get_fe_by_name_begin()

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

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

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

Parameters
fe_nameName of the finite element to get iterator for
Returns
EntFiniteElement_multiIndex::index<Unique_mi_tag>::type::iterator Begin iterator for finite elements

Implements MoFEM::CoreInterface.

Definition at line 857 of file FECore.cpp.

857 {
858 auto miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
859 if (miit != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
860 return entsFiniteElements.get<Unique_mi_tag>().lower_bound(
861 EntFiniteElement::getLocalUniqueIdCalculate(0, (*miit)->getFEUId()));
862 } else {
863 return entsFiniteElements.get<Unique_mi_tag>().end();
864 }
865}

◆ get_fe_by_name_end()

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

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

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

Parameters
fe_name

Implements MoFEM::CoreInterface.

Definition at line 868 of file FECore.cpp.

868 {
869 auto miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
870 if (miit != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
871 return entsFiniteElements.get<Unique_mi_tag>().upper_bound(
873 get_id_for_max_type<MBENTITYSET>(), (*miit)->getFEUId()));
874 } else {
875 return entsFiniteElements.get<Unique_mi_tag>().end();
876 }
877}

◆ get_field_bit_number()

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

get field bit number

Parameters
nameName of the field
Returns
FieldBitNumber The bit number assigned to the field Example:
auto field_number = mField.get_field_bit_number("DISPLACEMENT");
virtual FieldBitNumber get_field_bit_number(const std::string name) const =0
get field bit number

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.

◆ 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
dimDimension of entities to retrieve
entsRange object to store the retrieved entities
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 81 of file FieldCore.cpp.

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

◆ get_field_entities_by_handle()

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

get entities in the field by handle

Parameters
nameField name
entsRange object to store all entities in the field
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 100 of file FieldCore.cpp.

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

◆ get_field_entities_by_type()

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

get entities in the field by type

Parameters
nameField name
typeEntity type (MBVERTEX, MBEDGE, MBTRI, MBTET, etc.)
entsRange object to store the retrieved entities
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 91 of file FieldCore.cpp.

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

◆ get_field_ents() [1/2]

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

Get the field ents object.

Returns
const FieldEntity_multiIndex* Const pointer to field entities multi-index

Implements MoFEM::CoreInterface.

Definition at line 929 of file Core.cpp.

929 {
930 return &entsFields;
931}

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

866 {
868 *field_ents = &entsFields;
870}

◆ get_field_id()

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

Get field Id.

Parameters
nameName of the field
Returns
BitFieldId The unique bit field identifier

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
nameName of the field
Returns
EntityHandle Handle to the meshset containing field entities Example:
EntityHandle disp_files_meshset = mField.get_field_meshset("DISPLACEMENT");
virtual EntityHandle get_field_meshset(const std::string name) const =0
get field meshset

Implements MoFEM::CoreInterface.

Definition at line 53 of file FieldCore.cpp.

53 {
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
idThe bit field identifier
Returns
std::string The name of the field

Implements MoFEM::CoreInterface.

Definition at line 37 of file FieldCore.cpp.

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

◆ get_field_structure()

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

get field structure

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

Parameters
nameField name to retrieve
bhControls behaviour when field is not found
Returns
const Field* Pointer to field structure, or nullptr if not found and bh==MF_ZERO

Implements MoFEM::CoreInterface.

Definition at line 65 of file FieldCore.cpp.

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

◆ get_fields() [1/2]

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

Get the fields object.

Returns
const Field_multiIndex* Const pointer to fields multi-index

Implements MoFEM::CoreInterface.

Definition at line 916 of file Core.cpp.

916{ 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 824 of file Core.cpp.

824 {
826 *fields_ptr = &fIelds;
828}

◆ get_finite_element_entities_by_dimension()

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

get entities in the finite element by dimension

Parameters
namefinite element name
dimdim
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 286 of file FECore.cpp.

287 {
288
290
291 EntityHandle meshset = get_finite_element_meshset(name);
292 CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, true);
294}

◆ get_finite_element_entities_by_handle()

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

get entities in the finite element by handle

Parameters
namefinite element name
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 309 of file FECore.cpp.

310 {
311
313
314 EntityHandle meshset = get_finite_element_meshset(name);
315 CHKERR get_moab().get_entities_by_handle(meshset, ents, true);
316
318}

◆ get_finite_element_entities_by_type()

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

get entities in the finite element by type

Parameters
namefinite element name
typeentity type
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 296 of file FECore.cpp.

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

◆ get_finite_element_meshset() [1/2]

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

Definition at line 273 of file FECore.cpp.

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

◆ get_finite_element_meshset() [2/2]

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

get finite element meshset

Implements MoFEM::CoreInterface.

Definition at line 281 of file FECore.cpp.

281 {
283}

◆ get_finite_element_structure()

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

get finite element structure

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

Parameters
nameName of the finite element
bhControls behaviour when finite element is not found
Returns
const FiniteElement* Pointer to finite element structure, or nullptr if not found and bh==MF_ZERO

Implements MoFEM::CoreInterface.

Definition at line 18 of file FECore.cpp.

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

◆ get_finite_elements() [1/2]

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

Get the finite elements object.

Returns
const FiniteElement_multiIndex* Const pointer to finite elements multi-index

Implements MoFEM::CoreInterface.

Definition at line 923 of file Core.cpp.

923 {
924 return &finiteElements;
925}

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

878 {
880 *fe_ptr = &finiteElements;
882}

◆ get_meshsets_manager() [1/2]

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

get MeshsetsManager reference

Returns
MeshsetsManager& Reference to MeshsetsManager object

Implements MoFEM::CoreInterface.

Definition at line 366 of file Core.hpp.

366 {
367 return *get_meshsets_manager_ptr();
368 }
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition Core.cpp:891

◆ get_meshsets_manager() [2/2]

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

get MeshsetsManager reference

Returns
const MeshsetsManager& Const reference to MeshsetsManager object

Implements MoFEM::CoreInterface.

Definition at line 369 of file Core.hpp.

369 {
370 return *get_meshsets_manager_ptr();
371 }

◆ get_meshsets_manager_ptr() [1/2]

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

get MeshsetsManager pointer

Returns
MeshsetsManager* Pointer to MeshsetsManager object

Implements MoFEM::CoreInterface.

Definition at line 891 of file Core.cpp.

891 {
892 MeshsetsManager *meshsets_manager_ptr;
893 getInterface(meshsets_manager_ptr);
894 return meshsets_manager_ptr;
895}
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

Returns
const MeshsetsManager* Const pointer to MeshsetsManager object

Implements MoFEM::CoreInterface.

Definition at line 897 of file Core.cpp.

897 {
898 MeshsetsManager *meshsets_manager_ptr;
899 getInterface(meshsets_manager_ptr);
900 return meshsets_manager_ptr;
901}

◆ get_moab() [1/2]

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

get moab instance

Returns
moab::Interface& Reference to MOAB interface

Implements MoFEM::CoreInterface.

Definition at line 327 of file Core.hpp.

327{ return moab; }

◆ get_moab() [2/2]

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

get moab instance interface

Returns
const moab::Interface& Const reference to MOAB interface

Implements MoFEM::CoreInterface.

Definition at line 328 of file Core.hpp.

328{ 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 843 of file Core.cpp.

844 {
846 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
847 const ProblemsByName &problems = pRoblems.get<Problem_mi_tag>();
848 ProblemsByName::iterator p_miit = problems.find(problem_name);
849 if (p_miit == problems.end()) {
850 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
851 "problem < %s > not found, (top tip: check spelling)",
852 problem_name.c_str());
853 }
854 *problem_ptr = &*p_miit;
856}

◆ get_problem() [2/2]

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

Get the problem object.

Parameters
problem_nameName of the problem to retrieve
Returns
const Problem* Const pointer to problem structure

Implements MoFEM::CoreInterface.

Definition at line 933 of file Core.cpp.

933 {
934 const Problem *prb;
935 CHK_THROW_MESSAGE(get_problem(problem_name, &prb),
936 "Problem of given name not found");
937 return prb;
938}
MoFEMErrorCode get_problem(const std::string &problem_name, const Problem **problem_ptr) const
Get problem database (data structure)
Definition Core.cpp:843

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

934 {
936 auto &prb = pRoblems.get<Problem_mi_tag>();
937 auto p_miit = prb.find(problem_name);
938 if (p_miit == prb.end())
939 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
940 "No such problem like < %s >", problem_name.c_str());
941
942 auto fe_miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
943 if (fe_miit != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
944 auto miit =
945 p_miit->numeredFiniteElementsPtr->get<Unique_mi_tag>().lower_bound(
947 0, (*fe_miit)->getFEUId()));
948 auto hi_miit =
949 p_miit->numeredFiniteElementsPtr->get<Unique_mi_tag>().upper_bound(
951 get_id_for_max_type<MBENTITYSET>(), (*fe_miit)->getFEUId()));
952
953 if (miit != hi_miit) {
954 std::vector<EntityHandle> ents;
955 ents.reserve(std::distance(miit, hi_miit));
956 for (; miit != hi_miit; ++miit)
957 ents.push_back((*miit)->getEnt());
958 int part = (*miit)->getPart();
959 CHKERR get_moab().tag_clear_data(th_Part, &*ents.begin(), ents.size(),
960 &part);
961 CHKERR get_moab().add_entities(meshset, &*ents.begin(), ents.size());
962 }
963 }
964
966}
Tag th_Part
Tag for partition number.
Definition Core.hpp:262

◆ get_problems() [1/2]

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

Get the problems object.

Returns
const Problem_multiIndex* Const pointer to problems multi-index

Implements MoFEM::CoreInterface.

Definition at line 939 of file Core.cpp.

939{ 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 859 of file Core.cpp.

859 {
861 *problems_ptr = &pRoblems;
863}

◆ get_ref_ents() [1/2]

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

Get the ref ents object.

Returns
const RefEntity_multiIndex* Const pointer to refined entities multi-index

Implements MoFEM::CoreInterface.

Definition at line 917 of file Core.cpp.

917 {
918 return &refinedEntities;
919}

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

831 {
833 *refined_entities_ptr = &refinedEntities;
835}

◆ 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* Const pointer to refined finite elements multi-index

Implements MoFEM::CoreInterface.

Definition at line 920 of file Core.cpp.

920 {
921 return &refinedFiniteElements;
922}

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

837 {
839 *refined_finite_elements_ptr = &refinedFiniteElements;
841}

◆ get_th_RefBitEdge()

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

Definition at line 204 of file Core.hpp.

204{ return th_RefBitEdge; }

◆ get_th_RefBitLevel()

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

Definition at line 203 of file Core.hpp.

203{ return th_RefBitLevel; }

◆ get_th_RefParentHandle()

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

Definition at line 202 of file Core.hpp.

202{ return th_RefParentHandle; }

◆ getBitFEId()

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

Get field Id.

Parameters
namefield name
Returns
field id

Definition at line 255 of file FECore.cpp.

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

◆ getBitFEIdName()

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

Get field name.

Parameters
idfield id
Returns
field name

Definition at line 265 of file FECore.cpp.

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

◆ getBitProblemId()

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

Definition at line 125 of file ProblemsCore.cpp.

125 {
126 auto p_miit = pRoblems.get<Problem_mi_tag>().find(name);
127 if (p_miit == pRoblems.get<Problem_mi_tag>().end()) {
128 THROW_MESSAGE("no such problem like " + name + " >");
129 }
130 return p_miit->getId();
131}

◆ getBuildMoFEM()

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

Get flags/semaphores for different stages.

Definition at line 230 of file Core.hpp.

230{ return *buildMoFEM; }

◆ getOptions()

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

Get core options from command line.

Returns
MoFEMErrorCode

Definition at line 798 of file Core.cpp.

798 {
800 if (verb == -1)
801 verb = verbose;
802
803 PetscOptionsBegin(mofemComm, optionsPrefix.c_str(), "Mesh cut options",
804 "See MoFEM documentation");
805
806 CHKERR PetscOptionsBool(
807 "-mofem_init_fields", "Initialise fields on construction", "",
809
810 CHKERR PetscOptionsBool(
811 "-mofem_init_fields", "Initialise fields on construction", "",
813
814 // TODO: Add read verbosity level
815 // TODO: Add option to initalise problems ??? - DO WE REALLY NEED THAT
816
817 PetscOptionsEnd();
818
820}
std::string optionsPrefix
Prefix for options on command line.
Definition Core.hpp:1060

◆ getPetscOptionsFile()

const std::string & MoFEM::Core::getPetscOptionsFile ( )
static

PETSc options file passed to PetscInitialize(), either explicit -param_file or the default file argument from Core::Initialize().

Definition at line 121 of file Core.cpp.

121{ return petscOptionsFile; }
static std::string petscOptionsFile
Definition Core.hpp:1071

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

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

◆ getTags()

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

Get tag handles.

Parameters
verbverbosity level
Returns
error code

Definition at line 594 of file Core.cpp.

594 {
596
597 const EntityHandle root_meshset = get_moab().get_root_set();
598 if (root_meshset) {
599 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
600 "Root meshset should be 0");
601 }
602
603 // Set version
604 {
605 Version version;
606 CHKERR getFileVersion(moab, version);
607 }
608
609 // Global Variables
610 {
611
612 auto check_tag_allocated = [](auto &rval) {
614 if (rval == MB_ALREADY_ALLOCATED)
615 rval = MB_SUCCESS;
616 else
617 CHKERRG(rval);
619 };
620
621 // Safety nets
622 int def_bool = 0;
623 rval = get_moab().tag_get_handle("_MoFEMBuild", 1, MB_TYPE_INTEGER,
624 th_MoFEMBuild, MB_TAG_CREAT | MB_TAG_MESH,
625 &def_bool);
626 CHKERR check_tag_allocated(rval);
627
628 CHKERR get_moab().tag_get_by_ptr(th_MoFEMBuild, &root_meshset, 1,
629 (const void **)&buildMoFEM);
630 }
631
632 // Tags saved in vtk-files
633 {
634 const int def_part = -1;
635 CHKERR get_moab().tag_get_handle("PARTITION", 1, MB_TYPE_INTEGER, th_Part,
636 MB_TAG_CREAT | MB_TAG_SPARSE, &def_part);
637 }
638
639 // Tags Ref
640 {
641
642 // Fix size of bir ref level tags
644
645 const int def_part = -1;
646 CHKERR get_moab().tag_get_handle("_MeshsetPartition", 1, MB_TYPE_INTEGER,
647 th_Part, MB_TAG_CREAT | MB_TAG_SPARSE,
648 &def_part);
649 EntityHandle def_handle = 0;
650 CHKERR get_moab().tag_get_handle("_RefParentHandle", 1, MB_TYPE_HANDLE,
652 MB_TAG_CREAT | MB_TAG_SPARSE, &def_handle);
653 BitRefLevel def_bit_level = 0;
654 CHKERR get_moab().tag_get_handle(
655 "_RefBitLevel", sizeof(BitRefLevel), MB_TYPE_OPAQUE, th_RefBitLevel,
656 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_bit_level);
657 BitRefLevel def_bit_level_mask = BitRefLevel().set();
658 CHKERR get_moab().tag_get_handle(
659 "_RefBitLevelMask", sizeof(BitRefLevel), MB_TYPE_OPAQUE,
660 th_RefBitLevel_Mask, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
661 &def_bit_level_mask);
662 BitRefEdges def_bit_edge = 0;
663 CHKERR get_moab().tag_get_handle(
664 "_RefBitEdge", sizeof(BitRefEdges), MB_TYPE_OPAQUE, th_RefBitEdge,
665 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_bit_edge);
666 }
667
668 // Tags Field
669 {
670 const unsigned long int def_id = 0;
671 CHKERR get_moab().tag_get_handle(
672 "_FieldId", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FieldId,
673 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
674 FieldSpace def_space = LASTSPACE;
675 CHKERR get_moab().tag_get_handle(
676 "_FieldSpace", sizeof(FieldSpace), MB_TYPE_OPAQUE, th_FieldSpace,
677 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_space);
678 FieldContinuity def_continuity = LASTCONTINUITY;
679 CHKERR get_moab().tag_get_handle(
680 "_FieldContinuity", sizeof(FieldContinuity), MB_TYPE_OPAQUE,
681 th_FieldContinuity, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
682 &def_continuity);
684 CHKERR get_moab().tag_get_handle(
685 "_FieldBase", sizeof(FieldApproximationBase), MB_TYPE_OPAQUE,
686 th_FieldBase, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_base);
687 const int def_val_len = 0;
688 CHKERR get_moab().tag_get_handle(
689 "_FieldName", def_val_len, MB_TYPE_OPAQUE, th_FieldName,
690 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
691 CHKERR get_moab().tag_get_handle(
692 "_FieldName_DataNamePrefix", def_val_len, MB_TYPE_OPAQUE,
694 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
695 }
696
697 // Tags FE
698 {
699 const unsigned long int def_id = 0;
700 const int def_val_len = 0;
701 CHKERR get_moab().tag_get_handle(
702 "_FEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_FEId,
703 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
704 CHKERR get_moab().tag_get_handle(
705 "_FEName", def_val_len, MB_TYPE_OPAQUE, th_FEName,
706 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
707 CHKERR get_moab().tag_get_handle(
708 "_FEIdCol", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdCol,
709 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
710 CHKERR get_moab().tag_get_handle(
711 "_FEIdRow", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdRow,
712 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
713 CHKERR get_moab().tag_get_handle(
714 "_FEIdData", sizeof(BitFieldId), MB_TYPE_OPAQUE, th_FEIdData,
715 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
716 }
717
718 // Tags Problem
719 {
720 const unsigned long int def_id = 0;
721 const int def_val_len = 0;
722 CHKERR get_moab().tag_get_handle(
723 "_ProblemId", sizeof(BitProblemId), MB_TYPE_OPAQUE, th_ProblemId,
724 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
725 CHKERR get_moab().tag_get_handle(
726 "_ProblemFEId", sizeof(BitFEId), MB_TYPE_OPAQUE, th_ProblemFEId,
727 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_id);
728 CHKERR get_moab().tag_get_handle(
729 "_ProblemName", def_val_len, MB_TYPE_OPAQUE, th_ProblemName,
730 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
731 DofIdx def_nbdofs = 0;
732 CHKERR get_moab().tag_get_handle(
733 "_ProblemNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
734 th_ProblemNbDofsRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
735 &def_nbdofs);
736 CHKERR get_moab().tag_get_handle(
737 "_ProblemNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
738 th_ProblemNbDofsCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
739 &def_nbdofs);
740 CHKERR get_moab().tag_get_handle(
741 "_ProblemLocalNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
742 th_ProblemLocalNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
743 &def_nbdofs);
744 CHKERR get_moab().tag_get_handle(
745 "_ProblemGhostNbDofsRow", sizeof(DofIdx), MB_TYPE_OPAQUE,
746 th_ProblemGhostNbDofRow, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
747 &def_nbdofs);
748 CHKERR get_moab().tag_get_handle(
749 "_ProblemLocalNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
750 th_ProblemLocalNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
751 &def_nbdofs);
752 CHKERR get_moab().tag_get_handle(
753 "_ProblemGhostNbDofsCol", sizeof(DofIdx), MB_TYPE_OPAQUE,
754 th_ProblemGhostNbDofCol, MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE,
755 &def_nbdofs);
756 }
757
758 // Meshsets with boundary conditions and material sets
759 MeshsetsManager *meshsets_manager_ptr;
760 CHKERR getInterface(meshsets_manager_ptr);
761 CHKERR meshsets_manager_ptr->getTags(verb);
762
763 // Series recorder
764 SeriesRecorder *series_recorder_ptr;
765 CHKERR getInterface(series_recorder_ptr);
766 CHKERR series_recorder_ptr->getTags(verb);
767
769}
FieldApproximationBase
approximation base
Definition definitions.h:58
@ LASTBASE
Definition definitions.h:69
@ LASTSPACE
FieldSpace in [ 0, LASTSPACE )
Definition definitions.h:89
@ LASTCONTINUITY
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
int DofIdx
Index of DOF.
Definition Types.hpp:18
std::bitset< BITREFEDGES_SIZE > BitRefEdges
Definition Types.hpp:34
static MoFEMErrorCode fixTagSize(moab::Interface &moab, bool *changed=nullptr)
Fix tag size when BITREFLEVEL_SIZE of core library is different than file BITREFLEVEL_SIZE.
Tag th_ProblemLocalNbDofCol
Definition Core.hpp:272
Tag th_ProblemLocalNbDofRow
Definition Core.hpp:271
Tag th_ProblemGhostNbDofRow
Definition Core.hpp:271
Tag th_ProblemGhostNbDofCol
Definition Core.hpp:272

◆ getValue()

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

Get the core.

Returns
int The core value

Implements MoFEM::CoreInterface.

Reimplemented in MoFEM::CoreTmp<-1 >.

Definition at line 86 of file Core.hpp.

86{ return value; }
static constexpr int value
Definition Core.hpp:85

◆ initialiseDatabaseFromMesh()

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

Initialize database getting information on mesh.

Definition at line 307 of file Core.cpp.

307 {
308 BOOST_LOG_SCOPED_THREAD_ATTR("Timeline", attrs::timer());
309 MOFEM_LOG_CHANNEL("WORLD");
310
312 if (verb == -1)
313 verb = verbose;
314
315 Range ref_elems_to_add;
316
317 MOFEM_LOG("WORLD", Sev::verbose) << "Get MoFEM meshsets";
318 // Initialize database
319 Range meshsets;
320 CHKERR get_moab().get_entities_by_type(0, MBENTITYSET, meshsets, false);
321 Range special_meshsets;
322 for (auto mit : meshsets) {
323 BitFieldId field_id;
324 // Get bit id form field tag
325 CHKERR get_moab().tag_get_data(th_FieldId, &mit, 1, &field_id);
326 // Check if meshset if field meshset
327 if (field_id != 0) {
328
329 const void *tag_name;
330 int tag_name_size;
331 CHKERR get_moab().tag_get_by_ptr(
332 th_FieldName, &mit, 1, (const void **)&tag_name, &tag_name_size);
333
334 if (verb > QUIET)
335 MOFEM_LOG("WORLD", Sev::verbose)
336 << "Read field "
337 << boost::string_ref((char *)tag_name, tag_name_size);
338
339 auto p = fIelds.insert(boost::make_shared<Field>(moab, mit));
340
341 if (!p.second) {
342 // Field meshset exists, remove duplicate meshsets from other
343 // processors.
344 Range ents;
345 CHKERR get_moab().get_entities_by_handle(mit, ents, true);
346 CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
348 get_moab(), mit, get_basic_entity_data_ptr()->pcommID);
349 CHKERR get_moab().delete_entities(&mit, 1);
350 } else {
351 special_meshsets.insert(mit);
352 }
353 }
354 // Check for finite elements
355 BitFieldId fe_id;
356 // Get bit id from fe tag
357 CHKERR get_moab().tag_get_data(th_FEId, &mit, 1, &fe_id);
358 // check if meshset is finite element meshset
359 if (fe_id != 0) {
360 std::pair<FiniteElement_multiIndex::iterator, bool> p =
361 finiteElements.insert(
362 boost::shared_ptr<FiniteElement>(new FiniteElement(moab, mit)));
363 if (verb > QUIET)
364 MOFEM_LOG("WORLD", Sev::verbose) << "Read finite element " << **p.first;
365
366 Range ents;
367 CHKERR get_moab().get_entities_by_type(mit, MBENTITYSET, ents, false);
368 CHKERR get_moab().get_entities_by_handle(mit, ents, true);
369 ref_elems_to_add.merge(ents);
370 if (!p.second) {
371 // Finite element mesh set exist, could be created on other processor.
372 // Remove duplicate.
373 CHKERR get_moab().add_entities((*p.first)->getMeshset(), ents);
375 get_moab(), mit, get_basic_entity_data_ptr()->pcommID);
376 CHKERR get_moab().delete_entities(&mit, 1);
377 } else {
378 special_meshsets.insert(mit);
379 }
380 }
381 BitProblemId problem_id;
382 // get bit id form problem tag
383 CHKERR get_moab().tag_get_data(th_ProblemId, &mit, 1, &problem_id);
384 // check if meshset if problem meshset
385 if (problem_id != 0) {
386 std::pair<Problem_multiIndex::iterator, bool> p =
387 pRoblems.insert(Problem(moab, mit));
388 if (verb > QUIET) {
389 MOFEM_LOG("WORLD", Sev::verbose) << "Read problem " << *p.first;
390 MOFEM_LOG("WORLD", Sev::noisy)
391 << "\tBitRef " << p.first->getBitRefLevel() << " BitMask "
392 << p.first->getBitRefLevelMask();
393 }
394
395 if (!p.second) {
396 // Problem meshset exists, could be created on other processor.
397 // Remove duplicate.
398 Range ents;
399 CHKERR get_moab().get_entities_by_handle(mit, ents, true);
400 CHKERR get_moab().get_entities_by_type(mit, MBENTITYSET, ents, true);
401 CHKERR get_moab().add_entities(p.first->meshset, ents);
403 get_moab(), mit, get_basic_entity_data_ptr()->pcommID);
404 CHKERR get_moab().delete_entities(&mit, 1);
405 } else {
406 special_meshsets.insert(mit);
407 }
408 }
409 }
410 MOFEM_LOG("WORLD", Sev::verbose) << "Get MoFEM meshsets <- done";
411
412 // Add entities to database
413 MOFEM_LOG("WORLD", Sev::verbose) << "Add entities to database";
414 Range bit_ref_ents;
415 CHKERR get_moab().get_entities_by_handle(0, bit_ref_ents, false);
416 bit_ref_ents = subtract(bit_ref_ents, special_meshsets);
417 CHKERR getInterface<BitRefManager>()->filterEntitiesByRefLevel(
418 BitRefLevel().set(), BitRefLevel().set(), bit_ref_ents);
419 CHKERR getInterface<BitRefManager>()->setEntitiesBitRefLevel(bit_ref_ents);
420 CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
421 ref_elems_to_add);
422 MOFEM_LOG("WORLD", Sev::verbose) << "Add entities to database <- done";
423
424 // Build field entities
425 MOFEM_LOG("WORLD", Sev::verbose) << "Add field to database";
426 for (auto field : fIelds) {
427 if (field->getSpace() != NOSPACE) {
428 Range ents_of_id_meshset;
429 CHKERR get_moab().get_entities_by_handle(field->getMeshset(),
430 ents_of_id_meshset, false);
431 CHKERR set_field_order(ents_of_id_meshset, field->getId(), -1, verb);
432 }
433 }
434 MOFEM_LOG("WORLD", Sev::verbose) << "Add field to database <- done";
435
437 MOFEM_LOG("WORLD", Sev::verbose) << "Build fields elements";
438 CHKERR build_fields(verb);
439 MOFEM_LOG("WORLD", Sev::verbose) << "Build fields elements <- done";
441 MOFEM_LOG("WORLD", Sev::verbose) << "Build finite elements";
443 MOFEM_LOG("WORLD", Sev::verbose) << "Build finite elements <- done";
444 }
445 }
446
447 if (verb > VERY_NOISY) {
448 list_fields();
450 list_problem();
451 }
452
453 // Initialize interfaces
454 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise interfaces from mesh";
455
456 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise MeshsetManager";
457 CHKERR getInterface<MeshsetsManager>() -> initialiseDatabaseFromMesh(verb);
458 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise MeshsetManager <- done";
459 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise SeriesRecorder";
460 CHKERR getInterface<SeriesRecorder>() -> initialiseDatabaseFromMesh(verb);
461 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise SeriesRecorder <- done";
462
463 MOFEM_LOG("WORLD", Sev::verbose) << "Initialise interfaces from mesh <- done";
464
466}
@ NOSPACE
Definition definitions.h:83
MoFEMErrorCode list_problem() const
list problems
MoFEMErrorCode set_field_order(const Range &ents, const BitFieldId id, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)
Build finite elements.
Definition FECore.cpp:672
MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)
MoFEMErrorCode list_finite_elements() const
list finite elements in database
Definition FECore.cpp:320
MoFEMErrorCode list_fields() const
list entities in the field

◆ Initialize()

MoFEMErrorCode MoFEM::Core::Initialize ( int *  argc,
char ***  args,
const char  file[],
const char  help[] 
)
static

Initializes the MoFEM database PETSc, MOAB and MPI.

Note
This function calls PetscInitialize, for more details see http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscInitialize.html

Example:

int main(int argc, char *argv[]) {
// Initailise MoFEM and Petsc
MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
try {
moab::Core mb_instance; // MoAB database
moab::Interface &moab = mb_instance;
MoFEM::Core core(moab); // MOFEM database
MoFEM::CoreInterface &m_field = core;
CHKERR foo(); // Call function
}
}
static char help[]
int main()
#define CATCH_ERRORS
Catch errors.
Core (interface) class.
Definition Core.hpp:83
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition Core.cpp:68
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:123
Parameters
argccount of number of command line arguments
argsthe command line arguments
file[optional] PETSc database file, also checks ~username/.petscrc
  • and .petscrc use NULL to not check for code specific file. Use * -skip_petscrc in the code specific file to skip the .petscrc files
help[optional] Help message to print, use NULL for no message
Returns
MoFEMErrorCode
Examples
mesh_reconstruction.cpp, mofem/atom_tests/add_blockset.cpp, mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/bernstein_bezier_generate_base.cpp, mofem/atom_tests/boundary_marker.cpp, mofem/atom_tests/build_composite_problem.cpp, mofem/atom_tests/build_large_problem.cpp, mofem/atom_tests/build_problems.cpp, mofem/atom_tests/child_and_parent.cpp, mofem/atom_tests/continuity_check_on_contact_prism_side_ele.cpp, mofem/atom_tests/continuity_check_on_skeleton_3d.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, mofem/atom_tests/cubit_bc_test.cpp, mofem/atom_tests/dg_projection.cpp, mofem/atom_tests/dm_build_partitioned_mesh.cpp, mofem/atom_tests/dm_create_subdm.cpp, mofem/atom_tests/dm_partitioned_no_field.cpp, mofem/atom_tests/edge_and_bubble_shape_functions_on_quad.cpp, mofem/atom_tests/field_blas.cpp, mofem/atom_tests/field_blas_axpy.cpp, mofem/atom_tests/field_evaluator.cpp, mofem/atom_tests/field_values_from_tags.cpp, mofem/atom_tests/find_local_coordinates.cpp, mofem/atom_tests/forces_and_sources_testing_edge_element.cpp, mofem/atom_tests/forces_and_sources_testing_flat_prism_element.cpp, mofem/atom_tests/forces_and_sources_testing_users_base.cpp, mofem/atom_tests/gauss_points_on_outer_product.cpp, mofem/atom_tests/hanging_node_approx.cpp, mofem/atom_tests/hcurl_check_approx_in_2d.cpp, mofem/atom_tests/hcurl_curl_operator.cpp, mofem/atom_tests/hcurl_divergence_operator_2d.cpp, mofem/atom_tests/hdiv_check_approx_in_3d.cpp, mofem/atom_tests/hdiv_divergence_operator.cpp, mofem/atom_tests/higher_derivatives.cpp, mofem/atom_tests/log.cpp, mofem/atom_tests/loop_entities.cpp, mofem/atom_tests/matrix_function.cpp, mofem/atom_tests/mesh_insert_interface_atom.cpp, mofem/atom_tests/mesh_refine_atom.cpp, mofem/atom_tests/node_merge.cpp, mofem/atom_tests/operators_tester_direction.cpp, mofem/atom_tests/operators_tests.cpp, mofem/atom_tests/partition_mesh.cpp, mofem/atom_tests/petsc_smart_ptr_objects.cpp, mofem/atom_tests/prism_elements_from_surface.cpp, mofem/atom_tests/prism_polynomial_approximation.cpp, mofem/atom_tests/quad_polynomial_approximation.cpp, mofem/atom_tests/rebuild_problem.cpp, mofem/atom_tests/rebuild_problem_hybrid.cpp, mofem/atom_tests/remove_entities_from_problem.cpp, mofem/atom_tests/remove_entities_from_problem_not_partitioned.cpp, mofem/atom_tests/scalar_check_approximation.cpp, mofem/atom_tests/schur_test_diag_mat.cpp, mofem/atom_tests/simple_interface.cpp, mofem/atom_tests/simple_l2_only.cpp, mofem/atom_tests/tensor_divergence_operator.cpp, mofem/atom_tests/test_broken_space.cpp, mofem/atom_tests/test_cache_on_entities.cpp, mofem/tools/delete_ho_nodes.cpp, mofem/tools/extrude_prisms.cpp, mofem/tools/field_to_vertices.cpp, mofem/tools/mesh_cut.cpp, mofem/tools/mesh_smoothing.cpp, mofem/tools/meshset_to_vtk.cpp, mofem/tools/remove_mofem_meshsets.cpp, mofem/tools/split_sideset.cpp, mofem/tutorials/adv-0_plasticity/plastic.cpp, mofem/tutorials/adv-3_level_set/level_set.cpp, mofem/tutorials/adv-4_dynamic_first_order_con_law/dynamic_first_order_con_law.cpp, mofem/tutorials/adv-5_poroelasticity/seepage.cpp, mofem/tutorials/adv-6_dg_projection/between_meshes_dg_projection.cpp, mofem/tutorials/clx-0_acoustics/helmholtz.cpp, mofem/tutorials/cor-0to1_unsaturated_transport/unsaturated_transport.cpp, mofem/tutorials/cor-10_navier_stokes/navier_stokes.cpp, mofem/tutorials/cor-12_cohesive_interface/arc_length_interface.cpp, mofem/tutorials/cor-2to5_analytical_poisson/analytical_nonlinear_poisson.cpp, mofem/tutorials/cor-2to5_analytical_poisson/analytical_poisson.cpp, mofem/tutorials/cor-2to5_analytical_poisson/analytical_poisson_field_split.cpp, mofem/tutorials/cor-6_simple_elasticity/simple_elasticity.cpp, mofem/tutorials/cor-7_elasticity_mixed_formulation/elasticity_mixed_formulation.cpp, mofem/tutorials/cor-9_reaction_diffusion/reaction_diffusion.cpp, mofem/tutorials/fun-0_hello_world/hello_world.cpp, mofem/tutorials/fun-1_integration/integration.cpp, mofem/tutorials/fun-2_plot_base/plot_base.cpp, mofem/tutorials/max-0_magnetostatics/magnetostatic.cpp, mofem/tutorials/max-1_lorentz_force//lorentz_force.cpp, mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp, mofem/tutorials/mix-1_light_intensity_equation/phase.cpp, mofem/tutorials/scl-0_least_squares/approximation.cpp, mofem/tutorials/scl-12_electrostatics/electrostatics.cpp, mofem/tutorials/scl-1_poisson_2d_homogeneous/poisson_2d_homogeneous.cpp, mofem/tutorials/scl-6_heat_equation/heat_equation.cpp, mofem/tutorials/scl-7_wave_equation/wave_equation.cpp, mofem/tutorials/scl-8_heat_radiation/radiation.cpp, mofem/tutorials/scl-9_heat_method/heat_method.cpp, mofem/tutorials/vec-0_elasticity/elastic.cpp, mofem/tutorials/vec-10_elasticity_schur/schur_elastic.cpp, mofem/tutorials/vec-11_elastic_tie_mesh/elastic_tie_mesh.cpp, mofem/tutorials/vec-1_eigen_elasticity/eigen_elastic.cpp, mofem/tutorials/vec-2_nonlinear_elasticity/nonlinear_elastic.cpp, mofem/tutorials/vec-3_nonlinear_dynamics/nonlinear_dynamic_elastic.cpp, mofem/tutorials/vec-4_shallow_wave/approx_sphere.cpp, mofem/tutorials/vec-4_shallow_wave/shallow_wave.cpp, mofem/tutorials/vec-5_free_surface/free_surface.cpp, mofem/tutorials/vec-6_dg_kirchhoff_plate/plate.cpp, mofem/tutorials/vec-7_shape_optimisation/adjoint.cpp, mofem/tutorials/vec-9_arc_length/arc_length.cpp, mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp, mofem/users_modules/basic_finite_elements/atom_tests/testing_jacobian_of_hook_element.cpp, mofem/users_modules/basic_finite_elements/atom_tests/testing_jacobian_of_hook_scaled_with_density_element.cpp, mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp, mofem/users_modules/basic_finite_elements/nonlinear_elasticity/nonlinear_dynamics.cpp, mofem/users_modules/bone_remodelling/bone_adaptation.cpp, mofem/users_modules/minimal_surface_equation/minimal_surface_area.cpp, and project_roughness.cpp.

Definition at line 68 of file Core.cpp.

69 {
70
71 MPI_Initialized(&mpiInitialised);
72 if (!mpiInitialised)
73 MPI_Init(argc, args);
74
75 PetscInitialized(&isInitialized);
76 if (isInitialized == PETSC_FALSE) {
77 bool has_param_file_arg = false;
78 for (int i = 0; i < *argc - 1; ++i) {
79 if (std::strcmp((*args)[i], "-param_file") == 0) {
80 file = (*args)[i + 1];
81 has_param_file_arg = true;
82 petscOptionsFile = file ? file : "";
83 break;
84 }
85 }
86 if (!has_param_file_arg && file && !std::ifstream(file)) {
87 file = PETSC_NULLPTR;
88 petscOptionsFile.clear();
89 }
90 PetscInitialize(argc, args, file, help);
91 PetscPushErrorHandler(mofem_error_handler, PETSC_NULLPTR);
92 }
93
94 LogManager::createDefaultSinks(MPI_COMM_WORLD);
95 PetscVFPrintf = LogManager::logPetscFPrintf;
98
99 MOFEM_LOG_CHANNEL("WORLD");
100 char petsc_version[255];
101 CHKERR PetscGetVersion(petsc_version, 255);
102 MOFEM_LOG_C("WORLD", Sev::inform, "MoFEM version %d.%d.%d (%s %s)",
103 MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD,
104 MOAB_VERSION_STRING, petsc_version);
105 MOFEM_LOG_C("WORLD", Sev::inform, "git commit id %s", GIT_SHA1_NAME);
106
107 auto log_time = [&](const auto perefix, auto time) {
108 MOFEM_LOG("WORLD", Sev::inform)
109 << perefix << time.date().year() << "-" << time.date().month() << "-"
110 << time.date().day() << " " << time.time_of_day().hours() << ":"
111 << time.time_of_day().minutes() << ":" << time.time_of_day().seconds();
112 };
113
114 // Get current system time
115 log_time("Local time: ", boost::posix_time::second_clock::local_time());
116 log_time("UTC time: ", boost::posix_time::second_clock::universal_time());
117
118 return MOFEM_SUCCESS;
119}
static PetscErrorCode mofem_error_handler(MPI_Comm comm, int line, const char *fun, const char *file, PetscErrorCode n, PetscErrorType p, const char *mess, void *ctx)
@ MOFEM_SUCCESS
Definition definitions.h:30
FTensor::Index< 'i', SPACE_DIM > i
static MoFEMErrorCode getOptions()
Get logger option.
static void createDefaultSinks(MPI_Comm comm)
Create default sinks.
static PetscErrorCode logPetscFPrintf(FILE *fd, const char format[], va_list Argp)
Use to handle PETSc output.

◆ list_dofs_by_field_name()

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

list dofs

Implements MoFEM::CoreInterface.

Definition at line 1381 of file FieldCore.cpp.

1381 {
1383 auto dit = dofsField.get<Unique_mi_tag>().lower_bound(
1385 auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(
1387 MOFEM_LOG("SYNC", Sev::inform) << "List DOFs:";
1388 for (; dit != hi_dit; dit++)
1389 MOFEM_LOG("SYNC", Sev::inform) << *dit;
1390
1393}

◆ list_fields()

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

list entities in the field

Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 1395 of file FieldCore.cpp.

1395 {
1397 MOFEM_LOG("SYNC", Sev::inform) << "List Fields:";
1398 for (auto &miit : fIelds.get<BitFieldId_mi_tag>())
1399 MOFEM_LOG("SYNC", Sev::inform) << *miit;
1400
1403}
MoFEM::LogManager::SeverityLevel Sev

◆ list_finite_elements()

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

list finite elements in database

Implements MoFEM::CoreInterface.

Definition at line 320 of file FECore.cpp.

320 {
322 for (auto &fe : finiteElements.get<FiniteElement_name_mi_tag>())
323 MOFEM_LOG("SYNC", Sev::inform) << fe;
324
327}

◆ list_problem()

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

list problems

Implements MoFEM::CoreInterface.

Definition at line 133 of file ProblemsCore.cpp.

133 {
135 typedef Problem_multiIndex::index<BitProblemId_mi_tag>::type ProblemById;
136 const ProblemById &set_id = pRoblems.get<BitProblemId_mi_tag>();
137 ProblemById::iterator miit = set_id.begin();
138 for (; miit != set_id.end(); miit++) {
139 std::ostringstream ss;
140 ss << *miit << std::endl;
141 PetscPrintf(mofemComm, "%s", ss.str().c_str());
142 }
144}

◆ loop_dofs() [1/4]

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

Make a loop over dofs.

Parameters
problem_ptrPointer to problem structure
field_nameName of the field containing DOFs to loop over
rcRow/column data specification
methodUser-defined method to execute on each DOF
lower_rankLower processor rank range (inclusive)
upper_rankUpper processor rank range (inclusive)
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 535 of file ProblemsCore.cpp.

538 {
540 SET_BASIC_METHOD(method, &*problem_ptr);
541 typedef NumeredDofEntity_multiIndex::index<Unique_mi_tag>::type
542 NumeredDofsByUId;
543 NumeredDofsByUId *dofs;
544 switch (rc) {
545 case ROW:
546 dofs = &problem_ptr->numeredRowDofsPtr->get<Unique_mi_tag>();
547 break;
548 case COL:
549 dofs = &problem_ptr->numeredColDofsPtr->get<Unique_mi_tag>();
550 break;
551 default:
552 SETERRQ(mofemComm, MOFEM_DATA_INCONSISTENCY, "Not implemented");
553 }
554
555 auto field_it = fIelds.get<FieldName_mi_tag>().find(field_name);
556 if (field_it != fIelds.get<FieldName_mi_tag>().end()) {
557 method.fieldPtr = *field_it;
558 } else {
559 SETERRQ(mofemComm, MOFEM_NOT_FOUND, "Field not found %s",
560 field_name.c_str());
561 }
562
563 auto miit = dofs->lower_bound(
564 FieldEntity::getLoBitNumberUId((*field_it)->getBitNumber()));
565 auto hi_miit = dofs->upper_bound(
566 FieldEntity::getHiBitNumberUId((*field_it)->getBitNumber()));
567
568 method.loopSize = std::distance(miit, hi_miit);
569 method.loHiFERank = std::make_pair(lower_rank, upper_rank);
570
571 CHKERR method.preProcess();
572
573 int nn = 0;
574 for (; miit != hi_miit; miit++, nn++) {
575 if ((*miit)->getPart() >= lower_rank && (*miit)->getPart() <= upper_rank) {
576 method.nInTheLoop = nn; // Index of element in the loop
577 method.dofPtr = miit->get()->getDofEntityPtr();
578 method.dofNumeredPtr = *miit;
579 CHKERR method();
580 }
581 }
582
583 CHKERR method.postProcess();
585}
#define SET_BASIC_METHOD(METHOD, PROBLEM_PTR)

◆ loop_dofs() [2/4]

MoFEMErrorCode MoFEM::Core::loop_dofs ( const std::string &  field_name,
DofMethod &  method,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Make a loop over dofs.

Parameters
field_nameName of the field containing DOFs to loop over
methodUser-defined method to execute on each DOF
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 621 of file ProblemsCore.cpp.

622 {
624 if (verb == DEFAULT_VERBOSITY)
625 verb = verbose;
626 SET_BASIC_METHOD(method, nullptr);
627
628 auto field_it = fIelds.get<FieldName_mi_tag>().find(field_name);
629 if (field_it != fIelds.get<FieldName_mi_tag>().end()) {
630 method.fieldPtr = *field_it;
631 } else {
632 SETERRQ(mofemComm, MOFEM_NOT_FOUND, "Field not found %s",
633 field_name.c_str());
634 }
635
636 auto miit = dofsField.get<Unique_mi_tag>().lower_bound(
637 FieldEntity::getLoBitNumberUId((*field_it)->getBitNumber()));
638 auto hi_miit = dofsField.get<Unique_mi_tag>().upper_bound(
639 FieldEntity::getHiBitNumberUId((*field_it)->getBitNumber()));
640
641 method.loopSize = std::distance(miit, hi_miit);
642 method.loHiFERank = std::make_pair(0, get_comm_size());
643
644 CHKERR method.preProcess();
645 for (int nn = 0; miit != hi_miit; miit++, nn++) {
646 method.nInTheLoop = nn;
647 method.dofPtr = *miit;
648 CHKERR method();
649 }
650 CHKERR method.postProcess();
652}
int get_comm_size() const
Definition Core.hpp:1038

◆ loop_dofs() [3/4]

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

Make a loop over dofs.

Parameters
problem_nameName of the problem containing DOFs
field_nameName of the field containing DOFs to loop over
rcRow/column data specification
methodUser-defined method to execute on each DOF
lower_rankLower processor rank range (inclusive)
upper_rankUpper processor rank range (inclusive)
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 587 of file ProblemsCore.cpp.

595 {
597 if (verb == DEFAULT_VERBOSITY)
598 verb = verbose;
599 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
600 // find p_miit
601 ProblemsByName &pRoblems_set = pRoblems.get<Problem_mi_tag>();
602 ProblemsByName::iterator p_miit = pRoblems_set.find(problem_name);
603 if (p_miit == pRoblems_set.end())
604 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem not in database %s",
605 problem_name.c_str());
606 CHKERR loop_dofs(&*p_miit, field_name, rc, method, lower_rank, upper_rank,
607 verb);
609}
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.

◆ loop_dofs() [4/4]

MoFEMErrorCode MoFEM::Core::loop_dofs ( const std::string &  problem_name,
const std::string &  field_name,
RowColData  rc,
DofMethod &  method,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Make a loop over dofs.

Parameters
problem_nameName of the problem containing DOFs
field_nameName of the field containing DOFs to loop over
rcRow/column data specification
methodUser-defined method to execute on each DOF
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 611 of file ProblemsCore.cpp.

613 {
615 if (verb == DEFAULT_VERBOSITY)
616 verb = verbose;
617 CHKERR loop_dofs(problem_name, field_name, rc, method, 0, sIze, verb);
619}

◆ loop_entities() [1/4]

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

Loop over field entities in the problem.

Parameters
problem_ptrPointer to problem structure
field_nameName of the field containing entities to loop over
rcRow/column data specification
methodUser-defined method to execute on each entity
lower_rankLower processor rank range (inclusive)
upper_rankUpper processor rank range (inclusive)
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 654 of file ProblemsCore.cpp.

657 {
659 if (verb == DEFAULT_VERBOSITY)
660 verb = verbose;
661 decltype(problem_ptr->numeredRowDofsPtr) dofs;
662 switch (rc) {
663 case ROW:
664 dofs = problem_ptr->numeredRowDofsPtr;
665 break;
666 case COL:
667 dofs = problem_ptr->numeredColDofsPtr;
668 break;
669 default:
671 "It works only with rows or columns");
672 }
673
674 auto field_it = fIelds.get<FieldName_mi_tag>().find(field_name);
675 if (field_it != fIelds.get<FieldName_mi_tag>().end()) {
676 method.fieldPtr = *field_it;
677 } else {
678 SETERRQ(mofemComm, MOFEM_NOT_FOUND, "Field not found %s",
679 field_name.c_str());
680 }
681
682 auto miit = dofs->lower_bound(
683 FieldEntity::getLoBitNumberUId((*field_it)->getBitNumber()));
684 auto hi_miit = dofs->upper_bound(
685 FieldEntity::getHiBitNumberUId((*field_it)->getBitNumber()));
686
687 using FieldEntity_view_multiIndex = multi_index_container<
688
689 boost::shared_ptr<FieldEntity>,
690 indexed_by<
691
693
694 tag<Ent_mi_tag>,
695 const_mem_fun<FieldEntity::interface_type_RefEntity, EntityHandle,
697
698 >>;
699
700 FieldEntity_view_multiIndex ents_view;
701 auto hint = ents_view.begin();
702 for (; miit != hi_miit; ++miit)
703 if ((*miit)->getPart() >= lower_rank && (*miit)->getPart() <= upper_rank)
704 ents_view.emplace_hint(hint, (*miit)->getFieldEntityPtr());
705
706 SET_BASIC_METHOD(method, problem_ptr);
707
708 method.loopSize = ents_view.size();
709 method.loHiFERank = std::make_pair(lower_rank, upper_rank);
710
711 CHKERR method.preProcess();
712 method.nInTheLoop = 0;
713 for (auto &field_ent : ents_view) {
714 method.entPtr = field_ent;
715 CHKERR method();
716 ++method.nInTheLoop;
717 }
718 CHKERR method.postProcess();
720}
list[str] ordered_unique(Iterable[str] items)
interface_RefEntity< RefEntity > interface_type_RefEntity

◆ loop_entities() [2/4]

MoFEMErrorCode MoFEM::Core::loop_entities ( const std::string  field_name,
EntityMethod &  method,
Range const *const  ents = nullptr,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Loop over field entities.

Parameters
field_nameName of the field containing entities to loop over
methodUser-defined method to execute on each entity
entsIf provided, loop only over subset of entities in the field (default: nullptr for all entities)
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 746 of file ProblemsCore.cpp.

748 {
750 if (verb == DEFAULT_VERBOSITY)
751 verb = verbose;
752 SET_BASIC_METHOD(method, nullptr);
753
754 auto field_it = fIelds.get<FieldName_mi_tag>().find(field_name);
755 if (field_it != fIelds.get<FieldName_mi_tag>().end()) {
756 method.fieldPtr = *field_it;
757 } else {
758 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field not found %s",
759 field_name.c_str());
760 }
761
762 auto lo_eit = entsFields.get<Unique_mi_tag>().lower_bound(
763 FieldEntity::getLoBitNumberUId((*field_it)->getBitNumber()));
764 auto hi_eit = entsFields.get<Unique_mi_tag>().upper_bound(
765 FieldEntity::getHiBitNumberUId((*field_it)->getBitNumber()));
766
767 typedef multi_index_container<
768 boost::shared_ptr<FieldEntity>,
769 indexed_by<ordered_unique<
770 tag<Ent_mi_tag>, const_mem_fun<FieldEntity::interface_RefEntity,
771 EntityHandle, &FieldEntity::getEnt>>>>
772 FieldEntity_view_multiIndex;
773
774 FieldEntity_view_multiIndex ents_view;
775 ents_view.insert(lo_eit, hi_eit);
776
777 method.loopSize = ents_view.size();
778 method.loHiFERank = std::make_pair(0, get_comm_size());
779
780 CHKERR method.preProcess();
781 method.nInTheLoop = 0;
782
783 if (ents)
784 for (auto p = ents->const_pair_begin(); p != ents->const_pair_end(); ++p)
785 for (auto feit = ents_view.lower_bound(p->first);
786 feit != ents_view.upper_bound(p->second); ++feit) {
787 method.entPtr = *feit;
788 CHKERR method();
789 ++method.nInTheLoop;
790 }
791 else
792 for (auto &field_ent : ents_view) {
793 method.entPtr = field_ent;
794 CHKERR method();
795 ++method.nInTheLoop;
796 }
797
798 CHKERR method.postProcess();
800}
interface_RefEntity(const boost::shared_ptr< REFENT > &sptr)

◆ loop_entities() [3/4]

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

Loop over field entities in the problem.

Parameters
problem_name
field_name
rc
method
lower_rank
upper_rank
verb
Returns
MoFEMErrorCode

Implements MoFEM::CoreInterface.

Definition at line 722 of file ProblemsCore.cpp.

725 {
727 if (verb == DEFAULT_VERBOSITY)
728 verb = verbose;
729 // find p_miit
730 auto &prb = pRoblems.get<Problem_mi_tag>();
731 auto p_miit = prb.find(problem_name);
732 if (p_miit == prb.end())
733 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem not in database %s",
734 problem_name.c_str());
735 CHKERR loop_entities(&*p_miit, field_name, rc, method, lower_rank, upper_rank,
736 verb);
738}
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.

◆ loop_entities() [4/4]

MoFEMErrorCode MoFEM::Core::loop_entities ( const std::string  problem_name,
const std::string  field_name,
RowColData  rc,
EntityMethod &  method,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Loop over field entities in the problem.

Parameters
problem_name
field_name
rc
method
verb
Returns
MoFEMErrorCode

Implements MoFEM::CoreInterface.

Definition at line 740 of file ProblemsCore.cpp.

742 {
743 return loop_entities(problem_name, field_name, rc, method, rAnk, rAnk, verb);
744}

◆ loop_finite_elements() [1/3]

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

Make a loop over finite elements on partitions from upper to lower rank.

This function is like a Swiss knife; it can be used for post-processing or matrix and vector assembly. It iterates over the given finite element for a given problem. The particular methods executed on each element are provided by a class derived from Interface::FEMethod. At the beginning of each loop the user- defined function (method) preProcess() is called; for each element operator() is executed; at the end, the loop finalizes with the user-defined function (method) postProcess().

Note
If fe_ptr is given, it is expected that the multi-index is a subset of problem multi-index. If this is not the case behavior of the code is undetermined.

For more details please look to examples.

Interface::FEMethod

Parameters
problem_ptrpointer to problem consisting set of elements
fe_namename of element in problem
methodclass derived from Interface::FEMethod
lower_ranklower rank of process owning the finite element
upper_rankupper rank of process owning the finite element
fe_ptrpointer to finite elements multi-index
bhif bH = MF_EXIST, throws error if fe_name does not exist
cache_datacache data vector
cache_rowcache row vector
cache_colcache row vector
verbverbosity level
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 431 of file ProblemsCore.cpp.

435 {
437 if (verb == DEFAULT_VERBOSITY)
438 verb = verbose;
439
440 CacheTupleSharedPtr tmp_cache_ptr;
441 if (!cache_ptr.use_count()) {
442 tmp_cache_ptr = boost::make_shared<CacheTuple>();
443 CHKERR cache_problem_entities(problem_ptr->getName(), tmp_cache_ptr);
444 method.cacheWeakPtr = tmp_cache_ptr;
445 } else {
446 method.cacheWeakPtr = cache_ptr;
447 }
448
449 if (!fe_ptr)
450 fe_ptr = problem_ptr->numeredFiniteElementsPtr;
451
452 auto miit = fe_ptr->get<Composite_Name_And_Part_mi_tag>().lower_bound(
453 boost::make_tuple(fe_name, lower_rank));
454 auto hi_miit = fe_ptr->get<Composite_Name_And_Part_mi_tag>().upper_bound(
455 boost::make_tuple(fe_name, upper_rank));
456
457 if (miit == hi_miit && (bh & MF_EXIST)) {
458 if (!check_finite_element(fe_name)) {
459 SETERRQ(mofemComm, MOFEM_NOT_FOUND, "finite element < %s > not found",
460 fe_name.c_str());
461 }
462 }
463
464 method.feName = fe_name;
465 method.loopSize =
466 std::distance(miit, hi_miit); // Set numbers of elements in the loop
467 method.loHiFERank = std::make_pair(lower_rank, upper_rank);
468
469 SET_BASIC_METHOD(method, &*problem_ptr)
470
471 PetscLogEventBegin(MOFEM_EVENT_preProcess, 0, 0, 0, 0);
472 CHKERR method.preProcess();
473 PetscLogEventEnd(MOFEM_EVENT_preProcess, 0, 0, 0, 0);
474
475 PetscLogEventBegin(MOFEM_EVENT_operator, 0, 0, 0, 0);
476 for (int nn = 0; miit != hi_miit; miit++, nn++) {
477
478 method.nInTheLoop = nn; // Index of element in the loop
479 method.numeredEntFiniteElementPtr = *miit;
480
481 if (method.exeTestHook) {
482 if (method.exeTestHook(&method)) {
483 CHKERR method();
484 }
485 } else {
486 CHKERR method();
487 }
488
489 }
490 PetscLogEventEnd(MOFEM_EVENT_operator, 0, 0, 0, 0);
491
492 PetscLogEventBegin(MOFEM_EVENT_postProcess, 0, 0, 0, 0);
493 CHKERR method.postProcess();
494 PetscLogEventEnd(MOFEM_EVENT_postProcess, 0, 0, 0, 0);
495
497}
boost::shared_ptr< CacheTuple > CacheTupleSharedPtr
bool check_finite_element(const std::string &name) const
Check if finite element is in database.
Definition FECore.cpp:35
MoFEMErrorCode cache_problem_entities(const std::string prb_name, CacheTupleWeakPtr cache_ptr)
Cache variables.

◆ loop_finite_elements() [2/3]

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

Make a loop over finite elements.

This function is like a Swiss knife; it can be used for post-processing or matrix and vector assembly. It iterates over the given finite element for a given problem. The particular methods executed on each element are provided by a class derived from Interface::FEMethod. At the beginning of each loop the user- defined function (method) preProcess() is called; for each element operator() is executed; at the end, the loop finalizes with the user-defined function (method) postProcess().

Methods are executed only for local elements on a given processor.

For more details please look at examples.

Note
If fe_ptr is given, it is expected that the multi-index is a subset of problem multi-index. If this is not the case behavior of the code is undetermined.
Parameters
problem_nameproblem consisting set of elements
fe_namename of element in problem
methodclass derived form Interface::FEMethod
fe_ptrpointer to finite elements multi-index
bhif bH = MF_EXIST, throws error if fe_name does not exist
cache_tuple_ptrcache
verbverbosity level
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 499 of file ProblemsCore.cpp.

503 {
505 if (verb == DEFAULT_VERBOSITY)
506 verb = verbose;
507
508 CHKERR loop_finite_elements(problem_name, fe_name, method, rAnk, rAnk, fe_ptr,
509 bh, cache_ptr, verb);
510
512}
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.

◆ loop_finite_elements() [3/3]

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

Make a loop over finite elements on partitions from upper to lower rank.

This function is like a Swiss knife; it can be used for post-processing or matrix and vector assembly. It iterates over the given finite element for a given problem. The particular methods executed on each element are provided by a class derived from Interface::FEMethod. At the beginning of each loop the user- defined function (method) preProcess() is called; for each element operator() is executed; at the end, the loop finalizes with the user-defined function (method) postProcess().

Note
If fe_ptr is given, it is expected that the multi-index is a subset of problem multi-index. If this is not the case behavior of the code is undetermined.

For more details please look to examples.

Parameters
problem_namepointer to problem consisting set of elements
fe_namename of element in problem
methodclass derived from Interface::FEMethod
lower_ranklower rank of process owning the finite element
upper_rankupper rank of process owning the finite element
fe_ptrpointer to finite elements multi-index
bhif bH = MF_EXIST, throws error if fe_name does not exist
cache_datacache data vector
cache_rowcache row vector
cache_colcache row vector
verbverbosity level
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 514 of file ProblemsCore.cpp.

518 {
520 if (verb == DEFAULT_VERBOSITY)
521 verb = verbose;
522
523 auto &prb_by_name = pRoblems.get<Problem_mi_tag>();
524 auto p_miit = prb_by_name.find(problem_name);
525 if (p_miit == prb_by_name.end())
526 SETERRQ(mofemComm, MOFEM_INVALID_DATA, "Problem <%s> is not in database",
527 problem_name.c_str());
528
529 CHKERR loop_finite_elements(&*p_miit, fe_name, method, lower_rank, upper_rank,
530 fe_ptr, bh, cache_ptr, verb);
531
533}
@ MOFEM_INVALID_DATA
Definition definitions.h:36

◆ make_shared_ref_entity()

boost::shared_ptr< RefEntityTmp< 0 > > MoFEM::Core::make_shared_ref_entity ( const EntityHandle  ent)
virtual

Get RefEntity.

Parameters
entEntity handle to create reference entity from
Returns
boost::shared_ptr<RefEntityTmp<0>> Shared pointer to reference entity

Implements MoFEM::CoreInterface.

Reimplemented in MoFEM::CoreTmp<-1 >.

Definition at line 1004 of file Core.cpp.

1004 {
1005 return this->makeSharedRefEntity(*this, ent);
1006}
static boost::shared_ptr< RefEntityTmp< 0 > > makeSharedRefEntity(MoFEM::Interface &m_field, const EntityHandle ent)
Definition Core.cpp:970

◆ makeSharedRefEntity()

boost::shared_ptr< RefEntityTmp< 0 > > MoFEM::Core::makeSharedRefEntity ( MoFEM::Interface &  m_field,
const EntityHandle  ent 
)
static

Definition at line 970 of file Core.cpp.

970 {
971
972 boost::shared_ptr<RefEntityTmp<0>> ref_ent_ptr;
973
974 switch (m_field.getValue()) {
975 case -1:
976 ref_ent_ptr = boost::shared_ptr<RefEntityTmp<0>>(
977
978 new RefEntityTmp<-1>(m_field.get_basic_entity_data_ptr(), ent)
979
980 );
981 break;
982 case 0:
983 ref_ent_ptr = boost::shared_ptr<RefEntityTmp<0>>(
984
985 new RefEntityTmp<0>(m_field.get_basic_entity_data_ptr(), ent)
986
987 );
988 break;
989 case 1:
990 ref_ent_ptr = boost::shared_ptr<RefEntityTmp<0>>(
991
992 new RefEntityTmp<1>(m_field.get_basic_entity_data_ptr(), ent)
993
994 );
995 break;
996 default:
997 THROW_MESSAGE("Core index can vary from -1 to MAX_CORE_TMP");
998 }
999
1000 return ref_ent_ptr;
1001}
virtual int getValue() const =0
Get the core.
virtual boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()=0
Get pointer to basic entity data.

◆ modify_finite_element_add_field_col()

MoFEMErrorCode MoFEM::Core::modify_finite_element_add_field_col ( const std::string &  fe_name,
const std::string  name_row 
)
protectedvirtual

set field col which finite element use

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

Implements MoFEM::CoreInterface.

Definition at line 182 of file FECore.cpp.

183 {
185 *buildMoFEM &= 1 << 0;
186 auto &finite_element_name_set =
187 finiteElements.get<FiniteElement_name_mi_tag>();
188 auto it_fe = finite_element_name_set.find(fe_name);
189 if (it_fe == finite_element_name_set.end())
191 "this FiniteElement is there");
192 bool success = finite_element_name_set.modify(
193 it_fe, FiniteElement_col_change_bit_add(get_field_id(name_col)));
194 if (!success)
196 "modification unsuccessful");
198}

◆ modify_finite_element_add_field_data()

MoFEMErrorCode MoFEM::Core::modify_finite_element_add_field_data ( const std::string &  fe_name,
const std::string  name_field 
)
protectedvirtual

set finite element field data

Note
modify_finite_element_add_field_data is a collective operation, should be executed on all processors. Otherwise could lead to deadlock.
Parameters
fe_nameFinite element name
name_fieldField name to add data for
Returns
MoFEMErrorCode Error code indicating success or failure

This function will set memory in the form of a vector

Implements MoFEM::CoreInterface.

Definition at line 138 of file FECore.cpp.

139 {
141 *buildMoFEM &= 1 << 0;
142 typedef FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type
143 FiniteElements_by_name;
144 FiniteElements_by_name &finite_element_name_set =
145 finiteElements.get<FiniteElement_name_mi_tag>();
146 FiniteElements_by_name::iterator it_fe =
147 finite_element_name_set.find(fe_name);
148 if (it_fe == finite_element_name_set.end())
149 SETERRQ(mofemComm, MOFEM_NOT_FOUND,
150 "This finite element is not defined (advise: check spelling)");
151 bool success = finite_element_name_set.modify(
152 it_fe, FiniteElement_change_bit_add(get_field_id(name_data)));
153 if (!success)
155 "modification unsuccessful");
157}

◆ modify_finite_element_add_field_row()

MoFEMErrorCode MoFEM::Core::modify_finite_element_add_field_row ( const std::string &  fe_name,
const std::string  name_row 
)
protectedvirtual

set field row which finite element use

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

Implements MoFEM::CoreInterface.

Definition at line 160 of file FECore.cpp.

161 {
163 *buildMoFEM &= 1 << 0;
164 typedef FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type
165 FiniteElements_by_name;
166 FiniteElements_by_name &finite_element_name_set =
167 finiteElements.get<FiniteElement_name_mi_tag>();
168 FiniteElements_by_name::iterator it_fe =
169 finite_element_name_set.find(fe_name);
170 if (it_fe == finite_element_name_set.end())
171 SETERRQ(mofemComm, MOFEM_NOT_FOUND, "this < %s > is not there",
172 fe_name.c_str());
173 bool success = finite_element_name_set.modify(
174 it_fe, FiniteElement_row_change_bit_add(get_field_id(name_row)));
175 if (!success)
177 "modification unsuccessful");
179}

◆ modify_finite_element_adjacency_table()

MoFEMErrorCode MoFEM::Core::modify_finite_element_adjacency_table ( const std::string &  fe_name,
const EntityType  type,
ElementAdjacencyFunct  function 
)
protectedvirtual

modify finite element table, only for advanced user

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

Using that functions means that you like to do something not usual.

Parameters
fe_nameName of the finite element to modify
typeEntity type to modify adjacency for
functionAdjacency function to apply
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 117 of file FECore.cpp.

119 {
121 *buildMoFEM &= 1 << 0;
122 typedef FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type
123 FiniteElements_by_name;
124 FiniteElements_by_name &finite_element_name_set =
125 finiteElements.get<FiniteElement_name_mi_tag>();
126 FiniteElements_by_name::iterator it_fe =
127 finite_element_name_set.find(fe_name);
128 if (it_fe == finite_element_name_set.end())
129 SETERRQ(mofemComm, MOFEM_NOT_FOUND,
130 "This finite element is not defined (advise: check spelling)");
131 boost::shared_ptr<FiniteElement> fe;
132 fe = *it_fe;
133 fe->elementAdjacencyTable[type] = function;
135}

◆ modify_finite_element_off_field_col()

MoFEMErrorCode MoFEM::Core::modify_finite_element_off_field_col ( const std::string &  fe_name,
const std::string  name_row 
)
protectedvirtual

unset field col which finite element use

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

Implements MoFEM::CoreInterface.

Definition at line 238 of file FECore.cpp.

239 {
241 *buildMoFEM &= 1 << 0;
242 auto &finite_element_name_set =
243 finiteElements.get<FiniteElement_name_mi_tag>();
244 auto it_fe = finite_element_name_set.find(fe_name);
245 if (it_fe == finite_element_name_set.end())
246 SETERRQ(mofemComm, MOFEM_NOT_FOUND, "this FiniteElement is there");
247 bool success = finite_element_name_set.modify(
248 it_fe, FiniteElement_col_change_bit_off(get_field_id(name_col)));
249 if (!success)
251 "modification unsuccessful");
253}

◆ modify_finite_element_off_field_data()

MoFEMErrorCode MoFEM::Core::modify_finite_element_off_field_data ( const std::string &  fe_name,
const std::string  name_field 
)
protectedvirtual

unset finite element field data

Note
modify_finite_element_off_field_data is a collective operation, should be executed on all processors. Otherwise could lead to deadlock.
Parameters
fe_nameFinite element name
name_fieldField name to remove data for
Returns
MoFEMErrorCode Error code indicating success or failure

This function will unset memory in the form of a vector

Implements MoFEM::CoreInterface.

Definition at line 201 of file FECore.cpp.

202 {
204 *buildMoFEM &= 1 << 0;
205 auto &finite_element_name_set =
206 finiteElements.get<FiniteElement_name_mi_tag>();
207 auto it_fe = finite_element_name_set.find(fe_name);
208 if (it_fe == finite_element_name_set.end())
209 SETERRQ(mofemComm, MOFEM_NOT_FOUND, "this FiniteElement is there");
210 bool success = finite_element_name_set.modify(
211 it_fe, FiniteElement_change_bit_off(get_field_id(name_data)));
212 if (!success)
214 "modification unsuccessful");
216}

◆ modify_finite_element_off_field_row()

MoFEMErrorCode MoFEM::Core::modify_finite_element_off_field_row ( const std::string &  fe_name,
const std::string  name_row 
)
protectedvirtual

unset field row which finite element use

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

Implements MoFEM::CoreInterface.

Definition at line 219 of file FECore.cpp.

220 {
222 *buildMoFEM &= 1 << 0;
223 auto &finite_element_name_set =
224 finiteElements.get<FiniteElement_name_mi_tag>();
225 auto it_fe = finite_element_name_set.find(fe_name);
226 if (it_fe == finite_element_name_set.end())
227 SETERRQ(mofemComm, MOFEM_NOT_FOUND, "this < %s > is not there",
228 fe_name.c_str());
229 bool success = finite_element_name_set.modify(
230 it_fe, FiniteElement_row_change_bit_off(get_field_id(name_row)));
231 if (!success)
233 "modification unsuccessful");
235}

◆ modify_problem_add_finite_element()

MoFEMErrorCode MoFEM::Core::modify_problem_add_finite_element ( const std::string  name_problem,
const std::string &  fe_name 
)
protectedvirtual

add finite element to problem, this add entities assigned to finite element to a particular problem

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

Implements MoFEM::CoreInterface.

Definition at line 147 of file ProblemsCore.cpp.

148 {
150 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
151 ProblemsByName &set = pRoblems.get<Problem_mi_tag>();
152 ProblemsByName::iterator miit = set.find(name_problem);
153 if (miit == set.end()) {
154 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "this problem <%s> is not there",
155 name_problem.c_str());
156 }
157 BitFEId f_id = getBitFEId(fe_name);
158 bool success = set.modify(miit, ProblemFiniteElementChangeBitAdd(f_id));
159 if (!success)
160 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
161 "modification unsuccessful");
163}

◆ modify_problem_mask_ref_level_add_bit()

MoFEMErrorCode MoFEM::Core::modify_problem_mask_ref_level_add_bit ( const std::string &  name_problem,
const BitRefLevel &  bit 
)
protectedvirtual

set dof mask ref level for problem

Implements MoFEM::CoreInterface.

Definition at line 222 of file ProblemsCore.cpp.

223 {
225 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
226 ProblemsByName &set = pRoblems.get<Problem_mi_tag>();
227 ProblemsByName::iterator miit = set.find(name_problem);
228 if (miit == set.end()) {
229 std::ostringstream ss;
230 ss << name_problem;
231 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "this problem <%s> is there",
232 ss.str().c_str());
233 }
234 bool success = set.modify(miit, ProblemChangeRefLevelBitDofMaskAdd(bit));
235 if (!success)
236 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
237 "modification unsuccessful");
239}

◆ modify_problem_mask_ref_level_set_bit()

MoFEMErrorCode MoFEM::Core::modify_problem_mask_ref_level_set_bit ( const std::string &  name_problem,
const BitRefLevel &  bit 
)
protectedvirtual

set dof mask ref level for problem

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

Implements MoFEM::CoreInterface.

Definition at line 242 of file ProblemsCore.cpp.

243 {
244 MoFEMFunctionBegin typedef Problem_multiIndex::index<Problem_mi_tag>::type
245 ProblemsByName;
246 ProblemsByName &set = pRoblems.get<Problem_mi_tag>();
247 ProblemsByName::iterator miit = set.find(name_problem);
248 if (miit == set.end()) {
249 std::ostringstream ss;
250 ss << name_problem;
251 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "this problem <%s> is there",
252 ss.str().c_str());
253 }
254 bool success = set.modify(miit, ProblemChangeRefLevelBitDofMaskSet(bit));
255 if (!success)
256 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
257 "modification unsuccessful");
259}

◆ modify_problem_ref_level_add_bit()

MoFEMErrorCode MoFEM::Core::modify_problem_ref_level_add_bit ( const std::string &  name_problem,
const BitRefLevel &  bit 
)
protectedvirtual

add ref level to problem

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

if same finite element is solved using different level of refinements, than the level of refinement has to be specificied to problem in query

Parameters
nameProblem name
BitRefLevelbitLevel Example:
mField.modify_problem_add_finite_element("BEAM_BENDING_ON_MESH_REF1","ELASTIC");
mField.modify_problem_add_finite_element("BEAM_BENDING_ON_MESH_REF2","ELASTIC");
mField.modify_problem_ref_level_add_bit("BEAM_BENDING_ON_MESH_REF1",bit_level1);
mField.modify_problem_ref_level_add_bit("BEAM_BENDING_ON_MESH_REF2",bit_level2);
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
virtual MoFEMErrorCode modify_problem_add_finite_element(const std::string name_problem, const std::string &fe_name)=0
add finite element to problem, this add entities assigned to finite element to a particular problem
Two Problems exist and solved independently, both are elastic, but solved using different mesh refinement

Implements MoFEM::CoreInterface.

Definition at line 185 of file ProblemsCore.cpp.

186 {
188 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
189 ProblemsByName &set = pRoblems.get<Problem_mi_tag>();
190 ProblemsByName::iterator miit = set.find(name_problem);
191 std::ostringstream ss;
192 ss << name_problem;
193 if (miit == set.end())
194 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "this problem <%s> is there",
195 ss.str().c_str());
196 bool success = set.modify(miit, ProblemChangeRefLevelBitAdd(bit));
197 if (!success)
198 SETERRQ(PETSC_COMM_SELF, 1, "modification unsuccessful");
200}

◆ modify_problem_ref_level_set_bit()

MoFEMErrorCode MoFEM::Core::modify_problem_ref_level_set_bit ( const std::string &  name_problem,
const BitRefLevel &  bit 
)
protectedvirtual

set ref level for problem

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

if same finite element is solved using different level of refinements, than the level of refinement has to be specificied to problem in query

Parameters
nameProblem name
BitRefLevelbitLevel Example:
mField.modify_problem_add_finite_element("BEAM_BENDING_ON_MESH_REF1","ELASTIC");
mField.modify_problem_add_finite_element("BEAM_BENDING_ON_MESH_REF2","ELASTIC");
mField.modify_problem_ref_level_set_bit("BEAM_BENDING_ON_MESH_REF1",bit_level1);
mField.modify_problem_ref_level_set_bit("BEAM_BENDING_ON_MESH_REF2",bit_level2);
virtual MoFEMErrorCode modify_problem_ref_level_set_bit(const std::string &name_problem, const BitRefLevel &bit)=0
set ref level for problem
Two Problems exist and solved independently, both are elastic, but solved using different mesh refinement

Implements MoFEM::CoreInterface.

Definition at line 203 of file ProblemsCore.cpp.

204 {
206 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
207 ProblemsByName &set = pRoblems.get<Problem_mi_tag>();
208 ProblemsByName::iterator miit = set.find(name_problem);
209 std::ostringstream ss;
210 ss << name_problem;
211 if (miit == set.end())
212 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "this problem <%s> is there",
213 ss.str().c_str());
214 bool success = set.modify(miit, ProblemChangeRefLevelBitSet(bit));
215 if (!success)
216 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
217 "modification unsuccessful");
219}

◆ modify_problem_unset_finite_element()

MoFEMErrorCode MoFEM::Core::modify_problem_unset_finite_element ( const std::string  name_problem,
const std::string &  fe_name 
)
protectedvirtual

unset finite element from problem, this remove entities assigned to finite element to a particular problem

Note: If problem is build, it need to be cleaned to make this effective

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

Implements MoFEM::CoreInterface.

Definition at line 166 of file ProblemsCore.cpp.

167 {
169 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
170 ProblemsByName &set = pRoblems.get<Problem_mi_tag>();
171 ProblemsByName::iterator miit = set.find(name_problem);
172 if (miit == set.end()) {
173 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "this problem <%s> is not there",
174 name_problem.c_str());
175 }
176 BitFEId f_id = getBitFEId(fe_name);
177 bool success = set.modify(miit, ProblemFiniteElementChangeBitUnSet(f_id));
178 if (!success)
179 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
180 "modification unsuccessful");
182}

◆ problem_basic_method_postProcess() [1/2]

MoFEMErrorCode MoFEM::Core::problem_basic_method_postProcess ( const Problem *  problem_ptr,
BasicMethod &  method,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Set data for BasicMethod.

This function set data about problem, adjacencies and other multi-indices in database. This function can be used a special case when user need to do some pre- and post-processing before matrix or vector is initiated, or to assemble matrix for group of FEMethods. Is used by classes SnesCtx and TsCtx. Look for more details there.

FIXME: Here we need example

Parameters
pointerto problem data structure
methoduser method derived from BasicMethod

Implements MoFEM::CoreInterface.

Definition at line 399 of file ProblemsCore.cpp.

400 {
402 SET_BASIC_METHOD(method, problem_ptr)
403
404 PetscLogEventBegin(MOFEM_EVENT_postProcess, 0, 0, 0, 0);
405 CHKERR method.postProcess();
406 PetscLogEventEnd(MOFEM_EVENT_postProcess, 0, 0, 0, 0);
407
409}

◆ problem_basic_method_postProcess() [2/2]

MoFEMErrorCode MoFEM::Core::problem_basic_method_postProcess ( const std::string &  problem_name,
BasicMethod &  method,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Set data for BasicMethod.

This function set data about problem, adjacencies and other multi-indices in database. This function can be used a special case when user need to do some pre- and post-processing before matrix or vector is initiated, or to assemble matrix for group of FEMethods. Is used by classes SnesCtx and TsCtx. Look for more details there.

FIXME: Here we need example

Parameters
problem_namename of the problem
methoduser method derived from BasicMethod

Implements MoFEM::CoreInterface.

Definition at line 412 of file ProblemsCore.cpp.

413 {
415 if (verb == -1)
416 verb = verbose;
417 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
418
419 // find p_miit
420 ProblemsByName &pRoblems_set = pRoblems.get<Problem_mi_tag>();
421 ProblemsByName::iterator p_miit = pRoblems_set.find(problem_name);
422 if (p_miit == pRoblems_set.end())
423 SETERRQ(mofemComm, 1, "problem is not in database %s",
424 problem_name.c_str());
425
426 CHKERR problem_basic_method_postProcess(&*p_miit, method, verb);
427
429}
MoFEMErrorCode problem_basic_method_postProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
Set data for BasicMethod.

◆ problem_basic_method_preProcess() [1/2]

MoFEMErrorCode MoFEM::Core::problem_basic_method_preProcess ( const Problem *  problem_ptr,
BasicMethod &  method,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Set data for BasicMethod.

This function set data about problem, adjacencies and other multi-indices in database. This function can be used a special case when user need to do some pre- and post-processing before matrix or vector is initiated, or to assemble matrix for group of FEMethods. Is used by classes SnesCtx and TsCtx. Look for more details there.

FIXME: Here we need example

Parameters
pointerto problem data structure
methoduser method derived from BasicMethod

Implements MoFEM::CoreInterface.

Definition at line 367 of file ProblemsCore.cpp.

369 {
371 if (verb == -1)
372 verb = verbose;
373 // finite element
374 SET_BASIC_METHOD(method, problem_ptr)
375 PetscLogEventBegin(MOFEM_EVENT_preProcess, 0, 0, 0, 0);
376 CHKERR method.preProcess();
377 PetscLogEventEnd(MOFEM_EVENT_preProcess, 0, 0, 0, 0);
379}

◆ problem_basic_method_preProcess() [2/2]

MoFEMErrorCode MoFEM::Core::problem_basic_method_preProcess ( const std::string &  problem_name,
BasicMethod &  method,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Set data for BasicMethod.

This function set data about problem, adjacencies and other multi-indices in database. This function can be used a special case when user need to do some pre- and post-processing before matrix or vector is initiated, or to assemble matrix for group of FEMethods. Is used by classes SnesCtx and TsCtx. Look for more details there.

FIXME: Here we need example

Parameters
problem_namename of the problem
methoduser method derived from BasicMethod

Implements MoFEM::CoreInterface.

Definition at line 382 of file ProblemsCore.cpp.

383 {
385 if (verb == -1)
386 verb = verbose;
387 typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
388 // find p_miit
389 ProblemsByName &pRoblems_set = pRoblems.get<Problem_mi_tag>();
390 ProblemsByName::iterator p_miit = pRoblems_set.find(problem_name);
391 if (p_miit == pRoblems_set.end())
392 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem is not in database %s",
393 problem_name.c_str());
394 CHKERR problem_basic_method_preProcess(&*p_miit, method, verb);
396}
MoFEMErrorCode problem_basic_method_preProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
Set data for BasicMethod.

◆ query_interface()

MoFEMErrorCode MoFEM::Core::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const
virtual

Getting interface of core database.

Parameters
uuidunique ID of interface
ifacereturned pointer to interface
Returns
error code

Implements MoFEM::UnknownInterface.

Definition at line 43 of file Core.cpp.

44 {
46 *iface = NULL;
47 if (type_index == boost::typeindex::type_id<CoreInterface>()) {
48 *iface = static_cast<CoreInterface *>(const_cast<Core *>(this));
50 } else if (type_index ==
51 boost::typeindex::type_id<DeprecatedCoreInterface>()) {
52 *iface = static_cast<DeprecatedCoreInterface *>(const_cast<Core *>(this));
54 }
55
56 // Get sub-interface
57 auto it = iFaces.find(type_index);
58 if (it != iFaces.end()) {
59 *iface = it->second;
61 }
62
63 *iface = NULL;
64 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
66}
CoreTmp< 0 > Core
Definition Core.hpp:1161

◆ rebuild_database()

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

Clear database and initialize it once again.

Parameters
verbVerbosity level
Returns
Error code

Implements MoFEM::CoreInterface.

Definition at line 779 of file Core.cpp.

779 {
781 if (verb == -1)
782 verb = verbose;
783 CHKERR this->clearMap();
784 CHKERR this->getTags(verb);
787}

◆ regEvents()

template<class IFACE >
MoFEMErrorCode MoFEM::Core::regEvents ( )
protected

Register petsc events.

Template Parameters
IFACE
Returns
MoFEMErrorCode

Definition at line 195 of file Core.cpp.

195 {
197 auto ptr = boost::make_shared<IFACE>();
198 // See SFINAE:
199 // https://stackoverflow.com/questions/257288/is-it-possible-to-write-a-template-to-check-for-a-functions-existence
200 // https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error
201 auto get_event_options = [](auto *const ptr) {
202 return get_event_options_imp(ptr, 0);
203 };
204 CHKERR get_event_options(ptr.get());
206}
static auto get_event_options_imp(T *const ptr, int) -> decltype(ptr->getEventOptions())
Definition Core.cpp:162

◆ registerSubInterfaces()

MoFEMErrorCode MoFEM::Core::registerSubInterfaces ( )
protected

Register insterfaces.

Returns
MoFEMErrorCode

Definition at line 498 of file Core.cpp.

498 {
500
501 iFaces.clear();
502
503 // Register sub interfaces
504 CHKERR regSubInterface<LogManager>();
505 CHKERR regSubInterface<JsonConfigManager>();
506 CHKERR regSubInterface<Simple>();
507 CHKERR regSubInterface<OperatorsTester>();
508 CHKERR regSubInterface<TestingInterface>();
509 CHKERR regSubInterface<CouplerInterface>();
510 CHKERR regSubInterface<DGProjectionInterface>();
511#ifdef WITH_CGAL
512 CHKERR regSubInterface<CGALInterface>();
513#endif
514 CHKERR regSubInterface<PipelineManager>();
515 CHKERR regSubInterface<PipelineGraph>();
516 CHKERR regSubInterface<ProblemsManager>();
517 CHKERR regSubInterface<MatrixManager>();
518 CHKERR regSubInterface<ISManager>();
519 CHKERR regSubInterface<VecManager>();
520 CHKERR regSubInterface<FieldBlas>();
521 CHKERR regSubInterface<BitRefManager>();
522 CHKERR regSubInterface<Tools>();
523 CHKERR regSubInterface<CommInterface>();
524 CHKERR regSubInterface<MeshsetsManager>();
525 CHKERR regSubInterface<NodeMergerInterface>();
526 CHKERR regSubInterface<PrismsFromSurfaceInterface>();
527 CHKERR regSubInterface<MeshRefinement>();
528 CHKERR regSubInterface<PrismInterface>();
529 CHKERR regSubInterface<CutMeshInterface>();
530 CHKERR regSubInterface<SeriesRecorder>();
531#ifdef WITH_TETGEN
532 CHKERR regSubInterface<TetGenInterface>();
533#endif
534#ifdef WITH_MED
535 CHKERR regSubInterface<MedInterface>();
536#endif
537 CHKERR regSubInterface<FieldEvaluatorInterface>();
538 CHKERR regSubInterface<BcManager>();
539
540 // Register events
541 CHKERR regEvents<SchurEvents>();
542
544};

◆ regSubInterface()

template<class IFACE >
MoFEMErrorCode MoFEM::Core::regSubInterface ( )
protected

Register sub-interfaces in core interface.

Template Parameters
IFACE
Returns
MoFEMErrorCode

Definition at line 177 of file Core.cpp.

177 {
179 CHKERR registerInterface<IFACE>(true);
180 IFACE *ptr = createInterface<IFACE>(*this);
181
182 // If sub interface has function getSubInterfaceOptions run
183 // it after construction. getSubInterfaceOptions is used to
184 // get parameters from command line.
185 auto get_sub_iface_options = [](auto *const ptr) {
186 return get_sub_iface_options_imp(ptr, 0);
187 };
188 CHKERR get_sub_iface_options(ptr);
189
190 auto type_idx = boost::typeindex::type_id<IFACE>();
191 iFaces.insert(type_idx, ptr);
193}
static auto get_sub_iface_options_imp(T *const ptr, int) -> decltype(ptr->getSubInterfaceOptions())
Definition Core.cpp:149

◆ remove_ents()

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

Remove entities from MoFEM database.

Parameters
entsRange of entities to remove
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 429 of file DeleteCore.cpp.

429 {
431 if (verb == -1)
432 verb = verbose;
434 CHKERR remove_ents_from_field(ents, verb);
435
436 for (Range::const_pair_iterator p_eit = ents.pair_begin();
437 p_eit != ents.pair_end(); ++p_eit) {
438
439 RefElement_multiIndex::index<Ent_mi_tag>::type::iterator frit, hi_frit;
440 frit = refinedFiniteElements.get<Ent_mi_tag>().lower_bound(p_eit->first);
441 hi_frit =
442 refinedFiniteElements.get<Ent_mi_tag>().upper_bound(p_eit->second);
443 refinedFiniteElements.get<Ent_mi_tag>().erase(frit, hi_frit);
444
445 RefEntity_multiIndex::index<Ent_mi_tag>::type::iterator rit, hi_rit;
446 rit = refinedEntities.get<Ent_mi_tag>().lower_bound(p_eit->first);
447 hi_rit = refinedEntities.get<Ent_mi_tag>().upper_bound(p_eit->second);
448 refinedEntities.get<Ent_mi_tag>().erase(rit, hi_rit);
449 }
450
452}

◆ remove_ents_by_bit_ref()

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

Remove entities from MoFEM database.

Parameters
bitBit level to select entities
maskMask for bit level selection
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 454 of file DeleteCore.cpp.

455 {
457 if (verb == -1)
458 verb = verbose;
459 Range ents;
460 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
461 CHKERR remove_ents(ents, verb);
463}

◆ remove_ents_from_field() [1/3]

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

remove entities from all fields

Note
not collective
Parameters
entsRange of entities to remove from all fields
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 176 of file DeleteCore.cpp.

176 {
178 if (verb == -1)
179 verb = verbose;
180 CHKERR clear_ents_fields(ents, verb);
181 for (Field_multiIndex::iterator fit = fIelds.begin(); fit != fIelds.end();
182 fit++) {
183 EntityHandle meshset = fit->get()->getMeshset();
184 CHKERR get_moab().remove_entities(meshset, ents);
185 }
187}

◆ remove_ents_from_field() [2/3]

MoFEMErrorCode MoFEM::Core::remove_ents_from_field ( const std::string  name,
const EntityHandle  meshset,
const EntityType  type,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

remove entities from field

Note
not collective
Parameters
nameName of the field
meshsetMeshset containing entities to remove
typeType of entities to remove
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 152 of file DeleteCore.cpp.

154 {
156 if (verb == -1)
157 verb = verbose;
158 Range ents;
159 CHKERR get_moab().get_entities_by_type(meshset, type, ents);
162}

◆ remove_ents_from_field() [3/3]

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

remove entities from field

Note
not collective
Parameters
nameName of the field
entsRange of entities to remove
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 164 of file DeleteCore.cpp.

165 {
167 if (verb == -1)
168 verb = verbose;
169 EntityHandle meshset;
170 meshset = get_field_meshset(name);
171 CHKERR clear_ents_fields(name, ents, verb);
172 CHKERR get_moab().remove_entities(meshset, ents);
174}

◆ remove_ents_from_field_by_bit_ref()

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

remove entities from field

Note
not collective
Parameters
bitBit level to select entities
maskMask for bit level selection
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 189 of file DeleteCore.cpp.

191 {
193 if (verb == -1)
194 verb = verbose;
195 Range ents;
196 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
197 CHKERR remove_ents_from_field(ents, verb);
199}

◆ remove_ents_from_finite_element() [1/3]

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

remove entities from finite elements in database

Implements MoFEM::CoreInterface.

Definition at line 404 of file DeleteCore.cpp.

405 {
407 if (verb == -1)
408 verb = verbose;
409 CHKERR clear_finite_elements(ents, verb);
410 for (FiniteElement_multiIndex::iterator fe_it = finiteElements.begin();
411 fe_it != finiteElements.end(); fe_it++) {
412 EntityHandle meshset = fe_it->get()->getMeshset();
413 CHKERR get_moab().remove_entities(meshset, ents);
414 }
416}

◆ remove_ents_from_finite_element() [2/3]

MoFEMErrorCode MoFEM::Core::remove_ents_from_finite_element ( const std::string  name,
const EntityHandle  meshset,
const EntityType  type,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

remove entities from given refinement level to finite element database

Implements MoFEM::CoreInterface.

Definition at line 379 of file DeleteCore.cpp.

382 {
384 if (verb == -1)
385 verb = verbose;
386 Range ents;
387 CHKERR get_moab().get_entities_by_type(meshset, type, ents, false);
390}

◆ remove_ents_from_finite_element() [3/3]

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

remove entities from finite element database

Implements MoFEM::CoreInterface.

Definition at line 392 of file DeleteCore.cpp.

394 {
396 if (verb == -1)
397 verb = verbose;
398 CHKERR clear_finite_elements(name, ents, verb);
399 const EntityHandle idm = get_finite_element_meshset(name);
400 CHKERR get_moab().remove_entities(idm, ents);
402}

◆ remove_ents_from_finite_element_by_bit_ref()

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

remove elements from given refinement level to finite element database

Parameters
BitRefLevelbit
BitRefLevelmask
verboselevel

Implements MoFEM::CoreInterface.

Definition at line 418 of file DeleteCore.cpp.

419 {
421 if (verb == -1)
422 verb = verbose;
423 Range ents;
424 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
427}

◆ remove_parents_by_bit_ref()

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

Remove parent from entities on bit level.

Every entity created by refinement, split, or any other change on the mesh can have a parent. This function removes the parent from an entity.

Note
Functions making topological changes on entities should respect parent–child relations. This erases that relation. If you are going to split faces and create an interface, it is recommended to call this function before the split operation.
Parameters
bitBit level to select entities
maskMask for bit level selection
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 465 of file DeleteCore.cpp.

467 {
469 if (verb == -1)
470 verb = verbose;
471 Range ents;
472 CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
473 CHKERR remove_parents_by_ents(ents, verb);
475}
MoFEMErrorCode remove_parents_by_ents(const Range &ents, int verb=DEFAULT_VERBOSITY)
Remove parents from entities.

◆ remove_parents_by_ents()

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

Remove parents from entities.

Parameters
entsRange of entities to remove parents from
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 477 of file DeleteCore.cpp.

477 {
479
480 std::vector<EntityHandle> leftovers_ents;
481 leftovers_ents.reserve(ents.size());
482
483 for (auto pit = ents.pair_begin(); pit != ents.pair_end(); ++pit) {
484
485 EntityHandle f = pit->first;
486 const EntityHandle s = pit->second;
487 auto lo = refinedEntities.lower_bound(f);
488 for (; f <= s; ++f) {
489
490 auto check = [this](auto lo, auto f) {
491 if (lo == refinedEntities.end())
492 return false;
493 if ((*lo)->getEnt() == f)
494 return true;
495 return false;
496 };
497
498 if (check(lo, f)) {
499 bool success = refinedEntities.modify(lo, RefEntity_change_parent(0));
500 if (!success)
501 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
502 "Operation of removing parent unsuccessful");
503 ++lo;
504 } else
505 leftovers_ents.emplace_back(f);
506 }
507 }
508
509 if (!leftovers_ents.empty()) {
510 std::vector<EntityHandle> zero_parents(leftovers_ents.size());
511 CHKERR get_moab().tag_set_data(th_RefParentHandle, &leftovers_ents[0],
512 leftovers_ents.size(),
513 &*zero_parents.begin());
514 }
516}

◆ remove_parents_by_parents()

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

Remove parents from entities having parents in passed range.

Parameters
entsRange of parent entities to check against
verbVerbosity level (default: DEFAULT_VERBOSITY)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Definition at line 518 of file DeleteCore.cpp.

518 {
520 for (Range::iterator eit = ents.begin(); eit != ents.end(); ++eit) {
521 RefEntity_multiIndex::index<Ent_Ent_mi_tag>::type::iterator it;
522 while ((it = refinedEntities.get<Ent_Ent_mi_tag>().find(*eit)) !=
523 refinedEntities.get<Ent_Ent_mi_tag>().end()) {
524 bool success = refinedEntities.get<Ent_Ent_mi_tag>().modify(
525 it, RefEntity_change_parent(0));
526 if (!success) {
527 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
528 "Operation of removing parent unsuccessful");
529 }
530 }
531 }
533}

◆ set_field_order() [1/4]

MoFEMErrorCode MoFEM::Core::set_field_order ( const EntityHandle  meshset,
const EntityType  type,
const BitFieldId  id,
const ApproximationOrder  order,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 963 of file FieldCore.cpp.

965 {
967 if (verb == -1)
968 verb = verbose;
969 *buildMoFEM = 0;
970 Range ents;
971 CHKERR get_moab().get_entities_by_type(meshset, type, ents);
972 CHKERR this->set_field_order(ents, id, order, verb);
974}
constexpr int order

◆ set_field_order() [2/4]

MoFEMErrorCode MoFEM::Core::set_field_order ( const EntityHandle  meshset,
const EntityType  type,
const std::string &  name,
const ApproximationOrder  order,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Set order approximation of the entities in the field.

Note
not collective
Parameters
meshsetcontaining set of the entities (use 0 for all the entities in the meshset)
typeselected type of the entities f.e. MBTET, MBTRI, MBEDGE, MBVERTEX, see moab documentation
orderapproximation order

Implements MoFEM::CoreInterface.

Definition at line 975 of file FieldCore.cpp.

978 {
980 if (verb == -1)
981 verb = verbose;
982 *buildMoFEM = 0;
983 CHKERR this->set_field_order(meshset, type, get_field_id(name), order, verb);
985}

◆ set_field_order() [3/4]

MoFEMErrorCode MoFEM::Core::set_field_order ( const Range &  ents,
const BitFieldId  id,
const ApproximationOrder  order,
int  verb = DEFAULT_VERBOSITY 
)
protected

Definition at line 938 of file FieldCore.cpp.

939 {
940 MOFEM_LOG_CHANNEL("WORLD");
941 MOFEM_LOG_TAG("WORLD", "FieldCore");
942 MOFEM_LOG_CHANNEL("SYNC");
943 MOFEM_LOG_TAG("SYNC", "FieldCore");
946
947 // check field & meshset
948 auto field_it = fIelds.get<BitFieldId_mi_tag>().find(id);
949 if (field_it == fIelds.get<BitFieldId_mi_tag>().end())
950 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "no field found");
951
952 MOFEM_LOG("WORLD", Sev::noisy)
953 << "Field " << (*field_it)->getName() << " core value < "
954 << this->getValue() << " > field value ( "
955 << static_cast<int>((*field_it)->getBitNumber()) << " )"
956 << " nb. of ents " << ents.size();
957
958 CHKERR this->setFieldOrderImpl(*field_it, ents, order, verb);
959
961}
MoFEMErrorCode setFieldOrderImpl(boost::shared_ptr< Field > field_ptr, const Range &ents, const ApproximationOrder order, int verb)

◆ set_field_order() [4/4]

MoFEMErrorCode MoFEM::Core::set_field_order ( const Range &  ents,
const std::string &  name,
const ApproximationOrder  order,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Set order approximation of the entities in the field.

Note
not collective
Parameters
entities
typeselected type of the entities f.e. MBTET, MBTRI, MBEDGE, MBVERTEX, see moab documentation
orderapproximation order

Implements MoFEM::CoreInterface.

Definition at line 986 of file FieldCore.cpp.

987 {
989 if (verb == -1)
990 verb = verbose;
991 *buildMoFEM = 0;
992 CHKERR this->set_field_order(ents, get_field_id(name), order, verb);
994}

◆ set_field_order_by_entity_type_and_bit_ref() [1/2]

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

Definition at line 995 of file FieldCore.cpp.

997 {
999 if (verb == -1)
1000 verb = verbose;
1001 *buildMoFEM = 0;
1002 Range ents;
1003 CHKERR BitRefManager(*this).getEntitiesByTypeAndRefLevel(bit, mask, type,
1004 ents, verb);
1005 CHKERR this->set_field_order(ents, id, order, verb);
1007}

◆ set_field_order_by_entity_type_and_bit_ref() [2/2]

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

Set order approximation of the entities in the field.

Note
not collective
Parameters
bitrefinement level
maskbit mask
typeselected type of the entities f.e. MBTET, MBTRI, MBEDGE, MBVERTEX, see moab documentation
orderapproximation order

Implements MoFEM::CoreInterface.

Definition at line 1009 of file FieldCore.cpp.

1011 {
1013 if (verb == -1)
1014 verb = verbose;
1015 *buildMoFEM = 0;
1016 Range ents;
1017 CHKERR BitRefManager(*this).getEntitiesByTypeAndRefLevel(bit, mask, type,
1018 ents, verb);
1019 CHKERR this->set_field_order(ents, get_field_id(name), order, verb);
1021}

◆ set_moab_interface()

MoFEMErrorCode MoFEM::Core::set_moab_interface ( moab::Interface &  new_moab,
int  verb = VERBOSE 
)
protectedvirtual

Set the moab interface object.

Parameters
new_moabReference to new MOAB interface to set
verbVerbosity level (default: VERBOSE)
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::CoreInterface.

Reimplemented in MoFEM::CoreTmp<-1 >.

Definition at line 789 of file Core.cpp.

789 {
790 return this->setMoabInterface(new_moab, verb);
791};
MoFEMErrorCode setMoabInterface(moab::Interface &new_moab, int verb=VERBOSE)
Definition Core.cpp:468

◆ setFieldOrder()

MoFEMErrorCode MoFEM::CoreTmp< 0 >::setFieldOrder ( const Range &  ents,
const BitFieldId  id,
const ApproximationOrder  order,
int  ver 
)
protected

◆ setFieldOrderImpl()

MoFEMErrorCode MoFEM::Core::setFieldOrderImpl ( boost::shared_ptr< Field >  field_ptr,
const Range &  ents,
const ApproximationOrder  order,
int  verb 
)
protected

Definition at line 510 of file FieldCore.cpp.

513 {
515
516 if (verb == DEFAULT_VERBOSITY)
517 verb = verbose;
518 *buildMoFEM = 0;
519
520 const auto field_meshset = field_ptr->getMeshset();
521 const auto bit_number = field_ptr->getBitNumber();
522
523 // intersection with field meshset
524 Range ents_of_id_meshset;
525 CHKERR get_moab().get_entities_by_handle(field_meshset, ents_of_id_meshset,
526 false);
527 Range field_ents = intersect(ents, ents_of_id_meshset);
528 if (verb > QUIET) {
529 MOFEM_LOG_C("SYNC", Sev::noisy,
530 "change nb. of ents for order in the field <%s> %zu -> %zu",
531 field_ptr->getName().c_str(), ents.size(), field_ents.size());
532 }
533
534 // ent view by field id (in set all MoabEnts has the same FieldId)
535 auto eiit = entsFields.get<Unique_mi_tag>().lower_bound(
536 FieldEntity::getLoBitNumberUId(field_ptr->getBitNumber()));
538 if (eiit != entsFields.get<Unique_mi_tag>().end()) {
539 auto hi_eiit = entsFields.get<Unique_mi_tag>().upper_bound(
540 FieldEntity::getHiBitNumberUId(field_ptr->getBitNumber()));
541 std::copy(eiit, hi_eiit, std::back_inserter(ents_id_view));
542 }
543
544 if (verb > QUIET)
545 MOFEM_LOG_C("SYNC", Sev::noisy,
546 "current nb. of ents in the multi index field <%s> %zu",
547 field_ptr->getName().c_str(), ents_id_view.size());
548
549 // loop over ents
550 int nb_ents_set_order_up = 0;
551 int nb_ents_set_order_down = 0;
552 int nb_ents_set_order_new = 0;
553
554 FieldEntity_change_order modify_order_no_size_change(order, false);
555 FieldEntity_change_order modify_order_size_change(order, true);
556
557 for (auto pit = field_ents.const_pair_begin();
558 pit != field_ents.const_pair_end(); pit++) {
559 EntityHandle first = pit->first;
560 EntityHandle second = pit->second;
561
562 const auto type = static_cast<EntityType>(first >> MB_ID_WIDTH);
563
564 // Sanity check
565 switch (field_ptr->getSpace()) {
566 case H1:
567 break;
568 case HCURL:
569 if (type == MBVERTEX)
570 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
571 "Hcurl space on vertices makes no sense");
572
573 break;
574 case HDIV:
575 if (type == MBVERTEX)
576 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
577 "Hdiv space on vertices makes no sense");
578
579 if (type == MBEDGE)
580 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
581 "Hdiv space on edges makes no sense");
582
583 break;
584 default:
585 break;
586 }
587
588 // Entity is in database, change order only if needed
589 Range ents_in_database;
590 auto vit = ents_id_view.get<1>().lower_bound(first);
591 auto hi_vit = ents_id_view.get<1>().upper_bound(second);
592 if (order >= 0) {
593 for (; vit != hi_vit; ++vit) {
594 ents_in_database.insert(vit->get()->getEnt());
595 // entity is in database and order is changed or reset
596 const ApproximationOrder old_approximation_order =
597 (*vit)->getMaxOrder();
598
599 if (old_approximation_order != order) {
600
601 FieldEntity_multiIndex::iterator miit =
602 entsFields.get<Unique_mi_tag>().find((*vit)->getLocalUniqueId());
603
604 if ((*miit)->getMaxOrder() < order)
605 nb_ents_set_order_up++;
606 if ((*miit)->getMaxOrder() > order)
607 nb_ents_set_order_down++;
608
609 // set dofs inactive if order is reduced, and set new order to entity
610 // if order is increased (note that dofs are not build if order is
611 // increased)
612
613 bool can_change_size = true;
614 auto dit = dofsField.get<Unique_mi_tag>().lower_bound(
616 (*miit)->getEnt()));
617 if (dit != dofsField.get<Unique_mi_tag>().end()) {
618 auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(
620 (*miit)->getEnt()));
621
622 if (dit != hi_dit)
623 can_change_size = false;
624 for (; dit != hi_dit; dit++) {
625 if ((*dit)->getDofOrder() > order) {
626 bool success = dofsField.modify(dofsField.project<0>(dit),
627 DofEntity_active_change(false));
628 if (!success)
629 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
630 "modification unsuccessful");
631 }
632 }
633 }
634
635 bool success =
636 entsFields.modify(entsFields.project<0>(miit),
637 can_change_size ? modify_order_size_change
638 : modify_order_no_size_change);
639 if (!success)
640 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
641 "modification unsuccessful");
642 }
643 }
644 }
645
646 Range new_ents = subtract(Range(first, second), ents_in_database);
647 for (Range::const_pair_iterator pit = new_ents.const_pair_begin();
648 pit != new_ents.const_pair_end(); ++pit) {
649 const auto first = pit->first;
650 const auto second = pit->second;
651 const auto ent_type = get_moab().type_from_handle(first);
652
653 if (!field_ptr->getFieldOrderTable()[ent_type])
654 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
655 "Number of degrees of freedom for entity %s for %s space on "
656 "base %s can "
657 "not be deduced",
658 moab::CN::EntityTypeName(ent_type),
659 field_ptr->getSpaceName().c_str(),
660 field_ptr->getApproxBaseName().c_str());
661
662 auto get_nb_dofs_on_order = [&](const int order) {
663 return order >= 0 ? (field_ptr->getFieldOrderTable()[ent_type])(order)
664 : 0;
665 };
666 const int nb_dofs_on_order = get_nb_dofs_on_order(order);
667 if (nb_dofs_on_order || order == -1) {
668
669 const int field_rank = field_ptr->getNbOfCoeffs();
670 const int nb_dofs = nb_dofs_on_order * field_rank;
671
672 // Entity is not in database and order is changed or reset
673 auto miit_ref_ent =
674 refinedEntities.get<Ent_mi_tag>().lower_bound(first);
675
676 auto create_tags_for_max_order = [&](const Range &ents) {
678 if (order >= 0) {
679 std::vector<ApproximationOrder> o_vec(ents.size(), order);
680 CHKERR get_moab().tag_set_data(field_ptr->th_AppOrder, ents,
681 &*o_vec.begin());
682 }
684 };
685
686 auto create_tags_for_data = [&](const Range &ents) {
688 if (order >= 0) {
689
690 if (nb_dofs > 0) {
691 if (ent_type == MBVERTEX) {
692 std::vector<FieldData> d_vec(nb_dofs * ents.size(), 0);
693 CHKERR get_moab().tag_set_data(field_ptr->th_FieldDataVerts,
694 ents, &*d_vec.begin());
695 } else {
696 std::vector<int> tag_size(ents.size(), nb_dofs);
697 std::vector<FieldData> d_vec(nb_dofs, 0);
698 std::vector<void const *> d_vec_ptr(ents.size(),
699 &*d_vec.begin());
700 CHKERR get_moab().tag_set_by_ptr(field_ptr->th_FieldData, ents,
701 &*d_vec_ptr.begin(),
702 &*tag_size.begin());
703 }
704 }
705 }
706
708 };
709
710 auto get_ents_in_ref_ent = [&](auto miit_ref_ent) {
711 auto hi = refinedEntities.get<Ent_mi_tag>().upper_bound(second);
712 Range in;
713 for (; miit_ref_ent != hi; ++miit_ref_ent)
714 in.insert(miit_ref_ent->get()->getEnt());
715 return in;
716 };
717
718 auto get_ents_max_order = [&](const Range &ents) {
719 boost::shared_ptr<std::vector<const void *>> vec(
720 new std::vector<const void *>());
721 vec->resize(ents.size());
722 CHKERR get_moab().tag_get_by_ptr(field_ptr->th_AppOrder, ents,
723 &*vec->begin());
724 return vec;
725 };
726
727 auto get_ents_field_data_vector_adaptor =
728 [&](const Range &ents,
729 boost::shared_ptr<std::vector<const void *>> &ents_max_orders) {
730 // create shared pointer and reserve memory
731 boost::shared_ptr<std::vector<double *>> vec(
732 new std::vector<double *>());
733 vec->reserve(ents.size());
734
735 if (order >= 0 && nb_dofs == 0) {
736 // set empty vector adaptor
737 for (int i = 0; i != ents.size(); ++i)
738 vec->emplace_back(nullptr);
739 } else {
740 moab::ErrorCode rval;
741 std::vector<int> tag_size(ents.size());
742 std::vector<const void *> d_vec_ptr(ents.size());
743
744 // get tags data
745 if (ent_type == MBVERTEX)
746 rval = get_moab().tag_get_by_ptr(field_ptr->th_FieldDataVerts,
747 ents, &*d_vec_ptr.begin(),
748 &*tag_size.begin());
749 else
750 rval = get_moab().tag_get_by_ptr(field_ptr->th_FieldData,
751 ents, &*d_vec_ptr.begin(),
752 &*tag_size.begin());
753
754 auto cast = [](auto p) {
755 return const_cast<FieldData *const>(
756 static_cast<const FieldData *>(p));
757 };
758
759 // some of entities has tag not set or zero dofs on entity
760 if (rval == MB_SUCCESS) {
761 // all is ok, all entities has tag set
762 auto tit = d_vec_ptr.begin();
763 auto oit = ents_max_orders->begin();
764 for (auto sit = tag_size.begin(); sit != tag_size.end();
765 ++sit, ++tit, ++oit)
766 vec->emplace_back(cast(*tit));
767
768 } else {
769 // set empty vector adaptor
770 for (int i = 0; i != ents.size(); ++i)
771 vec->emplace_back(nullptr);
772
773 // check order on all entities, and if for that order non zero
774 // dofs are expected get pointer to tag data and reset vector
775 // adaptor
776 auto oit = ents_max_orders->begin();
777 auto dit = vec->begin();
778 for (auto eit = ents.begin(); eit != ents.end();
779 ++eit, ++oit, ++dit) {
780
781 const int ent_order =
782 *static_cast<const ApproximationOrder *>(*oit);
783 const int ent_nb_dofs = get_nb_dofs_on_order(ent_order);
784
785 if (ent_nb_dofs) {
786 int tag_size;
787 const void *ret_val;
788 if (ent_type == MBVERTEX) {
789 rval = get_moab().tag_get_by_ptr(
790 field_ptr->th_FieldDataVerts, &*eit, 1, &ret_val,
791 &tag_size);
792 } else {
793 rval = get_moab().tag_get_by_ptr(
794 field_ptr->th_FieldData, &*eit, 1, &ret_val,
795 &tag_size);
796 if (rval != MB_SUCCESS) {
797
798 const int set_tag_size[] = {ent_nb_dofs * field_rank};
799 std::array<FieldData, MAX_DOFS_ON_ENTITY> set_d_vec;
800 std::fill(set_d_vec.begin(),
801 &set_d_vec[set_tag_size[0]], 0);
802 const void *set_d_vec_ptr[] = {set_d_vec.data()};
803 CHKERR get_moab().tag_set_by_ptr(
804 field_ptr->th_FieldData, &*eit, 1, set_d_vec_ptr,
805 set_tag_size);
806 rval = get_moab().tag_get_by_ptr(
807 field_ptr->th_FieldData, &*eit, 1, &ret_val,
808 &tag_size);
809
810 if (rval != MB_SUCCESS) {
814 MOFEM_LOG("SELF", Sev::error)
815 << "Error is triggered in MOAB, field tag data "
816 "for same reason can not be for accessed.";
817 MOFEM_LOG("SELF", Sev::error)
818 << "Set order: " << order;
819 MOFEM_LOG("SELF", Sev::error)
820 << "Nb. dofs on entity for given order: "
821 << set_tag_size[0];
822 MOFEM_LOG("SELF", Sev::error)
823 << "Entity type: "
824 << moab::CN::EntityTypeName(ent_type);
825 MOFEM_LOG("SELF", Sev::error)
826 << "Field: " << *field_ptr;
827 CHKERR rval;
828 }
829 }
830 }
831 const_cast<FieldData *&>(*dit) = cast(ret_val);
832 }
833 }
834 }
835 }
836 return vec;
837 };
838
839 auto ents_in_ref_ent = get_ents_in_ref_ent(miit_ref_ent);
840
841 CHKERR create_tags_for_max_order(ents_in_ref_ent);
842 CHKERR create_tags_for_data(ents_in_ref_ent);
843 auto ents_max_order = get_ents_max_order(ents_in_ref_ent);
844 auto ent_field_data =
845 get_ents_field_data_vector_adaptor(ents_in_ref_ent, ents_max_order);
846
847 // reserve memory for field dofs
848 auto ents_array = boost::make_shared<std::vector<FieldEntity>>();
849 // Add sequence to field data structure. Note that entities are
850 // allocated once into vector. This vector is passed into sequence as a
851 // weak_ptr. Vector is destroyed at the point last entity inside that
852 // vector is destroyed.
853 ents_array->reserve(second - first + 1);
854 auto vit_max_order = ents_max_order->begin();
855 auto vit_field_data = ent_field_data->begin();
856 for (int i = 0; i != ents_in_ref_ent.size(); ++i) {
857
858 ents_array->emplace_back(
859 field_ptr, *miit_ref_ent,
860 boost::shared_ptr<double *const>(ent_field_data,
861 &*vit_field_data),
862 boost::shared_ptr<const int>(
863 ents_max_order, static_cast<const int *>(*vit_max_order)));
864 ++vit_max_order;
865 ++vit_field_data;
866 ++miit_ref_ent;
867 }
868 if (!ents_array->empty())
869 if ((*ents_array)[0].getFieldRawPtr() != field_ptr.get())
870 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
871 "Get field ent poiter and field pointer do not match for "
872 "field %s",
873 field_ptr->getName().c_str());
874 nb_ents_set_order_new += ents_array->size();
875
876 // Check if any of entities in the range has bit level but is not added
877 // to database. That generate data inconsistency and error.
878 if (ents_in_ref_ent.size() < (second - first + 1)) {
879 Range ents_not_in_database =
880 subtract(Range(first, second), ents_in_ref_ent);
881 std::vector<const void *> vec_bits(ents_not_in_database.size());
882 CHKERR get_moab().tag_get_by_ptr(
883 get_basic_entity_data_ptr()->th_RefBitLevel, ents_not_in_database,
884 &*vec_bits.begin());
885 auto cast = [](auto p) {
886 return static_cast<const BitRefLevel *>(p);
887 };
888 for (auto v : vec_bits)
889 if (cast(v)->any())
890 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
891 "Try to add entities which are not seeded or added to "
892 "database");
893 }
894
895 // Add entities to database
896 // Keep the successor of this ascending batch, including gap rebuilds.
897 const auto hint = ents_array->empty()
898 ? entsFields.end()
899 : entsFields.upper_bound(
900 ents_array->back().getLocalUniqueId());
901 for (auto &v : *ents_array)
902 entsFields.emplace_hint(hint, ents_array, &v);
903 }
904 }
905 }
906
907 if (verb > QUIET) {
908 MOFEM_LOG_C("SYNC", Sev::noisy,
909 "nb. of entities in field <%s> for which order was "
910 "increased %d (order %d)",
911 field_ptr->getName().c_str(), nb_ents_set_order_up, order);
912 MOFEM_LOG_C("SYNC", Sev::noisy,
913 "nb. of entities in field <%s> for which order was "
914 "reduced %d (order %d)",
915 field_ptr->getName().c_str(), nb_ents_set_order_down, order);
917 "SYNC", Sev::noisy,
918 "nb. of entities in field <%s> for which order set %d (order %d)",
919 field_ptr->getName().c_str(), nb_ents_set_order_new, order);
920 }
921
922 if (verb > QUIET) {
923 auto eiit = entsFields.get<Unique_mi_tag>().lower_bound(
924 FieldEntity::getLoBitNumberUId(field_ptr->getBitNumber()));
925 auto hi_eiit = entsFields.get<Unique_mi_tag>().upper_bound(
926 FieldEntity::getHiBitNumberUId(field_ptr->getBitNumber()));
927 MOFEM_LOG_C("SYNC", Sev::noisy,
928 "nb. of ents in the multi index field <%s> %d",
929 field_ptr->getName().c_str(), std::distance(eiit, hi_eiit));
930 }
931
932 if (verb > QUIET)
934
936}
#define MB_ID_WIDTH
double FieldData
Field data type.
Definition Types.hpp:25

◆ setMoabInterface()

MoFEMErrorCode MoFEM::Core::setMoabInterface ( moab::Interface &  new_moab,
int  verb = VERBOSE 
)
protected

Definition at line 468 of file Core.cpp.

468 {
470 if (verb == -1)
471 verb = verbose;
472
473 // clear moab database
475
476 // set new reference
477 moab = std::ref(new_moab);
478
479 // check if moab has set communicator if not set communicator internally
480 ParallelComm *pComm = ParallelComm::get_pcomm(&new_moab, MYPCOMM_INDEX);
481 if (pComm == NULL) {
482 pComm = new ParallelComm(&new_moab, wrapMPIMOABComm->get_comm());
483 }
484
485 // create MoFEM tags
486 CHKERR getTags();
487
488 // Create basic entity data struture
489 basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
491
492 // Initalise database
494
496};

◆ setRefEntBasicDataPtr()

void MoFEM::Core::setRefEntBasicDataPtr ( MoFEM::Interface &  m_field,
boost::shared_ptr< BasicEntityData > &  ptr 
)
static

Definition at line 951 of file Core.cpp.

952 {
953
954 switch (m_field.getValue()) {
955 case -1:
957 break;
958 case 0:
959 set_ref_ent_basic_data_ptr_impl<0>(ptr);
960 break;
961 case 1:
962 set_ref_ent_basic_data_ptr_impl<1>(ptr);
963 break;
964 default:
965 THROW_MESSAGE("Core index can vary from -1 to MAX_CORE_TMP");
966 }
967};
void set_ref_ent_basic_data_ptr_impl(boost::shared_ptr< BasicEntityData > &ptr)
Definition Core.cpp:942

Member Data Documentation

◆ basicEntityDataPtr

boost::shared_ptr<BasicEntityData> MoFEM::CoreTmp< 0 >::basicEntityDataPtr
protected
Returns
pointer to BasicEntityData structure

BasicEntityData is structure which every BasicEntity have. It keeps data about tags to handles on the mesh, in particular tag to BitRefLevel and tag with handle to parent.

Definition at line 286 of file Core.hpp.

◆ buildMoFEM

int* MoFEM::CoreTmp< 0 >::buildMoFEM
mutableprotected

keeps flags/semaphores for different stages

Definition at line 1058 of file Core.hpp.

◆ dofsField

DofEntity_multiIndex MoFEM::CoreTmp< 0 >::dofsField
protected

dofs on fields

Definition at line 310 of file Core.hpp.

◆ entFEAdjacencies

adjacencies of elements to dofs

Definition at line 316 of file Core.hpp.

◆ entsFields

FieldEntity_multiIndex MoFEM::CoreTmp< 0 >::entsFields
protected

entities on fields

Definition at line 309 of file Core.hpp.

◆ entsFiniteElements

EntFiniteElement_multiIndex MoFEM::CoreTmp< 0 >::entsFiniteElements
protected

finite element entities

Definition at line 313 of file Core.hpp.

◆ fIelds

Field_multiIndex MoFEM::CoreTmp< 0 >::fIelds
protected

fields

Definition at line 308 of file Core.hpp.

◆ finiteElements

FiniteElement_multiIndex MoFEM::CoreTmp< 0 >::finiteElements
protected

finite elements

Definition at line 312 of file Core.hpp.

◆ iFaces

boost::ptr_map<boost::typeindex::type_index, UnknownInterface> MoFEM::CoreTmp< 0 >::iFaces
mutableprotected

Hash map of pointers to interfaces.

Definition at line 1056 of file Core.hpp.

◆ initaliseAndBuildField

PetscBool MoFEM::CoreTmp< 0 >::initaliseAndBuildField
protected

If true build field on database initialisation

Definition at line 1062 of file Core.hpp.

◆ initaliseAndBuildFiniteElements

PetscBool MoFEM::CoreTmp< 0 >::initaliseAndBuildFiniteElements
protected

Definition at line 1065 of file Core.hpp.

◆ isGloballyInitialised

bool MoFEM::CoreTmp< 0 >::isGloballyInitialised = false
inlinestaticprotected

Core base globally initialized.

Definition at line 1068 of file Core.hpp.

◆ isInitialized

PetscBool MoFEM::CoreTmp< 0 >::isInitialized = PETSC_FALSE
inlinestaticprotected

petsc was initialised by other agent

Definition at line 1070 of file Core.hpp.

◆ moab

std::reference_wrapper<moab::Interface> MoFEM::CoreTmp< 0 >::moab
protected

moab database

Definition at line 326 of file Core.hpp.

◆ MOFEM_EVENT_createMat

PetscLogEvent MoFEM::CoreTmp< 0 >::MOFEM_EVENT_createMat
protected

Definition at line 1016 of file Core.hpp.

◆ MOFEM_EVENT_operator

PetscLogEvent MoFEM::CoreTmp< 0 >::MOFEM_EVENT_operator
protected

Event for evaluating operator of finite element.

Definition at line 1013 of file Core.hpp.

◆ MOFEM_EVENT_postProcess

PetscLogEvent MoFEM::CoreTmp< 0 >::MOFEM_EVENT_postProcess
protected

Event for postProcess finite element.

Definition at line 1015 of file Core.hpp.

◆ MOFEM_EVENT_preProcess

PetscLogEvent MoFEM::CoreTmp< 0 >::MOFEM_EVENT_preProcess
protected

Event for preProcess finite element.

Definition at line 1011 of file Core.hpp.

◆ mofemComm

MPI_Comm MoFEM::CoreTmp< 0 >::mofemComm
mutableprotected

MoFEM communicator.

Definition at line 1024 of file Core.hpp.

◆ mpiInitialised

int MoFEM::CoreTmp< 0 >::mpiInitialised = 0
inlinestaticprotected

mpi was initialised by other agent

Definition at line 1069 of file Core.hpp.

◆ optionsPrefix

std::string MoFEM::CoreTmp< 0 >::optionsPrefix
protected

Prefix for options on command line.

Definition at line 1060 of file Core.hpp.

◆ pComm

ParallelComm* MoFEM::CoreTmp< 0 >::pComm
mutableprotected

MOAB communicator structure.

Definition at line 1025 of file Core.hpp.

◆ petscOptionsFile

std::string MoFEM::CoreTmp< 0 >::petscOptionsFile = ""
inlinestaticprotected

Definition at line 1071 of file Core.hpp.

◆ pRoblems

Problem_multiIndex MoFEM::CoreTmp< 0 >::pRoblems
protected

problems multi-index

Definition at line 318 of file Core.hpp.

◆ rAnk

int MoFEM::CoreTmp< 0 >::rAnk
protected

MOFEM communicator rank.

Definition at line 1028 of file Core.hpp.

◆ refinedEntities

RefEntity_multiIndex MoFEM::CoreTmp< 0 >::refinedEntities
protected

refined entities

Definition at line 305 of file Core.hpp.

◆ refinedFiniteElements

RefElement_multiIndex MoFEM::CoreTmp< 0 >::refinedFiniteElements
protected

refined elements

Definition at line 306 of file Core.hpp.

◆ sIze

int MoFEM::CoreTmp< 0 >::sIze
protected

MoFEM communicator size.

Definition at line 1027 of file Core.hpp.

◆ th_ElemType

Tag MoFEM::CoreTmp< 0 >::th_ElemType
protected

Needed for VTK files.

Definition at line 274 of file Core.hpp.

◆ th_FEId

Tag MoFEM::CoreTmp< 0 >::th_FEId
protected

Definition at line 267 of file Core.hpp.

◆ th_FEIdCol

Tag MoFEM::CoreTmp< 0 >::th_FEIdCol
protected

Definition at line 268 of file Core.hpp.

◆ th_FEIdData

Tag MoFEM::CoreTmp< 0 >::th_FEIdData
protected

Definition at line 268 of file Core.hpp.

◆ th_FEIdRow

Tag MoFEM::CoreTmp< 0 >::th_FEIdRow
protected

Definition at line 268 of file Core.hpp.

◆ th_FEName

Tag MoFEM::CoreTmp< 0 >::th_FEName
protected

Definition at line 267 of file Core.hpp.

◆ th_FieldBase

Tag MoFEM::CoreTmp< 0 >::th_FieldBase
protected

Definition at line 266 of file Core.hpp.

◆ th_FieldContinuity

Tag MoFEM::CoreTmp< 0 >::th_FieldContinuity
protected

Definition at line 266 of file Core.hpp.

◆ th_FieldId

Tag MoFEM::CoreTmp< 0 >::th_FieldId
protected

Definition at line 265 of file Core.hpp.

◆ th_FieldName

Tag MoFEM::CoreTmp< 0 >::th_FieldName
protected

Definition at line 265 of file Core.hpp.

◆ th_FieldName_DataNamePrefix

Tag MoFEM::CoreTmp< 0 >::th_FieldName_DataNamePrefix
protected

Definition at line 265 of file Core.hpp.

◆ th_FieldSpace

Tag MoFEM::CoreTmp< 0 >::th_FieldSpace
protected

Definition at line 265 of file Core.hpp.

◆ th_MoFEMBuild

Tag MoFEM::CoreTmp< 0 >::th_MoFEMBuild
protected

Internal use storing state, used to detect error and inconsistencies

Definition at line 275 of file Core.hpp.

◆ th_Part

Tag MoFEM::CoreTmp< 0 >::th_Part
protected

Tag for partition number.

Definition at line 262 of file Core.hpp.

◆ th_ProblemFEId

Tag MoFEM::CoreTmp< 0 >::th_ProblemFEId
protected

Definition at line 269 of file Core.hpp.

◆ th_ProblemGhostNbDofCol

Tag MoFEM::CoreTmp< 0 >::th_ProblemGhostNbDofCol
protected

Definition at line 272 of file Core.hpp.

◆ th_ProblemGhostNbDofRow

Tag MoFEM::CoreTmp< 0 >::th_ProblemGhostNbDofRow
protected

Definition at line 271 of file Core.hpp.

◆ th_ProblemId

Tag MoFEM::CoreTmp< 0 >::th_ProblemId
protected

Definition at line 269 of file Core.hpp.

◆ th_ProblemLocalNbDofCol

Tag MoFEM::CoreTmp< 0 >::th_ProblemLocalNbDofCol
protected

Definition at line 272 of file Core.hpp.

◆ th_ProblemLocalNbDofRow

Tag MoFEM::CoreTmp< 0 >::th_ProblemLocalNbDofRow
protected

Definition at line 271 of file Core.hpp.

◆ th_ProblemName

Tag MoFEM::CoreTmp< 0 >::th_ProblemName
protected

Definition at line 269 of file Core.hpp.

◆ th_ProblemNbDofsCol

Tag MoFEM::CoreTmp< 0 >::th_ProblemNbDofsCol
protected

Definition at line 270 of file Core.hpp.

◆ th_ProblemNbDofsRow

Tag MoFEM::CoreTmp< 0 >::th_ProblemNbDofsRow
protected

Definition at line 270 of file Core.hpp.

◆ th_ProblemShift

Tag MoFEM::CoreTmp< 0 >::th_ProblemShift
protected

Definition at line 273 of file Core.hpp.

◆ th_RefBitEdge

Tag MoFEM::CoreTmp< 0 >::th_RefBitEdge
protected

Definition at line 263 of file Core.hpp.

◆ th_RefBitLevel

Tag MoFEM::CoreTmp< 0 >::th_RefBitLevel
protected

Definition at line 263 of file Core.hpp.

◆ th_RefBitLevel_Mask

Tag MoFEM::CoreTmp< 0 >::th_RefBitLevel_Mask
protected

Definition at line 263 of file Core.hpp.

◆ th_RefFEMeshset

Tag MoFEM::CoreTmp< 0 >::th_RefFEMeshset
protected

Definition at line 264 of file Core.hpp.

◆ th_RefParentHandle

Tag MoFEM::CoreTmp< 0 >::th_RefParentHandle
protected

Definition at line 263 of file Core.hpp.

◆ value

constexpr const int MoFEM::CoreTmp< 0 >::value = 0
staticconstexpr

Definition at line 85 of file Core.hpp.

◆ verbose

int MoFEM::CoreTmp< 0 >::verbose
protected

Verbosity level.

Definition at line 1051 of file Core.hpp.

◆ wrapMPIMOABComm

boost::shared_ptr<WrapMPIComm> MoFEM::CoreTmp< 0 >::wrapMPIMOABComm
protected

manage creation and destruction of MOAB communicator

Definition at line 1049 of file Core.hpp.


The documentation for this struct was generated from the following files: