v0.12.1
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
MoFEM::CoreTmp< 0 > Struct Reference

Core (interface) class. More...

#include <src/interfaces/Core.hpp>

Inheritance diagram for MoFEM::CoreTmp< 0 >:
[legend]
Collaboration diagram for MoFEM::CoreTmp< 0 >:
[legend]

Public Member Functions

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

Static Public Attributes

static constexpr int value = 0
 

Protected Member Functions

template<int V>
 CoreTmp (moab::Interface &moab, MPI_Comm comm, const int verbose, CoreValue< V >)
 
MoFEMErrorCode coreGenericConstructor (moab::Interface &moab, MPI_Comm comm, const int verbose)
 
MoFEMErrorCode addProblem (const BitProblemId id, const std::string &name, int verb=DEFAULT_VERBOSITY)
 add problem More...
 
MoFEMErrorCode getTags (int verb=DEFAULT_VERBOSITY)
 Get tag handles. More...
 
MoFEMErrorCode clearMap ()
 Cleaning database. More...
 
MoFEMErrorCode registerSubInterfaces ()
 Register insterfaces. More...
 
BitProblemId getProblemShift ()
 Return unique problem Id. More...
 
MoFEMErrorCode initialiseDatabaseFromMesh (int verb=DEFAULT_VERBOSITY)
 Initialize database getting information on mesh. More...
 
MoFEMErrorCode getOptions (int verb=DEFAULT_VERBOSITY)
 Get core options from command line. More...
 
template<class IFACE >
MoFEMErrorCode regSubInterface ()
 Register subinterfac in core interface. More...
 

Protected Attributes

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

Static Protected Attributes

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

Auxiliary data and functions

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

Tags to data on mesh and entities

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

Multi-Indices accessing data on the mesh

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

Get moab database

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

Log events

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

Communicator

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

Assessing interfaces

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Getting interface of core database. More...
 

Get tag handles to data on the mesh

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

Global initialisation and finalisation <br>

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

Static functions

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

Check database consistency

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

Clear database

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

Getting access to meshset manager

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

Remove and delete entities

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

Fields

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

Set approximation order

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

Build fields

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

Clear DOFs

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

Clear ENTs

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

Remove field entities

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

Other auxiliary functions for fields

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

Finite elements

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

Problems

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

Adjacencies

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

Methods for preforming operations on elements

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

Accessing multi-indices

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

Additional Inherited Members

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

Detailed Description

Core (interface) class.

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

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

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

Todo:
Implement static functions for Initialization and Finalization of MoFEM. Those functions should keep all static variables and initialize/finalize other libs like PETSc. Moreover initialization functions should set error handlers, etc.
Examples
add_blockset.cpp, add_cubit_meshsets.cpp, analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, approx_sphere.cpp, bernstein_bezier_generate_base.cpp, bone_adaptation.cpp, boundary_marker.cpp, build_large_problem.cpp, build_problems.cpp, cell_forces.cpp, contact.cpp, continuity_check_on_contact_prism_side_ele.cpp, continuity_check_on_skeleton_3d.cpp, continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, cubit_bc_test.cpp, delete_ho_nodes.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, edge_and_bubble_shape_functions_on_quad.cpp, eigen_elastic.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, ep.cpp, field_blas_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_outer_product.cpp, hcurl_check_approx_in_2d.cpp, hcurl_curl_operator.cpp, hcurl_divergence_operator_2d.cpp, hdiv_divergence_operator.cpp, heat_equation.cpp, heat_method.cpp, hello_world.cpp, helmholtz.cpp, hertz_surface.cpp, log.cpp, loop_entities.cpp, lorentz_force.cpp, magnetostatic.cpp, mesh_cut.cpp, mesh_insert_interface_atom.cpp, mesh_smoothing.cpp, meshset_to_vtk.cpp, minimal_surface_area.cpp, mixed_poisson.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, nonlinear_dynamics.cpp, nonlinear_elastic.cpp, partition_mesh.cpp, photon_diffusion.cpp, plastic.cpp, plot_base.cpp, prism_elements_from_surface.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, reaction_diffusion.cpp, remove_entities_from_problem.cpp, remove_entities_from_problem_not_partitioned.cpp, scalar_check_approximation.cpp, shallow_wave.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, simple_interface.cpp, split_sideset.cpp, test_cache_on_entities.cpp, test_jacobian_of_simple_contact_element.cpp, testing_jacobian_of_hook_element.cpp, testing_jacobian_of_hook_scaled_with_density_element.cpp, thermo_plastic.cpp, unsaturated_transport.cpp, wave_equation.cpp, and wavy_surface.cpp.

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

