v0.10.0
Classes | 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]

Classes

struct  WrapMPIComm
 

Public Member Functions

const int getValue () const
 Get the core. More...
 
RefEntityTmp< 0 > getRefEntity (const EntityHandle ent)
 
virtual boost::shared_ptr< RefEntityTmp< 0 > > make_shared_ref_entity (const EntityHandle ent)
 Get RefEntity. More...
 
 CoreTmp (moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
 
 ~CoreTmp ()
 
- Public Member Functions inherited from MoFEM::DeprecatedCoreInterface
template<class IFace >
DEPRECATED MoFEMErrorCode query_interface (IFace *&ptr) const
 
template<class IFace >
DEPRECATED IFace * query_interface () const
 
virtual DEPRECATED MoFEMErrorCode seed_ref_level_2D (const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
 seed 2D entities (Triangles entities only) in the meshset and their adjacencies (only TRIs adjacencies) in a particular BitRefLevel More...
 
DEPRECATED MoFEMErrorCode seed_ref_level_3D (const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
 seed 2D entities in the meshset and their adjacencies (only TETs adjacencies) in a particular BitRefLevel More...
 
DEPRECATED MoFEMErrorCode seed_ref_level (const Range &ents, const BitRefLevel &bit, const bool only_tets=true, int verb=-1)
 seed entities in the range and their adjacencies in a particular BitRefLevel More...
 
DEPRECATED MoFEMErrorCode seed_ref_level_MESHSET (const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
 
DEPRECATED MoFEMErrorCode seed_finite_elements (const EntityHandle meshset, int verb=-1)
 
DEPRECATED MoFEMErrorCode seed_finite_elements (const Range &entities, int verb=-1)
 
DEPRECATED MoFEMErrorCode get_entities_by_type_and_ref_level (const BitRefLevel &bit, const BitRefLevel &mask, const EntityType type, const EntityHandle meshset, int verb=-1)
 add all ents from ref level given by bit to meshset More...
 
DEPRECATED MoFEMErrorCode get_entities_by_type_and_ref_level (const BitRefLevel &bit, const BitRefLevel &mask, const EntityType type, Range &ents, int verb=-1)
 add all ents from ref level given by bit to meshset More...
 
DEPRECATED MoFEMErrorCode get_entities_by_ref_level (const BitRefLevel &bit, const BitRefLevel &mask, const EntityHandle meshset)
 add all ents from ref level given by bit to meshset More...
 
DEPRECATED MoFEMErrorCode get_entities_by_ref_level (const BitRefLevel &bit, const BitRefLevel &mask, Range &ents)
 add all ents from ref level given by bit to meshset More...
 
DEPRECATED bool check_msId_meshset (const int msId, const CubitBCType cubit_bc_type)
 check for CUBIT Id and CUBIT type More...
 
DEPRECATED MoFEMErrorCode add_cubit_msId (const CubitBCType cubit_bc_tyep, const int msId, const std::string name="")
 add cubit meshset More...
 
DEPRECATED MoFEMErrorCode set_cubit_msId_attribites (const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
 set attributes to cubit meshset More...
 
DEPRECATED MoFEMErrorCode set_cubit_msId_attribites_data_structure (const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
 set (material) data structure to cubit meshset More...
 
DEPRECATED MoFEMErrorCode set_cubit_msId_bc_data_structure (const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
 set boundary data structure to meshset More...
 
DEPRECATED MoFEMErrorCode delete_cubit_msId (const CubitBCType cubit_bc_type, const int msId)
 delete cubit meshset More...
 
DEPRECATED MoFEMErrorCode get_cubit_msId (const int msId, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr)
 get cubit meshset More...
 
DEPRECATED MoFEMErrorCode get_cubit_msId_entities_by_dimension (const int ms_id, const CubitBCType cubit_bc_type, const int dimension, Range &entities, const bool recursive=false)
 
DEPRECATED MoFEMErrorCode get_cubit_msId_entities_by_dimension (const int ms_id, const CubitBCType cubit_bc_type, Range &entities, const bool recursive=false)
 
DEPRECATED MoFEMErrorCode get_cubit_msId_entities_by_dimension (const int msId, const unsigned int cubit_bc_type, const int dimension, Range &entities, const bool recursive=false)
 get entities from CUBIT/meshset of a particular entity dimension More...
 
DEPRECATED MoFEMErrorCode get_cubit_msId_entities_by_dimension (const int msId, const unsigned int cubit_bc_type, Range &entities, const bool recursive=false)
 get entities related to CUBIT/meshset, More...
 
DEPRECATED MoFEMErrorCode get_cubit_msId_meshset (const int msId, const unsigned int cubit_bc_type, EntityHandle &meshset)
 get meshset from CUBIT Id and CUBIT type More...
 
DEPRECATED MoFEMErrorCode get_cubit_meshsets (const unsigned int cubit_bc_type, Range &meshsets)
 get all CUBIT meshsets by CUBIT type More...
 
DEPRECATED MoFEMErrorCode print_cubit_displacement_set () const
 
DEPRECATED MoFEMErrorCode print_cubit_pressure_set () const
 
DEPRECATED MoFEMErrorCode print_cubit_force_set () const
 
DEPRECATED MoFEMErrorCode print_cubit_materials_set () const
 
DEPRECATED MoFEMErrorCode update_meshset_by_entities_children (const EntityHandle parent, const BitRefLevel &child_bit, const EntityHandle child, EntityType child_type, const bool recursive=false, int verb=-1)
 Get child entities form meshset containing parent entities. More...
 
DEPRECATED MoFEMErrorCode update_field_meshset_by_entities_children (const BitRefLevel &child_bit, int verb=-1)
 update fields meshesets by child entities More...
 
DEPRECATED MoFEMErrorCode update_field_meshset_by_entities_children (const std::string name, const BitRefLevel &child_bit, int verb=-1)
 update field mesheset by child entities More...
 
DEPRECATED MoFEMErrorCode update_finite_element_meshset_by_entities_children (const std::string name, const BitRefLevel &child_bit, const EntityType fe_ent_type, int verb=-1)
 update finite element mesheset by child entities More...
 
DEPRECATED MoFEMErrorCode shift_right_bit_ref (const int shift, int verb=-1)
 right shift bit ref level More...
 
DEPRECATED MoFEMErrorCode build_problem (const std::string &name, const bool square_matrix, int verb=-1)
 build problem data structures More...
 
DEPRECATED MoFEMErrorCode build_problem (Problem *problem_ptr, const bool square_matrix, int verb=-1)
 build problem data structures More...
 
DEPRECATED MoFEMErrorCode build_problem_on_distributed_mesh (const std::string &name, const bool square_matrix=true, int verb=-1)
 build problem data structures, assuming that mesh is distributed (collective) More...
 
DEPRECATED MoFEMErrorCode build_problem_on_distributed_mesh (Problem *problem_ptr, const bool square_matrix=true, int verb=-1)
 build problem data structures, assuming that mesh is distributed (collective) More...
 
DEPRECATED MoFEMErrorCode partition_mesh (const Range &ents, const int dim, const int adj_dim, const int n_parts, int verb=-1)
 Set partition tag to each finite element in the problem. More...
 
DEPRECATED MoFEMErrorCode partition_simple_problem (const std::string &name, int verb=-1)
 partition problem dofs More...
 
DEPRECATED MoFEMErrorCode partition_problem (const std::string &name, int verb=-1)
 partition problem dofs (collective) More...
 
DEPRECATED MoFEMErrorCode partition_compose_problem (const std::string &name, const std::string &problem_for_rows, const bool copy_rows, const std::string &problem_for_cols, const bool copy_cols, int verb=-1)
 build indexing and partition problem inheriting indexing and partitioning from two other problems More...
 
DEPRECATED MoFEMErrorCode build_sub_problem (const std::string &out_name, const std::vector< std::string > &fields_row, const std::vector< std::string > &fields_col, const std::string &main_problem, const bool square_matrix=true, int verb=-1)
 build sub problem More...
 
DEPRECATED MoFEMErrorCode partition_ghost_dofs (const std::string &name, int verb=-1)
 determine ghost nodes More...
 
DEPRECATED MoFEMErrorCode partition_finite_elements (const std::string &name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=-1)
 partition finite elements More...
 
DEPRECATED MoFEMErrorCode get_problem_elements_layout (const std::string &name, const std::string &fe_name, PetscLayout *layout, int verb=-1)
 Get layout of elements in the problem. More...
 
DEPRECATED MoFEMErrorCode VecCreateSeq (const std::string &name, RowColData rc, Vec *V) const
 create local vector for problem More...
 
DEPRECATED MoFEMErrorCode VecCreateGhost (const std::string &name, RowColData rc, Vec *V) const
 create ghost vector for problem (collective) More...
 
DEPRECATED MoFEMErrorCode ISCreateFromProblemFieldToOtherProblemField (const std::string &x_problem, const std::string &x_field_name, RowColData x_rc, const std::string &y_problem, const std::string &y_field_name, RowColData y_rc, std::vector< int > &idx, std::vector< int > &idy, int verb=-1) const
 create IS for give two problems and field More...
 
DEPRECATED MoFEMErrorCode ISCreateFromProblemFieldToOtherProblemField (const std::string &x_problem, const std::string &x_field_name, RowColData x_rc, const std::string &y_problem, const std::string &y_field_name, RowColData y_rc, IS *ix, IS *iy, int verb=-1) const
 create IS for give two problems and field More...
 
DEPRECATED MoFEMErrorCode ISCreateProblemOrder (const std::string &problem, RowColData rc, int min_order, int max_order, IS *is, int verb=-1) const
 create IS for given order range (collective) More...
 
DEPRECATED MoFEMErrorCode ISCreateProblemFieldAndRank (const std::string &problem, RowColData rc, const std::string &field, int min_coeff_idx, int max_coeff_idx, IS *is, int verb=-1) const
 create IS for given problem, field and rank range (collective) More...
 
DEPRECATED MoFEMErrorCode VecScatterCreate (Vec xin, const std::string &x_problem, const std::string &x_field_name, RowColData x_rc, Vec yin, const std::string &y_problem, const std::string &y_field_name, RowColData y_rc, VecScatter *newctx, int verb=-1) const
 create scatter for vectors form one to another problem (collective) More...
 
DEPRECATED MoFEMErrorCode VecScatterCreate (Vec xin, const std::string &x_problem, RowColData x_rc, Vec yin, const std::string &y_problem, RowColData y_rc, VecScatter *newctx, int verb=-1) const
 create scatter for vectors form one to another problem (collective) More...
 
DEPRECATED MoFEMErrorCode set_local_ghost_vector (const Problem *problem_ptr, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to meshdatabase More...
 
DEPRECATED MoFEMErrorCode set_local_ghost_vector (const std::string &name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to meshdatabase More...
 
DEPRECATED MoFEMErrorCode set_global_ghost_vector (const Problem *problem_ptr, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to mesh database (collective) More...
 
DEPRECATED MoFEMErrorCode set_global_ghost_vector (const std::string &name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to mesh database (collective) More...
 
DEPRECATED MoFEMErrorCode set_other_local_ghost_vector (const Problem *problem_ptr, const std::string &fiel_name, const std::string &cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode, int verb=-1)
 Copy vector to field which is not part of the problem. More...
 
DEPRECATED MoFEMErrorCode set_other_local_ghost_vector (const std::string &name, const std::string &field_name, const std::string &cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode, int verb=-1)
 Copy vector to field which is not part of the problem. More...
 
DEPRECATED MoFEMErrorCode set_other_global_ghost_vector (const Problem *problem_ptr, const std::string &field_name, const std::string &cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode, int verb=-1)
 Copy vector to field which is not part of the problem (collective) More...
 
DEPRECATED MoFEMErrorCode set_other_global_ghost_vector (const std::string &name, const std::string &field_name, const std::string &cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode, int verb=-1)
 Copy vector to field which is not part of the problem (collective) More...
 
DEPRECATED MoFEMErrorCode field_axpy (const double alpha, const std::string &fiel_name_x, const std::string &field_name_y, bool error_if_missing=false, bool creat_if_missing=false)
 axpy fields More...
 
DEPRECATED MoFEMErrorCode field_scale (const double alpha, const std::string &field_name)
 scale field More...
 
DEPRECATED MoFEMErrorCode set_field (const double val, const EntityType type, const std::string &field_name)
 use FieldBlas More...
 
DEPRECATED MoFEMErrorCode set_field (const double val, const EntityType type, const Range &ents, const std::string &field_name)
 set field More...
 
DEPRECATED MoFEMErrorCode get_adjacencies_equality (const EntityHandle from_entiti, const int to_dimension, Range &adj_entities) const
 Get the adjacencies associated with a entity to entities of a specified dimension. \ separate interface, i.e. BitLevelManager. More...
 
DEPRECATED MoFEMErrorCode get_adjacencies_any (const EntityHandle from_entiti, const int to_dimension, Range &adj_entities) const
 Get the adjacencies associated with a entity to entities of a specified dimension. More...
 
DEPRECATED MoFEMErrorCode get_adjacencies (const Problem *problem_ptr, const EntityHandle *from_entities, const int num_netities, const int to_dimension, Range &adj_entities, const int operation_type=moab::Interface::INTERSECT, const int verb=0) const
 Get the adjacencies associated with a entity to entities of a specified dimension. \ separate interface, i.e. BitLevelManage. More...
 
DEPRECATED MoFEMErrorCode get_adjacencies (const BitRefLevel &bit, const EntityHandle *from_entities, const int num_netities, const int to_dimension, Range &adj_entities, const int operation_type=moab::Interface::INTERSECT, const int verb=0) const
 Get the adjacencies associated with a entity to entities of a specified dimension. \ separate interface, i.e. BitLevelManage. More...
 
DEPRECATED MoFEMErrorCode clear_dofs_fields (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
DEPRECATED MoFEMErrorCode clear_ents_fields (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
DEPRECATED MoFEMErrorCode clear_finite_elements (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_VERTICEs (const Range &nodes, const std::string &name, int verb=-1)
 set field entities on vertices More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_VERTICEs (const EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities on vertices More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_EDGEs (const Range &edges, const std::string &name, int verb=-1)
 set field entities form adjacencies of edges More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_EDGEs (const EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities form adjacencies of edges More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_TRIs (const EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities form adjacencies of triangles More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_TRIs (const Range &tris, const std::string &name, int verb=-1)
 set field entities form adjacencies of triangles More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_TETs (const EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities from adjacencies of tetrahedron More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_TETs (const Range &tets, const std::string &name, int verb=-1)
 set field entities from adjacencies of tetrahedron More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_QUADs (const Range &quads, const std::string &name, int verb=-1)
 set field entities from adjacencies of quads More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_QUADs (EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities from adjacencies of quads More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_PRISMs (const Range &prisms, const std::string &name, int verb=-1)
 set field entities from adjacencies of prisms More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_PRISMs (EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities from adjacencies of prisms More...
 
DEPRECATED MoFEMErrorCode MatCreateMPIAIJWithArrays (const std::string &name, Mat *Aij, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode MatCreateMPIAdj_with_Idx_mi_tag (const std::string &name, Mat *Adj, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode MatCreateSeqAIJWithArrays (const std::string &name, Mat *Aij, PetscInt **i, PetscInt **j, PetscScalar **v, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode loop_finite_elements (const Problem *problem_ptr, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, MoFEMTypes bh, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode loop_finite_elements (const std::string &problem_name, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, MoFEMTypes bh, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode loop_finite_elements (const std::string &problem_name, const std::string &fe_name, FEMethod &method, MoFEMTypes bh, int verb=DEFAULT_VERBOSITY)
 
virtual 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)=0
 Make a loop over finite elements. More...
 
virtual 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)=0
 Make a loop over finite elements on partitions from upper to lower rank. More...
 
virtual 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)=0
 Make a loop over finite elements on partitions from upper to lower rank. More...
 
DEPRECATED MoFEMErrorCode make_entities_multishared (const EntityHandle *entities, const int num_entities, const int my_proc=0, int verb=DEFAULT_VERBOSITY)
 make entities from proc 0 shared on all proc More...
 
DEPRECATED MoFEMErrorCode make_entities_multishared (Range &entities, const int my_proc=0, int verb=DEFAULT_VERBOSITY)
 make entities from proc 0 shared on all proc More...
 
DEPRECATED MoFEMErrorCode make_field_entities_multishared (const std::string field_name, const int owner_proc=0, int verb=DEFAULT_VERBOSITY)
 make field entities multi shared More...
 
DEPRECATED MoFEMErrorCode exchange_field_data (const std::string field_name, int verb=DEFAULT_VERBOSITY)
 Exchange field data. More...
 
DEPRECATED MoFEMErrorCode synchronise_entities (Range &ent, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode synchronise_field_entities (const std::string &name, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode remove_parents_by_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 
- Public Member Functions inherited from MoFEM::CoreInterface
virtual ~CoreInterface ()=default
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (const MOFEMuuid &uuid, bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE , bool VERIFY = false>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, IFACE *&iface) const
 Get interface by uuid and return reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 
virtual MoFEMErrorCode getLibVersion (Version &version) const
 Get library version. More...
 
virtual const MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version) const
 Get database major version. More...
 
virtual MoFEMErrorCode getInterfaceVersion (Version &version) const
 Get database major version. More...
 
template<>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, UnknownInterface *&iface) const
 

Static Public Attributes

static constexpr int value = 0
 

Protected Member Functions

template<int V>
 CoreTmp (moab::Interface &moab, MPI_Comm comm, const int verbose, CoreValue< V >)
 
MoFEMErrorCode coreGenericConstructor (moab::Interface &moab, MPI_Comm comm, const int verbose)
 
MoFEMErrorCode addProblem (const BitProblemId id, const std::string &name, int verb=DEFAULT_VERBOSITY)
 add problem More...
 
MoFEMErrorCode getTags (int verb=DEFAULT_VERBOSITY)
 Get tag handles. More...
 
MoFEMErrorCode clearMap ()
 Cleaning database. More...
 
MoFEMErrorCode registerSubInterfaces ()
 Register insterfaces. More...
 
BitFieldId getFieldShift ()
 Return unique field Id. More...
 
BitFEId getFEShift ()
 Return unique finite element Id. More...
 
BitProblemId getProblemShift ()
 Return unique problem Id. More...
 
MoFEMErrorCode initialiseDatabaseFromMesh (int verb=DEFAULT_VERBOSITY)
 Initialize database getting information on mesh. More...
 
MoFEMErrorCode getOptions (int verb=DEFAULT_VERBOSITY)
 Get core options from command line. More...
 
template<class IFACE >
MoFEMErrorCode regSubInterface (const MOFEMuuid &uid)
 Register subinterfac in core interface. More...
 
- Protected Member Functions inherited from MoFEM::UnknownInterface
boost::typeindex::type_index getClassIdx (const MOFEMuuid &uid) const
 Get type name for interface Id. More...
 
MOFEMuuid getUId (const boost::typeindex::type_index &class_idx) const
 Get interface Id for class name. More...
 

Protected Attributes

boost::shared_ptr< WrapMPIComm > wrapMPIComm
 
int verbose
 Verbosity level. More...
 
int * fShift
 Ptr to tag handle storing last set bit in field ID. More...
 
int * feShift
 Ptr to tag handle storing last set bit in finite element ID. More...
 
int * pShift
 Ptr to tag handle storing last set bit in problem ID. More...
 
boost::ptr_map< unsigned long, UnknownInterfaceiFaces
 Hash map of pointers to interfaces. More...
 
int * buildMoFEM
 keeps flags/semaphores for different stages More...
 
std::string optionsPrefix
 Prefix for options on command line. More...
 
PetscBool initaliseAndBuildField
 
PetscBool initaliseAndBuildFiniteElements
 

Static Protected Attributes

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

Global initialisation and finalisation


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

Static functions

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

Assessing interfaces

MoFEMErrorCode query_interface (const MOFEMuuid &uuid, UnknownInterface **iface) const
 Getting interface of core database. More...
 

Get tag handles to data on the mesh

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

Auxiliary data and functions

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

Tags to data on mesh and entities

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

Multi-Indices accessing data on the mesh

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

Get moab database

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

Check database consistency

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

Clear database

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

Getting access to meshset manager

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

Remove and delete entities

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

Fields

virtual MoFEMErrorCode add_field (const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 Add filed. More...
 
MoFEMErrorCode addField (const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type, const enum MoFEMTypes bh, int verb)
 Template for add_field. More...
 
MoFEMErrorCode addEntsToFieldByDim (const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode add_ents_to_field_by_dim (const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. More...
 
MoFEMErrorCode add_ents_to_field_by_type (const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. More...
 
MoFEMErrorCode add_ents_to_field_by_dim (const EntityHandle meshset, const int dim, const std::string &name, const bool recursive=true, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. More...
 
MoFEMErrorCode add_ents_to_field_by_type (const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. More...
 
MoFEMErrorCode create_vertices_and_add_to_field (const std::string name, const double coords[], int size, int verb=DEFAULT_VERBOSITY)
 Create a vertices and add to field object. More...
 

Set approximation order

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

Build fields

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

Clear DOFs

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

Clear ENTs

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

Remove field entities

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

Other auxiliary functions for fields

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

Finite elements

bool check_finite_element (const std::string &name) const
 Check if finite element is in database. More...
 
MoFEMErrorCode add_finite_element (const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 add finite element More...
 
MoFEMErrorCode modify_finite_element_adjacency_table (const std::string &fe_name, const EntityType type, ElementAdjacencyFunct function)
 modify finite element table, only for advanced user More...
 
MoFEMErrorCode modify_finite_element_add_field_data (const std::string &fe_name, const std::string &name_filed)
 set finite element field data More...
 
MoFEMErrorCode modify_finite_element_add_field_row (const std::string &fe_name, const std::string &name_row)
 set field row which finite element use More...
 
MoFEMErrorCode modify_finite_element_add_field_col (const std::string &fe_name, const std::string &name_col)
 set field col which finite element use More...
 
MoFEMErrorCode modify_finite_element_off_field_data (const std::string &fe_name, const std::string &name_filed)
 unset finite element field data More...
 
MoFEMErrorCode modify_finite_element_off_field_row (const std::string &fe_name, const std::string &name_row)
 unset field row which finite element use More...
 
MoFEMErrorCode modify_finite_element_off_field_col (const std::string &fe_name, const std::string &name_col)
 unset field col which finite element use More...
 
MoFEMErrorCode add_ents_to_finite_element_by_type (const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
 add entities to finite element More...
 
MoFEMErrorCode add_ents_to_finite_element_by_dim (const EntityHandle meshset, const int dim, const std::string &name, const bool recursive=true)
 add entities to finite element More...
 
MoFEMErrorCode add_ents_to_finite_element_by_type (const Range &ents, const EntityType type, const std::string &name)
 add entities to finite elements More...
 
MoFEMErrorCode add_ents_to_finite_element_by_dim (const Range &ents, const int dim, const std::string &name)
 add entities to finite elements More...
 
MoFEMErrorCode add_ents_to_finite_element_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
 add TET entities from given refinement level to finite element database given by name More...
 
MoFEMErrorCode add_ents_to_finite_element_by_MESHSET (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add MESHSET element to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_VERTICEs (const Range &vert, const std::string &name)
 add VERTICES entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_EDGEs (const Range &vert, const std::string &name)
 add EDGES entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_EDGEs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add EDGES finite elements More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TRIs (const Range &tris, const std::string &name)
 add TRI entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TRIs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add TRI entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TETs (const Range &tets, const std::string &name)
 add TET entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TETs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add TET entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_PRISMs (const Range &prims, const BitFEId id)
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_PRISMs (const Range &prims, const std::string &name)
 add PRISM entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_PRISMs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add TET entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_EntType_by_bit_ref (const BitRefLevel &bit, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
 add TET elements from given refinement level to finite element database given by name More...
 
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)
 add TET entities from given refinement level to finite element database given by name More...
 
MoFEMErrorCode remove_ents_from_finite_element_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 remove elements from given refinement level to finite element database More...
 
MoFEMErrorCode remove_ents_from_finite_element (const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
 remove entities from given refinement level to finite element database More...
 
MoFEMErrorCode remove_ents_from_finite_element (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from finite element database More...
 
MoFEMErrorCode remove_ents_from_finite_element (const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from finite elements in database More...
 
MoFEMErrorCode delete_finite_element (const std::string name, int verb=DEFAULT_VERBOSITY)
 delete finite element from mofem database More...
 
BitFEId getBitFEId (const std::string &name) const
 Get field Id. More...
 
std::string getBitFEIdName (const BitFEId id) const
 Get field name. More...
 
EntityHandle get_finite_element_meshset (const BitFEId id) const
 
EntityHandle get_finite_element_meshset (const std::string &name) const
 
MoFEMErrorCode get_finite_element_entities_by_dimension (const std::string name, int dim, Range &ents) const
 get entities in the finite element by dimension More...
 
MoFEMErrorCode get_finite_element_entities_by_type (const std::string name, EntityType type, Range &ents) const
 get entities in the finite element by type More...
 
MoFEMErrorCode get_finite_element_entities_by_handle (const std::string name, Range &ents) const
 get entities in the finite element by handle More...
 
MoFEMErrorCode list_finite_elements () const
 list finite elements in database More...
 

Problems

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

Adjacencies

MoFEMErrorCode build_adjacencies (const Range &ents, int verb=DEFAULT_VERBOSITY)
 build adjacencies More...
 
MoFEMErrorCode build_adjacencies (const BitRefLevel &bit, int verb=DEFAULT_VERBOSITY)
 build adjacencies More...
 
MoFEMErrorCode build_adjacencies (const BitRefLevel &bit, const BitRefLevel &mask, int verb=DEFAULT_VERBOSITY)
 build adjacencies More...
 
MoFEMErrorCode clear_adjacencies_entities (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 clear adjacency map for entities on given bit level More...
 
MoFEMErrorCode clear_adjacencies_entities (const Range ents, int verb=DEFAULT_VERBOSITY)
 clear adjacencies for field entities by entities More...
 
MoFEMErrorCode clear_adjacencies_entities (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 clear adjacencies for field entities by entities and field namd More...
 
MoFEMErrorCode clear_adjacencies_finite_elements (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 clear adjacency map for finite elements on given bit level More...
 
MoFEMErrorCode clear_adjacencies_finite_elements (const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_adjacencies_finite_elements (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 

Methods for preforming operations on elements

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

Accessing multi-indices

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

Log events

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

Communicator

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

Detailed Description

Core (interface) class.

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

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

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

Todo:
Implement static functions for Initialization and Finalization of MoFEM. Those functions should keep all static variables and initialize/finalize other libs like PETSc. Moreover initialization functions should set error handlers, etc.
Examples
add_blockset.cpp, add_cubit_meshsets.cpp, analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, bernstein_bezier_generate_base.cpp, bone_adaptation.cpp, boundary_marker.cpp, build_large_problem.cpp, build_problems.cpp, cell_forces.cpp, contact.cpp, continuity_check_on_contact_prism_side_ele.cpp, continuity_check_on_skeleton_3d.cpp, continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, cubit_bc_test.cpp, delete_ho_nodes.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, dynamic_elastic.cpp, edge_and_bubble_shape_functions_on_quad.cpp, eigen_elastic.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, ep.cpp, field_blas_set_vertex_dofs.cpp, field_evaluator.cpp, field_to_vertices.cpp, forces_and_sources_testing_edge_element.cpp, forces_and_sources_testing_flat_prism_element.cpp, forces_and_sources_testing_users_base.cpp, gauss_points_on_quad.cpp, hcurl_check_approx_in_2d.cpp, hcurl_curl_operator.cpp, hcurl_divergence_operator_2d.cpp, hdiv_divergence_operator.cpp, heat_equation.cpp, hello_world.cpp, helmholtz.cpp, hertz_surface.cpp, log.cpp, loop_entities.cpp, lorentz_force.cpp, magnetostatic.cpp, mesh_cut.cpp, mesh_insert_interface_atom.cpp, mesh_smoothing.cpp, meshset_to_vtk.cpp, minimal_surface_area.cpp, prism_elements_from_surface.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, reaction_diffusion.cpp, remove_entities_from_problem.cpp, scalar_check_approximation_2d.cpp, simple_contact.cpp, simple_elasticity.cpp, simple_interface.cpp, split_sideset.cpp, test_cache_on_entities.cpp, test_jacobian_of_simple_contact_element.cpp, testing_jacobian_of_hook_element.cpp, testing_jacobian_of_hook_scaled_with_density_element.cpp, unsaturated_transport.cpp, wave_equation.cpp, and wavy_surface.cpp.

Definition at line 77 of file Core.hpp.

Member Enumeration Documentation

◆ SemaphoresBuildMofem

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

Enumerator
BUILD_FIELD 
BUILD_FE 
BUILD_ADJ 
BUILD_PROBLEM 
PARTITION_PROBLEM 
PARTITION_FE 
PARTITION_GHOST_DOFS 
PARTITION_MESH 

Definition at line 207 of file Core.hpp.

207  {
208  BUILD_FIELD = 1 << 0,
209  BUILD_FE = 1 << 1,
210  BUILD_ADJ = 1 << 2,
211  BUILD_PROBLEM = 1 << 3,
212  PARTITION_PROBLEM = 1 << 4,
213  PARTITION_FE = 1 << 5,
214  PARTITION_GHOST_DOFS = 1 << 6,
215  PARTITION_MESH = 1 << 7
216  };

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

199  : CoreTmp(moab, comm, verbose, CoreValue<0>()) {
200 
201  // Register sub-interfaces
202  ierr = this->registerSubInterfaces();
203  CHKERRABORT(comm, ierr);
204  ierr = this->clearMap();
205  CHKERRABORT(comm, ierr);
206  ierr = this->getTags();
207  CHKERRABORT(comm, ierr);
208  ierr = this->getOptions(verbose);
209  CHKERRABORT(comm, ierr);
210 
211  this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
213 
215  CHKERRABORT(comm, ierr);
216 }

◆ ~CoreTmp()

MoFEM::Core::~CoreTmp ( )

Definition at line 243 of file Core.cpp.

243  {
244  PetscBool is_finalized;
245  PetscFinalized(&is_finalized);
246  // Destroy interfaces
247  iFaces.clear();
248  // This is deprecated ONE should use MoFEM::Core::Initialize
249  if (isGloballyInitialised && is_finalized) {
250  isGloballyInitialised = false;
251  }
252 }

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

46  : moab(moab), cOmm(0), verbose(verbose),
47  initaliseAndBuildField(PETSC_FALSE),
48  initaliseAndBuildFiniteElements(PETSC_FALSE) {
49 
51  CHKERRABORT(comm, ierr);
52 
53  if (verbose > QUIET) {
54  MOFEM_LOG_CHANNEL("WORLD");
55  MOFEM_LOG_C("WORLD", Sev::verbose, "Core number < %d >", V);
56  }
57 }

Member Function Documentation

◆ add_ents_to_field_by_dim() [1/2]

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

Add entities to field meshset.

\not collective

The lower dimension entities are added depending on the space type

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

Implements MoFEM::CoreInterface.

Definition at line 365 of file FieldCore.cpp.

368  {
370  Range ents;
371  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
372  CHKERR addEntsToFieldByDim(ents, dim, name, verb);
374 }

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

347  {
348  Range ents_dim = ents.subset_by_dimension(dim);
349  return addEntsToFieldByDim(ents_dim, dim, name, verb);
350 }

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

379  {
381  Range ents;
382  CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
383  if (!ents.empty()) {
384  const int dim = get_moab().dimension_from_handle(ents[0]);
385  CHKERR addEntsToFieldByDim(ents, dim, name, verb);
386  }
388 }

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

355  {
357  Range ents_type = ents.subset_by_type(type);
358  if (!ents_type.empty()) {
359  const int dim = get_moab().dimension_from_handle(ents_type[0]);
360  CHKERR addEntsToFieldByDim(ents_type, dim, name, verb);
361  }
363 }

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

453  {
455 
456  if (verb == -1)
457  verb = verbose;
458  *buildMoFEM &= 1 << 0;
459  const BitFEId id = getBitFEId(name);
461 
462  auto &ref_MoFEMFiniteElement = refinedFiniteElements.get<Ent_mi_tag>();
463  auto miit = ref_MoFEMFiniteElement.lower_bound(get_id_for_min_type(type));
464  auto hi_miit = ref_MoFEMFiniteElement.upper_bound(get_id_for_max_type(type));
465 
466  int nb_add_fes = 0;
467  for (; miit != hi_miit; miit++) {
468  BitRefLevel bit2 = miit->get()->getBitRefLevel();
469  if ((bit2 & mask) != bit2)
470  continue;
471  if ((bit2 & bit).any()) {
472  EntityHandle ent = miit->get()->getEnt();
473  CHKERR get_moab().add_entities(idm, &ent, 1);
474  nb_add_fes++;
475  }
476  }
477 
478  MOFEM_LOG("SYNC", Sev::inform)
479  << "Finite element " << name << " added. Nb. of elements added "
480  << nb_add_fes << " out of " << std::distance(miit, hi_miit);
481 
483 
485 }

◆ add_ents_to_finite_element_by_dim() [1/2]

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

add entities to finite element

Note
not collective
Parameters
entitiesmeshset or range form were entities taken
dimdimension
namename of field
recursivetake entities from meshsets in meshset
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 332 of file FECore.cpp.

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

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

360  {
361  EntityHandle idm = no_handle;
362  *buildMoFEM &= 1 << 0;
365  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
366  ents.subset_by_dimension(dim));
367  CHKERR get_moab().add_entities(idm, ents.subset_by_dimension(dim));
369 }

◆ add_ents_to_finite_element_by_EDGEs() [1/2]

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

add EDGES finite elements

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
meshset
namename of finite element
recursivetake entities from meshsets in meshset
Returns
error code

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 371 of file FECore.cpp.

372  {
374  CHKERR add_ents_to_finite_element_by_type(meshset, MBEDGE, name, recursive);
376 }

◆ add_ents_to_finite_element_by_EDGEs() [2/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_EDGEs ( const Range &  edge,
const std::string &  name 
)
protectedvirtual

add EDGES entities from range to finite element database given by name

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
rangecontains tetrahedron
nameFinite Element name

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 378 of file FECore.cpp.

379  {
381  CHKERR add_ents_to_finite_element_by_type(edges, MBEDGE, name);
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 487 of file FECore.cpp.

488  {
490  *buildMoFEM &= 1 << 0;
491  const BitFEId id = getBitFEId(name);
493  if (recursive == false) {
494  CHKERR get_moab().add_entities(idm, &meshset, 1);
495  } else {
496  Range meshsets;
497  CHKERR get_moab().get_entities_by_type(meshset, MBENTITYSET, meshsets,
498  false);
499  CHKERR get_moab().add_entities(idm, meshsets);
500  }
502 }

◆ add_ents_to_finite_element_by_PRISMs() [1/3]

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

add TET entities from meshset to finite element database given by name

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
meshsetcontains tetrahedron
nameFinite Element name
recursiveif true parent meshset is searched recursively

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 424 of file FECore.cpp.

425  {
427  CHKERR add_ents_to_finite_element_by_type(meshset, MBPRISM, name, recursive);
429 }

◆ add_ents_to_finite_element_by_PRISMs() [2/3]

DEPRECATED MoFEMErrorCode MoFEM::CoreTmp< 0 >::add_ents_to_finite_element_by_PRISMs ( const Range &  prims,
const BitFEId  id 
)
protected

◆ add_ents_to_finite_element_by_PRISMs() [3/3]

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_PRISMs ( const Range &  prims,
const std::string &  name 
)
protectedvirtual

add PRISM entities from meshset to finite element database given by name

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
rangecontains tetrahedron
nameFinite Element name

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 418 of file FECore.cpp.

419  {
421  CHKERR add_ents_to_finite_element_by_type(prims, MBPRISM, name);
423 }

◆ add_ents_to_finite_element_by_TETs() [1/2]

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

add TET entities from meshset to finite element database given by name

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
meshsetcontains tetrahedron
nameFinite Element name
recursiveif true parent meshset is searched recursively

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 411 of file FECore.cpp.

412  {
414  CHKERR add_ents_to_finite_element_by_type(meshset, MBTET, name, recursive);
416 }

◆ add_ents_to_finite_element_by_TETs() [2/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_TETs ( const Range &  tets,
const std::string &  name 
)
protectedvirtual

add TET entities from range to finite element database given by name

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
rangecontains tetrahedron
nameFinite Element name

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 405 of file FECore.cpp.

406  {
408  CHKERR add_ents_to_finite_element_by_type(tets, MBTET, name);
410 }

◆ add_ents_to_finite_element_by_TRIs() [1/2]

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

add TRI entities from meshset to finite element database given by name

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
rangecontains tetrahedron
nameFinite Element name
recursiveif true parent meshset is searched recursively

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 398 of file FECore.cpp.

399  {
401  CHKERR add_ents_to_finite_element_by_type(meshset, MBTRI, name, recursive);
403 }

◆ add_ents_to_finite_element_by_TRIs() [2/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_TRIs ( const Range &  tris,
const std::string &  name 
)
protectedvirtual

add TRI entities from range to finite element database given by name

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
rangecontains tetrahedron
nameFinite Element name

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 392 of file FECore.cpp.

393  {
395  CHKERR add_ents_to_finite_element_by_type(tris, MBTRI, name);
397 }

◆ add_ents_to_finite_element_by_type() [1/2]

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

add entities to finite element

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

Implements MoFEM::CoreInterface.

Definition at line 315 of file FECore.cpp.

317  {
318  *buildMoFEM &= 1 << 0;
319  EntityHandle idm = no_handle;
321 
323  Range ents;
324  CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
325  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
326  CHKERR get_moab().add_entities(idm, ents);
327 
329 }

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

347  {
348  EntityHandle idm = no_handle;
349  *buildMoFEM &= 1 << 0;
352  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
353  ents.subset_by_type(type));
354  CHKERR get_moab().add_entities(idm, ents.subset_by_type(type));
356 } // namespace MoFEM

◆ add_ents_to_finite_element_by_VERTICEs()

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_VERTICEs ( const Range &  vert,
const std::string &  name 
)
protectedvirtual

add VERTICES entities from range to finite element database given by name

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
rangecontains tetrahedron
nameFinite Element name

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 385 of file FECore.cpp.

386  {
388  CHKERR add_ents_to_finite_element_by_type(vert, MBVERTEX, name);
390 }

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

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

Deprecated:
use add_ents_to_finite_element_by_bit_ref with mask explicitly given
Parameters
BitRefLevelbit
BitRefLevelmask
finiteelement name
finiteelement type
verrboselevel

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 442 of file FECore.cpp.

444  {
446  CHKERR add_ents_to_finite_element_by_bit_ref(bit, mask, name, type, verb);
447 
449 }

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

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

Deprecated:
use add_ents_to_finite_element_by_bit_ref with mask explicitly given
Parameters
BitRefLevelbit
finiteelement name
finiteelenent type
verrboselevel

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 432 of file FECore.cpp.

434  {
437  type, verb);
438 
440 }

◆ add_field()

MoFEMErrorCode MoFEM::Core::add_field ( const std::string &  name,
const FieldSpace  space,
const FieldApproximationBase  base,
const FieldCoefficientsNumber  nb_coefficients,
const TagType  tag_type = MB_TAG_SPARSE,
const enum MoFEMTypes  bh = MF_EXCL,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Add filed.

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

TODO:

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

FIXME:

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

Implements MoFEM::CoreInterface.

Definition at line 257 of file FieldCore.cpp.

261  {
262  return this->addField(name, space, base, nb_of_coefficients, tag_type, bh,
263  verb);
264 }

◆ add_finite_element()

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

add finite element

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

Example

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

Implements MoFEM::CoreInterface.

Definition at line 41 of file FECore.cpp.

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

◆ 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()) {
92  CHKERR addProblem(id, name, verb);
93  } else if (bh == MF_EXCL) {
94  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem is in database %s",
95  name.c_str());
96  }
98 }

◆ addEntsToFieldByDim()

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

Definition at line 266 of file FieldCore.cpp.

267  {
268 
269  *buildMoFEM = 0;
270  EntityHandle idm = no_handle;
271  if (verb == -1)
272  verb = verbose;
274  idm = get_field_meshset(name);
275  FieldSpace space;
276  CHKERR get_moab().tag_get_data(th_FieldSpace, &idm, 1, &space);
277  std::vector<int> nb_ents_on_dim(3, 0);
278  switch (space) {
279  case L2:
280  CHKERR get_moab().add_entities(idm, ents);
281  if (verb >= VERY_VERBOSE) {
282  std::ostringstream ss;
283  ss << "add entities to field " << name;
284  ss << " nb. add ents " << ents.size();
285  ss << std::endl;
286  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
287  }
288  break;
289  case H1:
290  CHKERR get_moab().add_entities(idm, ents);
291  for (int dd = 0; dd != dim; ++dd) {
292  Range adj_ents;
293  CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
294  moab::Interface::UNION);
295  if (dd == 0) {
296  Range topo_nodes;
297  CHKERR get_moab().get_connectivity(ents, topo_nodes, true);
298  Range mid_nodes;
299  CHKERR get_moab().get_connectivity(ents, mid_nodes, false);
300  mid_nodes = subtract(mid_nodes, topo_nodes);
301  adj_ents = subtract(adj_ents, mid_nodes);
302  }
303  CHKERR get_moab().add_entities(idm, adj_ents);
304  nb_ents_on_dim[dd] = adj_ents.size();
305  }
306  break;
307  case HCURL:
308  CHKERR get_moab().add_entities(idm, ents);
309  for (int dd = 1; dd != dim; ++dd) {
310  Range adj_ents;
311  CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
312  moab::Interface::UNION);
313  CHKERR get_moab().add_entities(idm, adj_ents);
314  nb_ents_on_dim[dd] = adj_ents.size();
315  }
316  break;
317  case HDIV:
318  CHKERR get_moab().add_entities(idm, ents);
319  if (dim > 2) {
320  Range adj_ents;
321  CHKERR get_moab().get_adjacencies(ents, 2, false, adj_ents,
322  moab::Interface::UNION);
323  CHKERR get_moab().add_entities(idm, adj_ents);
324  nb_ents_on_dim[2] = adj_ents.size();
325  }
326  break;
327  default:
328  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
329  "sorry, unknown space added to entity");
330  }
331  if (verb >= VERY_VERBOSE) {
332  std::ostringstream ss;
333  ss << "add entities to field " << name;
334  ss << " nb. add ents " << ents.size();
335  ss << " nb. add faces " << nb_ents_on_dim[2];
336  ss << " nb. add edges " << nb_ents_on_dim[1];
337  ss << " nb. add nodes " << nb_ents_on_dim[0];
338  ss << std::endl;
339  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
340  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
341  }
343 }

◆ addField()

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

Template for add_field.

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

Definition at line 109 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  if (verb == -1)
122  verb = verbose;
123  *buildMoFEM = 0;
124  auto fit = fIelds.get<FieldName_mi_tag>().find(name);
125  if (fit != fIelds.get<FieldName_mi_tag>().end()) {
126  if (bh == MF_EXCL)
127  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
128  "field is <%s> in database", name.c_str());
129 
130  } else {
131 
132  EntityHandle meshset;
133  CHKERR get_moab().create_meshset(MESHSET_SET, meshset);
134 
135  // Add field mesh set to partion meshset. In case of no elements
136  // on processor part, when mesh file is read, finite element meshset is
137  // prevented from deletion by moab reader.
138  auto add_meshset_to_partition = [&](auto meshset) {
140  const void *tag_vals[] = {&rAnk};
141  ParallelComm *pcomm = ParallelComm::get_pcomm(
142  &get_moab(), get_basic_entity_data_ptr()->pcommID);
143  Tag part_tag = pcomm->part_tag();
144  Range tagged_sets;
145  CHKERR get_moab().get_entities_by_type_and_tag(0, MBENTITYSET, &part_tag,
146  tag_vals, 1, tagged_sets,
147  moab::Interface::UNION);
148  for (auto s : tagged_sets)
149  CHKERR get_moab().add_entities(s, &meshset, 1);
151  };
152  CHKERR add_meshset_to_partition(meshset);
153 
154  // id
155  BitFieldId id = getFieldShift();
156 
157  auto create_tags = [&]() {
159  CHKERR
160  get_moab().tag_set_data(th_FieldId, &meshset, 1, &id);
161  // space
162  CHKERR get_moab().tag_set_data(th_FieldSpace, &meshset, 1, &space);
163  // base
164  CHKERR get_moab().tag_set_data(th_FieldBase, &meshset, 1, &base);
165 
166  // name
167  void const *tag_data[] = {name.c_str()};
168  int tag_sizes[1];
169  tag_sizes[0] = name.size();
170  CHKERR get_moab().tag_set_by_ptr(th_FieldName, &meshset, 1, tag_data,
171  tag_sizes);
172  // name data prefix
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, th_rank;
180  // data
181  std::string tag_data_name = name_data_prefix + name;
182  const int def_len = 0;
183  CHKERR get_moab().tag_get_handle(
184  tag_data_name.c_str(), def_len, MB_TYPE_DOUBLE, th_field_data,
185  MB_TAG_CREAT | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
186  std::string tag_data_name_verts = name_data_prefix + name + "V";
187  VectorDouble def_vert_data(nb_of_coefficients);
188  def_vert_data.clear();
189  CHKERR get_moab().tag_get_handle(
190  tag_data_name_verts.c_str(), nb_of_coefficients, MB_TYPE_DOUBLE,
191  th_field_data_vert, MB_TAG_CREAT | tag_type, &*def_vert_data.begin());
192  // order
193  ApproximationOrder def_ApproximationOrder = -1;
194  const std::string Tag_ApproximationOrder_name = "_App_Order_" + name;
195  CHKERR get_moab().tag_get_handle(
196  Tag_ApproximationOrder_name.c_str(), 1, MB_TYPE_INTEGER, th_app_order,
197  MB_TAG_CREAT | tag_type, &def_ApproximationOrder);
198  // rank
199  int def_rank = 1;
200  const std::string tag_rank_name = "_Field_Rank_" + name;
201  CHKERR get_moab().tag_get_handle(tag_rank_name.c_str(), 1,
202  MB_TYPE_INTEGER, th_rank,
203  MB_TAG_CREAT | MB_TAG_SPARSE, &def_rank);
204  CHKERR get_moab().tag_set_data(th_rank, &meshset, 1, &nb_of_coefficients);
205 
207  };
208 
209  auto create_undefined_cs = [&](auto &undefined_cs_ptr) {
211  const int unidefined_cs_dim[] = {-1, 0, 0, 0};
212  CHKERR getInterface<CoordSystemsManager>()->addCoordinateSystem(
213  unidefined_cs_dim, "UNDEFINED", MF_ZERO);
214  CHKERR getInterface<CoordSystemsManager>()->getCoordSysPtr(
215  "UNDEFINED", undefined_cs_ptr);
217  };
218 
219  auto add_field_meshset_to_cs = [&](auto &undefined_cs_ptr) {
221  int cs_name_size[1];
222  cs_name_size[0] = undefined_cs_ptr->getName().size();
223  void const *cs_name[] = {&*undefined_cs_ptr->getNameRef().begin()};
224  CHKERR get_moab().tag_set_by_ptr(
225  getInterface<CoordSystemsManager>()->get_th_CoordSysName(), &meshset,
226  1, cs_name, cs_name_size);
227  EntityHandle coord_sys_meshset = undefined_cs_ptr->getMeshset();
228  CHKERR get_moab().add_entities(coord_sys_meshset, &meshset, 1);
230  };
231 
232  CHKERR create_tags();
233  boost::shared_ptr<CoordSys> undefined_cs_ptr;
234  CHKERR create_undefined_cs(undefined_cs_ptr);
235  CHKERR add_field_meshset_to_cs(undefined_cs_ptr);
236 
237  auto p = fIelds.insert(
238  boost::make_shared<Field>(moab, meshset, undefined_cs_ptr));
239  if (verb > QUIET) {
240  MOFEM_LOG("WORLD", Sev::inform) << "Add field " << **p.first;
241  MOFEM_LOG("WORLD", Sev::noisy)
242  << "Field " << (*p.first)->getName() << " core value < "
243  << this->getValue() << " > field value ) "
244  << (*p.first)->getBitNumber() << " )";
245  }
246 
247  if (!p.second)
248  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND,
249  "field not inserted %s (top tip, it could be already "
250  "there)",
251  Field(moab, meshset, undefined_cs_ptr).getName().c_str());
252  }
253 
255 }

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

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

◆ addProblem()

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

add problem

Parameters
idproblem id
nameproblem name
verbverbosity level
Returns
MoFEMErrorCode

Definition at line 40 of file ProblemsCore.cpp.

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

◆ build_adjacencies() [1/3]

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

build adjacencies

Parameters
bitadjacencies for refine level
maskmask for bit level

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

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

Implements MoFEM::CoreInterface.

Definition at line 897 of file FECore.cpp.

898  {
900  if (verb == -1)
901  verb = verbose;
902  Range ents;
903  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents);
904 
905  CHKERR build_adjacencies(ents, verb);
906 
908 }

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

909  {
911  if (verb == -1)
912  verb = verbose;
913  CHKERR build_adjacencies(bit, BitRefLevel().set(), verb);
914 
916 }

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

824  {
826  if (verb == DEFAULT_VERBOSITY)
827  verb = verbose;
828 
829  if (!((*buildMoFEM) & BUILD_FIELD))
830  SETERRQ(cOmm, MOFEM_NOT_FOUND, "field not build");
831  if (!((*buildMoFEM) & BUILD_FE))
832  SETERRQ(cOmm, MOFEM_NOT_FOUND, "fe not build");
833  for (Range::const_pair_iterator peit = ents.pair_begin();
834  peit != ents.pair_end(); ++peit) {
835  EntFiniteElement_multiIndex::index<Ent_mi_tag>::type::iterator fit, hi_fit;
836  fit = entsFiniteElements.get<Ent_mi_tag>().lower_bound(peit->first);
837  hi_fit = entsFiniteElements.get<Ent_mi_tag>().upper_bound(peit->second);
838  for (; fit != hi_fit; ++fit) {
839  if ((*fit)->getBitFieldIdRow().none() &&
840  (*fit)->getBitFieldIdCol().none() &&
841  (*fit)->getBitFieldIdData().none())
842  continue;
843  int by = BYROW;
844  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol())
845  by |= BYCOL;
846  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData())
847  by |= BYDATA;
848  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_row(by);
849  auto hint = entFEAdjacencies.end();
850  for (auto e : *(*fit)->getRowFieldEntsPtr()) {
851  hint = entFEAdjacencies.emplace_hint(hint, e.lock(), *fit);
852  bool success = entFEAdjacencies.modify(hint, modify_row);
853  if (!success)
854  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
855  "modification unsuccessful");
856  }
857  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol()) {
858  int by = BYCOL;
859  if ((*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData())
860  by |= BYDATA;
861  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_col(by);
862  auto hint = entFEAdjacencies.end();
863  for (auto e : *(*fit)->getColFieldEntsPtr()) {
864  hint = entFEAdjacencies.emplace_hint(hint, e.lock(), *fit);
865  bool success = entFEAdjacencies.modify(hint, modify_col);
866  if (!success)
867  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
868  "modification unsuccessful");
869  }
870  }
871  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData() ||
872  (*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData()) {
873  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_data(
874  BYDATA);
875  auto hint = entFEAdjacencies.end();
876  for (auto &e : (*fit)->getDataFieldEnts()) {
877  hint = entFEAdjacencies.emplace_hint(hint, e.lock(), *fit);
878  bool success = entFEAdjacencies.modify(hint, modify_data);
879  if (!success)
880  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
881  "modification unsuccessful");
882  }
883  }
884  }
885  }
886 
887  if (verb >= VERBOSE) {
888  MOFEM_LOG("WORLD", Sev::inform)
889  << "Number of adjacencies " << entFEAdjacencies.size();
891  }
892 
893  *buildMoFEM |= 1 << 2;
895 }

◆ build_field()

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

build field by name

Parameters
field_name
verbm
Returns
MoFEMErrorCode

Implements MoFEM::CoreInterface.

Definition at line 1257 of file FieldCore.cpp.

1257  {
1259  auto field_it = fIelds.get<FieldName_mi_tag>().find(field_name);
1260  if (field_it == fIelds.get<FieldName_mi_tag>().end())
1261  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field < %s > not found",
1262  field_name.c_str());
1263 
1264  CHKERR this->buildField(*field_it, verb);
1265  if (verb > QUIET)
1268 }

◆ build_fields()

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

build fields

Implements MoFEM::CoreInterface.

Definition at line 1270 of file FieldCore.cpp.

1270  {
1272  if (verb == -1)
1273  verb = verbose;
1274 
1275  for (auto field : fIelds.get<BitFieldId_mi_tag>())
1276  CHKERR this->buildField(field, verb);
1277 
1278  *buildMoFEM = 1 << 0;
1279  if (verb > QUIET) {
1280  MOFEM_LOG("SYNC", Sev::inform) << "Number of dofs " << dofsField.size();
1282  }
1283 
1285 }

◆ build_finite_elements() [1/3]

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

Definition at line 790 of file FECore.cpp.

790  {
792  SETERRQ(cOmm, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
794 }

◆ build_finite_elements() [2/3]

MoFEMErrorCode MoFEM::CoreTmp< 0 >::build_finite_elements ( const string  fe_name,
const Range *const  ents_ptr = nullptr,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Build finite elements.

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

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

Implements MoFEM::CoreInterface.

◆ build_finite_elements() [3/3]

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

Build finite elements.

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

Parameters
verbVerbosity level
Returns
Error code

Implements MoFEM::CoreInterface.

Definition at line 743 of file FECore.cpp.

743  {
745 
746  if (verb == DEFAULT_VERBOSITY)
747  verb = verbose;
748 
749  // loop Finite Elements
750  for (auto &fe : finiteElements)
751  CHKERR buildFiniteElements(fe, NULL, verb);
752 
753  if (verb > QUIET) {
754 
755  auto &fe_ents = entsFiniteElements.get<FiniteElement_name_mi_tag>();
756  for (auto &fe : finiteElements) {
757  auto miit = fe_ents.lower_bound(fe->getName());
758  auto hi_miit = fe_ents.upper_bound(fe->getName());
759  const auto count = std::distance(miit, hi_miit);
760  MOFEM_LOG("SYNC", Sev::inform)
761  << "Finite element " << fe->getName()
762  << " added. Nb. of elements added " << count;
763  MOFEM_LOG("SYNC", Sev::noisy) << *fe;
764 
765  auto slg = MoFEM::LogManager::getLog("SYNC");
766  for (auto &field : fIelds) {
767  auto rec = slg.open_record(keywords::severity = Sev::verbose);
768  if (rec) {
769  logging::record_ostream strm(rec);
770  strm << "Field " << field->getName() << " on finite element: ";
771  if ((field->getId() & fe->getBitFieldIdRow()).any())
772  strm << "row ";
773  if ((field->getId() & fe->getBitFieldIdCol()).any())
774  strm << "columns ";
775  if ((field->getId() & fe->getBitFieldIdData()).any())
776  strm << "data";
777  strm.flush();
778  slg.push_record(boost::move(rec));
779  }
780  }
781  }
782 
784  }
785 
786  *buildMoFEM |= 1 << 1;
788 }

◆ build_problem_on_distributed_mesh()

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

build problem data structures, assuming that mesh is distributed (collective)

Deprecated:
Use ProblemsManager to build and partition problems

Mesh is distributed, that means that each processor keeps only own part of the mesh and shared entities.

Collective - need to be run on all processors in communicator, i.e. each function has to call this function.

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 249 of file ProblemsCore.cpp.

249  {
251  if (verb == -1)
252  verb = verbose;
253  Problem_multiIndex::iterator p_miit = pRoblems.begin();
254  for (; p_miit != pRoblems.end(); p_miit++) {
255  CHKERR getInterface<ProblemsManager>()->buildProblemOnDistributedMesh(
256  const_cast<Problem *>(&*p_miit), verb);
257  }
259 }

◆ build_problems()

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

build problem data structures

Deprecated:
Use MoFEM::Interface::build_problem(const std::string &name,const bool square_matrix,int verb = -1) instead. This function not allows to Control if problem is structurally symmetric.

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 309 of file ProblemsCore.cpp.

309  {
311  if (verb == -1)
312  verb = verbose;
313  if (!((*buildMoFEM) & BUILD_FIELD))
314  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "fields not build");
315  if (!((*buildMoFEM) & BUILD_FE))
316  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "FEs not build");
317  if (!((*buildMoFEM) & BUILD_ADJ))
318  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "adjacencies not build");
319  // iterate problems
320  Problem_multiIndex::iterator p_miit = pRoblems.begin();
321  for (; p_miit != pRoblems.end(); p_miit++) {
322  Problem *problem_ptr = const_cast<Problem *>(&*p_miit);
323  CHKERR getInterface<ProblemsManager>()->buildProblem(problem_ptr, false,
324  verb);
325  }
328 }

◆ buildField()

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

Definition at line 1171 of file FieldCore.cpp.

1172  {
1174  if (verb == -1)
1175  verb = verbose;
1176  if (verb > QUIET)
1177  MOFEM_LOG("SYNC", Sev::verbose) << "Build field " << field->getName();
1178 
1179  std::map<EntityType, int> dof_counter;
1180  std::map<EntityType, int> inactive_dof_counter;
1181 
1182  // Need to rebuild order table since number of dofs on each order when
1183  // field was created.
1184  if (field->getApproxBase() == USER_BASE)
1185  CHKERR field->rebuildDofsOrderMap();
1186 
1187  switch (field->getSpace()) {
1188  case NOFIELD:
1189  CHKERR this->buildFieldForNoField(field->getId(), dof_counter, verb);
1190  break;
1191  case L2:
1192  case H1:
1193  case HCURL:
1194  case HDIV:
1195  CHKERR this->buildFieldForL2H1HcurlHdiv(field->getId(), dof_counter,
1196  inactive_dof_counter, verb);
1197  break;
1198  default:
1199  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1200  }
1201 
1202  if (verb > QUIET) {
1203  int nb_added_dofs = 0;
1204  int nb_inactive_added_dofs = 0;
1205  for (auto const &it : dof_counter) {
1206  switch (it.first) {
1207  case MBVERTEX:
1208  MOFEM_LOG("SYNC", Sev::verbose)
1209  << "Nb. of dofs (vertices) " << it.second << " (inactive "
1210  << inactive_dof_counter[it.first] << ")";
1211  break;
1212  case MBEDGE:
1213  MOFEM_LOG("SYNC", Sev::verbose)
1214  << "Nb. of dofs (edge) " << it.second << " (inactive "
1215  << inactive_dof_counter[it.first] << ")";
1216  break;
1217  case MBTRI:
1218  MOFEM_LOG("SYNC", Sev::verbose)
1219  << "Nb. of dofs (triangles) " << it.second << " (inactive "
1220  << inactive_dof_counter[it.first] << ")";
1221  break;
1222  case MBQUAD:
1223  MOFEM_LOG("SYNC", Sev::verbose)
1224  << "Nb. of dofs (quads) " << it.second << " (inactive "
1225  << inactive_dof_counter[it.first] << ")";
1226  break;
1227  case MBTET:
1228  MOFEM_LOG("SYNC", Sev::verbose)
1229  << "Nb. of dofs (tetrahedra) " << it.second << " (inactive "
1230  << inactive_dof_counter[it.first] << ")";
1231  break;
1232  case MBPRISM:
1233  MOFEM_LOG("SYNC", Sev::verbose)
1234  << "Nb. of dofs (prisms) " << it.second << " (inactive "
1235  << inactive_dof_counter[it.first] << ")";
1236  break;
1237  case MBENTITYSET:
1238  MOFEM_LOG("SYNC", Sev::verbose)
1239  << "Nb. of dofs (meshsets) " << it.second << " (inactive "
1240  << inactive_dof_counter[it.first] << ")";
1241  break;
1242  default:
1243  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1244  }
1245  nb_added_dofs += it.second;
1246  nb_inactive_added_dofs += inactive_dof_counter[it.first];
1247  }
1248  if (verb > QUIET) {
1249  MOFEM_LOG("SYNC", Sev::verbose)
1250  << "Nb. added dofs " << nb_added_dofs << " (number of inactive dofs "
1251  << nb_inactive_added_dofs << " )";
1252  }
1253  }
1255 }

◆ buildFieldForL2H1HcurlHdiv()

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

Definition at line 1057 of file FieldCore.cpp.

1059  {
1061  if (verb == -1)
1062  verb = verbose;
1063 
1064  // Find field
1065  auto &set_id = fIelds.get<BitFieldId_mi_tag>();
1066  auto field_it = set_id.find(id);
1067  if (field_it == set_id.end()) {
1068  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field not found");
1069  }
1070  const int bit_number = field_it->get()->getBitNumber();
1071  const int rank = field_it->get()->getNbOfCoeffs();
1072  const boost::string_ref &field_name = field_it->get()->getNameRef();
1073 
1074  // Ents in the field meshset
1075  Range ents_of_id_meshset;
1076  CHKERR get_moab().get_entities_by_handle((*field_it)->meshSet,
1077  ents_of_id_meshset, false);
1078  if (verb > VERY_NOISY) {
1079  PetscSynchronizedPrintf(PETSC_COMM_SELF, "Ents in field %s meshset %d\n",
1080  (*field_it)->getName().c_str(),
1081  ents_of_id_meshset.size());
1082  }
1083 
1084  for (auto p_eit = ents_of_id_meshset.pair_begin();
1085  p_eit != ents_of_id_meshset.pair_end(); ++p_eit) {
1086 
1087  const EntityHandle first = p_eit->first;
1088  const EntityHandle second = p_eit->second;
1089  const auto lo_uid =
1090  FieldEntity::getLoLocalEntityBitNumber(bit_number, first);
1091  const auto hi_uid =
1092  FieldEntity::getHiLocalEntityBitNumber(bit_number, second);
1093 
1094  auto feit = entsFields.get<Unique_mi_tag>().lower_bound(lo_uid);
1095  if (feit == entsFields.get<Unique_mi_tag>().end())
1096  continue;
1097  auto hi_feit = entsFields.get<Unique_mi_tag>().upper_bound(hi_uid);
1098 
1099  // If there are DOFs in that range is more pragmatic to remove them
1100  // rather than to find sub-ranges or make them inactive
1101  auto dit = dofsField.get<Unique_mi_tag>().lower_bound(lo_uid);
1102  auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(hi_uid);
1103  dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
1104 
1105  // Add vertices DOFs by bulk
1106  boost::shared_ptr<std::vector<DofEntity>> dofs_array =
1107  boost::make_shared<std::vector<DofEntity>>(std::vector<DofEntity>());
1108  // Add Sequence of DOFs to sequence container as weak_ptr
1109  int nb_dofs_on_ents = 0;
1110  for (auto tmp_feit = feit; tmp_feit != hi_feit; ++tmp_feit) {
1111  nb_dofs_on_ents += rank * tmp_feit->get()->getOrderNbDofs(
1112  tmp_feit->get()->getMaxOrder());
1113  }
1114 
1115  // Reserve memory
1116  dofs_array->reserve(nb_dofs_on_ents);
1117 
1118  // Create DOFs
1119  for (; feit != hi_feit; ++feit) {
1120  // Create dofs instances and shared pointers
1121  int DD = 0;
1122  // Loop orders (loop until max entity order is set)
1123  for (int oo = 0; oo <= feit->get()->getMaxOrder(); ++oo) {
1124  // Loop nb. dofs at order oo
1125  for (int dd = 0; dd < feit->get()->getOrderNbDofsDiff(oo); ++dd) {
1126  // Loop rank
1127  for (int rr = 0; rr < rank; ++rr, ++DD) {
1128  dofs_array->emplace_back(*feit, oo, rr, DD);
1129  ++dof_counter[feit->get()->getEntType()];
1130  }
1131  }
1132  }
1133  if (DD > feit->get()->getNbDofsOnEnt()) {
1134  std::ostringstream ss;
1135  ss << "rank " << rAnk << " ";
1136  ss << **feit << std::endl;
1137  SETERRQ3(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1138  "Expected number of DOFs on entity not equal to number added "
1139  "to database (DD = %d != %d = "
1140  "feit->get()->getNbDofsOnEnt())\n"
1141  "%s",
1142  DD, feit->get()->getNbDofsOnEnt(), ss.str().c_str());
1143  }
1144  }
1145 
1146  // Insert into Multi-Index container
1147  int dofs_field_size0 = dofsField.size();
1148  auto hint = dofsField.end();
1149  for (auto &v : *dofs_array)
1150  hint = dofsField.emplace_hint(hint, dofs_array, &v);
1151 
1152  // Add Sequence of DOFs to sequence container as weak_ptr
1153  field_it->get()->getDofSequenceContainer().push_back(dofs_array);
1154 
1155  // Check data consistency
1156  if (PetscUnlikely(static_cast<int>(dofs_array.use_count()) !=
1157  static_cast<int>(dofs_array->size() + 1))) {
1158  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1159  "Wrong use count %d != %d", dofs_array.use_count(),
1160  dofs_array->size() + 1);
1161  }
1162  if (dofs_field_size0 + dofs_array->size() != dofsField.size()) {
1163  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1164  "Wrong number of inserted DOFs %d != %d", dofs_array->size(),
1165  dofsField.size() - dofs_field_size0);
1166  }
1167  }
1169 }

◆ buildFieldForNoField()

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

Definition at line 1034 of file FieldCore.cpp.

1035  {
1037 
1038  if (verb == -1)
1039  verb = verbose;
1040 
1041  // find fields
1042  auto field_it = fIelds.get<BitFieldId_mi_tag>().find(id);
1043  if (field_it == fIelds.get<BitFieldId_mi_tag>().end())
1044  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field not found");
1045 
1046  if (verb > QUIET)
1047  MOFEM_LOG("WORLD", Sev::noisy)
1048  << "Field " << (*field_it)->getName() << " core value < "
1049  << this->getValue() << " > field value () "
1050  << (*field_it)->getBitNumber() << " )";
1051 
1052  CHKERR this->buildFieldForNoFieldImpl(*field_it, dof_counter, verb);
1053 
1055 }

◆ buildFieldForNoFieldImpl()

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

Definition at line 929 of file FieldCore.cpp.

931  {
933 
934  const auto bit_number = field_ptr->getBitNumber();
935 
936  // ents in the field meshset
937  Range ents;
938  CHKERR get_moab().get_entities_by_handle(field_ptr->getMeshset(), ents,
939  false);
940  if (verb > VERBOSE)
941  MOFEM_LOG_C("SYNC", Sev::noisy, "Ents in field %s meshset %d\n",
942  field_ptr->getName().c_str(), ents.size());
943 
944  // ent view by field id (in set all MoabEnts has the same FieldId)
945  auto eiit = entsFields.get<Unique_mi_tag>().lower_bound(
946  FieldEntity::getLoBitNumberUId(field_ptr->getBitNumber()));
947  FieldEntity_multiIndex_ent_view ents_id_view;
948  if (eiit != entsFields.get<Unique_mi_tag>().end()) {
949  auto hi_eiit = entsFields.get<Unique_mi_tag>().upper_bound(
950  FieldEntity::getHiBitNumberUId(field_ptr->getBitNumber()));
951  std::copy(eiit, hi_eiit, std::back_inserter(ents_id_view));
952  }
953 
954  boost::shared_ptr<const int> zero_order(new const int(0));
955 
956  for (auto ent : ents) {
957  // search if field meshset is in database
958  auto ref_ent_it = refinedEntities.get<Ent_mi_tag>().find(ent);
959  if (ref_ent_it == refinedEntities.get<Ent_mi_tag>().end())
960  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
961  "Entity is not in MoFEM database, entities in field meshset need "
962  "to be seeded (i.e. bit ref level add to them)");
963 
964  auto add_dofs = [&](auto field_eit) {
966  // create dofs on this entity (nb. of dofs is equal to rank)
967  for (FieldCoefficientsNumber rank = 0; rank < field_ptr->getNbOfCoeffs();
968  rank++) {
969  // insert dof
970  auto p = dofsField.insert(
971  boost::make_shared<DofEntity>(field_eit, 0, rank, rank));
972  if (p.second) {
973  dof_counter[MBENTITYSET]++; // Count entities in the meshset
974  } else
975  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
976  "Dof expected to be created");
977  }
979  };
980 
981  // create database entity
982  auto field_ent_it = ents_id_view.get<1>().find(ent);
983  if (field_ent_it == ents_id_view.get<1>().end()) {
984 
985  auto p = entsFields.insert(
986 
987  boost::make_shared<FieldEntity>(
988  field_ptr, *ref_ent_it,
990  *ref_ent_it),
991  boost::shared_ptr<const int>(zero_order, zero_order.get()))
992 
993  );
994 
995  if ((*p.first)->getFieldRawPtr() != field_ptr.get())
996  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
997  "Get field ent poiter and field pointer do not match for "
998  "field %s",
999  field_ptr->getName().c_str());
1000 
1001  if (!p.second)
1002  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1003  "Entity should be created");
1004 
1005  CHKERR add_dofs(*(p.first));
1006 
1007  } else {
1008 
1009  // If there are DOFs in that range is more pragmatic to remove them
1010  // rather than to find sub-ranges or make them inactive
1011  auto dit = dofsField.get<Unique_mi_tag>().lower_bound(
1012  FieldEntity::getLoLocalEntityBitNumber(bit_number, ent));
1013  auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(
1014  FieldEntity::getHiLocalEntityBitNumber(bit_number, ent));
1015  dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
1016  CHKERR add_dofs(*field_ent_it);
1017  }
1018  }
1019 
1020  if (verb > VERBOSE) {
1021  auto lo_dof = dofsField.get<Unique_mi_tag>().lower_bound(
1022  FieldEntity::getLoBitNumberUId(field_ptr->getBitNumber()));
1023  auto hi_dof = dofsField.get<Unique_mi_tag>().upper_bound(
1024  FieldEntity::getHiBitNumberUId(field_ptr->getBitNumber()));
1025  for (; lo_dof != hi_dof; lo_dof++)
1026  MOFEM_LOG("SYNC", Sev::noisy) << **lo_dof;
1028  }
1029 
1031 }

◆ buildFiniteElements()

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

Definition at line 505 of file FECore.cpp.

506  {
508  if (verb == DEFAULT_VERBOSITY)
509  verb = verbose;
510 
511  if (verb > QUIET)
512  MOFEM_LOG("SYNC", Sev::verbose)
513  << "Build Finite Elements " << fe->getName();
514 
515  auto &fields_by_id = fIelds.get<BitFieldId_mi_tag>();
516 
517  // Get id of mofem fields for row, col and data
518  enum IntLoop { ROW = 0, COL, DATA, LAST };
519  std::array<BitFieldId, LAST> fe_fields = {fe.get()->getBitFieldIdRow(),
520  fe.get()->getBitFieldIdCol(),
521  fe.get()->getBitFieldIdData()};
522 
523  // Get finite element meshset
524  EntityHandle meshset = get_finite_element_meshset(fe.get()->getId());
525 
526  // Get entities from finite element meshset // if meshset
527  Range fe_ents;
528  CHKERR get_moab().get_entities_by_handle(meshset, fe_ents, false);
529 
530  if (ents_ptr)
531  fe_ents = intersect(fe_ents, *ents_ptr);
532 
533  // Map entity uid to pointers
534  typedef std::vector<boost::weak_ptr<EntFiniteElement>> VecOfWeakFEPtrs;
535  typedef std::map<const UId *, VecOfWeakFEPtrs> MapEntUIdAndVecOfWeakFEPtrs;
536  MapEntUIdAndVecOfWeakFEPtrs ent_uid_and_fe_vec;
537  VecOfWeakFEPtrs processed_fes;
538  processed_fes.reserve(fe_ents.size());
539 
540  int last_data_field_ents_view_size = 0;
541  int last_row_field_ents_view_size = 0;
542  int last_col_field_ents_view_size = 0;
543 
544  // Loop meshset finite element ents and add finite elements
545  for (Range::const_pair_iterator peit = fe_ents.const_pair_begin();
546  peit != fe_ents.const_pair_end(); peit++) {
547 
548  const auto first = peit->first;
549  const auto second = peit->second;
550 
551  // Find range of ref entities that is sequence
552  // note: iterator is a wrapper
553  // check if is in refinedFiniteElements database
554  auto ref_fe_miit =
555  refinedFiniteElements.get<Ent_mi_tag>().lower_bound(first);
556  if (ref_fe_miit == refinedFiniteElements.get<Ent_mi_tag>().end()) {
557  std::ostringstream ss;
558  ss << "refinedFiniteElements not in database ent = " << first;
559  ss << " type " << get_moab().type_from_handle(first);
560  ss << " " << *fe;
561  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, ss.str().c_str());
562  }
563  auto hi_ref_fe_miit =
564  refinedFiniteElements.get<Ent_mi_tag>().upper_bound(second);
565 
566  EntFiniteElement_multiIndex::iterator hint_p = entsFiniteElements.end();
567  for (; ref_fe_miit != hi_ref_fe_miit; ref_fe_miit++) {
568 
569  // Add finite element to database
570  hint_p = entsFiniteElements.emplace_hint(
571  hint_p, boost::make_shared<EntFiniteElement>(*ref_fe_miit, fe));
572  processed_fes.emplace_back(*hint_p);
573  auto fe_raw_ptr = hint_p->get();
574 
575  // Allocate space for etities view
576  bool row_as_data = false, col_as_row = false;
577  if (fe_fields[DATA] == fe_fields[ROW])
578  row_as_data = true;
579  if (fe_fields[ROW] == fe_fields[COL])
580  col_as_row = true;
581 
582  fe_raw_ptr->getDataFieldEntsPtr()->reserve(
583  last_data_field_ents_view_size);
584 
585  if (row_as_data) {
586  fe_raw_ptr->getRowFieldEntsPtr() = fe_raw_ptr->getDataFieldEntsPtr();
587  } else {
588  // row and col are diffent
589  if (fe_raw_ptr->getRowFieldEntsPtr() ==
590  fe_raw_ptr->getDataFieldEntsPtr())
591  fe_raw_ptr->getRowFieldEntsPtr() =
592  boost::make_shared<FieldEntity_vector_view>();
593  fe_raw_ptr->getRowFieldEntsPtr()->reserve(
594  last_row_field_ents_view_size);
595  }
596 
597  if (row_as_data && col_as_row) {
598  fe_raw_ptr->getColFieldEntsPtr() = fe_raw_ptr->getDataFieldEntsPtr();
599  } else if (col_as_row) {
600  fe_raw_ptr->getColFieldEntsPtr() = fe_raw_ptr->getRowFieldEntsPtr();
601  } else {
602  if (
603 
604  fe_raw_ptr->getColFieldEntsPtr() ==
605  fe_raw_ptr->getRowFieldEntsPtr() ||
606  fe_raw_ptr->getColFieldEntsPtr() ==
607  fe_raw_ptr->getDataFieldEntsPtr()
608 
609  )
610  fe_raw_ptr->getColFieldEntsPtr() =
611  boost::make_shared<FieldEntity_vector_view>();
612  fe_raw_ptr->getColFieldEntsPtr()->reserve(
613  last_col_field_ents_view_size);
614  }
615 
616  // Iterate over all field and check which one is on the element
617  for (unsigned int ii = 0; ii != BitFieldId().size(); ++ii) {
618 
619  // Common field id for ROW, COL and DATA
620  BitFieldId id_common = 0;
621  // Check if the field (ii) is added to finite element
622  for (int ss = 0; ss < LAST; ss++) {
623  id_common |= fe_fields[ss] & BitFieldId().set(ii);
624  }
625  if (id_common.none())
626  continue;
627 
628  // Find in database data associated with the field (ii)
629  const BitFieldId field_id = BitFieldId().set(ii);
630  auto miit = fields_by_id.find(field_id);
631  if (miit == fields_by_id.end())
632  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Field not found");
633  auto field_bit_number = (*miit)->getBitNumber();
634 
635  // Loop over adjacencies of element and find field entities on those
636  // adjacencies, that create hash map map_uid_fe which is used later
637  const std::string field_name = miit->get()->getName();
638  const bool add_to_data = (field_id & fe_fields[DATA]).any();
639  const bool add_to_row = (field_id & fe_fields[ROW]).any();
640  const bool add_to_col = (field_id & fe_fields[COL]).any();
641 
642  // Entities adjacent to entities
643  Range adj_ents;
644 
645  // Resolve entities on element, those entities are used to build tag
646  // with dof uids on finite element tag
647  CHKERR fe_raw_ptr->getElementAdjacency(*miit, adj_ents);
648 
649  for (Range::pair_iterator p_eit = adj_ents.pair_begin();
650  p_eit != adj_ents.pair_end(); ++p_eit) {
651 
652  const EntityHandle first = p_eit->first;
653  const EntityHandle second = p_eit->second;
654 
656  FieldEntityByComposite;
657  auto &field_ents_by_name_and_ent = entsFields.get<Unique_mi_tag>();
658  FieldEntityByComposite::iterator meit;
659 
660  const auto lo_uid =
661  FieldEntity::getLocalUniqueIdCalculate(field_bit_number, first);
662 
663  // If one entity in the pair search for one, otherwise search for
664  // range
665  if (first == second)
666  meit = field_ents_by_name_and_ent.find(lo_uid);
667  else
668  meit = field_ents_by_name_and_ent.lower_bound(lo_uid);
669 
670  if (meit != field_ents_by_name_and_ent.end()) {
671 
672  decltype(meit) hi_meit;
673 
674  if (first == second) {
675  hi_meit = meit;
676  ++hi_meit;
677  } else
678  hi_meit = field_ents_by_name_and_ent.upper_bound(
680  second));
681 
682  // Add to view and create list of finite elements with this dof UId
683  for (; meit != hi_meit; ++meit) {
684  // Add entity to map with key entity uids pointers and data
685  // finite elements weak ptrs. I using pointers to uids instead
686  // uids because this is faster.
687  const UId *uid_ptr = &(meit->get()->getLocalUniqueId());
688  auto &fe_vec = ent_uid_and_fe_vec[uid_ptr];
689  if (add_to_data) {
690  fe_raw_ptr->getDataFieldEntsPtr()->emplace_back(*meit);
691  }
692  if (add_to_row && !row_as_data) {
693  fe_raw_ptr->getRowFieldEntsPtr()->emplace_back(*meit);
694  }
695  if (add_to_col && !col_as_row) {
696  fe_raw_ptr->getColFieldEntsPtr()->emplace_back(*meit);
697  }
698 
699  // add finite element to processed list
700  fe_vec.emplace_back(*hint_p);
701  }
702  }
703  }
704  }
705 
706  // Sort field ents by uid
707  auto uid_comp = [](const auto &a, const auto &b) {
708  return a.lock()->getLocalUniqueId() < b.lock()->getLocalUniqueId();
709  };
710 
711  // Sort all views
712 
713  // Data
714  sort(fe_raw_ptr->getDataFieldEntsPtr()->begin(),
715  fe_raw_ptr->getDataFieldEntsPtr()->end(), uid_comp);
716  last_data_field_ents_view_size =
717  fe_raw_ptr->getDataFieldEntsPtr()->size();
718 
719  // Row
720  if (!row_as_data) {
721  sort(fe_raw_ptr->getRowFieldEntsPtr()->begin(),
722  fe_raw_ptr->getRowFieldEntsPtr()->end(), uid_comp);
723  last_row_field_ents_view_size =
724  fe_raw_ptr->getRowFieldEntsPtr()->size();
725  }
726 
727  // Column
728  if (!col_as_row) {
729  sort(fe_raw_ptr->getColFieldEntsPtr()->begin(),
730  fe_raw_ptr->getColFieldEntsPtr()->end(), uid_comp);
731  last_col_field_ents_view_size =
732  fe_raw_ptr->getColFieldEntsPtr()->size();
733  }
734 
735  }
736  }
737 
738  auto &dofs_by_ent_uid = dofsField.get<Unique_mi_tag>();
739 
741 }

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

760  {
762 
763  if (auto cache_ptr = cache_weak_ptr.lock()) {
764  auto p_miit = pRoblems.get<Problem_mi_tag>().find(prb_name);
765  if (p_miit == pRoblems.get<Problem_mi_tag>().end())
766  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem not in database %s",
767  prb_name.c_str());
768 
769  const BitRefLevel prb_bit = p_miit->getBitRefLevel();
770  const BitRefLevel prb_mask = p_miit->getMaskBitRefLevel();
771  const BitFEId prb_fe_id = p_miit->getBitFEId();
772 
773  auto &row_dofs = p_miit->numeredRowDofsPtr;
774  auto &col_dofs = p_miit->numeredColDofsPtr;
775 
776  auto &cache_data = std::get<0>(*cache_ptr);
777  auto &cache_row = std::get<1>(*cache_ptr);
778  auto &cache_col = std::get<2>(*cache_ptr);
779 
780  cache_row.resize(entsFields.size());
781  if (row_dofs != col_dofs)
782  cache_col.resize(entsFields.size());
783  cache_data.resize(entsFields.size());
784 
785  size_t idx = 0;
786  for (auto it = entsFields.begin(); it != entsFields.end(); ++it, ++idx) {
787 
788  const auto uid = (*it)->getLocalUniqueId();
789  auto r = entFEAdjacencies.get<Unique_mi_tag>().equal_range(uid);
790  for (auto lo = r.first; lo != r.second; ++lo) {
791 
792  if ((lo->getBitFEId() & prb_fe_id).any()) {
793 
794  const BitRefLevel fe_bit = lo->entFePtr->getBitRefLevel();
795 
796  // if entity is not problem refinement level
797  if (((fe_bit & prb_mask) != fe_bit) ||
798  ((fe_bit & prb_bit) != prb_bit))
799  continue;
800 
801  auto cache_numered_dofs = [&](auto &numered_dofs, auto &cache_vec,
802  auto &ent_cache) {
803  auto dit = numered_dofs->lower_bound(uid);
804  decltype(dit) hi_dit;
805  if (dit != numered_dofs->end())
806  hi_dit = numered_dofs->upper_bound(
807  uid | static_cast<UId>(MAX_DOFS_ON_ENTITY - 1));
808  else
809  hi_dit = dit;
810 
811  ent_cache = boost::shared_ptr<EntityCacheNumeredDofs>(
812  cache_ptr, &(cache_vec[idx]));
813  cache_vec[idx].loHi = {dit, hi_dit};
814  };
815 
816  auto cache_dofs = [&](auto &dofs, auto &cache_vec, auto &ent_cache) {
817  auto dit = dofs.lower_bound(uid);
818  decltype(dit) hi_dit;
819  if (dit != dofs.end())
820  hi_dit = dofs.upper_bound(
821  uid | static_cast<UId>(MAX_DOFS_ON_ENTITY - 1));
822  else
823  hi_dit = dit;
824 
825  ent_cache = boost::shared_ptr<EntityCacheDofs>(cache_ptr,
826  &(cache_vec[idx]));
827  cache_vec[idx].loHi = {dit, hi_dit};
828  };
829 
830  cache_numered_dofs(row_dofs, cache_row, (*it)->entityCacheRowDofs);
831  if (row_dofs != col_dofs) {
832  if (cache_col.size() != entsFields.size())
833  cache_col.resize(entsFields.size());
834  cache_numered_dofs(col_dofs, cache_col, (*it)->entityCacheColDofs);
835  } else {
836  (*it)->entityCacheColDofs = (*it)->entityCacheRowDofs;
837  }
838 
839  cache_dofs(dofsField, cache_data, (*it)->entityCacheDataDofs);
840 
841  break;
842  }
843  }
844  }
845  } else {
846  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Cache not allocated");
847  }
848 
850 }

◆ check_field()

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

check if field is in database

Parameters
namefield name
Returns
true if field exist

Implements MoFEM::CoreInterface.

Definition at line 61 of file FieldCore.cpp.

61  {
62  auto &set = fIelds.get<FieldName_mi_tag>();
63  auto miit = set.find(name);
64  if (miit == set.end())
65  return false;
66  return true;
67 }

◆ check_finite_element()

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

Check if finite element is in database.

Parameters
nameName of finite element
Returns
true if element is declared

Implements MoFEM::CoreInterface.

Definition at line 31 of file FECore.cpp.

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

◆ check_number_of_ents_in_ents_field() [1/2]

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

check data consistency in entitiesPtr

Implements MoFEM::CoreInterface.

Definition at line 1412 of file FieldCore.cpp.

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

◆ check_number_of_ents_in_ents_field() [2/2]

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

check data consistency in entitiesPtr

Implements MoFEM::CoreInterface.

Definition at line 1384 of file FieldCore.cpp.

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

◆ check_number_of_ents_in_ents_finite_element() [1/2]

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

check data consistency in entsFiniteElements

Implements MoFEM::CoreInterface.

Definition at line 952 of file FECore.cpp.

952  {
954  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
955  it = finiteElements.get<FiniteElement_name_mi_tag>().begin();
956  for (; it != finiteElements.get<FiniteElement_name_mi_tag>().end(); it++) {
957  EntityHandle meshset = (*it)->getMeshset();
958 
959  int num_entities;
960  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
961 
962  if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
963  (*it)->getName().c_str()) != (unsigned int)num_entities) {
964  SETERRQ1(cOmm, 1,
965  "not equal number of entities in meshset and finite elements "
966  "multiindex < %s >",
967  (*it)->getName().c_str());
968  }
969  }
971 }

◆ check_number_of_ents_in_ents_finite_element() [2/2]

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

check data consistency in entsFiniteElements

Implements MoFEM::CoreInterface.

Definition at line 929 of file FECore.cpp.

930  {
932  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
933  it = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
934  if (it == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
935  SETERRQ1(cOmm, 1, "finite element not found < %s >", name.c_str());
936  }
937  EntityHandle meshset = (*it)->getMeshset();
938 
939  int num_entities;
940  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
941 
942  if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
943  (*it)->getName().c_str()) != (unsigned int)num_entities) {
944  SETERRQ1(cOmm, 1,
945  "not equal number of entities in meshset and finite elements "
946  "multiindex < %s >",
947  (*it)->getName().c_str());
948  }
950 }

◆ check_problem()

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

check if problem exist

Parameters
nameproblem name
Returns
true if problem is in database

Implements MoFEM::CoreInterface.

Definition at line 31 of file ProblemsCore.cpp.

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

◆ clear_adjacencies_entities() [1/3]

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

clear adjacency map for entities on given bit level

Parameters
bit
mask

Implements MoFEM::CoreInterface.

Definition at line 214 of file DeleteCore.cpp.

216  {
218  if (verb == -1)
219  verb = verbose;
220  Range ents;
221  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
224 }

◆ clear_adjacencies_entities() [2/3]

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

clear adjacencies for field entities by entities

Implements MoFEM::CoreInterface.

Definition at line 226 of file DeleteCore.cpp.

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

◆ clear_adjacencies_entities() [3/3]

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

clear adjacencies for field entities by entities and field namd

Implements MoFEM::CoreInterface.

Definition at line 244 of file DeleteCore.cpp.

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

◆ clear_adjacencies_finite_elements() [1/3]

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

clear adjacency map for finite elements on given bit level

Parameters
bit
mask

Implements MoFEM::CoreInterface.

Definition at line 329 of file DeleteCore.cpp.

331  {
333  Range ents;
334  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
337 }

◆ clear_adjacencies_finite_elements() [2/3]

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

Definition at line 339 of file DeleteCore.cpp.

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

◆ clear_adjacencies_finite_elements() [3/3]

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

Definition at line 358 of file DeleteCore.cpp.

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

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

741  {
743  if (verb == -1)
744  verb = verbose;
745  CHKERR clearMap();
747 }

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

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

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

91  {
93  if (verb == -1)
94  verb = verbose;
95 
96  const auto bit_number = get_field_bit_number(name);
97 
98  for (Range::const_pair_iterator p_eit = ents.pair_begin();
99  p_eit != ents.pair_end(); p_eit++) {
100  const auto first = p_eit->first;
101  const auto second = p_eit->second;
102  const auto lo_uid =
103  DofEntity::getLoFieldEntityUId(bit_number, first);
104  const auto hi_uid =
105  DofEntity::getHiFieldEntityUId(bit_number, second);
106  auto dit = dofsField.get<Unique_mi_tag>().lower_bound(lo_uid);
107  auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(hi_uid);
108  dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
109  }
111 }

◆ clear_dofs_fields_by_bit_ref()

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

Clear dofs by bit level

Implements MoFEM::CoreInterface.

Definition at line 58 of file DeleteCore.cpp.

59  {
61  if (verb == -1)
62  verb = verbose;
63  Range ents;
64  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
65  CHKERR clear_dofs_fields(ents, verb);
67 }

◆ clear_ents_fields() [1/2]

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

Clear entities by field name

Implements MoFEM::CoreInterface.

Definition at line 126 of file DeleteCore.cpp.

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

◆ clear_ents_fields() [2/2]

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

Clear entities by field name

Implements MoFEM::CoreInterface.

Definition at line 144 of file DeleteCore.cpp.

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

◆ clear_ents_fields_by_bit_ref()

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

Clear ents by bit level

Implements MoFEM::CoreInterface.

Definition at line 113 of file DeleteCore.cpp.

114  {
116  if (verb == -1)
117  verb = verbose;
118  Range ents;
119  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
120  CHKERR clear_dofs_fields(ents, verb);
122  CHKERR clear_ents_fields(ents, verb);
124 }

◆ clear_finite_elements() [1/2]

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 288 of file DeleteCore.cpp.

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

◆ clear_finite_elements() [2/2]

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 305 of file DeleteCore.cpp.

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

◆ clear_finite_elements_by_bit_ref()

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 276 of file DeleteCore.cpp.

278  {
280  if (verb == -1)
281  verb = verbose;
282  Range ents;
283  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
284  CHKERR clear_finite_elements(ents, verb);
286 }

◆ clear_inactive_dofs()

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

Clear inactive dofs

Implements MoFEM::CoreInterface.

Definition at line 42 of file DeleteCore.cpp.

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

◆ clear_problem()

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

clear problem

Implements MoFEM::CoreInterface.

Definition at line 261 of file ProblemsCore.cpp.

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

◆ clear_problems()

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

clear problems

Implements MoFEM::CoreInterface.

Definition at line 330 of file ProblemsCore.cpp.

330  {
332  if (verb == -1)
333  verb = verbose;
334  // iterate problems
335  for (auto p_miit = pRoblems.begin(); p_miit != pRoblems.end(); p_miit++)
336  CHKERR clear_problem(p_miit->getName(), verb);
338 }

◆ clearMap()

MoFEMErrorCode MoFEM::Core::clearMap ( )
protected

Cleaning database.

Definition at line 490 of file Core.cpp.

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

◆ coreGenericConstructor()

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

Definition at line 160 of file Core.cpp.

161  {
163 
164  // This is deprecated ONE should use MoFEM::Core::Initialize
166  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
167  "MoFEM globally is not initialised, call MoFEM::Core::Initialize");
168 
169  // Create duplicate communicator
170  wrapMPIComm = boost::make_shared<WrapMPIComm>(comm, cOmm);
171  MPI_Comm_size(cOmm, &sIze);
172  MPI_Comm_rank(cOmm, &rAnk);
173 
174  // CHeck if moab has set communicator if not set communicator interbally
175  ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
176  if (pComm == NULL)
177  pComm = new ParallelComm(&moab, cOmm);
178 
179  // Register interfaces for this implementation
180  CHKERR registerInterface<UnknownInterface>(IDD_MOFEMUnknown);
181  CHKERR registerInterface<CoreInterface>(IDD_MOFEMCoreInterface);
182  CHKERR registerInterface<DeprecatedCoreInterface>(
184 
185  // Register MOFEM events in PETSc
186  PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
187  PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
188  PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
189  PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
190 
192 }

◆ create_vertices_and_add_to_field()

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

Create a vertices and add to field object.

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

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

Implements MoFEM::CoreInterface.

Definition at line 390 of file FieldCore.cpp.

392  {
394 
395  if (verb == DEFAULT_VERBOSITY)
396  verb = verbose;
397 
398  Range verts;
399 
400  auto create_vertices = [&]() {
402 
403  vector<double *> arrays_coord;
404  EntityHandle startv = 0;
405  ReadUtilIface *iface;
406  CHKERR get_moab().query_interface(iface);
407  CHKERR iface->get_node_coords(3, size, 0, startv, arrays_coord);
408  verts.insert(startv, startv + size - 1);
409  for (int n = 0; n != size; ++n)
410  for (auto d : {0, 1, 2})
411  arrays_coord[d][n] = coords[3 * n + d];
412 
414  };
415 
416  auto add_verts_to_field = [&]() {
418  EntityHandle field_meshset = get_field_meshset(name);
419  CHKERR get_moab().add_entities(field_meshset, verts);
421  };
422 
423  CHKERR create_vertices();
424  CHKERR add_verts_to_field();
425 
427 }

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

delete entities form mofem and moab database

Implements MoFEM::CoreInterface.

Definition at line 553 of file DeleteCore.cpp.

556  {
558  if (verb == -1)
559  verb = verbose;
560 
561  Range ents;
562  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
563  Range ents_meshsets = ents.subset_by_type(MBENTITYSET);
564  ents = subtract(ents,ents_meshsets);
565 
566  CHKERR remove_ents(ents, verb);
567 
568  // remove parent
569  if (remove_parent) {
571  }
572 
573  Range meshsets;
574  CHKERR get_moab().get_entities_by_type(0, MBENTITYSET, meshsets, true);
575  for (Range::iterator mit = meshsets.begin(); mit != meshsets.end(); mit++) {
576  CHKERR get_moab().remove_entities(*mit, ents);
577  }
578 
579  rval = get_moab().delete_entities(ents);
580  if(rval != MB_SUCCESS) {
581  if(verb >= VERY_VERBOSE) {
582  for (Range::iterator eit = ents.begin(); eit != ents.end(); ++eit) {
583  try {
584  RefEntity ref_ent(basicEntityDataPtr, *eit);
585  MOFEM_LOG("WORLD", Sev::error)
586  << "Error: " << RefEntity(basicEntityDataPtr, *eit) << " "
587  << ref_ent.getBitRefLevel();
588  } catch (std::exception const &ex) {
589  }
590  };
591  }
592  EntityHandle out_meshset;
593  CHKERR get_moab().create_meshset(MESHSET_SET, out_meshset);
594  CHKERR get_moab().add_entities(out_meshset,ents);
595  CHKERR get_moab().write_file("error.vtk", "VTK", "", &out_meshset, 1);
596  THROW_MESSAGE("Can not delete entities from MoAB database (see error.vtk)");
597  }
598 
599  if (verb >= VERBOSE)
600  MOFEM_LOG_C("WORLD", Sev::verbose, "Nb. of deleted entities %d",
601  ents.size());
602 
604 }

◆ delete_finite_element()

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

delete finite element from mofem database

Implements MoFEM::CoreInterface.

Definition at line 606 of file DeleteCore.cpp.

606  {
609  FiniteElementsByName;
610  FiniteElementsByName &fe = finiteElements.get<FiniteElement_name_mi_tag>();
611  FiniteElementsByName::iterator mit = fe.find(name);
612  if (mit == fe.end()) {
613  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
614  "Finite element <%s> not found", name.c_str());
615  }
616  EntityHandle meshset = mit->get()->getMeshset();
617  Range ents;
618  CHKERR get_moab().get_entities_by_handle(meshset, ents, false);
619  CHKERR remove_ents_from_finite_element(name, ents, verb);
620  fe.erase(mit);
621  CHKERR get_moab().delete_entities(&meshset, 1);
623 }

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

100  {
102  auto p_miit = pRoblems.get<Problem_mi_tag>().find(name);
103  if (p_miit == pRoblems.get<Problem_mi_tag>().end()) {
104  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "no such problem like < %s >",
105  name.c_str());
106  }
107  const EntityHandle meshset = p_miit->meshset;
108  pRoblems.get<Problem_mi_tag>().erase(p_miit);
109  CHKERR get_moab().delete_entities(&meshset, 1);
111 }

◆ Finalize()

MoFEMErrorCode MoFEM::Core::Finalize ( )
static

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

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

Note
This function calls PetscInitialize, for more details see http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscFinalize.html
Returns
MoFEMErrorCode
Examples
add_blockset.cpp, add_cubit_meshsets.cpp, analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, bases_on_reference_rectangle.cpp, bernstein_bezier_generate_base.cpp, bone_adaptation.cpp, boundary_marker.cpp, build_large_problem.cpp, build_problems.cpp, cell_forces.cpp, contact.cpp, continuity_check_on_contact_prism_side_ele.cpp, continuity_check_on_skeleton_3d.cpp, continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, cubit_bc_test.cpp, delete_ho_nodes.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, dynamic_elastic.cpp, edge_and_bubble_shape_functions_on_quad.cpp, eigen_elastic.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, ep.cpp, field_axpy_atom_test.cpp, field_blas_set_vertex_dofs.cpp, field_evaluator.cpp, field_to_vertices.cpp, find_local_coordinates_on_tet.cpp, forces_and_sources_testing_edge_element.cpp, forces_and_sources_testing_flat_prism_element.cpp, forces_and_sources_testing_users_base.cpp, gauss_points_on_quad.cpp, hcurl_check_approx_in_2d.cpp, hcurl_curl_operator.cpp, hcurl_divergence_operator_2d.cpp, hdiv_divergence_operator.cpp, heat_equation.cpp, hello_world.cpp, helmholtz.cpp, hertz_surface.cpp, log.cpp, loop_entities.cpp, lorentz_force.cpp, magnetostatic.cpp, matrix_function.cpp, mesh_cut.cpp, mesh_insert_interface_atom.cpp, mesh_smoothing.cpp, meshset_to_vtk.cpp, minimal_surface_area.cpp, petsc_smart_ptr_objects.cpp, prism_elements_from_surface.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, reaction_diffusion.cpp, remove_entities_from_problem.cpp, scalar_check_approximation_2d.cpp, simple_contact.cpp, simple_elasticity.cpp, simple_interface.cpp, split_sideset.cpp, test_cache_on_entities.cpp, test_jacobian_of_simple_contact_element.cpp, testing_jacobian_of_hook_element.cpp, testing_jacobian_of_hook_scaled_with_density_element.cpp, unsaturated_transport.cpp, wave_equation.cpp, and wavy_surface.cpp.

Definition at line 100 of file Core.cpp.

100  {
101  if (isGloballyInitialised) {
102  PetscPopErrorHandler();
103  isGloballyInitialised = false;
104 
105  if (isInitialized == PETSC_FALSE) {
106  PetscBool is_finalized;
107  PetscFinalized(&is_finalized);
108  if (!is_finalized)
109  PetscFinalize();
110  }
111 
112  if (!mpiInitialised) {
113  int mpi_finalized;
114  MPI_Finalized(&mpi_finalized);
115  if (!mpi_finalized)
116  MPI_Finalize();
117  }
118  }
119 
120  return 0;
121 }

◆ get_basic_entity_data_ptr()

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

Get pointer to basic entity data.

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

Implements MoFEM::CoreInterface.

Definition at line 287 of file Core.hpp.

287  {
288  return basicEntityDataPtr;
289  }

◆ get_comm()

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

Implements MoFEM::CoreInterface.

Definition at line 974 of file Core.hpp.

974 { return cOmm; }

◆ get_comm_rank()

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

Implements MoFEM::CoreInterface.

Definition at line 984 of file Core.hpp.

984 { return rAnk; }

◆ get_comm_size()

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

Implements MoFEM::CoreInterface.

Definition at line 979 of file Core.hpp.

979 { return sIze; }

◆ get_dofs() [1/2]

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

Get the dofs object.

Returns
const DofEntity_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 903 of file Core.cpp.

903 { 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 842 of file Core.cpp.

842  {
844  *dofs_ptr = &dofsField;
846 }

◆ get_dofs_by_name_and_ent_begin()

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

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

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

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1356 of file FieldCore.cpp.

1357  {
1358  return dofsField.get<Unique_mi_tag>().lower_bound(
1360  ent));
1361 }

◆ get_dofs_by_name_and_ent_end()

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

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

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

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1363 of file FieldCore.cpp.

1364  {
1365  return dofsField.get<Unique_mi_tag>().upper_bound(
1367  ent));
1368 }

◆ get_dofs_by_name_and_type_begin()

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

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

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

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1370 of file FieldCore.cpp.

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

◆ get_dofs_by_name_and_type_end()

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

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

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

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1377 of file FieldCore.cpp.

1378  {
1379  return dofsField.get<Unique_mi_tag>().upper_bound(
1382 }

◆ get_dofs_by_name_begin()

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

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

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

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1346 of file FieldCore.cpp.

1346  {
1347  return dofsField.get<Unique_mi_tag>().lower_bound(
1349 }

◆ get_dofs_by_name_end()

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

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

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

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1351 of file FieldCore.cpp.

1351  {
1352  return dofsField.get<Unique_mi_tag>().upper_bound(
1354 }

◆ get_ent_field_by_name_begin()

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

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

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

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1336 of file FieldCore.cpp.

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

◆ get_ent_field_by_name_end()

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

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

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

Parameters
field_name

Implements MoFEM::CoreInterface.

Definition at line 1341 of file FieldCore.cpp.

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

◆ get_ents_elements_adjacency() [1/2]

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

Get the dofs elements adjacency object.

Returns
const FieldEntityEntFiniteElementAdjacencyMap_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 883 of file Core.cpp.

883  {
884  return &entFEAdjacencies;
885 }

◆ get_ents_elements_adjacency() [2/2]

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

Get the dofs elements adjacency object.

Parameters
dofs_elements_adjacency
Returns
MoFEMErrorCode

Implements MoFEM::CoreInterface.

Definition at line 874 of file Core.cpp.

876  {
878  *dofs_elements_adjacency = &entFEAdjacencies;
880 }

◆ get_ents_finite_elements() [1/2]

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

Get the ents finite elements object.

Returns
const EntFiniteElement_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 897 of file Core.cpp.

897  {
898  return &entsFiniteElements;
899 }

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

856  {
858  *fe_ent_ptr = &entsFiniteElements;
860 }

◆ get_fe_by_name_begin()

EntFiniteElementByName::iterator MoFEM::Core::get_fe_by_name_begin ( const std::string &  fe_name) const
protectedvirtual

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

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

Parameters
fe_name

Implements MoFEM::CoreInterface.

Definition at line 919 of file FECore.cpp.

919  {
920  return entsFiniteElements.get<FiniteElement_name_mi_tag>().lower_bound(
921  fe_name);
922 }

◆ get_fe_by_name_end()

EntFiniteElementByName::iterator MoFEM::Core::get_fe_by_name_end ( const std::string &  fe_name) const
protectedvirtual

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

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

Parameters
fe_name

Implements MoFEM::CoreInterface.

Definition at line 924 of file FECore.cpp.

924  {
925  return entsFiniteElements.get<FiniteElement_name_mi_tag>().upper_bound(
926  fe_name);
927 }

◆ get_field_bit_number()

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

get field bit number

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

Implements MoFEM::CoreInterface.

Definition at line 41 of file FieldCore.cpp.

41  {
42  auto &set = fIelds.get<FieldName_mi_tag>();
43  auto miit = set.find(name);
44  if (miit == set.end())
45  THROW_MESSAGE("field not in database (top tip: check spelling)");
46  return (*miit)->getBitNumber();
47 }

◆ get_field_entities_by_dimension()

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

get entities in the field by dimension

Parameters
namefield name
dimdim
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 82 of file FieldCore.cpp.

84  {
85 
87  EntityHandle meshset = get_field_meshset(name);
88  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, true);
90 }

◆ get_field_entities_by_handle()

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

get entities in the field by handle

Parameters
namefield name
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 101 of file FieldCore.cpp.

102  {
104  EntityHandle meshset = get_field_meshset(name);
105  CHKERR get_moab().get_entities_by_handle(meshset, ents, true);
107 }

◆ get_field_entities_by_type()

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

get entities in the field by type

Parameters
namefield name
typeentity type
entsents
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 92 of file FieldCore.cpp.

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

◆ get_field_ents() [1/2]

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

Get the field ents object.

Returns
const FieldEntity_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 900 of file Core.cpp.

900  {
901  return &entsFields;
902 }

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

837  {
839  *field_ents = &entsFields;
841 }

◆ get_field_meshset() [1/2]

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

Definition at line 49 of file FieldCore.cpp.

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

◆ get_field_meshset() [2/2]

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

get field meshset

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

Implements MoFEM::CoreInterface.

Definition at line 57 of file FieldCore.cpp.

57  {
58  return get_field_meshset(getBitFieldId(name));
59 }

◆ get_field_structure()

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

get field structure

Parameters
namefield name
Returns
const Field*

Implements MoFEM::CoreInterface.

Definition at line 69 of file FieldCore.cpp.

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

◆ get_fields() [1/2]

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

Get the fields object.

Returns
const Field_multiIndex*

Implements MoFEM::CoreInterface.

Definition at line 887 of file Core.cpp.

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

795  {
797  *fields_ptr = &fIelds;
799 }

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

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

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

296  {
297 
299 
301  CHKERR get_moab().get_entities_by_handle(meshset, ents, true);
302 
304 }

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

284  {
285 
287 
289  CHKERR get_moab().get_entities_by_type(meshset, type, ents, true);
290 
292 }

◆ get_finite_element_meshset() [1/2]