v0.9.0
Classes | Public Member Functions | List of all members
MoFEM::Core Struct Reference

Core (interface) class. More...

#include <src/interfaces/Core.hpp>

Inheritance diagram for MoFEM::Core:
[legend]
Collaboration diagram for MoFEM::Core:
[legend]

Classes

struct  WrapMPIComm
 

Public Member Functions

 Core (moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE, const bool distributed_mesh=true)
 
 ~Core ()
 
- 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 problemIn layout is stored information how many elements is on each processor, for more information look int petsc documentation http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/IS/PetscLayoutCreate.html#PetscLayoutCreate 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)collective - need to be run on all processors in communicator 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)User specify what name of field on one problem is scattered to another. 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)collective - need tu be run on all processors in communicator 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)collective - need tu be run on all processors in communicator 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)collective - need tu be run on all processors in communicator. 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)collective - need tu be run on all processors in communicator. 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.bit ref level of adjacent entities is any of bit ref level of adjacent entities. 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 verticesThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_VERTICEs (const EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities on verticesThe lower dimension entities are added depending on the space type 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 edgesThe lower dimension entities are added depending on the space type 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 edgesThe lower dimension entities are added depending on the space type 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 trianglesThe lower dimension entities are added depending on the space type 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 trianglesThe lower dimension entities are added depending on the space type 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 tetrahedronThe lower dimension entities are added depending on the space type 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 tetrahedronThe lower dimension entities are added depending on the space type 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 quadsThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_QUADs (EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities from adjacencies of quadsThe lower dimension entities are added depending on the space type 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 prismsThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_PRISMs (EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities from adjacencies of prismsThe lower dimension entities are added depending on the space type 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, 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, 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, int verb=DEFAULT_VERBOSITY)=0
 Make a loop over finite elements on partitions from upper to lower rank. More...
 
DEPRECATED MoFEMErrorCode resolve_shared_ents (const Problem *problem_ptr, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode resolve_shared_ents (const std::string &name, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode resolve_shared_finite_elements (const Problem *problem_ptr, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
 resolve shared entities for finite elements in the problem More...
 
DEPRECATED MoFEMErrorCode resolve_shared_finite_elements (const std::string &name, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
 resolve shared entities for finite elements in the problem\depreacted Use CommInterface 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)
 
- Public Member Functions inherited from MoFEM::CoreInterface
- 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
 

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

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
}
 
intgetBuildMoFEM () 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, const bool distributed_mesh=true)
 Set the moab interface object. More...
 

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_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, int verb=DEFAULT_VERBOSITY)
 
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

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 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\not collective. 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 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 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
 
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 problemNote: If problem is build, it need to be cleaned to make this effective 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 elementsBuild finite element data structures. Have to be run before problem and adjacencies are constructed. 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 elementsBuild finite element data structures. Have to be run before problem and adjacencies are constructed. 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)
 
MoFEMErrorCode list_adjacencies () const
 list adjacencies More...
 

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 BasicMethodThis function set data about problem, adjacencies and other multi-indices in database. This function can be used a special case when user need to do some pre- and post-processing before matrix or vector is initiated, or to assemble matrix for group of FEMethods. Is used by classes SnesCtx and TsCtx. Look for more details there. More...
 
MoFEMErrorCode problem_basic_method_postProcess (const std::string &problem_name, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethodThis function set data about problem, adjacencies and other multi-indices in database. This function can be used a special case when user need to do some pre- and post-processing before matrix or vector is initiated, or to assemble matrix for group of FEMethods. Is used by classes SnesCtx and TsCtx. Look for more details there. 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, 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, 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, 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...
 
FieldEntityByFieldName::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...
 
FieldEntityByFieldName::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)for(IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
DofEntityByFieldName::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)for(IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
DofEntityByFieldName::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)for(IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
DofEntityByNameAndEnt::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...
 
DofEntityByNameAndEnt::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)for(IT_GET_DOFS_FIELD_BY_NAME_AND_ENT_FOR_LOOP(MFIELD,NAME,ENT,IT)) { ... } More...
 
DofEntityByNameAndType::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...
 
DofEntityByNameAndType::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...
 
boost::shared_ptr< WrapMPICommwrapMPIComm
 
int verbose
 Verbosity level. More...
 
intfShift
 Ptr to tag handle storing last set bit in field ID. More...
 
intfeShift
 Ptr to tag handle storing last set bit in finite element ID. More...
 
intpShift
 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...
 
intbuildMoFEM
 keeps flags/semaphores for different stages More...
 
std::string optionsPrefix
 Prefix for options on command line. More...
 
PetscBool initaliseAndBuildField
 
PetscBool initaliseAndBuildFiniteElements
 
static bool isGloballyInitialised = false
 Core base globally initialized. More...
 
MPI_Comm & get_comm () const
 
int get_comm_size () const
 
int get_comm_rank () const
 
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)
 

Additional Inherited Members

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

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, analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, bernstein_bezier_generate_base.cpp, bone_adaptation.cpp, boundary_marker.cpp, build_problems.cpp, cell_forces.cpp, continuity_check_on_skeleton_3d.cpp, continuity_check_on_skeleton_with_simple_2d.cpp, cubit_bc_test.cpp, delete_ho_nodes.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, edge_and_bubble_shape_functions_on_quad.cpp, 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, 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, hello_world.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_equation.cpp, remove_entities_from_problem.cpp, simple_elasticity.cpp, simple_interface.cpp, split_sideset.cpp, testing_jacobian_of_hook_element.cpp, testing_jacobian_of_hook_scaled_with_density_element.cpp, and unsaturated_transport.cpp.

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

Constructor & Destructor Documentation

◆ Core()

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

Construct core database

Parameters
moabMoAB interface
commMPI communicator
verboseVerbosity level
distributed_meshUId of entities and dofs depends on owing processor, assumed that mesh is distributed. Otherwise is assumed that all processors have the same meshes and same entity handlers.

Definition at line 106 of file Core.cpp.