222  {
223  BUILD_FIELD = 1 << 0,
224  BUILD_FE = 1 << 1,
225  BUILD_ADJ = 1 << 2,
226  BUILD_PROBLEM = 1 << 3,
227  PARTITION_PROBLEM = 1 << 4,
228  PARTITION_FE = 1 << 5,
229  PARTITION_GHOST_DOFS = 1 << 6,
230  PARTITION_MESH = 1 << 7
231  };

Constructor & Destructor Documentation

◆ CoreTmp() [1/2]

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

Construct core database

Parameters
moabMoAB interface
commMPI communicator
verboseVerbosity level

Definition at line 222 of file Core.cpp.

227  : CoreTmp(moab, comm, verbose, CoreValue<0>()) {
228 
229  // Register sub-interfaces
230  ierr = this->registerSubInterfaces();
231  CHKERRABORT(comm, ierr);
232  ierr = this->clearMap();
233  CHKERRABORT(comm, ierr);
234  ierr = this->getTags();
235  CHKERRABORT(comm, ierr);
236  ierr = this->getOptions(verbose);
237  CHKERRABORT(comm, ierr);
238 
239  this->basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
241 
243  CHKERRABORT(comm, ierr);
244 }
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:488
static void setRefEntBasicDataPtr(MoFEM::Interface &m_field, boost::shared_ptr< BasicEntityData > &ptr)
Definition: Core.cpp:887
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize database getting information on mesh.
Definition: Core.cpp:281
MoFEMErrorCode registerSubInterfaces()
Register insterfaces.
Definition: Core.cpp:452
MoFEMErrorCode getOptions(int verb=DEFAULT_VERBOSITY)
Get core options from command line.
Definition: Core.cpp:734
int verbose
Verbosity level.
Definition: Core.hpp:994
MoFEMErrorCode getTags(int verb=DEFAULT_VERBOSITY)
Get tag handles.
Definition: Core.cpp:536
CoreTmp(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
Definition: Core.cpp:222
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:293
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:333

◆ ~CoreTmp()

MoFEM::Core::~CoreTmp ( )

Definition at line 270 of file Core.cpp.

270  {
271  PetscBool is_finalized;
272  PetscFinalized(&is_finalized);
273  // Destroy interfaces
274  iFaces.clear();
275  // This is deprecated ONE should use MoFEM::Core::Initialize
276  if (isGloballyInitialised && is_finalized) {
277  isGloballyInitialised = false;
278  }
279 }
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:1011
boost::ptr_map< boost::typeindex::type_index, UnknownInterface > iFaces
Hash map of pointers to interfaces.
Definition: Core.hpp:999

◆ CoreTmp() [2/2]

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

Construct core database

Parameters
moabMoAB interface
commMPI communicator

Definition at line 42 of file CoreTemplates.hpp.

44  : moab(moab), mofemComm(comm), verbose(verbose),
45  initaliseAndBuildField(PETSC_FALSE),
46  initaliseAndBuildFiniteElements(PETSC_FALSE) {
47 
49  CHKERRABORT(comm, ierr);
50 
51  MOFEM_LOG_CHANNEL("WORLD");
52  if (verbose > QUIET) {
53  MOFEM_LOG_C("WORLD", Sev::verbose, "Core number < %d >", V);
54  }
55 }
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:312
@ QUIET
Definition: definitions.h:221
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:285
PetscBool initaliseAndBuildFiniteElements
Definition: Core.hpp:1008
MoFEMErrorCode coreGenericConstructor(moab::Interface &moab, MPI_Comm comm, const int verbose)
Definition: Core.cpp:184
PetscBool initaliseAndBuildField
Definition: Core.hpp:1005
MPI_Comm mofemComm
MoFEM communicator.
Definition: Core.hpp:967

Member Function Documentation

◆ add_ents_to_field_by_dim() [1/2]

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

Add entities to field meshset.

\not collective

The lower dimension entities are added depending on the space type

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

Implements MoFEM::CoreInterface.

Definition at line 382 of file FieldCore.cpp.

385  {
387  Range ents;
388  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
389  CHKERR addEntsToFieldByDim(ents, dim, name, verb);
391 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
#define CHKERR
Inline error check.
Definition: definitions.h:548
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
const int dim
moab::Interface & get_moab()
Definition: Core.hpp:334
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:288

◆ add_ents_to_field_by_dim() [2/2]

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

Add entities to field meshset.

Note
not collective

The lower dimension entities are added depending on the space type

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

Implements MoFEM::CoreInterface.

Definition at line 362 of file FieldCore.cpp.

364  {
365  Range ents_dim = ents.subset_by_dimension(dim);
366  return addEntsToFieldByDim(ents_dim, dim, name, verb);
367 }

◆ add_ents_to_field_by_type() [1/2]

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

Add entities to field meshset.

Note
not collective

The lower dimension entities are added depending on the space type

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

Implements MoFEM::CoreInterface.

Definition at line 393 of file FieldCore.cpp.

396  {
398  Range ents;
399  CHKERR get_moab().get_entities_by_type(meshset, type, ents, recursive);
400  if (!ents.empty()) {
401  const int dim = get_moab().dimension_from_handle(ents[0]);
402  CHKERR addEntsToFieldByDim(ents, dim, name, verb);
403  }
405 }
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429

◆ add_ents_to_field_by_type() [2/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_field_by_type ( const Range &  ents,
const EntityType  type,
const std::string &  name,
int  verb = DEFAULT_VERBOSITY 
)
protectedvirtual

Add entities to field meshset.

Note
not collective

The lower dimension entities are added depending on the space type

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

Implements MoFEM::CoreInterface.

Definition at line 369 of file FieldCore.cpp.

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

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

408  {
410 
411  if (verb == -1)
412  verb = verbose;
413  *buildMoFEM &= 1 << 0;
414  const BitFEId id = getBitFEId(name);
416 
417  auto &ref_MoFEMFiniteElement = refinedFiniteElements.get<Ent_mi_tag>();
418  auto miit = ref_MoFEMFiniteElement.lower_bound(get_id_for_min_type(type));
419  auto hi_miit = ref_MoFEMFiniteElement.upper_bound(get_id_for_max_type(type));
420 
421  int nb_add_fes = 0;
422  for (; miit != hi_miit; miit++) {
423  BitRefLevel bit2 = miit->get()->getBitRefLevel();
424  if ((bit2 & mask) != bit2)
425  continue;
426  if ((bit2 & bit).any()) {
427  EntityHandle ent = miit->get()->getEnt();
428  CHKERR get_moab().add_entities(idm, &ent, 1);
429  nb_add_fes++;
430  }
431  }
432 
433  MOFEM_LOG("SYNC", Sev::inform)
434  << "Finite element " << name << " added. Nb. of elements added "
435  << nb_add_fes << " out of " << std::distance(miit, hi_miit);
436 
438 
440 }
#define FECoreFunctionBegin
Definition: FECore.cpp:21
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:346
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:309
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:54
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
EntityHandle get_id_for_max_type()
EntityHandle get_id_for_min_type()
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:274
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:313
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:1001
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:256

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

349  {
350  EntityHandle idm = no_handle;
351  *buildMoFEM &= 1 << 0;
354  Range ents;
355  CHKERR get_moab().get_entities_by_dimension(meshset, dim, ents, recursive);
356  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
357  CHKERR get_moab().add_entities(idm, ents);
359 }
const EntityHandle no_handle
No entity handle is indicated by zero handle, i.e. root meshset.
Definition: Common.hpp:23

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

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

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

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

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

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

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

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

◆ add_ents_to_finite_element_EntType_by_bit_ref() [1/2]

MoFEMErrorCode MoFEM::Core::add_ents_to_finite_element_EntType_by_bit_ref ( const BitRefLevel bit,
const BitRefLevel mask,
const std::string &  name,
EntityType  type,
int  verb = DEFAULT_VERBOSITY 
)
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 397 of file FECore.cpp.

399  {
401  CHKERR add_ents_to_finite_element_by_bit_ref(bit, mask, name, type, verb);
402 
404 }
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:406

◆ add_ents_to_finite_element_EntType_by_bit_ref() [2/2]

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

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

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

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 387 of file FECore.cpp.

389  {
392  type, verb);
393 
395 }

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

283  {
284  return this->addField(name, space, base, nb_of_coefficients, tag_type, bh,
285  verb);
286 }
MoFEMErrorCode addField(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type, const enum MoFEMTypes bh, int verb)
Template for add_field.
Definition: FieldCore.cpp:109

◆ add_finite_element()

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

add finite element

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

Example

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

Implements MoFEM::CoreInterface.

Definition at line 41 of file FECore.cpp.

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

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

98  {
100  if (verb == -1)
101  verb = verbose;
102  auto miit = pRoblems.get<Problem_mi_tag>().find(name);
103  if (miit == pRoblems.get<Problem_mi_tag>().end()) {
104 
105  int p_shift = 0;
106  for (; pRoblems.get<BitProblemId_mi_tag>().find(BitProblemId().set(
107  p_shift)) != pRoblems.get<BitProblemId_mi_tag>().end();
108  ++p_shift) {
109  }
110 
111  auto id = BitProblemId().set(p_shift);
112  CHKERR addProblem(id, name, verb);
113 
114  } else if (bh == MF_EXCL) {
115  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem is in database %s",
116  name.c_str());
117  }
119 }
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition: Types.hpp:55
MoFEMErrorCode addProblem(const BitProblemId id, const std::string &name, int verb=DEFAULT_VERBOSITY)
add problem
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:325

◆ addEntsToFieldByDim()

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

Definition at line 288 of file FieldCore.cpp.

289  {
290 
291  *buildMoFEM = 0;
292  EntityHandle idm = no_handle;
293  if (verb == -1)
294  verb = verbose;
295 
296  MOFEM_LOG_CHANNEL("SYNC");
297  MOFEM_LOG_TAG("SYNC", "FieldCore");
299 
301  idm = get_field_meshset(name);
302  FieldSpace space;
303  CHKERR get_moab().tag_get_data(th_FieldSpace, &idm, 1, &space);
304  std::vector<int> nb_ents_on_dim(3, 0);
305  switch (space) {
306  case L2:
307  CHKERR get_moab().add_entities(idm, ents);
308  break;
309  case H1:
310  CHKERR get_moab().add_entities(idm, ents);
311  for (int dd = 0; dd != dim; ++dd) {
312  Range adj_ents;
313  CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
314  moab::Interface::UNION);
315  if (dd == 0) {
316  Range topo_nodes;
317  CHKERR get_moab().get_connectivity(ents, topo_nodes, true);
318  Range mid_nodes;
319  CHKERR get_moab().get_connectivity(ents, mid_nodes, false);
320  mid_nodes = subtract(mid_nodes, topo_nodes);
321  adj_ents = subtract(adj_ents, mid_nodes);
322  }
323  CHKERR get_moab().add_entities(idm, adj_ents);
324  nb_ents_on_dim[dd] = adj_ents.size();
325  }
326  break;
327  case HCURL:
328  CHKERR get_moab().add_entities(idm, ents);
329  for (int dd = 1; dd != dim; ++dd) {
330  Range adj_ents;
331  CHKERR get_moab().get_adjacencies(ents, dd, false, adj_ents,
332  moab::Interface::UNION);
333  CHKERR get_moab().add_entities(idm, adj_ents);
334  nb_ents_on_dim[dd] = adj_ents.size();
335  }
336  break;
337  case HDIV:
338  CHKERR get_moab().add_entities(idm, ents);
339  if (dim > 2) {
340  Range adj_ents;
341  CHKERR get_moab().get_adjacencies(ents, 2, false, adj_ents,
342  moab::Interface::UNION);
343  CHKERR get_moab().add_entities(idm, adj_ents);
344  nb_ents_on_dim[2] = adj_ents.size();
345  }
346  break;
347  default:
348  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
349  "sorry, unknown space added to entity");
350  }
351  if (verb >= VERBOSE) {
352  MOFEM_LOG("SYNC", Sev::noisy) << "add entities to field " << name;
353  MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add ents " << ents.size();
354  MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add faces " << nb_ents_on_dim[2];
355  MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add edges " << nb_ents_on_dim[1];
356  MOFEM_LOG("SYNC", Sev::noisy) << "\tnb. add nodes " << nb_ents_on_dim[0];
358  }
360 }
@ VERBOSE
Definition: definitions.h:222
FieldSpace
approximation spaces
Definition: definitions.h:95
@ L2
field with C-1 continuity
Definition: definitions.h:101
@ H1
continuous field
Definition: definitions.h:98
@ HCURL
field with continuous tangents
Definition: definitions.h:99
@ HDIV
field with continuous normal traction
Definition: definitions.h:100
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:44
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:340
#define MOFEM_LOG_FUNCTION()
Set scope.
Definition: LogManager.hpp:326
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
EntityHandle get_field_meshset(const BitFieldId id) const
Definition: FieldCore.cpp:49

