v0.9.1
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 make_entities_multishared (const EntityHandle *entities, const int num_entities, const int my_proc=0, int verb=DEFAULT_VERBOSITY)
 make entities from proc 0 shared on all proc More...
 
DEPRECATED MoFEMErrorCode make_entities_multishared (Range &entities, const int my_proc=0, int verb=DEFAULT_VERBOSITY)
 make entities from proc 0 shared on all proc More...
 
DEPRECATED MoFEMErrorCode make_field_entities_multishared (const std::string field_name, const int owner_proc=0, int verb=DEFAULT_VERBOSITY)
 make field entities multi shared More...
 
DEPRECATED MoFEMErrorCode exchange_field_data (const std::string field_name, int verb=DEFAULT_VERBOSITY)
 Exchange field data. More...
 
DEPRECATED MoFEMErrorCode synchronise_entities (Range &ent, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode synchronise_field_entities (const std::string &name, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode remove_parents_by_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 
- Public Member Functions inherited from MoFEM::CoreInterface
virtual ~CoreInterface ()=default
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (const MOFEMuuid &uuid, bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE , bool VERIFY = false>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, IFACE *&iface) const
 Get interface by uuid and return reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 
virtual MoFEMErrorCode getLibVersion (Version &version) const
 Get library version. More...
 
virtual const MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version) const
 Get database major version. More...
 
virtual MoFEMErrorCode getInterfaceVersion (Version &version) const
 Get database major version. More...
 
template<>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, UnknownInterface *&iface) const
 

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
}
 
int & getBuildMoFEM () const
 Get flags/semaphores for different stages. More...
 
MoFEMErrorCode addPrismToDatabase (const EntityHandle prism, int verb=DEFAULT_VERBOSITY)
 add prim element More...
 

Tags to data on mesh and entities

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

Multi-Indices accessing data on the mesh

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

Get moab database

std::reference_wrapper< moab::Interface > moab
 moab database More...
 
moab::Interface & get_moab ()
 
const moab::Interface & get_moab () const
 
MoFEMErrorCode set_moab_interface (moab::Interface &new_moab, int verb=VERBOSE, 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_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 Remove parent from entities on bit level. More...
 
MoFEMErrorCode remove_parents_by_parents (const Range &ents, int verb=DEFAULT_VERBOSITY)
 Remove paremts from entities having parents in passed range. More...
 
MoFEMErrorCode remove_ents (const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities form mofem database More...
 
MoFEMErrorCode remove_ents_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 remove entities form mofem database More...
 
MoFEMErrorCode delete_ents_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, const bool remove_parent=false, int verb=DEFAULT_VERBOSITY)
 delete entities form mofem and moab database More...
 

Fields

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)
 

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...
 
const Field_multiIndexget_fields () const
 Get the fields object. More...
 
const RefEntity_multiIndexget_ref_ents () const
 Get the ref ents object. More...
 
const RefElement_multiIndexget_ref_finite_elements () const
 Get the ref finite elements object. More...
 
const FiniteElement_multiIndexget_finite_elements () const
 Get the finite elements object. More...
 
const EntFiniteElement_multiIndexget_ents_finite_elements () const
 Get the ents finite elements object. More...
 
const FieldEntity_multiIndexget_field_ents () const
 Get the field ents object. More...
 
const DofEntity_multiIndexget_dofs () const
 Get the dofs object. More...
 
const Problemget_problem (const std::string &problem_name) const
 Get the problem object. More...
 
const Problem_multiIndexget_problems () const
 Get the problems object. More...
 
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...
 
int * fShift
 Ptr to tag handle storing last set bit in field ID. More...
 
int * feShift
 Ptr to tag handle storing last set bit in finite element ID. More...
 
int * pShift
 Ptr to tag handle storing last set bit in problem ID. More...
 
boost::ptr_map< unsigned long, UnknownInterfaceiFaces
 Hash map of pointers to interfaces. More...
 
int * buildMoFEM
 keeps flags/semaphores for different stages More...
 
std::string optionsPrefix
 Prefix for options on command line. More...
 
PetscBool initaliseAndBuildField
 
PetscBool initaliseAndBuildFiniteElements
 
static 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)
 Register subinterfac in core interface. More...
 

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, add_cubit_meshsets.cpp, analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, bernstein_bezier_generate_base.cpp, bone_adaptation.cpp, boundary_marker.cpp, build_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, hdiv_divergence_operator.cpp, hello_world.cpp, lesson1_moment_of_inertia.cpp, lesson2_approximaton.cpp, lesson3_poisson.cpp, lesson4_elastic.cpp, lesson5_helmholtz.cpp, lesson6_radiation.cpp, lesson7_plastic.cpp, lesson8_contact.cpp, log.cpp, loop_entities.cpp, lorentz_force.cpp, magnetostatic.cpp, mesh_cut.cpp, mesh_insert_interface_atom.cpp, mesh_smoothing.cpp, meshset_to_vtk.cpp, minimal_surface_area.cpp, prism_elements_from_surface.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, reaction_diffusion_equation.cpp, remove_entities_from_problem.cpp, scalar_check_approximation_2d.cpp, simple_contact.cpp, simple_elasticity.cpp, simple_interface.cpp, split_sideset.cpp, test_jacobian_of_simple_contact_element.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 113 of file Core.cpp.