108  : moab(moab), cOmm(0), verbose(verbose),
109  initaliseAndBuildField(PETSC_FALSE),
110  initaliseAndBuildFiniteElements(PETSC_FALSE) {
111 
112  // This is deprecated ONE should use MoFEM::Core::Initialize
113  if (!isGloballyInitialised) {
114  PetscPushErrorHandler(mofem_error_handler, PETSC_NULL);
115  isGloballyInitialised = true;
116  }
117 
118  // Create duplicate communicator
119  wrapMPIComm = boost::make_shared<WrapMPIComm>(comm, cOmm);
120  MPI_Comm_size(cOmm, &sIze);
121  MPI_Comm_rank(cOmm, &rAnk);
122  // CHeck if moab has set communicator if not set communicator interbally
123  ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
124  if (pComm == NULL) {
125  pComm = new ParallelComm(&moab, cOmm);
126  }
127 
128  // Register interfaces for this implementation
129  ierr = registerInterface<UnknownInterface>(IDD_MOFEMUnknown);
130  CHKERRABORT(comm, ierr);
131  ierr = registerInterface<CoreInterface>(IDD_MOFEMCoreInterface);
132  CHKERRABORT(comm, ierr);
133  ierr = registerInterface<DeprecatedCoreInterface>(
135  CHKERRABORT(comm, ierr);
136 
137  // Register sub-interfaces
139  CHKERRABORT(PETSC_COMM_SELF, ierr);
140 
141  // Register MOFEM events in PETSc
142  PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
143  PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
144  PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
145  PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
146 
147  // Initialize database
148  ierr = getTags();
149  CHKERRABORT(cOmm, ierr);
150  ierr = clearMap();
151  CHKERRABORT(cOmm, ierr);
152 
153  basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
154  if (distributed_mesh)
155  basicEntityDataPtr->setDistributedMesh();
156  else
157  basicEntityDataPtr->unSetDistributedMesh();
158 
160  CHKERRABORT(cOmm, ierr);
162  CHKERRABORT(cOmm, ierr);
163 
164  // Print version
165  if (verbose > QUIET) {
166  char petsc_version[255];
167  ierr = PetscGetVersion(petsc_version, 255);
168  CHKERRABORT(cOmm, ierr);
169  ierr = PetscPrintf(cOmm, "MoFEM version %d.%d.%d (%s %s) \n",
170  MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR,
171  MoFEM_VERSION_BUILD, MOAB_VERSION_STRING, petsc_version);
172  CHKERRABORT(cOmm, ierr);
173  ierr = PetscPrintf(cOmm, "git commit id %s\n", GIT_SHA1_NAME);
174  CHKERRABORT(cOmm, ierr);
175  }
176 }
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:247
static const MOFEMuuid IDD_MOFEMCoreInterface
Definition: Interface.hpp:24
int sIze
MoFEM communicator size.
Definition: Core.hpp:849
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition: Core.cpp:575
PetscLogEvent MOFEM_EVENT_postProcess
Event for postProcess finite element.
Definition: Core.hpp:837
boost::shared_ptr< WrapMPIComm > wrapMPIComm
Definition: Core.hpp:883
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
PetscLogEvent MOFEM_EVENT_operator
Event for evaluating operator of finite element.
Definition: Core.hpp:835
static const MOFEMuuid IDD_MOFEMUnknown
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:838
MoFEMErrorCode registerSubInterfaces()
Register insterfaces.
Definition: Core.cpp:189
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:265
PetscLogEvent MOFEM_EVENT_preProcess
Event for preProcess finite element.
Definition: Core.hpp:833
PetscBool initaliseAndBuildField
Definition: Core.hpp:901
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:850
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
Definition: Core.cpp:550
MoFEMErrorCode getTags(int verb=DEFAULT_VERBOSITY)
Get tag handles.
Definition: Core.cpp:296
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:897
PetscBool initaliseAndBuildFiniteElements
Definition: Core.hpp:904
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:225
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:285
static PetscErrorCode mofem_error_handler(MPI_Comm comm, int line, const char *fun, const char *file, PetscErrorCode n, PetscErrorType p, const char *mess, void *ctx)
ParallelComm * pComm
MOAB communicator structure.
Definition: Core.hpp:847
int verbose
Verbosity level.
Definition: Core.hpp:885
static const MOFEMuuid IDD_MOFEMDeprecatedCoreInterface
Definition: Interface.hpp:26

◆ ~Core()

MoFEM::Core::~Core ( )

Definition at line 178 of file Core.cpp.

178  {
179  PetscBool is_finalized;
180  PetscFinalized(&is_finalized);
181  // Destroy interfaces
182  iFaces.clear();
183  // This is deprecated ONE should use MoFEM::Core::Initialize
184  if (isGloballyInitialised && is_finalized) {
185  isGloballyInitialised = false;
186  }
187 }
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:897
boost::ptr_map< unsigned long, UnknownInterface > iFaces
Hash map of pointers to interfaces.
Definition: Core.hpp:894

Member Function Documentation

◆ add_ents_to_field_by_dim() [1/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 313 of file FieldCore.cpp.

315  {
316  Range ents_dim = ents.subset_by_dimension(dim);
317  return addEntsToFieldByDim(ents_dim, dim, name, verb);
318 }
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:234

◆ add_ents_to_field_by_dim() [2/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 333 of file FieldCore.cpp.

336  {
338  Range ents;
339  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
340  CHKERR addEntsToFieldByDim(ents, dim, name, verb);
342 }
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
#define CHKERR
Inline error check.
Definition: definitions.h:596
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:234

◆ add_ents_to_field_by_type() [1/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 320 of file FieldCore.cpp.

323  {
325  Range ents_type = ents.subset_by_type(type);
326  if (!ents_type.empty()) {
327  const int dim = get_moab().dimension_from_handle(ents_type[0]);
328  CHKERR addEntsToFieldByDim(ents_type, dim, name, verb);
329  }
331 }
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:234
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ add_ents_to_field_by_type() [2/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 344 of file FieldCore.cpp.

347  {
349  Range ents;
350  CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
351  if (!ents.empty()) {
352  const int dim = get_moab().dimension_from_handle(ents[0]);
353  CHKERR addEntsToFieldByDim(ents, dim, name, verb);
354  }
356 }
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:234
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

483  {
485 
486  if (verb == -1)
487  verb = verbose;
488  *buildMoFEM &= 1 << 0;
489  const BitFEId id = getBitFEId(name);
491  typedef RefElement_multiIndex::index<EntType_mi_tag>::type refMoabFE_by_type;
492  refMoabFE_by_type &ref_MoFEMFiniteElement =
493  refinedFiniteElements.get<EntType_mi_tag>();
494  refMoabFE_by_type::iterator miit = ref_MoFEMFiniteElement.lower_bound(type);
495  refMoabFE_by_type::iterator hi_miit =
496  ref_MoFEMFiniteElement.upper_bound(type);
497  if (verb > 1) {
498  PetscSynchronizedPrintf(cOmm, "nb. ref elements in database %d\n",
499  std::distance(miit, hi_miit));
500  }
501  int nb_add_FEs = 0;
502  for (; miit != hi_miit; miit++) {
503  BitRefLevel bit2 = miit->get()->getBitRefLevel();
504  if ((bit2 & mask) != bit2)
505  continue;
506  if ((bit2 & bit).any()) {
507  EntityHandle ent = miit->get()->getRefEnt();
508  CHKERR get_moab().add_entities(idm, &ent, 1);
509  nb_add_FEs++;
510  }
511  }
512  if (verb > 0) {
513  std::ostringstream ss;
514  ss << "Add Nb. FEs " << nb_add_FEs << " form BitRef " << bit << std::endl;
515  PetscSynchronizedPrintf(cOmm, "%s", ss.str().c_str());
516  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
517  }
518 
520 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:280
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:258
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:54
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:245
#define CHKERR
Inline error check.
Definition: definitions.h:596
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

364  {
365  EntityHandle idm = no_handle;
366  *buildMoFEM &= 1 << 0;
369  Range ents;
370  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
371  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
372  CHKERR get_moab().add_entities(idm, ents);
374 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:280
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
const EntityHandle no_handle
No entity handle is indicated by zero handle, i.e. root meshset.
Definition: Common.hpp:27
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:258
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

390  {
391  EntityHandle idm = no_handle;
392  *buildMoFEM &= 1 << 0;
395  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
396  ents.subset_by_dimension(dim));
397  CHKERR get_moab().add_entities(idm, ents.subset_by_dimension(dim));
399 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:280
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
const EntityHandle no_handle
No entity handle is indicated by zero handle, i.e. root meshset.
Definition: Common.hpp:27
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:258
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ add_ents_to_finite_element_by_EDGEs() [1/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 408 of file FECore.cpp.

409  {
411  CHKERR add_ents_to_finite_element_by_type(edges, MBEDGE, name);
413 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
Definition: FECore.cpp:345
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ add_ents_to_finite_element_by_EDGEs() [2/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 401 of file FECore.cpp.

402  {
404  CHKERR add_ents_to_finite_element_by_type(meshset, MBEDGE, name, recursive);
406 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
Definition: FECore.cpp:345
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

523  {
525  *buildMoFEM &= 1 << 0;
526  const BitFEId id = getBitFEId(name);
528  if (recursive == false) {
529  CHKERR get_moab().add_entities(idm, &meshset, 1);
530  } else {
531  Range meshsets;
532  CHKERR get_moab().get_entities_by_type(meshset, MBENTITYSET, meshsets,
533  false);
534  CHKERR get_moab().add_entities(idm, meshsets);
535  }
537 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:280
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:258
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:54
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ add_ents_to_finite_element_by_PRISMs() [1/3]

DEPRECATED MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_by_PRISMs ( const Range &  prims,
const BitFEId  id 
)
protected

◆ add_ents_to_finite_element_by_PRISMs() [2/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 448 of file FECore.cpp.

449  {
451  CHKERR add_ents_to_finite_element_by_type(prims, MBPRISM, name);
453 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
Definition: FECore.cpp:345
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ add_ents_to_finite_element_by_PRISMs() [3/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 454 of file FECore.cpp.

455  {
457  CHKERR add_ents_to_finite_element_by_type(meshset, MBPRISM, name, recursive);
459 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
Definition: FECore.cpp:345
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ add_ents_to_finite_element_by_TETs() [1/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 435 of file FECore.cpp.

436  {
438  CHKERR add_ents_to_finite_element_by_type(tets, MBTET, name);
440 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
Definition: FECore.cpp:345
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ add_ents_to_finite_element_by_TETs() [2/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 441 of file FECore.cpp.

442  {
444  CHKERR add_ents_to_finite_element_by_type(meshset, MBTET, name, recursive);
446 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
Definition: FECore.cpp:345
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ add_ents_to_finite_element_by_TRIs() [1/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 422 of file FECore.cpp.

423  {
425  CHKERR add_ents_to_finite_element_by_type(tris, MBTRI, name);
427 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
Definition: FECore.cpp:345
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ add_ents_to_finite_element_by_TRIs() [2/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 428 of file FECore.cpp.

429  {
431  CHKERR add_ents_to_finite_element_by_type(meshset, MBTRI, name, recursive);
433 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
Definition: FECore.cpp:345
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

347  {
348  *buildMoFEM &= 1 << 0;
349  EntityHandle idm = no_handle;
351 
353  Range ents;
354  CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
355  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
356  CHKERR get_moab().add_entities(idm, ents);
357 
359 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:280
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
const EntityHandle no_handle
No entity handle is indicated by zero handle, i.e. root meshset.
Definition: Common.hpp:27
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:258
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

377  {
378  EntityHandle idm = no_handle;
379  *buildMoFEM &= 1 << 0;
382  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
383  ents.subset_by_type(type));
384  CHKERR get_moab().add_entities(idm, ents.subset_by_type(type));
386 } // namespace MoFEM
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:280
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
const EntityHandle no_handle
No entity handle is indicated by zero handle, i.e. root meshset.
Definition: Common.hpp:27
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:258
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

416  {
418  CHKERR add_ents_to_finite_element_by_type(vert, MBVERTEX, name);
420 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
Definition: FECore.cpp:345
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

464  {
467  type, verb);
468 
470 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEMErrorCode add_ents_to_finite_element_by_bit_ref(const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
add TET entities from given refinement level to finite element database given by name
Definition: FECore.cpp:481
#define CHKERR
Inline error check.
Definition: definitions.h:596
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

474  {
476  CHKERR add_ents_to_finite_element_by_bit_ref(bit, mask, name, type, verb);
477 
479 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEMErrorCode add_ents_to_finite_element_by_bit_ref(const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
add TET entities from given refinement level to finite element database given by name
Definition: FECore.cpp:481
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

95  {
97  if (verb == -1)
98  verb = verbose;
99  *buildMoFEM = 0;
100  auto fit = fIelds.get<FieldName_mi_tag>().find(name);
101  if (fit != fIelds.get<FieldName_mi_tag>().end()) {
102 
103  if (bh == MF_EXCL)
104  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
105  "field is <%s> in database", name.c_str());
106 
107  } else {
108 
109  EntityHandle meshset;
110  CHKERR get_moab().create_meshset(MESHSET_SET | MESHSET_TRACK_OWNER,
111  meshset);
112 
113  // Add field mesh set to partion meshset. In case of no elements
114  // on processor part, when mesh file is read, finite element meshset is
115  // prevented from deletion by moab reader.
116  auto add_meshset_to_partition = [&](auto meshset) {
118  const void *tag_vals[] = {&rAnk};
119  ParallelComm *pcomm = ParallelComm::get_pcomm(
120  &get_moab(), get_basic_entity_data_ptr()->pcommID);
121  Tag part_tag = pcomm->part_tag();
122  Range tagged_sets;
123  CHKERR get_moab().get_entities_by_type_and_tag(0, MBENTITYSET, &part_tag,
124  tag_vals, 1, tagged_sets,
125  moab::Interface::UNION);
126  for (auto s : tagged_sets)
127  CHKERR get_moab().add_entities(s, &meshset, 1);
129  };
130  CHKERR add_meshset_to_partition(meshset);
131 
132  // id
133  BitFieldId id = getFieldShift();
134 
135  auto create_tags = [&]() {
137  CHKERR
138  get_moab().tag_set_data(th_FieldId, &meshset, 1, &id);
139  // space
140  CHKERR get_moab().tag_set_data(th_FieldSpace, &meshset, 1, &space);
141  // base
142  CHKERR get_moab().tag_set_data(th_FieldBase, &meshset, 1, &base);
143 
144  // name
145  void const *tag_data[] = {name.c_str()};
146  int tag_sizes[1];
147  tag_sizes[0] = name.size();
148  CHKERR get_moab().tag_set_by_ptr(th_FieldName, &meshset, 1, tag_data,
149  tag_sizes);
150  // name data prefix
151  const std::string name_data_prefix("_App_Data");
152  void const *tag_prefix_data[] = {name_data_prefix.c_str()};
153  int tag_prefix_sizes[1];
154  tag_prefix_sizes[0] = name_data_prefix.size();
155  CHKERR get_moab().tag_set_by_ptr(th_FieldName_DataNamePrefix, &meshset, 1,
156  tag_prefix_data, tag_prefix_sizes);
157  Tag th_app_order, th_field_data, th_field_data_vert, th_rank;
158  // data
159  std::string tag_data_name = name_data_prefix + name;
160  const int def_len = 0;
161  CHKERR get_moab().tag_get_handle(
162  tag_data_name.c_str(), def_len, MB_TYPE_DOUBLE, th_field_data,
163  MB_TAG_CREAT | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
164  std::string tag_data_name_verts = name_data_prefix + name + "V";
165  VectorDouble def_vert_data(nb_of_coefficients);
166  def_vert_data.clear();
167  CHKERR get_moab().tag_get_handle(
168  tag_data_name_verts.c_str(), nb_of_coefficients, MB_TYPE_DOUBLE,
169  th_field_data_vert, MB_TAG_CREAT | tag_type, &*def_vert_data.begin());
170  // order
171  ApproximationOrder def_ApproximationOrder = -1;
172  const std::string Tag_ApproximationOrder_name = "_App_Order_" + name;
173  CHKERR get_moab().tag_get_handle(
174  Tag_ApproximationOrder_name.c_str(), 1, MB_TYPE_INTEGER, th_app_order,
175  MB_TAG_CREAT | tag_type, &def_ApproximationOrder);
176  // rank
177  int def_rank = 1;
178  const std::string tag_rank_name = "_Field_Rank_" + name;
179  CHKERR get_moab().tag_get_handle(tag_rank_name.c_str(), 1,
180  MB_TYPE_INTEGER, th_rank,
181  MB_TAG_CREAT | MB_TAG_SPARSE, &def_rank);
182  CHKERR get_moab().tag_set_data(th_rank, &meshset, 1, &nb_of_coefficients);
183 
185  };
186 
187  auto create_undefined_cs = [&](auto &undefined_cs_ptr) {
189  const int unidefined_cs_dim[] = {-1, 0, 0, 0};
190  CHKERR getInterface<CoordSystemsManager>()->addCoordinateSystem(
191  unidefined_cs_dim, "UNDEFINED", MF_ZERO);
192  CHKERR getInterface<CoordSystemsManager>()->getCoordSysPtr(
193  "UNDEFINED", undefined_cs_ptr);
195  };
196 
197  auto add_field_meshset_to_cs = [&](auto &undefined_cs_ptr) {
199  int cs_name_size[1];
200  cs_name_size[0] = undefined_cs_ptr->getName().size();
201  void const *cs_name[] = {&*undefined_cs_ptr->getNameRef().begin()};
202  CHKERR get_moab().tag_set_by_ptr(
203  getInterface<CoordSystemsManager>()->get_th_CoordSysName(), &meshset,
204  1, cs_name, cs_name_size);
205  EntityHandle coord_sys_meshset = undefined_cs_ptr->getMeshset();
206  CHKERR get_moab().add_entities(coord_sys_meshset, &meshset, 1);
208  };
209 
210  CHKERR create_tags();
211  boost::shared_ptr<CoordSys> undefined_cs_ptr;
212  CHKERR create_undefined_cs(undefined_cs_ptr);
213  CHKERR add_field_meshset_to_cs(undefined_cs_ptr);
214 
215  auto p = fIelds.insert(
216  boost::make_shared<Field>(moab, meshset, undefined_cs_ptr));
217  if (bh == MF_EXCL) {
218  if (!p.second)
219  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND,
220  "field not inserted %s (top tip, it could be already there)",
221  Field(moab, meshset, undefined_cs_ptr).getName().c_str());
222  }
223 
224  if (verb > QUIET) {
225  std::ostringstream ss;
226  ss << "add: " << **p.first << std::endl;
227  PetscPrintf(cOmm, ss.str().c_str());
228  }
229  }
230 
232 }
Tag th_FieldSpace
Definition: Core.hpp:204
Tag th_FieldName_DataNamePrefix
Definition: Core.hpp:204
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
int ApproximationOrder
Approximation on the entity.
Definition: Types.hpp:37
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:265
Tag th_FieldId
Definition: Core.hpp:204
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:850
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
Tag th_FieldBase
Definition: Core.hpp:204
Tag th_FieldName
Definition: Core.hpp:204
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition: Types.hpp:53
#define CHKERR
Inline error check.
Definition: definitions.h:596
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
ublas::vector< double, DoubleAllocator > VectorDouble
Definition: Types.hpp:72
boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()
Get pointer to basic entity data.
Definition: Core.hpp:234
BitFieldId getFieldShift()
Return unique field Id.
Definition: Core.cpp:225

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

46  {
48  *buildMoFEM &= 1 << 0;
49  if (verb == -1) {
50  verb = verbose;
51  }
52  typedef FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type
53  FiniteElements_by_name;
54  FiniteElements_by_name &finite_element_name_set =
55  finiteElements.get<FiniteElement_name_mi_tag>();
56  FiniteElements_by_name::iterator it_fe =
57  finite_element_name_set.find(fe_name);
58  if (bh == MF_EXCL) {
59  if (it_fe != finite_element_name_set.end()) {
60  SETERRQ1(cOmm, MOFEM_NOT_FOUND, "this < %s > is there", fe_name.c_str());
61  }
62  } else {
63  if (it_fe != finite_element_name_set.end())
65  }
66  EntityHandle meshset;
67  CHKERR get_moab().create_meshset(MESHSET_SET | MESHSET_TRACK_OWNER, meshset);
68 
69  // id
70  BitFEId id = getFEShift();
71  CHKERR get_moab().tag_set_data(th_FEId, &meshset, 1, &id);
72 
73  // Add finite element meshset to partion meshset. In case of no elements
74  // on processor part, when mesh file is read, finite element meshset is
75  // prevented from deletion by moab reader.
76  auto add_meshset_to_partition = [&](auto meshset) {
78  const void *tag_vals[] = {&rAnk};
79  ParallelComm *pcomm = ParallelComm::get_pcomm(
80  &get_moab(), get_basic_entity_data_ptr()->pcommID);
81  Tag part_tag = pcomm->part_tag();
82  Range tagged_sets;
83  CHKERR get_moab().get_entities_by_type_and_tag(0, MBENTITYSET, &part_tag,
84  tag_vals, 1, tagged_sets,
85  moab::Interface::UNION);
86  for (auto s : tagged_sets)
87  CHKERR get_moab().add_entities(s, &meshset, 1);
89  };
90  CHKERR add_meshset_to_partition(meshset);
91 
92  // id name
93  void const *tag_data[] = {fe_name.c_str()};
94  int tag_sizes[1];
95  tag_sizes[0] = fe_name.size();
96  CHKERR get_moab().tag_set_by_ptr(th_FEName, &meshset, 1, tag_data, tag_sizes);
97 
98  // add FiniteElement
99  std::pair<FiniteElement_multiIndex::iterator, bool> p = finiteElements.insert(
100  boost::shared_ptr<FiniteElement>(new FiniteElement(moab, meshset)));
101  if (!p.second)
102  SETERRQ(cOmm, MOFEM_OPERATION_UNSUCCESSFUL, "FiniteElement not inserted");
103  if (verb > 0) {
104  std::ostringstream ss;
105  ss << "add finite element: " << fe_name << std::endl;
106  PetscPrintf(cOmm, ss.str().c_str());
107  }
109 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
Tag th_FEName
Definition: Core.hpp:206
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:265
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:54
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:850
BitFEId getFEShift()
Return unique finite element Id.
Definition: Core.cpp:237
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
Tag th_FEId
Definition: Core.hpp:206
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()
Get pointer to basic entity data.
Definition: Core.hpp:234

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

77  {
79  if (verb == -1)
80  verb = verbose;
81  auto miit = pRoblems.get<Problem_mi_tag>().find(name);
82  if (miit == pRoblems.get<Problem_mi_tag>().end()) {
84  CHKERR addProblem(id, name, verb);
85  } else if (bh == MF_EXCL) {
86  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem is in database %s",
87  name.c_str());
88  }
90 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition: Types.hpp:55
BitProblemId getProblemShift()
Return unique problem Id.
Definition: Core.cpp:242
MoFEMErrorCode addProblem(const BitProblemId id, const std::string &name, int verb=DEFAULT_VERBOSITY)
add problem
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:257
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ addEntsToFieldByDim()

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

Definition at line 234 of file FieldCore.cpp.

235  {
236 
237  *buildMoFEM = 0;
238  EntityHandle idm = no_handle;
239  if (verb == -1)
240  verb = verbose;
242  idm = get_field_meshset(name);
243  FieldSpace space;
244  CHKERR get_moab().tag_get_data(th_FieldSpace, &idm, 1, &space);
245  std::vector<int> nb_ents_on_dim(3, 0);
246  switch (space) {
247  case L2:
248  CHKERR get_moab().add_entities(idm, ents);
249  if (verb >= VERY_VERBOSE) {
250  std::ostringstream ss;
251  ss << "add entities to field " << name;
252  ss << " nb. add ents " << ents.size();
253  ss << std::endl;
254  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
255  }
256  break;
257  case H1:
258  CHKERR get_moab().add_entities(idm, ents);
259  for (int dd = 0; dd != dim; ++dd) {
260  Range adj_ents;
261  CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
262  moab::Interface::UNION);
263  if (dd == 0) {
264  Range topo_nodes;
265  CHKERR get_moab().get_connectivity(ents, topo_nodes, true);
266  Range mid_nodes;
267  CHKERR get_moab().get_connectivity(ents, mid_nodes, false);
268  mid_nodes = subtract(mid_nodes, topo_nodes);
269  adj_ents = subtract(adj_ents, mid_nodes);
270  }
271  CHKERR get_moab().add_entities(idm, adj_ents);
272  nb_ents_on_dim[dd] = adj_ents.size();
273  }
274  break;
275  case HCURL:
276  CHKERR get_moab().add_entities(idm, ents);
277  for (int dd = 1; dd != dim; ++dd) {
278  Range adj_ents;
279  CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
280  moab::Interface::UNION);
281  CHKERR get_moab().add_entities(idm, adj_ents);
282  nb_ents_on_dim[dd] = adj_ents.size();
283  }
284  break;
285  case HDIV:
286  CHKERR get_moab().add_entities(idm, ents);
287  if (dim > 2) {
288  Range adj_ents;
289  CHKERR get_moab().get_adjacencies(ents, 2, false, adj_ents,
290  moab::Interface::UNION);
291  CHKERR get_moab().add_entities(idm, adj_ents);
292  nb_ents_on_dim[2] = adj_ents.size();
293  }
294  break;
295  default:
296  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
297  "sorry, unknown space added to entity");
298  }
299  if (verb >= VERY_VERBOSE) {
300  std::ostringstream ss;
301  ss << "add entities to field " << name;
302  ss << " nb. add ents " << ents.size();
303  ss << " nb. add faces " << nb_ents_on_dim[2];
304  ss << " nb. add edges " << nb_ents_on_dim[1];
305  ss << " nb. add nodes " << nb_ents_on_dim[0];
306  ss << std::endl;
307  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
308  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
309  }
311 }
Tag th_FieldSpace
Definition: Core.hpp:204
field with continuous normal traction
Definition: definitions.h:173
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
const EntityHandle no_handle
No entity handle is indicated by zero handle, i.e. root meshset.
Definition: Common.hpp:27
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
field with continuous tangents
Definition: definitions.h:172
FieldSpace
approximation spaces
Definition: definitions.h:168
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
EntityHandle get_field_meshset(const BitFieldId id) const
Definition: FieldCore.cpp:31
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
continuous field
Definition: definitions.h:171
field with C-1 continuity
Definition: definitions.h:174

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

267  {
269  if (verb == -1)
270  verb = verbose;
271  std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
272  p_ent = refinedEntities.insert(
273  boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
274  if (p_ent.second) {
275  std::pair<RefElement_multiIndex::iterator, bool> p;
276  p = refinedFiniteElements.insert(
277  boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)));
278  int num_nodes;
279  const EntityHandle *conn;
280  CHKERR get_moab().get_connectivity(prism, conn, num_nodes, true);
281  Range face_side3, face_side4;
282  CHKERR get_moab().get_adjacencies(conn, 3, 2, false, face_side3);
283  CHKERR get_moab().get_adjacencies(&conn[3], 3, 2, false, face_side4);
284  if (face_side3.size() != 1)
285  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
286  "prism don't have side face 3");
287  if (face_side4.size() != 1)
288  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
289  "prims don't have side face 4");
290  p.first->get()->getSideNumberPtr(*face_side3.begin());
291  p.first->get()->getSideNumberPtr(*face_side4.begin());
292  }
294 }
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:244
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:245
#define CHKERR
Inline error check.
Definition: definitions.h:596
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:225
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ addProblem()

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

add problem

Parameters
idproblem id
nameproblem name
verbverbosity level
Returns
MoFEMErrorCode

Definition at line 30 of file ProblemsCore.cpp.

31  {
33  if (verb == -1)
34  verb = verbose;
35  EntityHandle meshset;
36  CHKERR get_moab().create_meshset(MESHSET_SET | MESHSET_TRACK_OWNER, meshset);
37  CHKERR get_moab().tag_set_data(th_ProblemId, &meshset, 1, &id);
38 
39  // Add problem meshset to partion meshset. In case of no elements
40  // on processor part, when mesh file is read, finite element meshset is
41  // prevented from deletion by moab reader.
42  auto add_meshset_to_partition = [&](auto meshset) {
44  const void *tag_vals[] = {&rAnk};
45  ParallelComm *pcomm = ParallelComm::get_pcomm(
46  &get_moab(), get_basic_entity_data_ptr()->pcommID);
47  Tag part_tag = pcomm->part_tag();
48  Range tagged_sets;
49  CHKERR get_moab().get_entities_by_type_and_tag(0, MBENTITYSET, &part_tag,
50  tag_vals, 1, tagged_sets,
51  moab::Interface::UNION);
52  for (auto s : tagged_sets)
53  CHKERR get_moab().add_entities(s, &meshset, 1);
55  };
56  CHKERR add_meshset_to_partition(meshset);
57 
58  void const *tag_data[] = {name.c_str()};
59  int tag_sizes[1];
60  tag_sizes[0] = name.size();
61  CHKERR get_moab().tag_set_by_ptr(th_ProblemName, &meshset, 1, tag_data,
62  tag_sizes);
63  // create entry
64  std::pair<Problem_multiIndex::iterator, bool> p =
65  pRoblems.insert(Problem(moab, meshset));
66  NOT_USED(p);
67  assert(p.second);
68  if (verb > 0) {
69  std::ostringstream ss;
70  ss << "add problem: " << name << std::endl;
71  PetscPrintf(cOmm, ss.str().c_str());
72  }
74 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:265
Tag th_ProblemName
Definition: Core.hpp:208
Tag th_ProblemId
Definition: Core.hpp:208
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:850
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:257
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()
Get pointer to basic entity data.
Definition: Core.hpp:234
#define NOT_USED(x)
Definition: definitions.h:303

◆ build_adjacencies() [1/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 888 of file FECore.cpp.

888  {
890  if (verb == DEFAULT_VERBOSITY)
891  verb = verbose;
892  if (!((*buildMoFEM) & BUILD_FIELD))
893  SETERRQ(cOmm, MOFEM_NOT_FOUND, "field not build");
894  if (!((*buildMoFEM) & BUILD_FE))
895  SETERRQ(cOmm, MOFEM_NOT_FOUND, "fe not build");
896  for (Range::const_pair_iterator peit = ents.pair_begin();
897  peit != ents.pair_end(); ++peit) {
898  EntFiniteElement_multiIndex::index<Ent_mi_tag>::type::iterator fit, hi_fit;
899  fit = entsFiniteElements.get<Ent_mi_tag>().lower_bound(peit->first);
900  hi_fit = entsFiniteElements.get<Ent_mi_tag>().upper_bound(peit->second);
901  for (; fit != hi_fit; ++fit) {
902  if ((*fit)->getBitFieldIdRow().none() &&
903  (*fit)->getBitFieldIdCol().none() &&
904  (*fit)->getBitFieldIdData().none())
905  continue;
906  int by = BYROW;
907  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol())
908  by |= BYCOL;
909  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData())
910  by |= BYDATA;
911  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_row(by);
912  auto hint = entFEAdjacencies.end();
913  for (auto e : *(*fit)->row_field_ents_view) {
914  hint = entFEAdjacencies.emplace_hint(hint, e.lock(), *fit);
915  bool success = entFEAdjacencies.modify(hint, modify_row);
916  if (!success)
917  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
918  "modification unsuccessful");
919  }
920  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol()) {
921  int by = BYCOL;
922  if ((*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData())
923  by |= BYDATA;
924  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_col(by);
925  auto hint = entFEAdjacencies.end();
926  for (auto e : *(*fit)->col_field_ents_view) {
927  hint = entFEAdjacencies.emplace_hint(hint, e.lock(), *fit);
928  bool success = entFEAdjacencies.modify(hint, modify_col);
929  if (!success)
930  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
931  "modification unsuccessful");
932  }
933  }
934  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData() ||
935  (*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData()) {
936  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_data(
937  BYDATA);
938  auto hint = entFEAdjacencies.end();
939  for (auto &e : *(*fit)->data_field_ents_view) {
940  hint = entFEAdjacencies.emplace_hint(hint, e, *fit);
941  bool success = entFEAdjacencies.modify(hint, modify_data);
942  if (!success)
943  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
944  "modification unsuccessful");
945  }
946  }
947  }
948  }
949  if (verb >= VERY_NOISY) {
951  }
952  if (verb >= VERBOSE) {
953  PetscSynchronizedPrintf(cOmm, "Nb. entFEAdjacencies %u\n",
954  entFEAdjacencies.size());
955  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
956  }
957  *buildMoFEM |= 1 << 2;
959 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
int verbose
Verbosity level.
Definition: Core.hpp:885
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:252
MoFEMErrorCode list_adjacencies() const
list adjacencies
Definition: FieldCore.cpp:1183

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

973  {
975  if (verb == -1)
976  verb = verbose;
977  CHKERR build_adjacencies(bit, BitRefLevel().set(), verb);
978 
980 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)
build adjacencies
Definition: FECore.cpp:888
#define CHKERR
Inline error check.
Definition: definitions.h:596
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ build_adjacencies() [3/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 961 of file FECore.cpp.

962  {
964  if (verb == -1)
965  verb = verbose;
966  Range ents;
967  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents);
968 
969  CHKERR build_adjacencies(ents, verb);
970 
972 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)
build adjacencies
Definition: FECore.cpp:888
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

1128  {
1130  auto miit = fIelds.get<FieldName_mi_tag>().find(field_name);
1131  if (miit == fIelds.get<FieldName_mi_tag>().end()) {
1132  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field < %s > not found",
1133  field_name.c_str());
1134  }
1135  CHKERR buildField((*miit), verb);
1136  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
1138 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
MoFEMErrorCode buildField(const boost::shared_ptr< Field > &field, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1042
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ build_fields()

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

build fields

Implements MoFEM::CoreInterface.

Definition at line 1140 of file FieldCore.cpp.

1140  {
1142  if (verb == -1)
1143  verb = verbose;
1144  auto &set_id = fIelds.get<BitFieldId_mi_tag>();
1145  for (auto miit = set_id.begin(); miit != set_id.end(); miit++) {
1146  CHKERR buildField((*miit), verb);
1147  }
1148  *buildMoFEM = 1 << 0;
1149  if (verb > QUIET) {
1150  PetscSynchronizedPrintf(cOmm, "Nb. dofs %u\n", dofsField.size());
1151  }
1152  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
1154  // return 0;
1155 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:249
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
#define CHKERR
Inline error check.
Definition: definitions.h:596
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
MoFEMErrorCode buildField(const boost::shared_ptr< Field > &field, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1042
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ build_finite_elements() [1/3]

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

Build finite elementsBuild 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 820 of file FECore.cpp.

820  {
822  if (verb == DEFAULT_VERBOSITY)
823  verb = verbose;
824 
825  // loop Finite Elements
826  for (auto &fe : finiteElements) {
827  if (verb >= VERBOSE)
828  PetscPrintf(cOmm, "Build Finite Elements %s\n", fe->getName().c_str());
829  CHKERR buildFiniteElements(fe, NULL, verb);
830  }
831 
832  if (verb >= VERBOSE) {
833  PetscSynchronizedPrintf(cOmm, "Nb. FEs %u\n", entsFiniteElements.size());
834  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
835  auto &finite_elements_by_id = entsFiniteElements.get<BitFEId_mi_tag>();
836  for (auto &fe : finiteElements) {
837  auto miit = finite_elements_by_id.lower_bound(fe->getId());
838  auto hi_miit = finite_elements_by_id.upper_bound(fe->getId());
839  int count = std::distance(miit, hi_miit);
840  std::ostringstream ss;
841  ss << *fe << " Nb. FEs " << count << std::endl;
842  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
843  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
844  }
845  }
846 
847  *buildMoFEM |= 1 << 1;
849 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
MoFEMErrorCode buildFiniteElements(const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
Definition: FECore.cpp:581
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:252

◆ build_finite_elements() [2/3]

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

Definition at line 851 of file FECore.cpp.

851  {
853  SETERRQ(cOmm, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
855 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508

◆ build_finite_elements() [3/3]

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

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

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

Implements MoFEM::CoreInterface.

Definition at line 857 of file FECore.cpp.

859  {
861  if (verb == -1)
862  verb = verbose;
863 
864  auto fe_miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
865  if (fe_miit == finiteElements.get<FiniteElement_name_mi_tag>().end())
866  SETERRQ1(cOmm, MOFEM_NOT_FOUND, "Finite element <%s> not found",
867  fe_name.c_str());
868 
869  if (verb >= VERBOSE)
870  PetscPrintf(cOmm, "Build Finite Elements %s\n", fe_name.c_str());
871  CHKERR buildFiniteElements(*fe_miit, ents_ptr, verb);
872 
873  if (verb >= VERBOSE) {
874  auto &finite_elements_by_id = entsFiniteElements.get<BitFEId_mi_tag>();
875  auto miit = finite_elements_by_id.lower_bound((*fe_miit)->getId());
876  auto hi_miit = finite_elements_by_id.upper_bound((*fe_miit)->getId());
877  int count = std::distance(miit, hi_miit);
878  std::ostringstream ss;
879  ss << *(*fe_miit) << " Nb. FEs " << count << std::endl;
880  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
881  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
882  }
883 
884  *buildMoFEM |= 1 << 1;
886 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
MoFEMErrorCode buildFiniteElements(const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
Definition: FECore.cpp:581
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:252

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

241  {
243  if (verb == -1)
244  verb = verbose;
245  Problem_multiIndex::iterator p_miit = pRoblems.begin();
246  for (; p_miit != pRoblems.end(); p_miit++) {
247  CHKERR getInterface<ProblemsManager>()->buildProblemOnDistributedMesh(
248  const_cast<Problem *>(&*p_miit), verb);
249  }
251 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:257
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

301  {
303  if (verb == -1)
304  verb = verbose;
305  if (!((*buildMoFEM) & BUILD_FIELD))
306  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "fields not build");
307  if (!((*buildMoFEM) & BUILD_FE))
308  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "FEs not build");
309  if (!((*buildMoFEM) & BUILD_ADJ))
310  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "adjacencies not build");
311  // iterate problems
312  Problem_multiIndex::iterator p_miit = pRoblems.begin();
313  for (; p_miit != pRoblems.end(); p_miit++) {
314  Problem *problem_ptr = const_cast<Problem *>(&*p_miit);
315  CHKERR getInterface<ProblemsManager>()->buildProblem(problem_ptr, false,
316  verb);
317  }
320 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:896
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:257
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ buildField()

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

Definition at line 1042 of file FieldCore.cpp.

1043  {
1045  if (verb == -1)
1046  verb = verbose;
1047  if (verb > QUIET) {
1048  PetscSynchronizedPrintf(cOmm, "Build Field %s (rank %d)\n",
1049  field->getName().c_str(), rAnk);
1050  }
1051  std::map<EntityType, int> dof_counter;
1052  std::map<EntityType, int> inactive_dof_counter;
1053 
1054  // Need to rebuild order table since number of dofs on each order when
1055  // field was created.
1056  if (field->getApproxBase() == USER_BASE)
1057  CHKERR field->rebuildDofsOrderMap();
1058 
1059  switch (field->getSpace()) {
1060  case NOFIELD:
1061  CHKERR buildFieldForNoField(field->getId(), dof_counter, verb);
1062  break;
1063  case L2:
1064  case H1:
1065  case HCURL:
1066  case HDIV:
1067  CHKERR buildFieldForL2H1HcurlHdiv(field->getId(), dof_counter,
1068  inactive_dof_counter, verb);
1069  break;
1070  default:
1071  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1072  }
1073 
1074  if (verb > QUIET) {
1075  int nb_added_dofs = 0;
1076  int nb_inactive_added_dofs = 0;
1077  for (auto const &it : dof_counter) {
1078  switch (it.first) {
1079  case MBVERTEX:
1080  PetscSynchronizedPrintf(cOmm,
1081  "nb added dofs (vertices) %d (inactive %d)\n",
1082  it.second, inactive_dof_counter[it.first]);
1083  break;
1084  case MBEDGE:
1085  PetscSynchronizedPrintf(cOmm,
1086  "nb added dofs (edges) %d (inactive %d)\n",
1087  it.second, inactive_dof_counter[it.first]);
1088  break;
1089  case MBTRI:
1090  PetscSynchronizedPrintf(cOmm,
1091  "nb added dofs (triangles) %d (inactive %d)\n",
1092  it.second, inactive_dof_counter[it.first]);
1093  break;
1094  case MBQUAD:
1095  PetscSynchronizedPrintf(cOmm,
1096  "nb added dofs (quads) %d (inactive %d)\n",
1097  it.second, inactive_dof_counter[it.first]);
1098  break;
1099  case MBTET:
1100  PetscSynchronizedPrintf(cOmm, "nb added dofs (tets) %d (inactive %d)\n",
1101  it.second, inactive_dof_counter[it.first]);
1102  break;
1103  case MBPRISM:
1104  PetscSynchronizedPrintf(cOmm,
1105  "nb added dofs (prisms) %d (inactive %d)\n",
1106  it.second, inactive_dof_counter[it.first]);
1107  break;
1108  case MBENTITYSET:
1109  PetscSynchronizedPrintf(cOmm,
1110  "nb added dofs (meshsets) %d (inactive %d)\n",
1111  it.second, inactive_dof_counter[it.first]);
1112  break;
1113  default:
1114  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1115  }
1116  nb_added_dofs += it.second;
1117  nb_inactive_added_dofs += inactive_dof_counter[it.first];
1118  }
1119  if (verb > QUIET) {
1120  PetscSynchronizedPrintf(cOmm,
1121  "nb added dofs %d (number of inactive dofs %d)\n",
1122  nb_added_dofs, nb_inactive_added_dofs);
1123  }
1124  }
1126 }
field with continuous normal traction
Definition: definitions.h:173
user implemented approximation base
Definition: definitions.h:154
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
scalar or vector of scalars describe (no true field)
Definition: definitions.h:170
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:850
field with continuous tangents
Definition: definitions.h:172
#define CHKERR
Inline error check.
Definition: definitions.h:596
MoFEMErrorCode buildFieldForL2H1HcurlHdiv(const BitFieldId id, std::map< EntityType, int > &dof_counter, std::map< EntityType, int > &inactive_dof_counter, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:929
int verbose
Verbosity level.
Definition: Core.hpp:885
MoFEMErrorCode buildFieldForNoField(const BitFieldId id, std::map< EntityType, int > &dof_counter, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:819
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
continuous field
Definition: definitions.h:171
field with C-1 continuity
Definition: definitions.h:174

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

931  {
933  if (verb == -1)
934  verb = verbose;
935 
936  // Find field
937  auto &set_id = fIelds.get<BitFieldId_mi_tag>();
938  auto field_it = set_id.find(id);
939  if (field_it == set_id.end()) {
940  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field not found");
941  }
942  const int rank = field_it->get()->getNbOfCoeffs();
943  const boost::string_ref &field_name = field_it->get()->getNameRef();
944 
945  // Ents in the field meshset
946  Range ents_of_id_meshset;
947  CHKERR get_moab().get_entities_by_handle((*field_it)->meshSet,
948  ents_of_id_meshset, false);
949  if (verb > VERY_NOISY) {
950  PetscSynchronizedPrintf(PETSC_COMM_SELF, "Ents in field %s meshset %d\n",
951  (*field_it)->getName().c_str(),
952  ents_of_id_meshset.size());
953  }
954 
955  for (auto p_eit = ents_of_id_meshset.pair_begin();
956  p_eit != ents_of_id_meshset.pair_end(); ++p_eit) {
957 
958  const EntityHandle first = p_eit->first;
959  const EntityHandle second = p_eit->second;
960 
961  auto feit = entsFields.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
962  boost::make_tuple(field_name, first));
963  if (feit == entsFields.get<Composite_Name_And_Ent_mi_tag>().end())
964  continue;
965  auto hi_feit = entsFields.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
966  boost::make_tuple(field_name, second));
967 
968  // If there are DOFs in that range is more pragmatic to remove them
969  // rather than to find sub-ranges or make them inactive
970  auto dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
971  boost::make_tuple(field_name, first));
972  auto hi_dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
973  boost::make_tuple(field_name, second));
974  dofsField.get<Composite_Name_And_Ent_mi_tag>().erase(dit, hi_dit);
975 
976  // Add vertices DOFs by bulk
977  boost::shared_ptr<std::vector<DofEntity>> dofs_array =
978  boost::make_shared<std::vector<DofEntity>>(std::vector<DofEntity>());
979  // Add Sequence of DOFs to sequence container as weak_ptr
980  int nb_dofs_on_ents = 0;
981  for (auto tmp_feit = feit; tmp_feit != hi_feit; ++tmp_feit) {
982  nb_dofs_on_ents += rank * tmp_feit->get()->getOrderNbDofs(
983  tmp_feit->get()->getMaxOrder());
984  }
985 
986  // Reserve memory
987  dofs_array->reserve(nb_dofs_on_ents);
988 
989  // Create DOFs
990  for (; feit != hi_feit; ++feit) {
991  // Create dofs instances and shared pointers
992  int DD = 0;
993  // Loop orders (loop until max entity order is set)
994  for (int oo = 0; oo <= feit->get()->getMaxOrder(); ++oo) {
995  // Loop nb. dofs at order oo
996  for (int dd = 0; dd < feit->get()->getOrderNbDofsDiff(oo); ++dd) {
997  // Loop rank
998  for (int rr = 0; rr < rank; ++rr, ++DD) {
999  dofs_array->emplace_back(*feit, oo, rr, DD, true);
1000  ++dof_counter[feit->get()->getEntType()];
1001  }
1002  }
1003  }
1004  if (DD > feit->get()->getNbDofsOnEnt()) {
1005  std::ostringstream ss;
1006  ss << "rank " << rAnk << " ";
1007  ss << **feit << std::endl;
1008  SETERRQ3(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1009  "Expected number of DOFs on entity not equal to number added "
1010  "to database (DD = %d != %d = "
1011  "feit->get()->getNbDofsOnEnt())\n"
1012  "%s",
1013  DD, feit->get()->getNbDofsOnEnt(), ss.str().c_str());
1014  }
1015  }
1016 
1017  // Insert into Multi-Index container
1018  int dofs_field_size0 = dofsField.size();
1019  auto hint = dofsField.end();
1020  for (auto &v : *dofs_array)
1021  hint = dofsField.emplace_hint(hint, dofs_array, &v);
1022 
1023  // Add Sequence of DOFs to sequence container as weak_ptr
1024  field_it->get()->getDofSequenceContainer().push_back(dofs_array);
1025 
1026  // Check data consistency
1027  if (PetscUnlikely(static_cast<int>(dofs_array.use_count()) !=
1028  static_cast<int>(dofs_array->size() + 1))) {
1029  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1030  "Wrong use count %d != %d", dofs_array.use_count(),
1031  dofs_array->size() + 1);
1032  }
1033  if (dofs_field_size0 + dofs_array->size() != dofsField.size()) {
1034  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1035  "Wrong number of inserted DOFs %d != %d", dofs_array->size(),
1036  dofsField.size() - dofs_field_size0);
1037  }
1038  }
1040 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:249
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:248
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:850
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
#define CHKERR
Inline error check.
Definition: definitions.h:596
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ buildFieldForNoField()

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

Definition at line 819 of file FieldCore.cpp.

820  {
822  if (verb == -1)
823  verb = verbose;
824  // field it
825  auto &set_id = fIelds.get<BitFieldId_mi_tag>();
826  // find fields
827  auto miit = set_id.find(id);
828  if (miit == set_id.end())
829  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "field not found");
830 
831  // ents in the field meshset
832  Range ents_of_id_meshset;
833  CHKERR get_moab().get_entities_by_handle((*miit)->meshSet, ents_of_id_meshset,
834  false);
835  if (verb > VERY_NOISY)
836  PetscSynchronizedPrintf(cOmm, "ents in field %s meshset %d\n",
837  (*miit)->getName().c_str(),
838  ents_of_id_meshset.size());
839 
840  // ent view by field id (in set all MoabEnts has the same FieldId)
841  auto eiit =
842  entsFields.get<FieldName_mi_tag>().lower_bound(miit->get()->getNameRef());
843  FieldEntity_multiIndex_ent_view ents_id_view;
844  if (eiit != entsFields.get<FieldName_mi_tag>().end()) {
845  auto hi_eiit = entsFields.get<FieldName_mi_tag>().upper_bound(
846  miit->get()->getNameRef());
847  std::copy(eiit, hi_eiit, std::back_inserter(ents_id_view));
848  }
849 
850  boost::shared_ptr<const int> zero_order(new const int(0));
851 
852  for (Range::iterator eit = ents_of_id_meshset.begin();
853  eit != ents_of_id_meshset.end(); eit++) {
854  // search if field meshset is in database
855  RefEntity_multiIndex::index<Ent_mi_tag>::type::iterator miit_ref_ent;
856  miit_ref_ent = refinedEntities.get<Ent_mi_tag>().find(*eit);
857  if (miit_ref_ent == refinedEntities.get<Ent_mi_tag>().end()) {
858  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
859  "Entity is not in MoFEM database, entities in field meshset need "
860  "to be seeded (i.e. bit ref level add to them)");
861  }
862 
863  auto add_dofs = [&](auto field_eit) {
865  // create dofs on this entity (nb. of dofs is equal to rank)
866  for (FieldCoefficientsNumber rank = 0; rank < (*miit)->getNbOfCoeffs();
867  rank++) {
868  std::pair<DofEntity_multiIndex::iterator, bool> d_miit;
869  // insert dof
870  d_miit = dofsField.insert(
871  boost::make_shared<DofEntity>(field_eit, 0, rank, rank, true));
872  if (d_miit.second) {
873  dof_counter[MBENTITYSET]++; // Count entities in the meshset
874  } else {
875  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
876  "Dof should be created");
877  }
878  }
880  };
881 
882  // create database entity
883  auto field_eit = ents_id_view.get<1>().find(*eit);
884  if (field_eit == ents_id_view.get<1>().end()) {
885 
886  std::pair<FieldEntity_multiIndex::iterator, bool> e_miit;
887  e_miit = entsFields.insert(boost::make_shared<FieldEntity>(
888  *miit, *miit_ref_ent,
889  FieldEntity::makeSharedFieldDataAdaptorPtr(*miit, *miit_ref_ent),
890  boost::shared_ptr<const int>(zero_order, zero_order.get())));
891 
892  if (!e_miit.second)
893  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
894  "Entity should be created");
895 
896  CHKERR add_dofs(*(e_miit.first));
897 
898 
899  } else {
900 
901  // If there are DOFs in that range is more pragmatic to remove them
902  // rather than to find sub-ranges or make them inactive
903  auto dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
904  boost::make_tuple((*miit)->getNameRef(), *eit));
905  auto hi_dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
906  boost::make_tuple((*miit)->getNameRef(), *eit));
907  dofsField.get<Composite_Name_And_Ent_mi_tag>().erase(dit, hi_dit);
908 
909  CHKERR add_dofs(*field_eit);
910  }
911  }
912 
913  if (verb > VERY_VERBOSE) {
914  auto lo_dof = dofsField.get<FieldName_mi_tag>().lower_bound(
915  miit->get()->getNameRef());
916  auto hi_dof = dofsField.get<FieldName_mi_tag>().upper_bound(
917  miit->get()->getNameRef());
918  for (; lo_dof != hi_dof; lo_dof++) {
919  std::ostringstream ss;
920  ss << *lo_dof << std::endl;
921  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
922  }
923  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
924  }
925 
927 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:249
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:244
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:248
moab::Interface & get_moab()
Definition: Core.hpp:266
static boost::shared_ptr< FieldData *const > makeSharedFieldDataAdaptorPtr(const boost::shared_ptr< Field > &field_ptr, const boost::shared_ptr< RefEntity > &ref_ent_ptr)
Return shared pointer to entity field data vector adaptor.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
multi_index_container< boost::shared_ptr< FieldEntity >, indexed_by< sequenced<>, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FieldEntity, EntityHandle, &FieldEntity::getEnt > > > > FieldEntity_multiIndex_ent_view
#define CHKERR
Inline error check.
Definition: definitions.h:596
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
int FieldCoefficientsNumber
Number of field coefficients.
Definition: Types.hpp:38
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ buildFiniteElements()

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

Definition at line 581 of file FECore.cpp.

582  {
584  if (verb == DEFAULT_VERBOSITY)
585  verb = verbose;
586 
587  auto &fields_by_id = fIelds.get<BitFieldId_mi_tag>();
588 
589  // Get id of mofem fields for row, col and data
590  enum IntLoop { ROW = 0, COL, DATA, LAST };
591  std::array<BitFieldId, LAST> fe_fields = {fe.get()->getBitFieldIdRow(),
592  fe.get()->getBitFieldIdCol(),
593  fe.get()->getBitFieldIdData()};
594 
595  // Get finite element meshset
596  EntityHandle meshset = get_finite_element_meshset(fe.get()->getId());
597 
598  // Get entities from finite element meshset // if meshset
599  Range fe_ents;
600  CHKERR get_moab().get_entities_by_handle(meshset, fe_ents, false);
601 
602  if (ents_ptr)
603  fe_ents = intersect(fe_ents, *ents_ptr);
604 
605  // Map entity uid to pointers
606  typedef std::vector<boost::weak_ptr<EntFiniteElement>> VecOfWeakFEPtrs;
607  typedef std::map<const UId *, VecOfWeakFEPtrs> MapEntUIdAndVecOfWeakFEPtrs;
608  MapEntUIdAndVecOfWeakFEPtrs ent_uid_and_fe_vec;
609  std::map<EntityHandle, boost::shared_ptr<std::vector<FEDofEntity>>>
610  data_dofs_array;
611  VecOfWeakFEPtrs processed_fes;
612  processed_fes.reserve(fe_ents.size());
613 
614  int last_row_field_ents_view_size = 0;
615  int last_col_field_ents_view_size = 0;
616 
617  // View of field entities on element
618  FieldEntity_vector_view data_field_ents_view;
619 
620  // Loop meshset finite element ents and add finite elements
621  for (Range::const_pair_iterator peit = fe_ents.const_pair_begin();
622  peit != fe_ents.const_pair_end(); peit++) {
623 
624  EntityHandle first = peit->first;
625  EntityHandle second = peit->second;
626 
627  // Find range of ref entities that is sequence
628  // note: iterator is a wrapper
629  // check if is in refinedFiniteElements database
630  auto ref_fe_miit =
631  refinedFiniteElements.get<Ent_mi_tag>().lower_bound(first);
632  if (ref_fe_miit == refinedFiniteElements.get<Ent_mi_tag>().end()) {
633  std::ostringstream ss;
634  ss << "refinedFiniteElements not in database ent = " << first;
635  ss << " type " << get_moab().type_from_handle(first);
636  ss << " " << *fe;
637  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, ss.str().c_str());
638  }
639  auto hi_ref_fe_miit =
640  refinedFiniteElements.get<Ent_mi_tag>().upper_bound(second);
641 
642  EntFiniteElement_multiIndex::iterator hint_p = entsFiniteElements.end();
643  for (; ref_fe_miit != hi_ref_fe_miit; ref_fe_miit++) {
644 
645  // Add finite element to database
646  hint_p = entsFiniteElements.emplace_hint(
647  hint_p, boost::make_shared<EntFiniteElement>(*ref_fe_miit, fe));
648  processed_fes.emplace_back(*hint_p);
649  auto fe_raw_ptr = hint_p->get();
650 
651  // Allocate space for etities view
652  data_field_ents_view.clear();
653  fe_raw_ptr->row_field_ents_view->reserve(last_row_field_ents_view_size);
654  // Create shared pointer for entities view
655  if (fe_fields[ROW] == fe_fields[COL]) {
656  fe_raw_ptr->col_field_ents_view = fe_raw_ptr->row_field_ents_view;
657  } else {
658  // row and columns are diffent
659  if (fe_raw_ptr->col_field_ents_view ==
660  fe_raw_ptr->row_field_ents_view)
661  fe_raw_ptr->col_field_ents_view =
662  boost::make_shared<FieldEntity_vector_view>();
663  fe_raw_ptr->col_field_ents_view->reserve(last_col_field_ents_view_size);
664  }
665 
666  int nb_dofs_on_data = 0;
667 
668  // Iterate over all field and check which one is on the element
669  for (unsigned int ii = 0; ii != BitFieldId().size(); ++ii) {
670 
671  // Common field id for ROW, COL and DATA
672  BitFieldId id_common = 0;
673  // Check if the field (ii) is added to finite element
674  for (int ss = 0; ss < LAST; ss++) {
675  id_common |= fe_fields[ss] & BitFieldId().set(ii);
676  }
677  if (id_common.none())
678  continue;
679 
680  // Find in database data associated with the field (ii)
681  const BitFieldId field_id = BitFieldId().set(ii);
682  auto miit = fields_by_id.find(field_id);
683  if (miit == fields_by_id.end()) {
684  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
685  "Data inconsistency");
686  }
687 
688 
689  // Loop over adjacencies of element and find field entities on those
690  // adjacencies, that create hash map map_uid_fe which is used later
691  const std::string field_name = miit->get()->getName();
692  const bool add_to_data = (field_id & fe_fields[DATA]).any();
693  const bool add_to_row = (field_id & fe_fields[ROW]).any();
694  const bool add_to_col = (field_id & fe_fields[COL]).any();
695 
696  // Entities adjacent to entities
697  Range adj_ents;
698 
699  // Resolve entities on element, those entities are used to build tag
700  // with dof uids on finite element tag
701  CHKERR fe_raw_ptr->getElementAdjacency(*miit, adj_ents);
702 
703  for (Range::pair_iterator p_eit = adj_ents.pair_begin();
704  p_eit != adj_ents.pair_end(); ++p_eit) {
705 
706  const EntityHandle first = p_eit->first;
707  const EntityHandle second = p_eit->second;
708 
709  typedef FieldEntity_multiIndex::index<
710  Composite_Name_And_Ent_mi_tag>::type FieldEntityByComposite;
711  auto &field_ents_by_name_and_ent =
712  entsFields.get<Composite_Name_And_Ent_mi_tag>();
713  FieldEntityByComposite::iterator meit;
714 
715  // If one entity in the pair search for one, otherwise search for
716  // range
717  if (first == second)
718  meit = field_ents_by_name_and_ent.find(
719  boost::make_tuple(field_name, first));
720  else
721  meit = field_ents_by_name_and_ent.lower_bound(
722  boost::make_tuple(field_name, first));
723 
724  if (meit != field_ents_by_name_and_ent.end()) {
725 
726  decltype(meit) hi_meit;
727 
728  if (first == second) {
729  hi_meit = meit;
730  ++hi_meit;
731  } else
732  hi_meit = field_ents_by_name_and_ent.upper_bound(
733  boost::make_tuple(field_name, second));
734 
735  // Add to view and create list of finite elements with this dof UId
736  for (; meit != hi_meit; ++meit) {
737  // Add entity to map with key entity uids pointers and data
738  // finite elements weak ptrs. I using pointers to uids instead
739  // uids because this is faster.
740  const UId *uid_ptr = &(meit->get()->getGlobalUniqueId());
741  auto &fe_vec = ent_uid_and_fe_vec[uid_ptr];
742  // get number of dofs on entities to pre-allocate memory for
743  // element
744  const int nb_dofs_on_ent = meit->get()->getNbDofsOnEnt();
745  if (add_to_data) {
746  nb_dofs_on_data += nb_dofs_on_ent;
747  data_field_ents_view.emplace_back(*meit);
748  }
749  if (add_to_row) {
750  fe_raw_ptr->row_field_ents_view->emplace_back(*meit);
751  }
752  if (add_to_col) {
753  if (fe_raw_ptr->col_field_ents_view !=
754  fe_raw_ptr->row_field_ents_view)
755  fe_raw_ptr->col_field_ents_view->emplace_back(*meit);
756  }
757  // add finite element to processed list
758  fe_vec.emplace_back(*hint_p);
759  }
760  }
761  }
762  }
763 
764  // Sort field ents by uid
765  auto uid_comp = [](const auto &a, const auto &b) {
766  return a.lock()->getGlobalUniqueId() < b.lock()->getGlobalUniqueId();
767  };
768 
769  // Sort all views
770 
771  // Data
772  sort(data_field_ents_view.begin(), data_field_ents_view.end(), uid_comp);
773  for (auto e : data_field_ents_view)
774  fe_raw_ptr->data_field_ents_view->emplace_back(e);
775 
776  // Row
777  sort(fe_raw_ptr->row_field_ents_view->begin(),
778  fe_raw_ptr->row_field_ents_view->end(), uid_comp);
779  last_row_field_ents_view_size = fe_raw_ptr->row_field_ents_view->size();
780 
781  // Column
782  if (fe_raw_ptr->col_field_ents_view != fe_raw_ptr->row_field_ents_view) {
783  sort(fe_raw_ptr->col_field_ents_view->begin(),
784  fe_raw_ptr->col_field_ents_view->end(), uid_comp);
785  last_col_field_ents_view_size = fe_raw_ptr->col_field_ents_view->size();
786  }
787 
788  // Clear finite element data structures
789  fe_raw_ptr->data_dofs->clear();
790 
791  // Reserve memory for data FE Dofs
792  auto data_dofs_array_vec = boost::make_shared<std::vector<FEDofEntity>>();
793  data_dofs_array[fe_raw_ptr->getEnt()] = data_dofs_array_vec;
794  data_dofs_array_vec->reserve(nb_dofs_on_data);
795 
796  fe_raw_ptr->getDofsSequence() = data_dofs_array_vec;
797 
798 
799  }
800  }
801 
802  auto &dofs_by_ent_uid = dofsField.get<Unique_Ent_mi_tag>();
803 
804  // Loop over hash map, which has all entities on given elemnts
805  boost::shared_ptr<SideNumber> side_number_ptr;
806  for (auto &mit : ent_uid_and_fe_vec) {
807  auto range_dit = dofs_by_ent_uid.equal_range(*mit.first);
808  if (range_dit.first != range_dit.second) {
809  const BitFieldId field_id = range_dit.first->get()->getId();
810  if ((field_id & fe_fields[DATA]).any())
811  BuildFiniteElements<DATA>::addToData(range_dit, mit.second);
812  }
813  }
814 
816 
818 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:249
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:280
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:248
moab::Interface & get_moab()
Definition: Core.hpp:266
std::vector< boost::weak_ptr< FieldEntity > > FieldEntity_vector_view
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
static void emplaceHint(T &fe_vec)
Definition: FECore.cpp:561
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:245
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition: Types.hpp:53
#define CHKERR
Inline error check.
Definition: definitions.h:596
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
static void addToData(T1 &range_dit, T2 &fe_vec)
Definition: FECore.cpp:542
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:252
uint128_t UId
Unique Id.
Definition: Types.hpp:41

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

43  {
44  auto &set = fIelds.get<FieldName_mi_tag>();
45  auto miit = set.find(name);
46  if (miit == set.end())
47  return false;
48  return true;
49 }
Field_multiIndex fIelds
fields
Definition: Core.hpp:247

◆ check_finite_element()

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

Check if finite element is in database.

Parameters
nameName of finite element
Returns
true if element is declared

Implements MoFEM::CoreInterface.

Definition at line 35 of file FECore.cpp.

35  {
36  typedef FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type
37  FeSetByName;
38  const FeSetByName &set = finiteElements.get<FiniteElement_name_mi_tag>();
39  FeSetByName::iterator miit = set.find(name);
40  if (miit == set.end())
41  return false;
42  return true;
43 }
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251

◆ check_number_of_ents_in_ents_field() [1/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 1258 of file FieldCore.cpp.

1258  {
1260  auto it = fIelds.get<FieldName_mi_tag>().find(name);
1261  if (it == fIelds.get<FieldName_mi_tag>().end()) {
1262  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1263  "field not found < %s >", name.c_str());
1264  }
1265  EntityHandle meshset = (*it)->getMeshset();
1266  int num_entities;
1267  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1268  if (entsFields.get<FieldName_mi_tag>().count((*it)->getName()) >
1269  (unsigned int)num_entities) {
1270  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1271  "not equal number of entities in meshset and field multiindex "
1272  "< %s >",
1273  name.c_str());
1274  }
1276 }
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:248
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
#define CHKERR
Inline error check.
Definition: definitions.h:596
Field_multiIndex fIelds
fields
Definition: Core.hpp:247

◆ check_number_of_ents_in_ents_field() [2/2]

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

check data consistency in entitiesPtr

Implements MoFEM::CoreInterface.

Definition at line 1277 of file FieldCore.cpp.

1277  {
1279  for (auto &it : fIelds.get<FieldName_mi_tag>()) {
1280  if (it->getSpace() == NOFIELD)
1281  continue; // FIXME: should be treated properly, not test is just
1282  // skipped for this NOFIELD space
1283  EntityHandle meshset = it->getMeshset();
1284  int num_entities;
1285  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1286  if (entsFields.get<FieldName_mi_tag>().count(it->getName()) >
1287  (unsigned int)num_entities) {
1288  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1289  "not equal number of entities in meshset and field "
1290  "multiindex < %s >",
1291  it->getName().c_str());
1292  }
1293  }
1295 }
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:248
moab::Interface & get_moab()
Definition: Core.hpp:266
scalar or vector of scalars describe (no true field)
Definition: definitions.h:170
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ check_number_of_ents_in_ents_finite_element() [1/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 993 of file FECore.cpp.

994  {
996  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
997  it = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
998  if (it == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
999  SETERRQ1(cOmm, 1, "finite element not found < %s >", name.c_str());
1000  }
1001  EntityHandle meshset = (*it)->getMeshset();
1002 
1003  int num_entities;
1004  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1005 
1006  if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
1007  (*it)->getName().c_str()) != (unsigned int)num_entities) {
1008  SETERRQ1(cOmm, 1,
1009  "not equal number of entities in meshset and finite elements "
1010  "multiindex < %s >",
1011  (*it)->getName().c_str());
1012  }
1014 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:252

◆ check_number_of_ents_in_ents_finite_element() [2/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 1016 of file FECore.cpp.

1016  {
1018  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
1019  it = finiteElements.get<FiniteElement_name_mi_tag>().begin();
1020  for (; it != finiteElements.get<FiniteElement_name_mi_tag>().end(); it++) {
1021  EntityHandle meshset = (*it)->getMeshset();
1022 
1023  int num_entities;
1024  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1025 
1026  if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
1027  (*it)->getName().c_str()) != (unsigned int)num_entities) {
1028  SETERRQ1(cOmm, 1,
1029  "not equal number of entities in meshset and finite elements "
1030  "multiindex < %s >",
1031  (*it)->getName().c_str());
1032  }
1033  }
1035 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:846
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:252

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

21  {
22  Problem_multiIndex::index<Problem_mi_tag>::type::iterator pit;
23  pit = pRoblems.get<Problem_mi_tag>().find(name);
24  if (pit == pRoblems.get<Problem_mi_tag>().end()) {
25  return false;
26  }
27  return true;
28 }
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:257

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

207  {
209  if (verb == -1)
210  verb = verbose;
211  Range ents;
212  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
215 }
MoFEMErrorCode clear_adjacencies_entities(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:205
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

217  {
219  if (verb == -1)
220  verb = verbose;
221  for (Range::const_pair_iterator p_eit = ents.pair_begin();
222  p_eit != ents.pair_end(); ++p_eit) {
223  const EntityHandle first = p_eit->first;
224  const EntityHandle second = p_eit->second;
225  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
226  Ent_mi_tag>::type::iterator ait,
227  hi_ait;
228  ait = entFEAdjacencies.get<Ent_mi_tag>().lower_bound(first);
229  hi_ait = entFEAdjacencies.get<Ent_mi_tag>().upper_bound(second);
230  entFEAdjacencies.get<Ent_mi_tag>().erase(ait, hi_ait);
231  }
233 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
int verbose
Verbosity level.
Definition: Core.hpp:885

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

236  {
238  if (verb == -1)
239  verb = verbose;
240 
241  const Field *field_ptr = get_field_structure(name);
242  int field_bit_number = field_ptr->getBitNumber();
243  bool is_distributed_mesh = basicEntityDataPtr->trueIfDistributedMesh();
244  ParallelComm *pcomm =
245  ParallelComm::get_pcomm(&get_moab(), basicEntityDataPtr->pcommID);
246 
247  for (Range::const_pair_iterator p_eit = ents.pair_begin();
248  p_eit != ents.pair_end(); p_eit++) {
249 
250  // First and last handle
251  const EntityHandle first = p_eit->first;
252  const EntityHandle second = p_eit->second;
253 
254  // Get owner proc and owner handle
255  int f_owner_proc;
256  EntityHandle f_moab_owner_handle;
257  CHKERR pcomm->get_owner_handle(first, f_owner_proc, f_moab_owner_handle);
258  int s_owner_proc;
259  EntityHandle s_moab_owner_handle;
260  CHKERR pcomm->get_owner_handle(second, s_owner_proc, s_moab_owner_handle);
261 
262  // Get UId
264  f_owner_proc, field_bit_number, f_moab_owner_handle,
265  is_distributed_mesh);
267  s_owner_proc, field_bit_number, s_moab_owner_handle,
268  is_distributed_mesh);
269 
270  // Find adjacencies
271  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
272  Unique_mi_tag>::type::iterator ait,
273  hi_ait;
274  ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound(first_uid);
275  hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound(second_uid);
276  entFEAdjacencies.get<Unique_mi_tag>().erase(ait, hi_ait);
277  }
279 }
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
UId getGlobalUniqueIdCalculate() const
Calculate global UId.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
const Field * get_field_structure(const std::string &name)
get field structure
Definition: FieldCore.cpp:51
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
#define CHKERR
Inline error check.
Definition: definitions.h:596
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:225
int verbose
Verbosity level.
Definition: Core.hpp:885
uint128_t UId
Unique Id.
Definition: Types.hpp:41

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

336  {
338  Range ents;
339  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
342 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
MoFEMErrorCode clear_adjacencies_finite_elements(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
clear adjacency map for finite elements on given bit level
Definition: DeleteCore.cpp:334
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ clear_adjacencies_finite_elements() [2/3]

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

Definition at line 344 of file DeleteCore.cpp.

345  {
347  if (verb == -1)
348  verb = verbose;
349  for (Range::const_pair_iterator p_eit = ents.pair_begin();
350  p_eit != ents.pair_end(); p_eit++) {
351  EntityHandle first = p_eit->first;
352  EntityHandle second = p_eit->second;
353  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
354  FEEnt_mi_tag>::type::iterator ait,
355  hi_ait;
356  ait = entFEAdjacencies.get<FEEnt_mi_tag>().lower_bound(first);
357  hi_ait = entFEAdjacencies.get<FEEnt_mi_tag>().upper_bound(second);
358  entFEAdjacencies.get<FEEnt_mi_tag>().erase(ait, hi_ait);
359  }
361 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
int verbose
Verbosity level.
Definition: Core.hpp:885

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

365  {
367  if (verb == -1)
368  verb = verbose;
369 
370  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator
371  it_fe = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
372  if (it_fe != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
373 
374  const int fe_bit_number = it_fe->get()->getBitNumber();
375 
376  for (Range::const_pair_iterator p_eit = ents.pair_begin();
377  p_eit != ents.pair_end(); p_eit++) {
378 
379  // First and last handle
380  const EntityHandle first = p_eit->first;
381  const EntityHandle second = p_eit->second;
382 
383  // Get UId
384  UId first_uid =
385  EntFiniteElement::getGlobalUniqueIdCalculate(first, fe_bit_number);
386  UId second_uid =
387  EntFiniteElement::getGlobalUniqueIdCalculate(second, fe_bit_number);
388 
389  // Find and remove adjacencies
390  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
391  FE_Unique_mi_tag>::type::iterator ait,
392  hi_ait;
393  ait = entFEAdjacencies.get<FE_Unique_mi_tag>().lower_bound(first_uid);
394  hi_ait = entFEAdjacencies.get<FE_Unique_mi_tag>().upper_bound(second_uid);
395  entFEAdjacencies.get<FE_Unique_mi_tag>().erase(ait, hi_ait);
396  }
397  }
399 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
UId getGlobalUniqueIdCalculate() const
Generate UId for finite element entity.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
int verbose
Verbosity level.
Definition: Core.hpp:885
uint128_t UId
Unique Id.
Definition: Types.hpp:41

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

498  {
500  if (verb == -1)
501  verb = verbose;
502  CHKERR clearMap();
504 }
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:247
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

61  {
63  if (verb == -1)
64  verb = verbose;
65 
66  for (Range::const_pair_iterator p_eit = ents.pair_begin();
67  p_eit != ents.pair_end(); p_eit++) {
68  EntityHandle first = p_eit->first;
69  EntityHandle second = p_eit->second;
70  // get dofs range
71  DofEntityByEnt::iterator dit, hi_dit;
72  dit = dofsField.get<Ent_mi_tag>().lower_bound(first);
73  if (dit == dofsField.get<Ent_mi_tag>().end())
74  continue;
75  hi_dit = dofsField.get<Ent_mi_tag>().upper_bound(second);
76  // finally clear dofs
77  dofsField.get<Ent_mi_tag>().erase(dit,hi_dit);
78  }
80 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:249
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
int verbose
Verbosity level.
Definition: Core.hpp:885

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

83  {
85  if (verb == -1)
86  verb = verbose;
87 
88  for (Range::const_pair_iterator p_eit = ents.pair_begin();
89  p_eit != ents.pair_end(); p_eit++) {
90  EntityHandle first = p_eit->first;
91  EntityHandle second = p_eit->second;
92  DofEntityByNameAndEnt::iterator dit, hi_dit;
93  dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
94  boost::make_tuple(name, first));
95  hi_dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
96  boost::make_tuple(name, second));
97  dofsField.get<Composite_Name_And_Ent_mi_tag>().erase(dit, hi_dit);
98  }
100 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:249
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
int verbose
Verbosity level.
Definition: Core.hpp:885

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

51  {
53  if (verb == -1)
54  verb = verbose;
55  Range ents;
56  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
57  CHKERR clear_dofs_fields(ents, verb);
59 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:61
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885

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

115  {
117  if (verb == -1)
118  verb = verbose;
119  CHKERR clear_dofs_fields(ents, verb);
121  for (Range::const_pair_iterator p_eit = ents.pair_begin();
122  p_eit != ents.pair_end(); p_eit++) {
123  EntityHandle first = p_eit->first;
124  EntityHandle second = p_eit->second;
125  FieldEntity_multiIndex::index<Ent_mi_tag>::type::iterator dit, hi_dit;
126  dit = entsFields.get<Ent_mi_tag>().lower_bound(first);
127  hi_dit = entsFields.get<Ent_mi_tag>().upper_bound(second);
128  entsFields.get<Ent_mi_tag>().erase(dit, hi_dit);
129  }
131 }
MoFEMErrorCode clear_adjacencies_entities(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:205
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:248
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:61
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

134  {
136  if (verb == -1)
137  verb = verbose;
138  CHKERR clear_dofs_fields(name, ents, verb);
139  CHKERR clear_adjacencies_entities(name, ents, verb);
140  for (Range::const_pair_iterator p_eit = ents.pair_begin();
141  p_eit != ents.pair_end(); p_eit++) {
142  EntityHandle first = p_eit->first;
143  EntityHandle second = p_eit->second;
144  FieldEntity_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type::iterator
145  dit,
146  hi_dit;
147  dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
148  boost::make_tuple(name, first));
149  hi_dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
150  boost::make_tuple(name, second));
151  entsFields.get<Composite_Name_And_Ent_mi_tag>().erase(dit, hi_dit);
152  }
154 }
MoFEMErrorCode clear_adjacencies_entities(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:205
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:248
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:61
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

103  {
105  if (verb == -1)
106  verb = verbose;
107  Range ents;
108  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
109  CHKERR clear_dofs_fields(ents, verb);
111  CHKERR clear_ents_fields(ents, verb);
113 }
MoFEMErrorCode clear_adjacencies_entities(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:205
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEMErrorCode clear_ents_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:115
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:61
#define CHKERR
Inline error check.
Definition: definitions.h:596
int verbose
Verbosity level.
Definition: Core.hpp:885
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

293  {
295  if (verb == -1)
296  verb = verbose;
298  for (Range::const_pair_iterator p_eit = ents.pair_begin();
299  p_eit != ents.pair_end(); p_eit++) {
300  EntityHandle first = p_eit->first;
301  EntityHandle second = p_eit->second;
302  EntFiniteElement_multiIndex::index<Ent_mi_tag>::type::iterator fit, hi_fit;
303  fit = entsFiniteElements.get<Ent_mi_tag>().lower_bound(first);
304  hi_fit = entsFiniteElements.get<Ent_mi_tag>().upper_bound(second);
305  entsFiniteElements.get<Ent_mi_tag>().erase(fit, hi_fit);
306  }
308 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596