◆ addField()

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

Template for add_field.

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

Definition at line 109 of file FieldCore.cpp.

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

◆ addPrismToDatabase()

MoFEMErrorCode MoFEM::Core::addPrismToDatabase ( const EntityHandle  prism,
int  verb = DEFAULT_VERBOSITY 
)

add prim element

FIXME: This is dirt solution, need to be fixed

Parameters
prismprim handle
verbverbosity level
Returns
error code

Definition at line 507 of file Core.cpp.

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

◆ addProblem()

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

add problem

Parameters
idproblem id
nameproblem name
verbverbosity level
Returns
MoFEMErrorCode

Definition at line 40 of file ProblemsCore.cpp.

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

◆ build_adjacencies() [1/3]

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

build adjacencies

Parameters
bitadjacencies for refine level
maskmask for bit level

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

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

Implements MoFEM::CoreInterface.

Definition at line 821 of file FECore.cpp.

822  {
824  if (verb == -1)
825  verb = verbose;
826  Range ents;
827  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents);
828 
829  CHKERR build_adjacencies(ents, verb);
830 
832 }
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)
build adjacencies
Definition: FECore.cpp:750

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

833  {
835  if (verb == -1)
836  verb = verbose;
837  CHKERR build_adjacencies(bit, BitRefLevel().set(), verb);
838 
840 }