115  : moab(moab), cOmm(0), verbose(verbose),
116  initaliseAndBuildField(PETSC_FALSE),
117  initaliseAndBuildFiniteElements(PETSC_FALSE) {
118 
119  // This is deprecated ONE should use MoFEM::Core::Initialize
120  if (!isGloballyInitialised) {
121  PetscPushErrorHandler(mofem_error_handler, PETSC_NULL);
122  isGloballyInitialised = true;
123  }
124 
125  // Create duplicate communicator
126  wrapMPIComm = boost::make_shared<WrapMPIComm>(comm, cOmm);
127  MPI_Comm_size(cOmm, &sIze);
128  MPI_Comm_rank(cOmm, &rAnk);
129  // CHeck if moab has set communicator if not set communicator interbally
130  ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
131  if (pComm == NULL) {
132  pComm = new ParallelComm(&moab, cOmm);
133  }
134 
135  // Register interfaces for this implementation
136  ierr = registerInterface<UnknownInterface>(IDD_MOFEMUnknown);
137  CHKERRABORT(comm, ierr);
138  ierr = registerInterface<CoreInterface>(IDD_MOFEMCoreInterface);
139  CHKERRABORT(comm, ierr);
140  ierr = registerInterface<DeprecatedCoreInterface>(
142  CHKERRABORT(comm, ierr);
143 
144  // Register sub-interfaces
146  CHKERRABORT(PETSC_COMM_SELF, ierr);
147 
148  // Print version
149  if (verbose > QUIET) {
150  MOFEM_LOG_CHANNEL("WORLD");
151  char petsc_version[255];
152  ierr = PetscGetVersion(petsc_version, 255);
153  CHKERRABORT(comm, ierr);
154  MOFEM_LOG_C("WORLD", Sev::inform, "MoFEM version %d.%d.%d (%s %s)",
155  MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD,
156  MOAB_VERSION_STRING, petsc_version);
157  MOFEM_LOG_C("WORLD", Sev::inform, "git commit id %s", GIT_SHA1_NAME);
158  }
159 
160  // Register MOFEM events in PETSc
161  PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
162  PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
163  PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
164  PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
165 
166  // Initialize database
167  ierr = getTags();
168  CHKERRABORT(cOmm, ierr);
169  ierr = clearMap();
170  CHKERRABORT(cOmm, ierr);
171 
172  basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
173  if (distributed_mesh)
174  basicEntityDataPtr->setDistributedMesh();
175  else
176  basicEntityDataPtr->unSetDistributedMesh();
177 
179  CHKERRABORT(cOmm, ierr);
181  CHKERRABORT(cOmm, ierr);
182 }
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:255
static const MOFEMuuid IDD_MOFEMCoreInterface
Definition: Interface.hpp:24
int sIze
MoFEM communicator size.
Definition: Core.hpp:859
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition: Core.cpp:583
PetscLogEvent MOFEM_EVENT_postProcess
Event for postProcess finite element.
Definition: Core.hpp:847
boost::shared_ptr< WrapMPIComm > wrapMPIComm
Definition: Core.hpp:893
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
PetscLogEvent MOFEM_EVENT_operator
Event for evaluating operator of finite element.
Definition: Core.hpp:845
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:295
static const MOFEMuuid IDD_MOFEMUnknown
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:848
MoFEMErrorCode registerSubInterfaces()
Register insterfaces.
Definition: Core.cpp:195
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:265
PetscLogEvent MOFEM_EVENT_preProcess
Event for preProcess finite element.
Definition: Core.hpp:843
PetscBool initaliseAndBuildField
Definition: Core.hpp:911
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:860
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
Definition: Core.cpp:558
MoFEMErrorCode getTags(int verb=DEFAULT_VERBOSITY)
Get tag handles.
Definition: Core.cpp:304
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:907
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:268
PetscBool initaliseAndBuildFiniteElements
Definition: Core.hpp:914
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:225
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:291
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:857
int verbose
Verbosity level.
Definition: Core.hpp:895
static const MOFEMuuid IDD_MOFEMDeprecatedCoreInterface
Definition: Interface.hpp:26

◆ ~Core()

MoFEM::Core::~Core ( )

Definition at line 184 of file Core.cpp.

184  {
185  PetscBool is_finalized;
186  PetscFinalized(&is_finalized);
187  // Destroy interfaces
188  iFaces.clear();
189  // This is deprecated ONE should use MoFEM::Core::Initialize
190  if (isGloballyInitialised && is_finalized) {
191  isGloballyInitialised = false;
192  }
193 }
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:907
boost::ptr_map< unsigned long, UnknownInterface > iFaces
Hash map of pointers to interfaces.
Definition: Core.hpp:904

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

318  {
319  Range ents_dim = ents.subset_by_dimension(dim);
320  return addEntsToFieldByDim(ents_dim, dim, name, verb);
321 }
const int dim
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:237

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

339  {
341  Range ents;
342  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
343  CHKERR addEntsToFieldByDim(ents, dim, name, verb);
345 }
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:507
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
const int dim
#define CHKERR
Inline error check.
Definition: definitions.h:602
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:237

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

326  {
328  Range ents_type = ents.subset_by_type(type);
329  if (!ents_type.empty()) {
330  const int dim = get_moab().dimension_from_handle(ents_type[0]);
331  CHKERR addEntsToFieldByDim(ents_type, dim, name, verb);
332  }
334 }
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:483
const int dim
#define CHKERR
Inline error check.
Definition: definitions.h:602
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:237
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

350  {
352  Range ents;
353  CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
354  if (!ents.empty()) {
355  const int dim = get_moab().dimension_from_handle(ents[0]);
356  CHKERR addEntsToFieldByDim(ents, dim, name, verb);
357  }
359 }
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:483
const int dim
#define CHKERR
Inline error check.
Definition: definitions.h:602
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:237
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

464  {
466 
467  if (verb == -1)
468  verb = verbose;
469  *buildMoFEM &= 1 << 0;
470  const BitFEId id = getBitFEId(name);
472 
473  auto &ref_MoFEMFiniteElement = refinedFiniteElements.get<EntType_mi_tag>();
474  auto miit = ref_MoFEMFiniteElement.lower_bound(type);
475  auto hi_miit = ref_MoFEMFiniteElement.upper_bound(type);
476 
477  int nb_add_fes = 0;
478  for (; miit != hi_miit; miit++) {
479  BitRefLevel bit2 = miit->get()->getBitRefLevel();
480  if ((bit2 & mask) != bit2)
481  continue;
482  if ((bit2 & bit).any()) {
483  EntityHandle ent = miit->get()->getRefEnt();
484  CHKERR get_moab().add_entities(idm, &ent, 1);
485  nb_add_fes++;
486  }
487  }
488 
489  MOFEM_LOG("SYNC", Sev::inform)
490  << "Finite element " << name << " added. Nb. of elements added "
491  << nb_add_fes << " out of " << std::distance(miit, hi_miit);
492 
494 
496 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:261
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:292
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:239
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:53
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:245
#define FECoreFunctionBegin
Definition: FECore.cpp:19
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MOFEM_LOG_SYNCHORMISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:329
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
int verbose
Verbosity level.
Definition: Core.hpp:895

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

345  {
346  EntityHandle idm = no_handle;
347  *buildMoFEM &= 1 << 0;
350  Range ents;
351  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
352  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
353  CHKERR get_moab().add_entities(idm, ents);
355 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:261
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:483
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:239
const int dim
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

371  {
372  EntityHandle idm = no_handle;
373  *buildMoFEM &= 1 << 0;
376  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
377  ents.subset_by_dimension(dim));
378  CHKERR get_moab().add_entities(idm, ents.subset_by_dimension(dim));
380 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:261
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:483
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:239
const int dim
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

390  {
392  CHKERR add_ents_to_finite_element_by_type(edges, MBEDGE, name);
394 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:326
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

383  {
385  CHKERR add_ents_to_finite_element_by_type(meshset, MBEDGE, name, recursive);
387 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:326
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

499  {
501  *buildMoFEM &= 1 << 0;
502  const BitFEId id = getBitFEId(name);
504  if (recursive == false) {
505  CHKERR get_moab().add_entities(idm, &meshset, 1);
506  } else {
507  Range meshsets;
508  CHKERR get_moab().get_entities_by_type(meshset, MBENTITYSET, meshsets,
509  false);
510  CHKERR get_moab().add_entities(idm, meshsets);
511  }
513 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:261
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:483
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:239
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:53
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

430  {
432  CHKERR add_ents_to_finite_element_by_type(prims, MBPRISM, name);
434 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:326
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

436  {
438  CHKERR add_ents_to_finite_element_by_type(meshset, MBPRISM, name, recursive);
440 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:326
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

417  {
419  CHKERR add_ents_to_finite_element_by_type(tets, MBTET, name);
421 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:326
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

423  {
425  CHKERR add_ents_to_finite_element_by_type(meshset, MBTET, name, recursive);
427 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:326
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

404  {
406  CHKERR add_ents_to_finite_element_by_type(tris, MBTRI, name);
408 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:326
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

410  {
412  CHKERR add_ents_to_finite_element_by_type(meshset, MBTRI, name, recursive);
414 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:326
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

328  {
329  *buildMoFEM &= 1 << 0;
330  EntityHandle idm = no_handle;
332 
334  Range ents;
335  CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
336  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
337  CHKERR get_moab().add_entities(idm, ents);
338 
340 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:261
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:483
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:239
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

358  {
359  EntityHandle idm = no_handle;
360  *buildMoFEM &= 1 << 0;
363  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
364  ents.subset_by_type(type));
365  CHKERR get_moab().add_entities(idm, ents.subset_by_type(type));
367 } // namespace MoFEM
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:261
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:483
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:239
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

397  {
399  CHKERR add_ents_to_finite_element_by_type(vert, MBVERTEX, name);
401 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:326
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

445  {
448  type, verb);
449 
451 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:462
#define CHKERR
Inline error check.
Definition: definitions.h:602
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

455  {
457  CHKERR add_ents_to_finite_element_by_bit_ref(bit, mask, name, type, verb);
458 
460 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:462
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

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

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

40  {
42  *buildMoFEM &= 1 << 0;
43  if (verb == -1) {
44  verb = verbose;
45  }
47  FiniteElements_by_name;
48  FiniteElements_by_name &finite_element_name_set =
49  finiteElements.get<FiniteElement_name_mi_tag>();
50  FiniteElements_by_name::iterator it_fe =
51  finite_element_name_set.find(fe_name);
52  if (bh == MF_EXCL) {
53  if (it_fe != finite_element_name_set.end()) {
54  SETERRQ1(cOmm, MOFEM_NOT_FOUND, "this < %s > is there", fe_name.c_str());
55  }
56  } else {
57  if (it_fe != finite_element_name_set.end())
59  }
60  EntityHandle meshset;
61  CHKERR get_moab().create_meshset(MESHSET_SET, meshset);
62 
63  // id
64  BitFEId id = getFEShift();
65  CHKERR get_moab().tag_set_data(th_FEId, &meshset, 1, &id);
66 
67  // Add finite element meshset to partion meshset. In case of no elements
68  // on processor part, when mesh file is read, finite element meshset is
69  // prevented from deletion by moab reader.
70  auto add_meshset_to_partition = [&](auto meshset) {
72  const void *tag_vals[] = {&rAnk};
73  ParallelComm *pcomm = ParallelComm::get_pcomm(
74  &get_moab(), get_basic_entity_data_ptr()->pcommID);
75  Tag part_tag = pcomm->part_tag();
76  Range tagged_sets;
77  CHKERR get_moab().get_entities_by_type_and_tag(0, MBENTITYSET, &part_tag,
78  tag_vals, 1, tagged_sets,
79  moab::Interface::UNION);
80  for (auto s : tagged_sets)
81  CHKERR get_moab().add_entities(s, &meshset, 1);
83  };
84  CHKERR add_meshset_to_partition(meshset);
85 
86  // id name
87  void const *tag_data[] = {fe_name.c_str()};
88  int tag_sizes[1];
89  tag_sizes[0] = fe_name.size();
90  CHKERR get_moab().tag_set_by_ptr(th_FEName, &meshset, 1, tag_data, tag_sizes);
91 
92  // add FiniteElement
93  auto p = finiteElements.insert(
94  boost::shared_ptr<FiniteElement>(new FiniteElement(moab, meshset)));
95  if (!p.second)
96  SETERRQ(cOmm, MOFEM_OPERATION_UNSUCCESSFUL, "FiniteElement not inserted");
97 
98  if (verb > QUIET)
99  MOFEM_LOG("WORLD", Sev::inform) << "Add finite element " << fe_name;
100 
102 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:292
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:514
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:265
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:53
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:860
BitFEId getFEShift()
Return unique finite element Id.
Definition: Core.cpp:245
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
#define FECoreFunctionBegin
Definition: FECore.cpp:19
#define CHKERR
Inline error check.
Definition: definitions.h:602
int verbose
Verbosity level.
Definition: Core.hpp:895
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:413
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 82 of file ProblemsCore.cpp.

83  {
85  if (verb == -1)
86  verb = verbose;
87  auto miit = pRoblems.get<Problem_mi_tag>().find(name);
88  if (miit == pRoblems.get<Problem_mi_tag>().end()) {
90  CHKERR addProblem(id, name, verb);
91  } else if (bh == MF_EXCL) {
92  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem is in database %s",
93  name.c_str());
94  }
96 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition: Types.hpp:54
BitProblemId getProblemShift()
Return unique problem Id.
Definition: Core.cpp:250
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:602
int verbose
Verbosity level.
Definition: Core.hpp:895
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ addEntsToFieldByDim()

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

Definition at line 237 of file FieldCore.cpp.

238  {
239 
240  *buildMoFEM = 0;
241  EntityHandle idm = no_handle;
242  if (verb == -1)
243  verb = verbose;
245  idm = get_field_meshset(name);
246  FieldSpace space;
247  CHKERR get_moab().tag_get_data(th_FieldSpace, &idm, 1, &space);
248  std::vector<int> nb_ents_on_dim(3, 0);
249  switch (space) {
250  case L2:
251  CHKERR get_moab().add_entities(idm, ents);
252  if (verb >= VERY_VERBOSE) {
253  std::ostringstream ss;
254  ss << "add entities to field " << name;
255  ss << " nb. add ents " << ents.size();
256  ss << std::endl;
257  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
258  }
259  break;
260  case H1:
261  CHKERR get_moab().add_entities(idm, ents);
262  for (int dd = 0; dd != dim; ++dd) {
263  Range adj_ents;
264  CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
265  moab::Interface::UNION);
266  if (dd == 0) {
267  Range topo_nodes;
268  CHKERR get_moab().get_connectivity(ents, topo_nodes, true);
269  Range mid_nodes;
270  CHKERR get_moab().get_connectivity(ents, mid_nodes, false);
271  mid_nodes = subtract(mid_nodes, topo_nodes);
272  adj_ents = subtract(adj_ents, mid_nodes);
273  }
274  CHKERR get_moab().add_entities(idm, adj_ents);
275  nb_ents_on_dim[dd] = adj_ents.size();
276  }
277  break;
278  case HCURL:
279  CHKERR get_moab().add_entities(idm, ents);
280  for (int dd = 1; dd != dim; ++dd) {
281  Range adj_ents;
282  CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
283  moab::Interface::UNION);
284  CHKERR get_moab().add_entities(idm, adj_ents);
285  nb_ents_on_dim[dd] = adj_ents.size();
286  }
287  break;
288  case HDIV:
289  CHKERR get_moab().add_entities(idm, ents);
290  if (dim > 2) {
291  Range adj_ents;
292  CHKERR get_moab().get_adjacencies(ents, 2, false, adj_ents,
293  moab::Interface::UNION);
294  CHKERR get_moab().add_entities(idm, adj_ents);
295  nb_ents_on_dim[2] = adj_ents.size();
296  }
297  break;
298  default:
299  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
300  "sorry, unknown space added to entity");
301  }
302  if (verb >= VERY_VERBOSE) {
303  std::ostringstream ss;
304  ss << "add entities to field " << name;
305  ss << " nb. add ents " << ents.size();
306  ss << " nb. add faces " << nb_ents_on_dim[2];
307  ss << " nb. add edges " << nb_ents_on_dim[1];
308  ss << " nb. add nodes " << nb_ents_on_dim[0];
309  ss << std::endl;
310  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
311  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
312  }
314 }
Tag th_FieldSpace
Definition: Core.hpp:204
field with continuous normal traction
Definition: definitions.h:179
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
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:483
const EntityHandle no_handle
No entity handle is indicated by zero handle, i.e. root meshset.
Definition: Common.hpp:27
const int dim
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:906
field with continuous tangents
Definition: definitions.h:178
FieldSpace
approximation spaces
Definition: definitions.h:174
#define CHKERR
Inline error check.
Definition: definitions.h:602
int verbose
Verbosity level.
Definition: Core.hpp:895
EntityHandle get_field_meshset(const BitFieldId id) const
Definition: FieldCore.cpp:38
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
continuous field
Definition: definitions.h:177
field with C-1 continuity
Definition: definitions.h:180

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

275  {
277  if (verb == -1)
278  verb = verbose;
279  std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
280  p_ent = refinedEntities.insert(
281  boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
282  if (p_ent.second) {
283  std::pair<RefElement_multiIndex::iterator, bool> p;
284  p = refinedFiniteElements.insert(
285  boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)));
286  int num_nodes;
287  const EntityHandle *conn;
288  CHKERR get_moab().get_connectivity(prism, conn, num_nodes, true);
289  Range face_side3, face_side4;
290  CHKERR get_moab().get_adjacencies(conn, 3, 2, false, face_side3);
291  CHKERR get_moab().get_adjacencies(&conn[3], 3, 2, false, face_side4);
292  if (face_side3.size() != 1)
293  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
294  "prism don't have side face 3");
295  if (face_side4.size() != 1)
296  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
297  "prims don't have side face 4");
298  p.first->get()->getSideNumberPtr(*face_side3.begin());
299  p.first->get()->getSideNumberPtr(*face_side4.begin());
300  }
302 }
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:483
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:245
#define CHKERR
Inline error check.
Definition: definitions.h:602
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:225
int verbose
Verbosity level.
Definition: Core.hpp:895
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

39  {
41 
42  if (verb == -1)
43  verb = verbose;
44  EntityHandle meshset;
45  CHKERR get_moab().create_meshset(MESHSET_SET, meshset);
46  CHKERR get_moab().tag_set_data(th_ProblemId, &meshset, 1, &id);
47 
48  // Add problem meshset to partion meshset. In case of no elements
49  // on processor part, when mesh file is read, finite element meshset is
50  // prevented from deletion by moab reader.
51  auto add_meshset_to_partition = [&](auto meshset) {
53  const void *tag_vals[] = {&rAnk};
54  ParallelComm *pcomm = ParallelComm::get_pcomm(
55  &get_moab(), get_basic_entity_data_ptr()->pcommID);
56  Tag part_tag = pcomm->part_tag();
57  Range tagged_sets;
58  CHKERR get_moab().get_entities_by_type_and_tag(0, MBENTITYSET, &part_tag,
59  tag_vals, 1, tagged_sets,
60  moab::Interface::UNION);
61  for (auto s : tagged_sets)
62  CHKERR get_moab().add_entities(s, &meshset, 1);
64  };
65  CHKERR add_meshset_to_partition(meshset);
66 
67  void const *tag_data[] = {name.c_str()};
68  int tag_sizes[1];
69  tag_sizes[0] = name.size();
70  CHKERR get_moab().tag_set_by_ptr(th_ProblemName, &meshset, 1, tag_data,
71  tag_sizes);
72  // create entry
73  auto p = pRoblems.insert(Problem(moab, meshset));
74  if (!p.second)
75  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Problem not added");
76 
77  MOFEM_LOG("WORLD", Sev::inform) << "Add problem " << name;
78 
80 }
moab::Interface & get_moab()
Definition: Core.hpp:266
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:292
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:860
#define ProblemCoreFunctionBegin
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:257
#define CHKERR
Inline error check.
Definition: definitions.h:602
int verbose
Verbosity level.
Definition: Core.hpp:895
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()
Get pointer to basic entity data.
Definition: Core.hpp:234

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

876  {
878  if (verb == DEFAULT_VERBOSITY)
879  verb = verbose;
880 
881  if (!((*buildMoFEM) & BUILD_FIELD))
882  SETERRQ(cOmm, MOFEM_NOT_FOUND, "field not build");
883  if (!((*buildMoFEM) & BUILD_FE))
884  SETERRQ(cOmm, MOFEM_NOT_FOUND, "fe not build");
885  for (Range::const_pair_iterator peit = ents.pair_begin();
886  peit != ents.pair_end(); ++peit) {
887  EntFiniteElement_multiIndex::index<Ent_mi_tag>::type::iterator fit, hi_fit;
888  fit = entsFiniteElements.get<Ent_mi_tag>().lower_bound(peit->first);
889  hi_fit = entsFiniteElements.get<Ent_mi_tag>().upper_bound(peit->second);
890  for (; fit != hi_fit; ++fit) {
891  if ((*fit)->getBitFieldIdRow().none() &&
892  (*fit)->getBitFieldIdCol().none() &&
893  (*fit)->getBitFieldIdData().none())
894  continue;
895  int by = BYROW;
896  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol())
897  by |= BYCOL;
898  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData())
899  by |= BYDATA;
900  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_row(by);
901  auto hint = entFEAdjacencies.end();
902  for (auto e : *(*fit)->row_field_ents_view) {
903  hint = entFEAdjacencies.emplace_hint(hint, e.lock(), *fit);
904  bool success = entFEAdjacencies.modify(hint, modify_row);
905  if (!success)
906  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
907  "modification unsuccessful");
908  }
909  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol()) {
910  int by = BYCOL;
911  if ((*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData())
912  by |= BYDATA;
913  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_col(by);
914  auto hint = entFEAdjacencies.end();
915  for (auto e : *(*fit)->col_field_ents_view) {
916  hint = entFEAdjacencies.emplace_hint(hint, e.lock(), *fit);
917  bool success = entFEAdjacencies.modify(hint, modify_col);
918  if (!success)
919  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
920  "modification unsuccessful");
921  }
922  }
923  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData() ||
924  (*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData()) {
925  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_data(
926  BYDATA);
927  auto hint = entFEAdjacencies.end();
928  for (auto &e : *(*fit)->data_field_ents_view) {
929  hint = entFEAdjacencies.emplace_hint(hint, e, *fit);
930  bool success = entFEAdjacencies.modify(hint, modify_data);
931  if (!success)
932  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
933  "modification unsuccessful");
934  }
935  }
936  }
937  }
938 
939  if (verb >= VERBOSE) {
940  MOFEM_LOG("WORLD", Sev::inform)
941  << "Number of adjacencies " << entFEAdjacencies.size();
943  }
944 
945  *buildMoFEM |= 1 << 2;
947 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:292
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
#define FECoreFunctionBegin
Definition: FECore.cpp:19
#define MOFEM_LOG_SYNCHORMISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:329
int verbose
Verbosity level.
Definition: Core.hpp:895
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:252

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

961  {
963  if (verb == -1)
964  verb = verbose;
965  CHKERR build_adjacencies(bit, BitRefLevel().set(), verb);
966 
968 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)
build adjacencies
Definition: FECore.cpp:876
#define CHKERR
Inline error check.
Definition: definitions.h:602
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
int verbose
Verbosity level.
Definition: Core.hpp:895
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

950  {
952  if (verb == -1)
953  verb = verbose;
954  Range ents;
955  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents);
956 
957  CHKERR build_adjacencies(ents, verb);
958 
960 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)
build adjacencies
Definition: FECore.cpp:876
#define CHKERR
Inline error check.
Definition: definitions.h:602
int verbose
Verbosity level.
Definition: Core.hpp:895
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

1125  {
1127  auto miit = fIelds.get<FieldName_mi_tag>().find(field_name);
1128  if (miit == fIelds.get<FieldName_mi_tag>().end()) {
1129  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field < %s > not found",
1130  field_name.c_str());
1131  }
1132  CHKERR buildField((*miit), verb);
1133  if (verb > QUIET)
1136 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
#define FieldCoreFunctionBegin
Definition: FieldCore.cpp:19
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
MoFEMErrorCode buildField(const boost::shared_ptr< Field > &field, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1039
#define MOFEM_LOG_SYNCHORMISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:329

◆ build_fields()

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

build fields

Implements MoFEM::CoreInterface.

Definition at line 1138 of file FieldCore.cpp.

1138  {
1140  if (verb == -1)
1141  verb = verbose;
1142 
1143  for (auto miit : fIelds.get<BitFieldId_mi_tag>())
1144  CHKERR buildField(miit, verb);
1145 
1146  *buildMoFEM = 1 << 0;
1147  if (verb > QUIET) {
1148  MOFEM_LOG("SYNC", Sev::inform) << "Number of dofs " << dofsField.size();
1150  }
1151 
1153 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:249
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
#define FieldCoreFunctionBegin
Definition: FieldCore.cpp:19
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:292
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
#define CHKERR
Inline error check.
Definition: definitions.h:602
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
MoFEMErrorCode buildField(const boost::shared_ptr< Field > &field, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1039
#define MOFEM_LOG_SYNCHORMISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:329
int verbose
Verbosity level.
Definition: Core.hpp:895

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

796  {
798 
799  if (verb == DEFAULT_VERBOSITY)
800  verb = verbose;
801 
802  // loop Finite Elements
803  for (auto &fe : finiteElements)
804  CHKERR buildFiniteElements(fe, NULL, verb);
805 
806  if (verb > QUIET) {
807 
808  auto &fe_ents = entsFiniteElements.get<BitFEId_mi_tag>();
809  for (auto &fe : finiteElements) {
810  auto miit = fe_ents.lower_bound(fe->getId());
811  auto hi_miit = fe_ents.upper_bound(fe->getId());
812  const auto count = std::distance(miit, hi_miit);
813  MOFEM_LOG("SYNC", Sev::inform)
814  << "Finite element " << fe->getName()
815  << " added. Nb. of elements added " << count;
816  MOFEM_LOG("SYNC", Sev::noisy) << *fe;
817 
818  auto slg = MoFEM::LogManager::getLog("SYNC");
819  for (auto &field : fIelds) {
820  auto rec = slg.open_record(keywords::severity = Sev::verbose);
821  if (rec) {
822  logging::record_ostream strm(rec);
823  strm << "Field " << field->getName() << " on finite element: ";
824  if ((field->getId() & fe->getBitFieldIdRow()).any())
825  strm << "row ";
826  if ((field->getId() & fe->getBitFieldIdCol()).any())
827  strm << "columns ";
828  if ((field->getId() & fe->getBitFieldIdData()).any())
829  strm << "data";
830  strm.flush();
831  slg.push_record(boost::move(rec));
832  }
833  }
834  }
835 
837  }
838 
839  *buildMoFEM |= 1 << 1;
841 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:292
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
#define FECoreFunctionBegin
Definition: FECore.cpp:19
static LoggerType & getLog(const std::string channel)
Get logger by channel.
Definition: LogManager.cpp:344
#define CHKERR
Inline error check.
Definition: definitions.h:602
Field_multiIndex fIelds
fields
Definition: Core.hpp:247
#define MOFEM_LOG_SYNCHORMISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:329
int verbose
Verbosity level.
Definition: Core.hpp:895
MoFEMErrorCode buildFiniteElements(const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
Definition: FECore.cpp:557
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 843 of file FECore.cpp.

843  {
845  SETERRQ(cOmm, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
847 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:507
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514

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

851  {
853  if (verb == -1)
854  verb = verbose;
855 
856  auto fe_miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
857  if (fe_miit == finiteElements.get<FiniteElement_name_mi_tag>().end())
858  SETERRQ1(cOmm, MOFEM_NOT_FOUND, "Finite element <%s> not found",
859  fe_name.c_str());
860 
861  CHKERR buildFiniteElements(*fe_miit, ents_ptr, verb);
862 
863  if (verb >= VERBOSE) {
864  auto &fe_ents = entsFiniteElements.get<BitFEId_mi_tag>();
865  auto miit = fe_ents.lower_bound((*fe_miit)->getId());
866  auto hi_miit = fe_ents.upper_bound((*fe_miit)->getId());
867  const auto count = std::distance(miit, hi_miit);
868  MOFEM_LOG("SYNC", Sev::inform) << "Finite element " << fe_name
869  << " added. Nb. of elements added " << count;
870  }
871 
872  *buildMoFEM |= 1 << 1;
874 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:507
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:292
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:906
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
#define CHKERR
Inline error check.
Definition: definitions.h:602
int verbose
Verbosity level.
Definition: Core.hpp:895
MoFEMErrorCode buildFiniteElements(const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
Definition: FECore.cpp:557
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 247 of file ProblemsCore.cpp.

247  {
249  if (verb == -1)
250  verb = verbose;
251  Problem_multiIndex::iterator p_miit = pRoblems.begin();
252  for (; p_miit != pRoblems.end(); p_miit++) {
253  CHKERR getInterface<ProblemsManager>()->buildProblemOnDistributedMesh(
254  const_cast<Problem *>(&*p_miit), verb);
255  }
257 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:257
#define CHKERR
Inline error check.
Definition: definitions.h:602
int verbose
Verbosity level.
Definition: Core.hpp:895
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

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

◆ buildField()

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

Definition at line 1039 of file FieldCore.cpp.

1040  {
1042  if (verb == -1)
1043  verb = verbose;
1044  if (verb > QUIET)
1045  MOFEM_LOG("SYNC", Sev::verbose) << "Build field " << field->getName();
1046 
1047  std::map<EntityType, int> dof_counter;
1048  std::map<EntityType, int> inactive_dof_counter;
1049 
1050  // Need to rebuild order table since number of dofs on each order when
1051  // field was created.
1052  if (field->getApproxBase() == USER_BASE)
1053  CHKERR field->rebuildDofsOrderMap();
1054 
1055  switch (field->getSpace()) {
1056  case NOFIELD:
1057  CHKERR buildFieldForNoField(field->getId(), dof_counter, verb);
1058  break;
1059  case L2:
1060  case H1:
1061  case HCURL:
1062  case HDIV:
1063  CHKERR buildFieldForL2H1HcurlHdiv(field->getId(), dof_counter,
1064  inactive_dof_counter, verb);
1065  break;
1066  default:
1067  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1068  }
1069 
1070  if (verb > QUIET) {
1071  int nb_added_dofs = 0;
1072  int nb_inactive_added_dofs = 0;
1073  for (auto const &it : dof_counter) {
1074  switch (it.first) {
1075  case MBVERTEX:
1076  MOFEM_LOG("SYNC", Sev::verbose)
1077  << "Nb. of dofs (vertices) " << it.second << " (inactive "
1078  << inactive_dof_counter[it.first] << ")";
1079  break;
1080  case MBEDGE:
1081  MOFEM_LOG("SYNC", Sev::verbose)
1082  << "Nb. of dofs (edge) " << it.second << " (inactive "
1083  << inactive_dof_counter[it.first] << ")";
1084  break;
1085  case MBTRI:
1086  MOFEM_LOG("SYNC", Sev::verbose)
1087  << "Nb. of dofs (triangles) " << it.second << " (inactive "
1088  << inactive_dof_counter[it.first] << ")";
1089  break;
1090  case MBQUAD:
1091  MOFEM_LOG("SYNC", Sev::verbose)
1092  << "Nb. of dofs (quads) " << it.second << " (inactive "
1093  << inactive_dof_counter[it.first] << ")";
1094  break;
1095  case MBTET:
1096  MOFEM_LOG("SYNC", Sev::verbose)
1097  << "Nb. of dofs (tetrahedra) " << it.second << " (inactive "
1098  << inactive_dof_counter[it.first] << ")";
1099  break;
1100  case MBPRISM:
1101  MOFEM_LOG("SYNC", Sev::verbose)
1102  << "Nb. of dofs (prisms) " << it.second << " (inactive "
1103  << inactive_dof_counter[it.first] << ")";
1104  break;
1105  case MBENTITYSET:
1106  MOFEM_LOG("SYNC", Sev::verbose)
1107  << "Nb. of dofs (meshsets) " << it.second << " (inactive "
1108  << inactive_dof_counter[it.first] << ")";
1109  break;
1110  default:
1111  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1112  }
1113  nb_added_dofs += it.second;
1114  nb_inactive_added_dofs += inactive_dof_counter[it.first];
1115  }
1116  if (verb > QUIET) {
1117  MOFEM_LOG("SYNC", Sev::verbose)
1118  << "Nb. added dofs " << nb_added_dofs << " (number of inactive dofs "
1119  << nb_inactive_added_dofs << " )";
1120  }
1121  }
1123 }
field with continuous normal traction
Definition: definitions.h:179
user implemented approximation base
Definition: definitions.h:160
scalar or vector of scalars describe (no true field)
Definition: definitions.h:176
#define FieldCoreFunctionBegin
Definition: FieldCore.cpp:19
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:292
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
field with continuous tangents
Definition: definitions.h:178
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:926
int verbose
Verbosity level.
Definition: Core.hpp:895
MoFEMErrorCode buildFieldForNoField(const BitFieldId id, std::map< EntityType, int > &dof_counter, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:817
continuous field
Definition: definitions.h:177
field with C-1 continuity
Definition: definitions.h:180

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

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

◆ buildFieldForNoField()

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

Definition at line 817 of file FieldCore.cpp.

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

◆ buildFiniteElements()

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

Definition at line 557 of file FECore.cpp.

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

50  {
51  auto &set = fIelds.get<FieldName_mi_tag>();
52  auto miit = set.find(name);
53  if (miit == set.end())
54  return false;
55  return true;
56 }
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 29 of file FECore.cpp.

29  {
31  FeSetByName;
32  const FeSetByName &set = finiteElements.get<FiniteElement_name_mi_tag>();
33  FeSetByName::iterator miit = set.find(name);
34  if (miit == set.end())
35  return false;
36  return true;
37 }
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 1242 of file FieldCore.cpp.

1242  {
1244  auto it = fIelds.get<FieldName_mi_tag>().find(name);
1245  if (it == fIelds.get<FieldName_mi_tag>().end()) {
1246  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1247  "field not found < %s >", name.c_str());
1248  }
1249  EntityHandle meshset = (*it)->getMeshset();
1250  int num_entities;
1251  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1252  if (entsFields.get<FieldName_mi_tag>().count((*it)->getName()) >
1253  (unsigned int)num_entities) {
1254  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1255  "not equal number of entities in meshset and field multiindex "
1256  "< %s >",
1257  name.c_str());
1258  }
1260 }
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:507
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
#define CHKERR
Inline error check.
Definition: definitions.h:602
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 1261 of file FieldCore.cpp.

1261  {
1263  for (auto &it : fIelds.get<FieldName_mi_tag>()) {
1264  if (it->getSpace() == NOFIELD)
1265  continue; // FIXME: should be treated properly, not test is just
1266  // skipped for this NOFIELD space
1267  EntityHandle meshset = it->getMeshset();
1268  int num_entities;
1269  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1270  if (entsFields.get<FieldName_mi_tag>().count(it->getName()) >
1271  (unsigned int)num_entities) {
1272  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1273  "not equal number of entities in meshset and field "
1274  "multiindex < %s >",
1275  it->getName().c_str());
1276  }
1277  }
1279 }
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:176
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:413

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

982  {
984  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
985  it = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
986  if (it == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
987  SETERRQ1(cOmm, 1, "finite element not found < %s >", name.c_str());
988  }
989  EntityHandle meshset = (*it)->getMeshset();
990 
991  int num_entities;
992  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
993 
994  if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
995  (*it)->getName().c_str()) != (unsigned int)num_entities) {
996  SETERRQ1(cOmm, 1,
997  "not equal number of entities in meshset and finite elements "
998  "multiindex < %s >",
999  (*it)->getName().c_str());
1000  }
1002 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
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:483
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
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 1004 of file FECore.cpp.

1004  {
1006  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
1007  it = finiteElements.get<FiniteElement_name_mi_tag>().begin();
1008  for (; it != finiteElements.get<FiniteElement_name_mi_tag>().end(); it++) {
1009  EntityHandle meshset = (*it)->getMeshset();
1010 
1011  int num_entities;
1012  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
1013 
1014  if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
1015  (*it)->getName().c_str()) != (unsigned int)num_entities) {
1016  SETERRQ1(cOmm, 1,
1017  "not equal number of entities in meshset and finite elements "
1018  "multiindex < %s >",
1019  (*it)->getName().c_str());
1020  }
1021  }
1023 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:856
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:483
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:251
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
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 29 of file ProblemsCore.cpp.

29  {
30  Problem_multiIndex::index<Problem_mi_tag>::type::iterator pit;
31  pit = pRoblems.get<Problem_mi_tag>().find(name);
32  if (pit == pRoblems.get<Problem_mi_tag>().end()) {
33  return false;
34  }
35  return true;
36 }
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 211 of file DeleteCore.cpp.

213  {
215  if (verb == -1)
216  verb = verbose;
217  Range ents;
218  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
221 }
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:211
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
int verbose
Verbosity level.
Definition: Core.hpp:895
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

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

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

242  {
244  if (verb == -1)
245  verb = verbose;
246 
247  const Field *field_ptr = get_field_structure(name);
248  int field_bit_number = field_ptr->getBitNumber();
249  bool is_distributed_mesh = basicEntityDataPtr->trueIfDistributedMesh();
250  ParallelComm *pcomm =
251  ParallelComm::get_pcomm(&get_moab(), basicEntityDataPtr->pcommID);
252 
253  for (Range::const_pair_iterator p_eit = ents.pair_begin();
254  p_eit != ents.pair_end(); p_eit++) {
255 
256  // First and last handle
257  const EntityHandle first = p_eit->first;
258  const EntityHandle second = p_eit->second;
259 
260  // Get owner proc and owner handle
261  int f_owner_proc;
262  EntityHandle f_moab_owner_handle;
263  CHKERR pcomm->get_owner_handle(first, f_owner_proc, f_moab_owner_handle);
264  int s_owner_proc;
265  EntityHandle s_moab_owner_handle;
266  CHKERR pcomm->get_owner_handle(second, s_owner_proc, s_moab_owner_handle);
267 
268  // Get UId
270  f_owner_proc, field_bit_number, f_moab_owner_handle,
271  is_distributed_mesh);
273  s_owner_proc, field_bit_number, s_moab_owner_handle,
274  is_distributed_mesh);
275 
276  // Find adjacencies
277  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
278  Unique_mi_tag>::type::iterator ait,
279  hi_ait;
280  ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound(first_uid);
281  hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound(second_uid);
282  entFEAdjacencies.get<Unique_mi_tag>().erase(ait, hi_ait);
283  }
285 }
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:507
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:514
const Field * get_field_structure(const std::string &name)
get field structure
Definition: FieldCore.cpp:58
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
#define CHKERR
Inline error check.
Definition: definitions.h:602
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:225
int verbose
Verbosity level.
Definition: Core.hpp:895
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 340 of file DeleteCore.cpp.

342  {
344  Range ents;
345  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
348 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:340
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ clear_adjacencies_finite_elements() [2/3]

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

Definition at line 350 of file DeleteCore.cpp.

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

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

371  {
373  if (verb == -1)
374  verb = verbose;
375 
376  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator
377  it_fe = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
378  if (it_fe != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
379 
380  const int fe_bit_number = it_fe->get()->getBitNumber();
381 
382  for (Range::const_pair_iterator p_eit = ents.pair_begin();
383  p_eit != ents.pair_end(); p_eit++) {
384 
385  // First and last handle
386  const EntityHandle first = p_eit->first;
387  const EntityHandle second = p_eit->second;
388 
389  // Get UId
390  UId first_uid =
391  EntFiniteElement::getGlobalUniqueIdCalculate(first, fe_bit_number);
392  UId second_uid =
393  EntFiniteElement::getGlobalUniqueIdCalculate(second, fe_bit_number);
394 
395  // Find and remove adjacencies
396  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
397  FE_Unique_mi_tag>::type::iterator ait,
398  hi_ait;
399  ait = entFEAdjacencies.get<FE_Unique_mi_tag>().lower_bound(first_uid);
400  hi_ait = entFEAdjacencies.get<FE_Unique_mi_tag>().upper_bound(second_uid);
401  entFEAdjacencies.get<FE_Unique_mi_tag>().erase(ait, hi_ait);
402  }
403  }
405 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:507
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:514
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:895
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 506 of file Core.cpp.

506  {
508  if (verb == -1)
509  verb = verbose;
510  CHKERR clearMap();
512 }
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:255
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
int verbose
Verbosity level.
Definition: Core.hpp:895
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

67  {
69  if (verb == -1)
70  verb = verbose;
71 
72  for (Range::const_pair_iterator p_eit = ents.pair_begin();
73  p_eit != ents.pair_end(); p_eit++) {
74  EntityHandle first = p_eit->first;
75  EntityHandle second = p_eit->second;
76  // get dofs range
77  DofEntityByEnt::iterator dit, hi_dit;
78  dit = dofsField.get<Ent_mi_tag>().lower_bound(first);
79  if (dit == dofsField.get<Ent_mi_tag>().end())
80  continue;
81  hi_dit = dofsField.get<Ent_mi_tag>().upper_bound(second);
82  // finally clear dofs
83  dofsField.get<Ent_mi_tag>().erase(dit,hi_dit);
84  }
86 }
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:507
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
int verbose
Verbosity level.
Definition: Core.hpp:895

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

89  {
91  if (verb == -1)
92  verb = verbose;
93 
94  for (Range::const_pair_iterator p_eit = ents.pair_begin();
95  p_eit != ents.pair_end(); p_eit++) {
96  EntityHandle first = p_eit->first;
97  EntityHandle second = p_eit->second;
98  DofEntityByNameAndEnt::iterator dit, hi_dit;
99  dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
100  boost::make_tuple(name, first));
101  hi_dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
102  boost::make_tuple(name, second));
103  dofsField.get<Composite_Name_And_Ent_mi_tag>().erase(dit, hi_dit);
104  }
106 }
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:507
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
int verbose
Verbosity level.
Definition: Core.hpp:895

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

57  {
59  if (verb == -1)
60  verb = verbose;
61  Range ents;
62  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
63  CHKERR clear_dofs_fields(ents, verb);
65 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:507
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:67
#define CHKERR
Inline error check.
Definition: definitions.h:602
int verbose
Verbosity level.
Definition: Core.hpp:895

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

121  {
123  if (verb == -1)
124  verb = verbose;
125  CHKERR clear_dofs_fields(ents, verb);
127  for (Range::const_pair_iterator p_eit = ents.pair_begin();
128  p_eit != ents.pair_end(); p_eit++) {
129  EntityHandle first = p_eit->first;
130  EntityHandle second = p_eit->second;
131  FieldEntity_multiIndex::index<Ent_mi_tag>::type::iterator dit, hi_dit;
132  dit = entsFields.get<Ent_mi_tag>().lower_bound(first);
133  hi_dit = entsFields.get<Ent_mi_tag>().upper_bound(second);
134  entsFields.get<Ent_mi_tag>().erase(dit, hi_dit);
135  }
137 }
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:211
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:483
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:67
#define CHKERR
Inline error check.
Definition: definitions.h:602
int verbose
Verbosity level.
Definition: Core.hpp:895
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

140  {
142  if (verb == -1)
143  verb = verbose;
144  CHKERR clear_dofs_fields(name, ents, verb);
145  CHKERR clear_adjacencies_entities(name, ents, verb);
146  for (Range::const_pair_iterator p_eit = ents.pair_begin();
147  p_eit != ents.pair_end(); p_eit++) {
148  EntityHandle first = p_eit->first;
149  EntityHandle second = p_eit->second;
150  FieldEntity_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type::iterator
151  dit,
152  hi_dit;
153  dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
154  boost::make_tuple(name, first));
155  hi_dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
156  boost::make_tuple(name, second));
157  entsFields.get<Composite_Name_And_Ent_mi_tag>().erase(dit, hi_dit);
158  }
160 }
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:211
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:483
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:67
#define CHKERR
Inline error check.
Definition: definitions.h:602
int verbose
Verbosity level.
Definition: Core.hpp:895
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

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

109  {