◆ build_adjacencies() [3/3]

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

build adjacencies

Parameters
listof entities

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

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

Implements MoFEM::CoreInterface.

Definition at line 750 of file FECore.cpp.

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

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

1246  {
1248  auto field_it = fIelds.get<FieldName_mi_tag>().find(field_name);
1249  if (field_it == fIelds.get<FieldName_mi_tag>().end())
1250  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field < %s > not found",
1251  field_name.c_str());
1252 
1253  CHKERR this->buildField(*field_it, verb);
1254  if (verb > QUIET)
1257 }
#define FieldCoreFunctionBegin
Definition: FieldCore.cpp:21
Field_multiIndex::index< FieldName_mi_tag >::type::iterator field_it
MoFEMErrorCode buildField(const boost::shared_ptr< Field > &field, int verb=DEFAULT_VERBOSITY)
Definition: FieldCore.cpp:1195

◆ build_fields()

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

build fields

Implements MoFEM::CoreInterface.

Definition at line 1259 of file FieldCore.cpp.

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

◆ build_finite_elements() [1/3]

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

Definition at line 716 of file FECore.cpp.

716  {
718  SETERRQ(mofemComm, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
720 }
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:45

◆ build_finite_elements() [2/3]

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

Build finite elements.

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

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

Implements MoFEM::CoreInterface.

◆ build_finite_elements() [3/3]

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

Build finite elements.

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

Parameters
verbVerbosity level
Returns
Error code

Implements MoFEM::CoreInterface.

Definition at line 669 of file FECore.cpp.

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

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

270  {
272  if (verb == -1)
273  verb = verbose;
274  Problem_multiIndex::iterator p_miit = pRoblems.begin();
275  for (; p_miit != pRoblems.end(); p_miit++) {
276  CHKERR getInterface<ProblemsManager>()->buildProblemOnDistributedMesh(
277  const_cast<Problem *>(&*p_miit), verb);
278  }
280 }

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

330  {
332  if (verb == -1)
333  verb = verbose;
334  if (!((*buildMoFEM) & BUILD_FIELD))
335  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "fields not build");
336  if (!((*buildMoFEM) & BUILD_FE))
337  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "FEs not build");
338  if (!((*buildMoFEM) & BUILD_ADJ))
339  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "adjacencies not build");
340  // iterate problems
341  Problem_multiIndex::iterator p_miit = pRoblems.begin();
342  for (; p_miit != pRoblems.end(); p_miit++) {
343  Problem *problem_ptr = const_cast<Problem *>(&*p_miit);
344  CHKERR getInterface<ProblemsManager>()->buildProblem(problem_ptr, false,
345  verb);
346  }
349 }

◆ buildField()

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

Definition at line 1195 of file FieldCore.cpp.

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

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

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

◆ buildFieldForNoField()

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

Definition at line 1058 of file FieldCore.cpp.

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

◆ buildFieldForNoFieldImpl()

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

Definition at line 953 of file FieldCore.cpp.

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

◆ buildFiniteElements()

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

Definition at line 460 of file FECore.cpp.

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

◆ cache_problem_entities()

MoFEMErrorCode MoFEM::Core::cache_problem_entities ( const std::string  prb_name,
CacheTupleWeakPtr  cache_ptr 
)
protectedvirtual

Cache variables.

Parameters
prb_name
cache_ptr
Returns
MoFEMErrorCode

Implements MoFEM::CoreInterface.

Definition at line 804 of file ProblemsCore.cpp.

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

◆ check_field()

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

check if field is in database

Parameters
namefield name
Returns
true if field exist

Implements MoFEM::CoreInterface.

Definition at line 61 of file FieldCore.cpp.

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

◆ check_finite_element()

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

Check if finite element is in database.

Parameters
nameName of finite element
Returns
true if element is declared

Implements MoFEM::CoreInterface.

Definition at line 31 of file FECore.cpp.

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

◆ check_number_of_ents_in_ents_field() [1/2]

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

check data consistency in entitiesPtr

Implements MoFEM::CoreInterface.

Definition at line 1401 of file FieldCore.cpp.

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

◆ check_number_of_ents_in_ents_field() [2/2]

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

check data consistency in entitiesPtr

Implements MoFEM::CoreInterface.

Definition at line 1373 of file FieldCore.cpp.

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

◆ check_number_of_ents_in_ents_finite_element() [1/2]

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

check data consistency in entsFiniteElements

Implements MoFEM::CoreInterface.

Definition at line 876 of file FECore.cpp.

876  {
878  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
879  it = finiteElements.get<FiniteElement_name_mi_tag>().begin();
880  for (; it != finiteElements.get<FiniteElement_name_mi_tag>().end(); it++) {
881  EntityHandle meshset = (*it)->getMeshset();
882 
883  int num_entities;
884  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
885 
886  if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
887  (*it)->getName().c_str()) != (unsigned int)num_entities) {
888  SETERRQ1(mofemComm, 1,
889  "not equal number of entities in meshset and finite elements "
890  "multiindex < %s >",
891  (*it)->getName().c_str());
892  }
893  }
895 }

◆ check_number_of_ents_in_ents_finite_element() [2/2]

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

check data consistency in entsFiniteElements

Implements MoFEM::CoreInterface.

Definition at line 853 of file FECore.cpp.

854  {
856  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
857  it = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
858  if (it == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
859  SETERRQ1(mofemComm, 1, "finite element not found < %s >", name.c_str());
860  }
861  EntityHandle meshset = (*it)->getMeshset();
862 
863  int num_entities;
864  CHKERR get_moab().get_number_entities_by_handle(meshset, num_entities);
865 
866  if (entsFiniteElements.get<FiniteElement_name_mi_tag>().count(
867  (*it)->getName().c_str()) != (unsigned int)num_entities) {
868  SETERRQ1(mofemComm, 1,
869  "not equal number of entities in meshset and finite elements "
870  "multiindex < %s >",
871  (*it)->getName().c_str());
872  }
874 }

◆ check_problem()

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

check if problem exist

Parameters
nameproblem name
Returns
true if problem is in database

Implements MoFEM::CoreInterface.

Definition at line 31 of file ProblemsCore.cpp.

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

◆ clear_adjacencies_entities() [1/3]

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

clear adjacency map for entities on given bit level

Parameters
bit
mask

Implements MoFEM::CoreInterface.

Definition at line 214 of file DeleteCore.cpp.

216  {
218  if (verb == -1)
219  verb = verbose;
220  Range ents;
221  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
224 }
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:214

◆ clear_adjacencies_entities() [2/3]

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

clear adjacencies for field entities by entities

Implements MoFEM::CoreInterface.

Definition at line 226 of file DeleteCore.cpp.

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

◆ clear_adjacencies_entities() [3/3]

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

clear adjacencies for field entities by entities and field namd

Implements MoFEM::CoreInterface.

Definition at line 244 of file DeleteCore.cpp.

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

◆ clear_adjacencies_finite_elements() [1/3]

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

clear adjacency map for finite elements on given bit level

Parameters
bit
mask

Implements MoFEM::CoreInterface.

Definition at line 329 of file DeleteCore.cpp.

331  {
333  Range ents;
334  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
337 }
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:329

◆ clear_adjacencies_finite_elements() [2/3]

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

Definition at line 339 of file DeleteCore.cpp.

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

◆ clear_adjacencies_finite_elements() [3/3]

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

Definition at line 358 of file DeleteCore.cpp.

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

◆ clear_database()

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

Clear database.

Parameters
verbVerbosity level
Returns
Error code

Implements MoFEM::CoreInterface.

Definition at line 707 of file Core.cpp.

707  {
709  if (verb == -1)
710  verb = verbose;
711  CHKERR clearMap();
713 }

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

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

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

92  {
94  if (verb == -1)
95  verb = verbose;
96 
97  const auto bit_number = get_field_bit_number(name);
98 
99  for (Range::const_pair_iterator p_eit = ents.pair_begin();
100  p_eit != ents.pair_end(); p_eit++) {
101  const auto first = p_eit->first;
102  const auto second = p_eit->second;
103  const auto lo_uid = DofEntity::getLoFieldEntityUId(bit_number, first);
104  const auto hi_uid = DofEntity::getHiFieldEntityUId(bit_number, second);
105  auto dit = dofsField.get<Unique_mi_tag>().lower_bound(lo_uid);
106  auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(hi_uid);
107  dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
108  }
110 }
FieldBitNumber get_field_bit_number(const std::string name) const
get field bit number
Definition: FieldCore.cpp:41
static UId getLoFieldEntityUId(const FieldBitNumber bit, const EntityHandle ent)
static UId getHiFieldEntityUId(const FieldBitNumber bit, const EntityHandle ent)

◆ clear_dofs_fields_by_bit_ref()

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

Clear dofs by bit level

Implements MoFEM::CoreInterface.

Definition at line 58 of file DeleteCore.cpp.

60  {
62  if (verb == -1)
63  verb = verbose;
64  Range ents;
65  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
66  CHKERR clear_dofs_fields(ents, verb);
68 }
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:70

◆ clear_ents_fields() [1/2]

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

Clear entities by field name

Implements MoFEM::CoreInterface.

Definition at line 126 of file DeleteCore.cpp.

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

◆ clear_ents_fields() [2/2]

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

Clear entities by field name

Implements MoFEM::CoreInterface.

Definition at line 144 of file DeleteCore.cpp.

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

◆ clear_ents_fields_by_bit_ref()

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

Clear ents by bit level

Implements MoFEM::CoreInterface.

Definition at line 112 of file DeleteCore.cpp.

114  {
116  if (verb == -1)
117  verb = verbose;
118  Range ents;
119  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
120  CHKERR clear_dofs_fields(ents, verb);
122  CHKERR clear_ents_fields(ents, verb);
124 }
MoFEMErrorCode clear_ents_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:126

◆ clear_finite_elements() [1/2]

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 288 of file DeleteCore.cpp.

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

◆ clear_finite_elements() [2/2]

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 305 of file DeleteCore.cpp.

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

◆ clear_finite_elements_by_bit_ref()

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 276 of file DeleteCore.cpp.

278  {
280  if (verb == -1)
281  verb = verbose;
282  Range ents;
283  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
284  CHKERR clear_finite_elements(ents, verb);
286 }
MoFEMErrorCode clear_finite_elements(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:288

◆ clear_inactive_dofs()

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

Clear inactive dofs

Implements MoFEM::CoreInterface.

Definition at line 42 of file DeleteCore.cpp.

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

◆ clear_problem()

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

clear problem

Implements MoFEM::CoreInterface.

Definition at line 282 of file ProblemsCore.cpp.

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

◆ clear_problems()

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

clear problems

Implements MoFEM::CoreInterface.

Definition at line 351 of file ProblemsCore.cpp.

351  {
353  if (verb == -1)
354  verb = verbose;
355  // iterate problems
356  for (auto p_miit = pRoblems.begin(); p_miit != pRoblems.end(); p_miit++)
357  CHKERR clear_problem(p_miit->getName(), verb);
359 }
MoFEMErrorCode clear_problem(const std::string name, int verb=DEFAULT_VERBOSITY)
clear problem

◆ clearMap()

MoFEMErrorCode MoFEM::Core::clearMap ( )
protected

Cleaning database.

Definition at line 488 of file Core.cpp.

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

◆ coreGenericConstructor()

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

Definition at line 184 of file Core.cpp.

185  {
187 
188  // This is deprecated ONE should use MoFEM::Core::Initialize
190  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
191  "MoFEM globally is not initialised, call MoFEM::Core::Initialize");
192 
193  // Create duplicate communicator
194  wrapMPIMOABComm = boost::make_shared<WrapMPIComm>(comm, false);
195 
196  MPI_Comm_size(mofemComm, &sIze);
197  MPI_Comm_rank(mofemComm, &rAnk);
198 
199  // CHeck if moab has set communicator if not set communicator interbally
200  ParallelComm *pComm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
201  if (pComm == NULL)
202  pComm = new ParallelComm(&moab, wrapMPIMOABComm->get_comm());
203 
204  // Register interfaces for this implementation
205  CHKERR registerInterface<UnknownInterface>();
206  CHKERR registerInterface<CoreInterface>();
207  CHKERR registerInterface<DeprecatedCoreInterface>();
208 
209  // Register MOFEM events in PETSc
210  PetscLogEventRegister("FE_preProcess", 0, &MOFEM_EVENT_preProcess);
211  PetscLogEventRegister("FE_operator", 0, &MOFEM_EVENT_operator);
212  PetscLogEventRegister("FE_postProcess", 0, &MOFEM_EVENT_postProcess);
213  PetscLogEventRegister("MoFEMCreateMat", 0, &MOFEM_EVENT_createMat);
214 
215  MOFEM_LOG_CHANNEL("WORLD");
216  MOFEM_LOG_CHANNEL("SELF");
217  MOFEM_LOG_CHANNEL("SYNC");
218 
220 }
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:228
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:959
PetscLogEvent MOFEM_EVENT_preProcess
Event for preProcess finite element.
Definition: Core.hpp:954
int sIze
MoFEM communicator size.
Definition: Core.hpp:970
ParallelComm * pComm
MOAB communicator structure.
Definition: Core.hpp:968
PetscLogEvent MOFEM_EVENT_operator
Event for evaluating operator of finite element.
Definition: Core.hpp:956
PetscLogEvent MOFEM_EVENT_postProcess
Event for postProcess finite element.
Definition: Core.hpp:958
boost::shared_ptr< WrapMPIComm > wrapMPIMOABComm
manage creation and destruction of MOAB communicator
Definition: Core.hpp:992

◆ create_vertices_and_add_to_field()

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

Create a vertices and add to field object.

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

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

Implements MoFEM::CoreInterface.

Definition at line 407 of file FieldCore.cpp.

409  {
411 
412  if (verb == DEFAULT_VERBOSITY)
413  verb = verbose;
414 
415  Range verts;
416 
417  auto create_vertices = [&]() {
419 
420  vector<double *> arrays_coord;
421  EntityHandle startv = 0;
422  ReadUtilIface *iface;
423  CHKERR get_moab().query_interface(iface);
424  CHKERR iface->get_node_coords(3, size, 0, startv, arrays_coord);
425  verts.insert(startv, startv + size - 1);
426  for (int n = 0; n != size; ++n)
427  for (auto d : {0, 1, 2})
428  arrays_coord[d][n] = coords[3 * n + d];
429 
431  };
432 
433  auto add_verts_to_field = [&]() {
435  EntityHandle field_meshset = get_field_meshset(name);
436  CHKERR get_moab().add_entities(field_meshset, verts);
438  };
439 
440  CHKERR create_vertices();
441  CHKERR add_verts_to_field();
442 
444 }
static Index< 'n', 3 > n
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: dTensor0.hpp:27

◆ delete_ents_by_bit_ref()

MoFEMErrorCode MoFEM::Core::delete_ents_by_bit_ref ( const BitRefLevel  bit,
const BitRefLevel  mask,
const bool  remove_parent = false,
int  verb = DEFAULT_VERBOSITY,
MoFEMTypes  mf = MF_ZERO 
)
protectedvirtual

delete entities form mofem and moab database

Implements MoFEM::CoreInterface.

Definition at line 552 of file DeleteCore.cpp.

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

◆ delete_field()

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

Delete field.

Parameters
namefield name
verbverbosity level
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 626 of file DeleteCore.cpp.

626  {
628  auto &f = fIelds.get<FieldName_mi_tag>();
629  auto mit = f.find(name);
630  if (mit == f.end()) {
631  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
632  "Finite element <%s> not found", name.c_str());
633  }
634  EntityHandle meshset = mit->get()->getMeshset();
635  Range ents;
636  CHKERR get_moab().get_entities_by_handle(meshset, ents, false);
637  CHKERR remove_ents_from_field(name, ents, verb);
638  CHKERR get_moab().tag_delete((*mit)->th_FieldDataVerts);
639  CHKERR get_moab().tag_delete((*mit)->th_FieldData);
640  CHKERR get_moab().tag_delete((*mit)->th_AppOrder);
641  f.erase(mit);
642  CHKERR get_moab().delete_entities(&meshset, 1);
644 }
MoFEMErrorCode remove_ents_from_field(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
remove entities from field
Definition: DeleteCore.cpp:165

◆ delete_finite_element()

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

delete finite element from mofem database

Implements MoFEM::CoreInterface.

Definition at line 609 of file DeleteCore.cpp.

609  {
611  auto &fe = finiteElements.get<FiniteElement_name_mi_tag>();
612  auto mit = fe.find(name);
613  if (mit == fe.end()) {
614  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
615  "Finite element <%s> not found", name.c_str());
616  }
617  EntityHandle meshset = mit->get()->getMeshset();
618  Range ents;
619