v0.6.20
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MoFEM::Core Struct Reference

Core (interface) class. More...

#include <src/interfaces/Core.hpp>

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

Public Member Functions

 Core (moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE, const bool distributed_mesh=true)
 
 ~Core ()
 
- Public Member Functions inherited from MoFEM::DeprecatedCoreInterface
template<class IFace >
DEPRECATED MoFEMErrorCode query_interface (IFace *&ptr) const
 
template<class IFace >
DEPRECATED IFace * query_interface () const
 
virtual DEPRECATED MoFEMErrorCode seed_ref_level_2D (const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
 seed 2D entities (Triangles entities only) in the meshset and their adjacencies (only TRIs adjacencies) in a particular BitRefLevel More...
 
DEPRECATED MoFEMErrorCode seed_ref_level_3D (const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
 seed 2D entities in the meshset and their adjacencies (only TETs adjacencies) in a particular BitRefLevel More...
 
DEPRECATED MoFEMErrorCode seed_ref_level (const Range &ents, const BitRefLevel &bit, const bool only_tets=true, int verb=-1)
 seed entities in the range and their adjacencies in a particular BitRefLevel More...
 
DEPRECATED MoFEMErrorCode seed_ref_level_MESHSET (const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
 
DEPRECATED MoFEMErrorCode seed_finite_elements (const EntityHandle meshset, int verb=-1)
 
DEPRECATED MoFEMErrorCode seed_finite_elements (const Range &entities, int verb=-1)
 
DEPRECATED MoFEMErrorCode get_entities_by_type_and_ref_level (const BitRefLevel &bit, const BitRefLevel &mask, const EntityType type, const EntityHandle meshset, int verb=-1)
 add all ents from ref level given by bit to meshset More...
 
DEPRECATED MoFEMErrorCode get_entities_by_type_and_ref_level (const BitRefLevel &bit, const BitRefLevel &mask, const EntityType type, Range &ents, int verb=-1)
 add all ents from ref level given by bit to meshset More...
 
DEPRECATED MoFEMErrorCode get_entities_by_ref_level (const BitRefLevel &bit, const BitRefLevel &mask, const EntityHandle meshset)
 add all ents from ref level given by bit to meshset More...
 
DEPRECATED MoFEMErrorCode get_entities_by_ref_level (const BitRefLevel &bit, const BitRefLevel &mask, Range &ents)
 add all ents from ref level given by bit to meshset More...
 
DEPRECATED bool check_msId_meshset (const int msId, const CubitBCType cubit_bc_type)
 check for CUBIT Id and CUBIT type More...
 
DEPRECATED MoFEMErrorCode add_cubit_msId (const CubitBCType cubit_bc_tyep, const int msId, const std::string name="")
 add cubit meshset More...
 
DEPRECATED MoFEMErrorCode set_cubit_msId_attribites (const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
 set attributes to cubit meshset More...
 
DEPRECATED MoFEMErrorCode set_cubit_msId_attribites_data_structure (const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
 set (material) data structure to cubit meshset More...
 
DEPRECATED MoFEMErrorCode set_cubit_msId_bc_data_structure (const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
 set boundary data structure to meshset More...
 
DEPRECATED MoFEMErrorCode delete_cubit_msId (const CubitBCType cubit_bc_type, const int msId)
 delete cubit meshset More...
 
DEPRECATED MoFEMErrorCode get_cubit_msId (const int msId, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr)
 get cubit meshset More...
 
DEPRECATED MoFEMErrorCode get_cubit_msId_entities_by_dimension (const int ms_id, const CubitBCType cubit_bc_type, const int dimension, Range &entities, const bool recursive=false)
 
DEPRECATED MoFEMErrorCode get_cubit_msId_entities_by_dimension (const int ms_id, const CubitBCType cubit_bc_type, Range &entities, const bool recursive=false)
 
DEPRECATED MoFEMErrorCode get_cubit_msId_entities_by_dimension (const int msId, const unsigned int cubit_bc_type, const int dimension, Range &entities, const bool recursive=false)
 get entities from CUBIT/meshset of a particular entity dimension More...
 
DEPRECATED MoFEMErrorCode get_cubit_msId_entities_by_dimension (const int msId, const unsigned int cubit_bc_type, Range &entities, const bool recursive=false)
 get entities related to CUBIT/meshset, More...
 
DEPRECATED MoFEMErrorCode get_cubit_msId_meshset (const int msId, const unsigned int cubit_bc_type, EntityHandle &meshset)
 get meshset from CUBIT Id and CUBIT type More...
 
DEPRECATED MoFEMErrorCode get_cubit_meshsets (const unsigned int cubit_bc_type, Range &meshsets)
 get all CUBIT meshsets by CUBIT type More...
 
DEPRECATED MoFEMErrorCode print_cubit_displacement_set () const
 
DEPRECATED MoFEMErrorCode print_cubit_pressure_set () const
 
DEPRECATED MoFEMErrorCode print_cubit_force_set () const
 
DEPRECATED MoFEMErrorCode print_cubit_materials_set () const
 
DEPRECATED MoFEMErrorCode update_meshset_by_entities_children (const EntityHandle parent, const BitRefLevel &child_bit, const EntityHandle child, EntityType child_type, const bool recursive=false, int verb=-1)
 Get child entities form meshset containing parent entities. More...
 
DEPRECATED MoFEMErrorCode update_field_meshset_by_entities_children (const BitRefLevel &child_bit, int verb=-1)
 update fields meshesets by child entities More...
 
DEPRECATED MoFEMErrorCode update_field_meshset_by_entities_children (const std::string name, const BitRefLevel &child_bit, int verb=-1)
 update field mesheset by child entities More...
 
DEPRECATED MoFEMErrorCode update_finite_element_meshset_by_entities_children (const std::string name, const BitRefLevel &child_bit, const EntityType fe_ent_type, int verb=-1)
 update finite element mesheset by child entities More...
 
DEPRECATED MoFEMErrorCode shift_right_bit_ref (const int shift, int verb=-1)
 right shift bit ref level More...
 
DEPRECATED MoFEMErrorCode build_problem (const std::string &name, const bool square_matrix, int verb=-1)
 build problem data structures More...
 
DEPRECATED MoFEMErrorCode build_problem (Problem *problem_ptr, const bool square_matrix, int verb=-1)
 build problem data structures More...
 
DEPRECATED MoFEMErrorCode build_problem_on_distributed_mesh (const std::string &name, const bool square_matrix=true, int verb=-1)
 build problem data structures, assuming that mesh is distributed (collective) More...
 
DEPRECATED MoFEMErrorCode build_problem_on_distributed_mesh (Problem *problem_ptr, const bool square_matrix=true, int verb=-1)
 build problem data structures, assuming that mesh is distributed (collective) More...
 
DEPRECATED MoFEMErrorCode partition_mesh (const Range &ents, const int dim, const int adj_dim, const int n_parts, int verb=-1)
 Set partition tag to each finite element in the problem. More...
 
DEPRECATED MoFEMErrorCode partition_simple_problem (const std::string &name, int verb=-1)
 partition problem dofs More...
 
DEPRECATED MoFEMErrorCode partition_problem (const std::string &name, int verb=-1)
 partition problem dofs (collective) More...
 
DEPRECATED MoFEMErrorCode partition_compose_problem (const std::string &name, const std::string &problem_for_rows, const bool copy_rows, const std::string &problem_for_cols, const bool copy_cols, int verb=-1)
 build indexing and partition problem inheriting indexing and partitioning from two other problems More...
 
DEPRECATED MoFEMErrorCode build_sub_problem (const std::string &out_name, const std::vector< std::string > &fields_row, const std::vector< std::string > &fields_col, const std::string &main_problem, const bool square_matrix=true, int verb=-1)
 build sub problem More...
 
DEPRECATED MoFEMErrorCode partition_ghost_dofs (const std::string &name, int verb=-1)
 determine ghost nodes More...
 
DEPRECATED MoFEMErrorCode partition_finite_elements (const std::string &name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=-1)
 partition finite elements More...
 
DEPRECATED MoFEMErrorCode get_problem_elements_layout (const std::string &name, const std::string &fe_name, PetscLayout *layout, int verb=-1)
 Get layout of elements in the problemIn layout is stored information how many elements is on each processor, for more information look int petsc documentation http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/IS/PetscLayoutCreate.html#PetscLayoutCreate More...
 
DEPRECATED MoFEMErrorCode VecCreateSeq (const std::string &name, RowColData rc, Vec *V) const
 create local vector for problem More...
 
DEPRECATED MoFEMErrorCode VecCreateGhost (const std::string &name, RowColData rc, Vec *V) const
 create ghost vector for problem (collective)collective - need to be run on all processors in communicator More...
 
DEPRECATED MoFEMErrorCode ISCreateFromProblemFieldToOtherProblemField (const std::string &x_problem, const std::string &x_field_name, RowColData x_rc, const std::string &y_problem, const std::string &y_field_name, RowColData y_rc, std::vector< int > &idx, std::vector< int > &idy, int verb=-1) const
 create IS for give two problems and field More...
 
DEPRECATED MoFEMErrorCode ISCreateFromProblemFieldToOtherProblemField (const std::string &x_problem, const std::string &x_field_name, RowColData x_rc, const std::string &y_problem, const std::string &y_field_name, RowColData y_rc, IS *ix, IS *iy, int verb=-1) const
 create IS for give two problems and field More...
 
DEPRECATED MoFEMErrorCode ISCreateProblemOrder (const std::string &problem, RowColData rc, int min_order, int max_order, IS *is, int verb=-1) const
 create IS for given order range (collective) More...
 
DEPRECATED MoFEMErrorCode ISCreateProblemFieldAndRank (const std::string &problem, RowColData rc, const std::string &field, int min_coeff_idx, int max_coeff_idx, IS *is, int verb=-1) const
 create IS for given problem, field and rank range (collective) More...
 
DEPRECATED MoFEMErrorCode VecScatterCreate (Vec xin, const std::string &x_problem, const std::string &x_field_name, RowColData x_rc, Vec yin, const std::string &y_problem, const std::string &y_field_name, RowColData y_rc, VecScatter *newctx, int verb=-1) const
 create scatter for vectors form one to another problem (collective)User specify what name of field on one problem is scattered to another. More...
 
DEPRECATED MoFEMErrorCode VecScatterCreate (Vec xin, const std::string &x_problem, RowColData x_rc, Vec yin, const std::string &y_problem, RowColData y_rc, VecScatter *newctx, int verb=-1) const
 create scatter for vectors form one to another problem (collective) More...
 
DEPRECATED MoFEMErrorCode set_local_ghost_vector (const Problem *problem_ptr, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to meshdatabase More...
 
DEPRECATED MoFEMErrorCode set_local_ghost_vector (const std::string &name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to meshdatabase More...
 
DEPRECATED MoFEMErrorCode set_global_ghost_vector (const Problem *problem_ptr, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to mesh database (collective)collective - need tu be run on all processors in communicator More...
 
DEPRECATED MoFEMErrorCode set_global_ghost_vector (const std::string &name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
 set values of vector from/to mesh database (collective)collective - need tu be run on all processors in communicator More...
 
DEPRECATED MoFEMErrorCode set_other_local_ghost_vector (const Problem *problem_ptr, const std::string &fiel_name, const std::string &cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode, int verb=-1)
 Copy vector to field which is not part of the problem. More...
 
DEPRECATED MoFEMErrorCode set_other_local_ghost_vector (const std::string &name, const std::string &field_name, const std::string &cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode, int verb=-1)
 Copy vector to field which is not part of the problem. More...
 
DEPRECATED MoFEMErrorCode set_other_global_ghost_vector (const Problem *problem_ptr, const std::string &field_name, const std::string &cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode, int verb=-1)
 Copy vector to field which is not part of the problem (collective)collective - need tu be run on all processors in communicator. More...
 
DEPRECATED MoFEMErrorCode set_other_global_ghost_vector (const std::string &name, const std::string &field_name, const std::string &cpy_field_name, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode, int verb=-1)
 Copy vector to field which is not part of the problem (collective)collective - need tu be run on all processors in communicator. More...
 
DEPRECATED MoFEMErrorCode field_axpy (const double alpha, const std::string &fiel_name_x, const std::string &field_name_y, bool error_if_missing=false, bool creat_if_missing=false)
 axpy fields More...
 
DEPRECATED MoFEMErrorCode field_scale (const double alpha, const std::string &field_name)
 scale field More...
 
DEPRECATED MoFEMErrorCode set_field (const double val, const EntityType type, const std::string &field_name)
 use FieldBlas More...
 
DEPRECATED MoFEMErrorCode set_field (const double val, const EntityType type, const Range &ents, const std::string &field_name)
 set field More...
 
DEPRECATED MoFEMErrorCode get_adjacencies_equality (const EntityHandle from_entiti, const int to_dimension, Range &adj_entities) const
 Get the adjacencies associated with a entity to entities of a specified dimension. \ separate interface, i.e. BitLevelManager. More...
 
DEPRECATED MoFEMErrorCode get_adjacencies_any (const EntityHandle from_entiti, const int to_dimension, Range &adj_entities) const
 Get the adjacencies associated with a entity to entities of a specified dimension.bit ref level of adjacent entities is any of bit ref level of adjacent entities. More...
 
DEPRECATED MoFEMErrorCode get_adjacencies (const Problem *problem_ptr, const EntityHandle *from_entities, const int num_netities, const int to_dimension, Range &adj_entities, const int operation_type=moab::Interface::INTERSECT, const int verb=0) const
 Get the adjacencies associated with a entity to entities of a specified dimension. \ separate interface, i.e. BitLevelManage. More...
 
DEPRECATED MoFEMErrorCode get_adjacencies (const BitRefLevel &bit, const EntityHandle *from_entities, const int num_netities, const int to_dimension, Range &adj_entities, const int operation_type=moab::Interface::INTERSECT, const int verb=0) const
 Get the adjacencies associated with a entity to entities of a specified dimension. \ separate interface, i.e. BitLevelManage. More...
 
DEPRECATED MoFEMErrorCode clear_dofs_fields (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
DEPRECATED MoFEMErrorCode clear_ents_fields (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
DEPRECATED MoFEMErrorCode clear_finite_elements (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_VERTICEs (const Range &nodes, const std::string &name, int verb=-1)
 set field entities on verticesThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_VERTICEs (const EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities on verticesThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_EDGEs (const Range &edges, const std::string &name, int verb=-1)
 set field entities form adjacencies of edgesThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_EDGEs (const EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities form adjacencies of edgesThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_TRIs (const EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities form adjacencies of trianglesThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_TRIs (const Range &tris, const std::string &name, int verb=-1)
 set field entities form adjacencies of trianglesThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_TETs (const EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities from adjacencies of tetrahedronThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_TETs (const Range &tets, const std::string &name, int verb=-1)
 set field entities from adjacencies of tetrahedronThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_QUADs (const Range &quads, const std::string &name, int verb=-1)
 set field entities from adjacencies of quadsThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_QUADs (EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities from adjacencies of quadsThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_PRISMs (const Range &prisms, const std::string &name, int verb=-1)
 set field entities from adjacencies of prismsThe lower dimension entities are added depending on the space type More...
 
DEPRECATED MoFEMErrorCode add_ents_to_field_by_PRISMs (EntityHandle meshset, const std::string &name, int verb=-1)
 set field entities from adjacencies of prismsThe lower dimension entities are added depending on the space type More...
 
- Public Member Functions inherited from MoFEM::CoreInterface
template<typename DIT >
MoFEMErrorCode get_field_dof_data (const std::string &name, const EntityHandle *ent, const int num_ents, DIT dit, int *count=NULL)
 get field data from entity and fieldthis function is not recommended to be used in finite element implementation More...
 
template<typename DIT >
MoFEMErrorCode get_field_dof_data (const std::string &name, const Range &ents, DIT dit, int *count=NULL)
 get field data from entity and fieldthis function is not recommended to be used in finite element implementation More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (const MOFEMuuid &uuid, bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE , bool VERIFY>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, IFACE *&iface) const
 Get interface by uuid and return reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type >
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type >
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()
 
virtual MoFEMErrorCode getLibVersion (Version &version) const
 Get library version. More...
 
virtual const MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version) const
 Get database major version. More...
 
virtual MoFEMErrorCode getInterfaceVersion (Version &version) const
 Get database major version. More...
 
template<>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, UnknownInterface *&iface) const
 

Private Member Functions

MoFEMErrorCode getTags (int verb=-1)
 Get tag handles. More...
 
MoFEMErrorCode clearMap ()
 Cleaning database. More...
 
BitFieldId getFieldShift ()
 Return unique field Id. More...
 
BitFEId getFEShift ()
 Return unique finite element Id. More...
 
BitProblemId getProblemShift ()
 Return unique problem Id. More...
 
MoFEMErrorCode initialiseDatabaseFromMesh (int verb=-1)
 Initialize database getting information on mesh. More...
 
MoFEMErrorCode getOptions (int verb=-1)
 Get core options from command line. More...
 
template<class IFACE >
MoFEMErrorCode regSubInterface (const MOFEMuuid &uid)
 

Private Attributes

int verbose
 Verbosity level. More...
 
intfShift
 Ptr to tag handle storing last set bit in field ID. More...
 
intfeShift
 Ptr to tag handle storing last set bit in finite element ID. More...
 
intpShift
 Ptr to tag handle storing last set bit in problem ID. More...
 
boost::ptr_map< unsigned long, UnknownInterfaceiFaces
 Hash map of pointers to interfaces. More...
 
intbuildMoFEM
 keeps flags/semaphores for different stages More...
 
std::string optionsPrefix
 Prefix for options on command line. More...
 
PetscBool initaliseAndBuildField
 
PetscBool initaliseAndBuildFiniteElements
 

Static Private Attributes

static bool isGloballyInitialised = false
 Core base globally initialized. More...
 

Global initialisation and finalisation

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

Assessing interfaces

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

Get tag handles to data on the mesh

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

Auxiliary data and functions

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

Tags to data on mesh and entities

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

Multi-Indices accessing data on the mesh

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

Get moab database

moab::Interface & moab
 moab database More...
 
moab::Interface & get_moab ()
 
const moab::Interface & get_moab () const
 

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=-1)
 Clear database. More...
 
MoFEMErrorCode rebuild_database (int verb=-1)
 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=-1)
 Remove parents from entities. More...
 
MoFEMErrorCode remove_parents_by_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
MoFEMErrorCode remove_parents_by_parents (const Range &ents, int verb=-1)
 Remove paremts from entities having parents in passed range. More...
 
MoFEMErrorCode remove_ents (const Range &ents, int verb=-1)
 remove entities form mofem database More...
 
MoFEMErrorCode remove_ents_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 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=-1)
 delete entities form mofem and moab database More...
 

Synchronize entities (Following functions in future will be

deprecated)

MoFEMErrorCode synchronise_entities (Range &ent, int verb=-1)
 
MoFEMErrorCode synchronise_field_entities (const BitFieldId id, int verb=-1)
 
MoFEMErrorCode synchronise_field_entities (const std::string &name, int verb=-1)
 

Fields

MoFEMErrorCode add_field (const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=-1)
 Add filed. More...
 
MoFEMErrorCode addEntsToFieldByDim (const Range &ents, const int dim, const std::string &name, int verb=-1)
 
MoFEMErrorCode add_ents_to_field_by_dim (const Range &ents, const int dim, const std::string &name, int verb=-1)
 Add entities to field meshsetThe lower dimension entities are added depending on the space type. More...
 
MoFEMErrorCode add_ents_to_field_by_type (const Range &ents, const EntityType type, const std::string &name, int verb=-1)
 Add entities to field meshsetThe lower dimension entities are added depending on the space type. More...
 
MoFEMErrorCode add_ents_to_field_by_dim (const EntityHandle meshset, const int dim, const std::string &name, const bool recursive=true, int verb=-1)
 Add entities to field meshsetThe lower dimension entities are added depending on the space type. More...
 
MoFEMErrorCode add_ents_to_field_by_type (const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true, int verb=-1)
 Add entities to field meshsetThe lower dimension entities are added depending on the space type. More...
 

Set approximation order

MoFEMErrorCode set_field_order (const Range &ents, const BitFieldId id, const ApproximationOrder order, int verb=-1)
 
MoFEMErrorCode set_field_order (const EntityHandle meshset, const EntityType type, const BitFieldId id, const ApproximationOrder order, int verb=-1)
 
MoFEMErrorCode set_field_order (const Range &ents, const std::string &name, const ApproximationOrder order, int verb=-1)
 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=-1)
 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=-1)
 
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=-1)
 Set order approximation of the entities in the field. More...
 

Build fields

MoFEMErrorCode buildFieldForNoField (const BitFieldId id, std::map< EntityType, int > &dof_counter, int verb=-1)
 
MoFEMErrorCode buildFieldForL2H1HcurlHdiv (const BitFieldId id, std::map< EntityType, int > &dof_counter, std::map< EntityType, int > &inactive_dof_counter, int verb=-1)
 
MoFEMErrorCode build_fields (int verb=-1)
 

Clear DOFs

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

Clear ENTs

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

Remove field entities

MoFEMErrorCode remove_ents_from_field_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 remove entities from field More...
 
MoFEMErrorCode remove_ents_from_field (const std::string &name, const EntityHandle meshset, const EntityType type, int verb=-1)
 remove entities from field More...
 
MoFEMErrorCode remove_ents_from_field (const std::string &name, const Range &ents, int verb=-1)
 remove entities from field More...
 
MoFEMErrorCode remove_ents_from_field (const Range &ents, int verb=-1)
 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
 
std::string getBitFieldIdName (const BitFieldId id) const
 
EntityHandle get_field_meshset (const BitFieldId id) const
 
EntityHandle get_field_meshset (const std::string &name) const
 get field meshset More...
 
MoFEMErrorCode get_field_entities_by_dimension (const std::string name, int dim, Range &ents) const
 get entities in the field by dimension More...
 
MoFEMErrorCode get_field_entities_by_type (const std::string name, EntityType type, Range &ents) const
 get entities in the field by type More...
 
MoFEMErrorCode get_field_entities_by_handle (const std::string name, Range &ents) const
 get entities in the field by handle More...
 
bool check_field (const std::string &name) const
 check if field is in database More...
 
const Fieldget_field_structure (const std::string &name)
 get field structure More...
 

Finite elements

bool check_finite_element (const std::string &name) const
 Check if finite element is in database. More...
 
MoFEMErrorCode add_finite_element (const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL)
 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 userUsing that functions means that you like to do something not usual. 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=-1)
 add TET entities from given refinement level to finite element database given by name More...
 
MoFEMErrorCode add_ents_to_finite_element_by_MESHSET (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add MESHSET element to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_VERTICEs (const Range &vert, const std::string &name)
 add VERTICES entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_EDGEs (const Range &vert, const std::string &name)
 add EDGES entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_EDGEs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add EDGES finite elements More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TRIs (const Range &tris, const std::string &name)
 add TRI entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TRIs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add TRI entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TETs (const Range &tets, const std::string &name)
 add TET entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TETs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add TET entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_PRISMs (const Range &prims, const BitFEId id)
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_PRISMs (const Range &prims, const std::string &name)
 add PRISM entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_PRISMs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add TET entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_EntType_by_bit_ref (const BitRefLevel &bit, const std::string &name, EntityType type, int verb=-1)
 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=-1)
 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=-1)
 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=-1)
 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=-1)
 remove entities from finite element database More...
 
MoFEMErrorCode remove_ents_from_finite_element (const Range &ents, int verb=-1)
 remove entities from finite elements in database More...
 
MoFEMErrorCode delete_finite_element (const std::string name, int verb=-1)
 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 BitProblemId id, const std::string &name)
 
MoFEMErrorCode add_problem (const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=-1)
 Add problem. More...
 
bool check_problem (const std::string name)
 check if problem exist More...
 
MoFEMErrorCode delete_problem (const std::string name)
 Delete problem. More...
 
MoFEMErrorCode modify_problem_add_finite_element (const std::string &name_problem, const std::string &MoFEMFiniteElement_name)
 add finite element to problem, this add entities assigned to finite element to a particular problem More...
 
MoFEMErrorCode modify_problem_unset_finite_element (const std::string &name_problem, const std::string &MoFEMFiniteElement_name)
 unset finite element from problem, this remove entities assigned to finite element to a particular problemNote: If problem is build, it need to be cleaned to make this effective More...
 
MoFEMErrorCode modify_problem_ref_level_add_bit (const std::string &name_problem, const BitRefLevel &bit)
 add ref level to problemif same finite element is solved using different level of refinements, than the level of refinement has to be specificied to problem in query More...
 
MoFEMErrorCode modify_problem_ref_level_set_bit (const std::string &name_problem, const BitRefLevel &bit)
 set ref level for problemif same finite element is solved using different level of refinements, than the level of refinement has to be specificied to problem in query 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=-1)
 clear problem More...
 
MoFEMErrorCode clear_problems (int verb=-1)
 clear problems More...
 
MoFEMErrorCode build_finite_elements (int verb=-1)
 Build finite elementsBuild finite element data structures. Have to be run before problem and adjacencies are constructed. More...
 
MoFEMErrorCode build_finite_elements (const BitRefLevel &bit, int verb=-1)
 
MoFEMErrorCode build_finite_elements (const string fe_name, const Range *ents_ptr=NULL, int verb=-1)
 Build finite elementsBuild finite element data structures. Have to be run before problem and adjacencies are constructed. More...
 
MoFEMErrorCode buildFiniteElements (const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=-1)
 
MoFEMErrorCode clear_finite_elements_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
MoFEMErrorCode clear_finite_elements (const Range &ents, int verb=-1)
 
MoFEMErrorCode clear_finite_elements (const std::string &name, const Range &ents, int verb=-1)
 
MoFEMErrorCode resolve_shared_ents (const Problem *problem_ptr, const std::string &fe_name, int verb=-1)
 resolve shared entities for finite elements in the problem More...
 
MoFEMErrorCode resolve_shared_ents (const std::string &name, const std::string &fe_name, int verb=-1)
 resolve shared entities for finite elements in the problem More...
 
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=-1)
 build problem data structures, assuming that mesh is distributed (collective) More...
 
DEPRECATED MoFEMErrorCode build_problems (int verb=-1)
 build problem data structures More...
 
MoFEMErrorCode partition_check_matrix_fill_in (const std::string &problem_name, int row, int col, int verb)
 check if matrix fill in correspond to finite element indices More...
 

Adjacencies

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

Create matrices (will be moved to independent interface)

MoFEMErrorCode MatCreateMPIAIJWithArrays (const std::string &name, Mat *Aij, int verb=-1)
 create Mat (MPIAIJ) for problem (collective) More...
 
MoFEMErrorCode MatCreateMPIAdj_with_Idx_mi_tag (const std::string &name, Mat *Adj, int verb=-1)
 Create Adj matrix. More...
 
MoFEMErrorCode MatCreateSeqAIJWithArrays (const std::string &name, Mat *Aij, PetscInt **i, PetscInt **j, PetscScalar **v, int verb=-1)
 create Mat (AIJ) for problem More...
 

Methods for preforming operations on elements

MoFEMErrorCode problem_basic_method_preProcess (const Problem *problem_ptr, BasicMethod &method, int verb=-1)
 Set data for BasicMethod. More...
 
MoFEMErrorCode problem_basic_method_preProcess (const std::string &problem_name, BasicMethod &method, int verb=-1)
 Set data for BasicMethod. More...
 
MoFEMErrorCode problem_basic_method_postProcess (const Problem *problem_ptr, BasicMethod &method, int verb=-1)
 Set data for BasicMethodThis function set data about problem, adjacencies and other multi-indices in database. This function can be used a special case when user need to do some pre- and post-processing before matrix or vector is initiated, or to assemble matrix for group of FEMethods. Is used by classes SnesCtx and TsCtx. Look for more details there. More...
 
MoFEMErrorCode problem_basic_method_postProcess (const std::string &problem_name, BasicMethod &method, int verb=-1)
 Set data for BasicMethodThis function set data about problem, adjacencies and other multi-indices in database. This function can be used a special case when user need to do some pre- and post-processing before matrix or vector is initiated, or to assemble matrix for group of FEMethods. Is used by classes SnesCtx and TsCtx. Look for more details there. More...
 
MoFEMErrorCode loop_finite_elements (const Problem *problem_ptr, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, MoFEMTypes bh=MF_EXIST, int verb=-1)
 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, MoFEMTypes bh=MF_EXIST, int verb=-1)
 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, MoFEMTypes bh=MF_EXIST, int verb=-1)
 Make a loop over finite elements. More...
 
MoFEMErrorCode loop_dofs (const Problem *problem_ptr, const std::string &field_name, RowColData rc, EntMethod &method, int lower_rank, int upper_rank, int verb=-1)
 Make a loop over entities. More...
 
MoFEMErrorCode loop_dofs (const std::string &problem_name, const std::string &field_name, RowColData rc, EntMethod &method, int lower_rank, int upper_rank, int verb=-1)
 Make a loop over entities. More...
 
MoFEMErrorCode loop_dofs (const std::string &problem_name, const std::string &field_name, RowColData rc, EntMethod &method, int verb=-1)
 Make a loop over entities. More...
 
MoFEMErrorCode loop_dofs (const std::string &field_name, EntMethod &method, int verb=-1)
 Make a loop over entities. More...
 

Accessing multi-indices

MoFEMErrorCode get_fields (const Field_multiIndex **fields_ptr) const
 Get fields multi-index from database. More...
 
MoFEMErrorCode get_ref_ents (const RefEntity_multiIndex **refined_entities_ptr) const
 Get ref entities multi-index from database. More...
 
MoFEMErrorCode get_ref_finite_elements (const RefElement_multiIndex **refined_finite_elements_ptr) const
 Get ref finite elements multi-index form database. More...
 
MoFEMErrorCode get_finite_elements (const FiniteElement_multiIndex **fe_ptr) const
 Get finite elements multi-index. More...
 
MoFEMErrorCode get_ents_finite_elements (const EntFiniteElement_multiIndex **fe_ent_ptr) const
 Get entities finite elements multi-index. More...
 
MoFEMErrorCode get_field_ents (const FieldEntity_multiIndex **field_ents) const
 Get field multi index. More...
 
MoFEMErrorCode get_dofs (const DofEntity_multiIndex **dofs_ptr) const
 Get dofs multi index. More...
 
MoFEMErrorCode get_problem (const std::string &problem_name, const Problem **problem_ptr) const
 Get problem database (data structure) More...
 
MoFEMErrorCode get_problems (const Problem_multiIndex **problems_ptr) const
 Get pointer to problems multi-index. More...
 
FieldEntityByFieldName::iterator get_ent_field_by_name_begin (const std::string &field_name) const
 get begin iterator of filed ents of given name (instead you can use IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) mofem_field More...
 
FieldEntityByFieldName::iterator get_ent_field_by_name_end (const std::string &field_name) const
 get begin iterator of filed dofs of given name (instead you can use IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) mofem_field More...
 
DofEntityByFieldName::iterator get_dofs_by_name_begin (const std::string &field_name) const
 get begin iterator of filed dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) mofem_field More...
 
DofEntityByFieldName::iterator get_dofs_by_name_end (const std::string &field_name) const
 get begin iterator of filed dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) mofem_field More...
 
DofEntityByNameAndEnt::iterator get_dofs_by_name_and_ent_begin (const std::string &field_name, const EntityHandle ent) const
 get begin iterator of filed dofs of given name and ent(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,ENT,IT) mofem_field More...
 
DofEntityByNameAndEnt::iterator get_dofs_by_name_and_ent_end (const std::string &field_name, const EntityHandle ent) const
 get begin iterator of filed dofs of given name and ent (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,ENT,IT)for(IT_GET_DOFS_FIELD_BY_NAME_AND_ENT_FOR_LOOP(MFIELD,NAME,ENT,IT)) { ... } More...
 
DofEntityByNameAndType::iterator get_dofs_by_name_and_type_begin (const std::string &field_name, const EntityType type) const
 get begin iterator of filed dofs of given name and ent type (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT) mofem_field More...
 
DofEntityByNameAndType::iterator get_dofs_by_name_and_type_end (const std::string &field_name, const EntityType ent) const
 get begin iterator of filed dofs of given name end ent type(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT) mofem_field 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) mofem_access 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)for(IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 

Log events

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

Communicator

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

Additional Inherited Members

- Protected Member Functions inherited from MoFEM::UnknownInterface
boost::typeindex::type_index getClassIdx (const MOFEMuuid &uid) const
 Get type name for interface Id. More...
 
MOFEMuuid getUId (const boost::typeindex::type_index &class_idx) const
 Get interface Id for class name. More...
 

Detailed Description

Core (interface) class.

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

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

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

Todo:
Implement static functions for Initialization and Finalization of MoFEM. Those functions should keep all static variables and initialize/finalize other libs like PETSc. Moreover initialization functions should set error handlers, etc.
Examples:
analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, cell_forces.cpp, cubit_bc_test.cpp, elasticity.cpp, hello_world.cpp, magnetostatic.cpp, mesh_cut.cpp, simple_elasticity.cpp, simple_interface.cpp, split_sideset.cpp, and unsaturated_transport.cpp.

Definition at line 50 of file Core.hpp.

Member Enumeration Documentation

◆ SemaphoresBuildMofem

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

Enumerator
BUILD_FIELD 
BUILD_FE 
BUILD_ADJ 
BUILD_PROBLEM 
PARTITION_PROBLEM 
PARTITION_FE 
PARTITION_GHOST_DOFS 
PARTITION_MESH 

Definition at line 165 of file Core.hpp.

Constructor & Destructor Documentation

◆ Core()

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

Construct core database

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

Definition at line 78 of file Core.cpp.

80  : moab(moab), cOmm(0), verbose(verbose),
81  initaliseAndBuildField(PETSC_FALSE),
82  initaliseAndBuildFiniteElements(PETSC_FALSE) {
83 
84  // This is deprecated ONE should use MoFEM::Core::Initialize
85  if (!isGloballyInitialised) {
86  PetscPushErrorHandler(mofem_error_handler, PETSC_NULL);
87  isGloballyInitialised = true;
88  }
89 
90  // Register interfaces for this implementation
91  ierr = registerInterface<UnknownInterface>(IDD_MOFEMUnknown);
92  CHKERRABORT(PETSC_COMM_SELF, ierr);
93  ierr = registerInterface<CoreInterface>(IDD_MOFEMCoreInterface);
94  CHKERRABORT(PETSC_COMM_SELF, ierr);
95  ierr = registerInterface<DeprecatedCoreInterface>(
97  CHKERRABORT(PETSC_COMM_SELF, ierr);
98  // Register sub interfaces
99  ierr = regSubInterface<Simple>(IDD_MOFEMSimple);
100  CHKERRABORT(PETSC_COMM_SELF, ierr);
101  ierr = regSubInterface<ProblemsManager>(IDD_MOFEMProblemsManager);
102  CHKERRABORT(PETSC_COMM_SELF, ierr);
103  ierr = regSubInterface<ISManager>(IDD_MOFEMISManager);
104  CHKERRABORT(PETSC_COMM_SELF, ierr);
105  ierr = regSubInterface<VecManager>(IDD_MOFEMVEC);
106  CHKERRABORT(PETSC_COMM_SELF, ierr);
107  ierr = regSubInterface<FieldBlas>(IDD_MOFEMFieldBlas);
108  CHKERRABORT(PETSC_COMM_SELF, ierr);
109  ierr = regSubInterface<BitRefManager>(IDD_MOFEMBitRefManager);
110  CHKERRABORT(PETSC_COMM_SELF, ierr);
111  ierr = regSubInterface<Tools>(IDD_MOFEMTools);
112  CHKERRABORT(PETSC_COMM_SELF, ierr);
113  ierr = regSubInterface<MeshsetsManager>(IDD_MOFEMMeshsetsManager);
114  CHKERRABORT(PETSC_COMM_SELF, ierr);
115  ierr = regSubInterface<CoordSystemsManager>(IDD_MOFEMCoordsSystemsManager);
116  CHKERRABORT(PETSC_COMM_SELF, ierr);
117  ierr = regSubInterface<NodeMergerInterface>(IDD_MOFEMNodeMerger);
118  CHKERRABORT(PETSC_COMM_SELF, ierr);
119  ierr = regSubInterface<BitLevelCoupler>(IDD_MOFEMBitLevelCoupler);
120  CHKERRABORT(PETSC_COMM_SELF, ierr);
121  ierr =
122  regSubInterface<PrismsFromSurfaceInterface>(IDD_MOFEMPrismsFromSurface);
123  CHKERRABORT(PETSC_COMM_SELF, ierr);
124  ierr = regSubInterface<MeshRefinement>(IDD_MOFEMMeshRefine);
125  CHKERRABORT(PETSC_COMM_SELF, ierr);
126  ierr = regSubInterface<PrismInterface>(IDD_MOFEMPrismInterface);
127  CHKERRABORT(PETSC_COMM_SELF, ierr);
128  ierr = regSubInterface<CutMeshInterface>(IDD_MOFEMCutMesh);
129  CHKERRABORT(PETSC_COMM_SELF, ierr);
130  ierr = regSubInterface<SeriesRecorder>(IDD_MOFEMSeriesRecorder);
131  CHKERRABORT(PETSC_COMM_SELF, ierr);
132 #ifdef WITH_TETGEN
133  ierr = regSubInterface<TetGenInterface>(IDD_MOFEMTetGegInterface);
134  CHKERRABORT(PETSC_COMM_SELF, ierr);
135 #endif
136 #ifdef WITH_MED
137  ierr = regSubInterface<MedInterface>(IDD_MOFEMMedInterface);
138  CHKERRABORT(PETSC_COMM_SELF, ierr);
139 #endif
140 
141  // Register MOFEM events in PETSc
142  PetscLogEventRegister("FE_preProcess",0,&MOFEM_EVENT_preProcess);
143  PetscLogEventRegister("FE_operator",0,&MOFEM_EVENT_operator);
144  PetscLogEventRegister("FE_postProcess",0,&MOFEM_EVENT_postProcess);
145  PetscLogEventRegister("MoFEMCreateMat",0,&MOFEM_EVENT_createMat);
146 
147  // Duplicate PETSc communicator
148  ierr = PetscCommDuplicate(comm,&cOmm,NULL); CHKERRABORT(comm,ierr);
149  MPI_Comm_size(cOmm,&sIze);
150  MPI_Comm_rank(cOmm,&rAnk);
151  // CHeck if moab has set communicator if not set communicator interbally
152  ParallelComm* pComm = ParallelComm::get_pcomm(&moab,MYPCOMM_INDEX);
153  if(pComm == NULL) {
154  pComm = new ParallelComm(&moab,comm);
155  }
156 
157  // Initialize database
158  ierr = getTags(); CHKERRABORT(cOmm,ierr);
159  ierr = clearMap(); CHKERRABORT(cOmm,ierr);
160 
161  basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
162  if (distributed_mesh)
163  basicEntityDataPtr->setDistributedMesh();
164  else
165  basicEntityDataPtr->unSetDistributedMesh();
166 
167  ierr = getOptions(verbose); CHKERRABORT(cOmm,ierr);
168  ierr = initialiseDatabaseFromMesh(verbose); CHKERRABORT(cOmm,ierr);
169 
170  // Print version
171  if (verbose > QUIET) {
172  char petsc_version[255];
173  ierr = PetscGetVersion(petsc_version, 255);
174  CHKERRABORT(cOmm, ierr);
175  ierr = PetscPrintf(cOmm, "MoFEM version %d.%d.%d (%s %s) \n",
176  MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR,
177  MoFEM_VERSION_BUILD, MOAB_VERSION_STRING, petsc_version);
178  CHKERRABORT(cOmm, ierr);
179  ierr = PetscPrintf(cOmm, "git commit id %s\n", GIT_SHA1_NAME);
180  CHKERRABORT(cOmm, ierr);
181  }
182 }
static const MOFEMuuid IDD_MOFEMSeriesRecorder
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:222
static const MOFEMuuid IDD_MOFEMCoreInterface
Definition: Interface.hpp:24
int sIze
MoFEM communicator size.
Definition: Core.hpp:809
static const MOFEMuuid IDD_MOFEMMeshsetsManager
PetscLogEvent MOFEM_EVENT_postProcess
Event for postProcess finite element.
Definition: Core.hpp:797
static const MOFEMuuid IDD_MOFEMProblemsManager
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
PetscLogEvent MOFEM_EVENT_operator
Event for evaluating operator of finite element.
Definition: Core.hpp:795
static const MOFEMuuid IDD_MOFEMUnknown
static const MOFEMuuid IDD_MOFEMBitRefManager
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:798
static const MOFEMuuid IDD_MOFEMNodeMerger
Definition: NodeMerger.hpp:23
MoFEMErrorCode getTags(int verb=-1)
Get tag handles.
Definition: Core.cpp:270
static const MOFEMuuid IDD_MOFEMVEC
Definition: VecManager.hpp:26
static const MOFEMuuid IDD_MOFEMPrismsFromSurface
PetscLogEvent MOFEM_EVENT_preProcess
Event for preProcess finite element.
Definition: Core.hpp:793
static const MOFEMuuid IDD_MOFEMSimple
Definition: Simple.hpp:27
PetscBool initaliseAndBuildField
Definition: Core.hpp:846
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:810
static const MOFEMuuid IDD_MOFEMMeshRefine
moab::Interface & moab
moab database
Definition: Core.hpp:264
static const MOFEMuuid IDD_MOFEMTools
Definition: Tools.hpp:23
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:842
static const MOFEMuuid IDD_MOFEMTetGegInterface
PetscBool initaliseAndBuildFiniteElements
Definition: Core.hpp:849
static const MOFEMuuid IDD_MOFEMCutMesh
static const MOFEMuuid IDD_MOFEMCoordsSystemsManager
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:224
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:316
static PetscErrorCode mofem_error_handler(MPI_Comm comm, int line, const char *fun, const char *file, PetscErrorCode n, PetscErrorType p, const char *mess, void *ctx)
static const MOFEMuuid IDD_MOFEMFieldBlas
Definition: FieldBlas.hpp:26
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=-1)
Initialize database getting information on mesh.
Definition: Core.cpp:544
ParallelComm * pComm
MOAB communicator structure.
Definition: Core.hpp:807
int verbose
Verbosity level.
Definition: Core.hpp:830
static const MOFEMuuid IDD_MOFEMISManager
Definition: ISManager.hpp:26
static const MOFEMuuid IDD_MOFEMDeprecatedCoreInterface
Definition: Interface.hpp:25
static const MOFEMuuid IDD_MOFEMPrismInterface
MoFEMErrorCode getOptions(int verb=-1)
Get core options from command line.
Definition: Core.cpp:519
static const MOFEMuuid IDD_MOFEMMedInterface
static const MOFEMuuid IDD_MOFEMBitLevelCoupler

◆ ~Core()

MoFEM::Core::~Core ( )

Definition at line 184 of file Core.cpp.

184  {
185  PetscBool is_finalized;
186  PetscFinalized(&is_finalized);
187  // Destroy interfaces
188  iFaces.clear();
189  // This is deprecated ONE should use MoFEM::Core::Initialize
190  if (isGloballyInitialised && is_finalized) {
191  isGloballyInitialised = false;
192  }
193  // Destroy communicator
194  if (!is_finalized) {
195  ierr = PetscCommDestroy(&cOmm); CHKERRABORT(cOmm,ierr);
196  }
197 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:842
boost::ptr_map< unsigned long, UnknownInterface > iFaces
Hash map of pointers to interfaces.
Definition: Core.hpp:839

Member Function Documentation

◆ add_ents_to_field_by_dim() [1/2]

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

Add entities to field meshsetThe 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 303 of file FieldCore.cpp.

305  {
306  Range ents_dim = ents.subset_by_dimension(dim);
307  return addEntsToFieldByDim(ents_dim, dim, name, verb);
308 }
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=-1)
Definition: FieldCore.cpp:224

◆ add_ents_to_field_by_dim() [2/2]

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

Add entities to field meshsetThe 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 325 of file FieldCore.cpp.

328  {
330  Range ents;
331  rval = moab.get_entities_by_dimension(meshset, dim, ents, recursive);
333  ierr = addEntsToFieldByDim(ents, dim, name, verb);
334  CHKERRG(ierr);
336 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:529
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:558
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=-1)
Definition: FieldCore.cpp:224

◆ add_ents_to_field_by_type() [1/2]

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

Add entities to field meshsetThe 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 310 of file FieldCore.cpp.

313  {
314 
316  Range ents_type = ents.subset_by_type(type);
317  if (!ents_type.empty()) {
318  const int dim = moab.dimension_from_handle(ents_type[0]);
319  ierr = addEntsToFieldByDim(ents_type, dim, name, verb);
320  CHKERRG(ierr);
321  }
323 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:558
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=-1)
Definition: FieldCore.cpp:224

◆ add_ents_to_field_by_type() [2/2]

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

Add entities to field meshsetThe 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 338 of file FieldCore.cpp.

341  {
343  Range ents;
344  rval = moab.get_entities_by_type(meshset, type, ents, recursive);
346  if (!ents.empty()) {
347  const int dim = moab.dimension_from_handle(ents[0]);
348  ierr = addEntsToFieldByDim(ents, dim, name, verb);
349  CHKERRG(ierr);
350  }
352 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:529
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:558
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=-1)
Definition: FieldCore.cpp:224

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

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

Parameters
BitRefLevelbit
BitRefLevelmask
finiteelement name
finiteelement type
verboselevel

Implements MoFEM::CoreInterface.

Definition at line 480 of file FECore.cpp.

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

◆ 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

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

363  {
364  EntityHandle idm = no_handle;
365  *buildMoFEM &= 1 << 0;
368  Range ents;
369  CHKERR moab.get_entities_by_dimension(meshset, dim, ents, recursive);
370  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
371  CHKERR moab.add_entities(idm, ents);
373 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:279
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
const EntityHandle no_handle
Definition: Common.hpp:133
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:257
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
#define CHKERR
Inline error check.
Definition: definitions.h:610
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ 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

Parameters
entsrange of entities
dimdimension of entities
namename of finite element
Returns
error code

Implements MoFEM::CoreInterface.

Definition at line 388 of file FECore.cpp.

389  {
390  EntityHandle idm = no_handle;
391  *buildMoFEM &= 1 << 0;
394  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
395  ents.subset_by_dimension(dim));
396  CHKERR moab.add_entities(idm, ents.subset_by_dimension(dim));
398 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:279
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
const EntityHandle no_handle
Definition: Common.hpp:133
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:257
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
#define CHKERR
Inline error check.
Definition: definitions.h:610
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_ents_to_finite_element_by_EDGEs() [1/2]

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

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

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
rangecontains tetrahedron
nameFinite Element name

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 407 of file FECore.cpp.

408  {
410  CHKERR add_ents_to_finite_element_by_type(edges, MBEDGE, name);
412 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
add entities to finite element
Definition: FECore.cpp:344
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_ents_to_finite_element_by_EDGEs() [2/2]

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

add EDGES finite elements

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

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 400 of file FECore.cpp.

401  {
403  CHKERR add_ents_to_finite_element_by_type(meshset, MBEDGE, name, recursive);
405 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
add entities to finite element
Definition: FECore.cpp:344
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ 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

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

Implements MoFEM::CoreInterface.

Definition at line 521 of file FECore.cpp.

522  {
524  *buildMoFEM &= 1 << 0;
525  const BitFEId id = getBitFEId(name);
527  if (recursive == false) {
528  CHKERR moab.add_entities(idm, &meshset, 1);
529  } else {
530  Range meshsets;
531  CHKERR moab.get_entities_by_type(meshset, MBENTITYSET, meshsets, false);
532  CHKERR moab.add_entities(idm, meshsets);
533  }
535 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:279
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
std::bitset< BITFEID_SIZE > BitFEId
Definition: Common.hpp:150
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:257
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
#define CHKERR
Inline error check.
Definition: definitions.h:610
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_ents_to_finite_element_by_PRISMs() [1/3]

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

◆ add_ents_to_finite_element_by_PRISMs() [2/3]

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

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

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
rangecontains tetrahedron
nameFinite Element name

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 447 of file FECore.cpp.

448  {
450  CHKERR add_ents_to_finite_element_by_type(prims, MBPRISM, name);
452 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
add entities to finite element
Definition: FECore.cpp:344
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_ents_to_finite_element_by_PRISMs() [3/3]

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

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

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

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 453 of file FECore.cpp.

454  {
456  CHKERR add_ents_to_finite_element_by_type(meshset, MBPRISM, name, recursive);
458 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
add entities to finite element
Definition: FECore.cpp:344
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_ents_to_finite_element_by_TETs() [1/2]

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

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

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
rangecontains tetrahedron
nameFinite Element name

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 434 of file FECore.cpp.

435  {
437  CHKERR add_ents_to_finite_element_by_type(tets, MBTET, name);
439 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
add entities to finite element
Definition: FECore.cpp:344
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_ents_to_finite_element_by_TETs() [2/2]

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

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

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

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 440 of file FECore.cpp.

441  {
443  CHKERR add_ents_to_finite_element_by_type(meshset, MBTET, name, recursive);
445 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
add entities to finite element
Definition: FECore.cpp:344
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_ents_to_finite_element_by_TRIs() [1/2]

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

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

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
rangecontains tetrahedron
nameFinite Element name

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 421 of file FECore.cpp.

422  {
424  CHKERR add_ents_to_finite_element_by_type(tris, MBTRI, name);
426 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
add entities to finite element
Definition: FECore.cpp:344
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_ents_to_finite_element_by_TRIs() [2/2]

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

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

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

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 427 of file FECore.cpp.

428  {
430  CHKERR add_ents_to_finite_element_by_type(meshset, MBTRI, name, recursive);
432 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
add entities to finite element
Definition: FECore.cpp:344
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ 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

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

346  {
347  *buildMoFEM &= 1 << 0;
348  EntityHandle idm = no_handle;
350 
352  Range ents;
353  CHKERR moab.get_entities_by_type(meshset, type, ents, recursive);
354  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(ents);
355  CHKERR moab.add_entities(idm, ents);
356 
358 }
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:279
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
const EntityHandle no_handle
Definition: Common.hpp:133
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:257
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
#define CHKERR
Inline error check.
Definition: definitions.h:610
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ 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

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

Implements MoFEM::CoreInterface.

Definition at line 375 of file FECore.cpp.

376  {
377  EntityHandle idm = no_handle;
378  *buildMoFEM &= 1 << 0;
381  CHKERR getInterface<BitRefManager>()->setElementsBitRefLevel(
382  ents.subset_by_type(type));
383  CHKERR moab.add_entities(idm, ents.subset_by_type(type));
385 } // namespace MoFEM
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:279
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
const EntityHandle no_handle
Definition: Common.hpp:133
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:257
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
#define CHKERR
Inline error check.
Definition: definitions.h:610
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_ents_to_finite_element_by_VERTICEs()

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

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

Deprecated:
use add_ents_to_finite_element_by_type
Parameters
rangecontains tetrahedron
nameFinite Element name

Implements MoFEM::DeprecatedCoreInterface.

Definition at line 414 of file FECore.cpp.

415  {
417  CHKERR add_ents_to_finite_element_by_type(vert, MBVERTEX, name);
419 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
add entities to finite element
Definition: FECore.cpp:344
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_ents_to_finite_element_EntType_by_bit_ref() [1/2]

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

463  {
466  type, verb);
467 
469 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
MoFEMErrorCode add_ents_to_finite_element_by_bit_ref(const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name, EntityType type, int verb=-1)
add TET entities from given refinement level to finite element database given by name ...
Definition: FECore.cpp:480
#define CHKERR
Inline error check.
Definition: definitions.h:610
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_ents_to_finite_element_EntType_by_bit_ref() [2/2]

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

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

◆ 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 = -1 
)
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 116 of file FieldCore.cpp.

120  {
122  if (verb == -1)
123  verb = verbose;
124  *buildMoFEM = 0;
125  Field_multiIndex::index<FieldName_mi_tag>::type::iterator fit;
126  fit = fIelds.get<FieldName_mi_tag>().find(name);
127  if (fit != fIelds.get<FieldName_mi_tag>().end()) {
128  if (bh == MF_EXCL) {
129  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
130  "field is <%s> in database", name.c_str());
131  }
132  } else {
133  EntityHandle meshset;
134  rval = moab.create_meshset(MESHSET_SET | MESHSET_TRACK_OWNER, meshset);
136  // id
137  BitFieldId id = getFieldShift();
138  rval = moab.tag_set_data(th_FieldId, &meshset, 1, &id);
140  // space
141  rval = moab.tag_set_data(th_FieldSpace, &meshset, 1, &space);
143  // base
144  rval = moab.tag_set_data(th_FieldBase, &meshset, 1, &base);
146  // name
147  void const *tag_data[] = {name.c_str()};
148  int tag_sizes[1];
149  tag_sizes[0] = name.size();
150  rval = moab.tag_set_by_ptr(th_FieldName, &meshset, 1, tag_data, tag_sizes);
152  // name data prefix
153  std::string name_data_prefix("_App_Data");
154  void const *tag_prefix_data[] = {name_data_prefix.c_str()};
155  int tag_prefix_sizes[1];
156  tag_prefix_sizes[0] = name_data_prefix.size();
157  rval = moab.tag_set_by_ptr(th_FieldName_DataNamePrefix, &meshset, 1,
158  tag_prefix_data, tag_prefix_sizes);
160  Tag th_AppOrder, th_FieldData, th_Rank;
161  // data
162  std::string Tag_data_name = name_data_prefix + name;
163  const int def_len = 0;
164  rval = moab.tag_get_handle(
165  Tag_data_name.c_str(), def_len, MB_TYPE_OPAQUE, th_FieldData,
166  MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
168  // order
169  ApproximationOrder def_ApproximationOrder = -1;
170  std::string Tag_ApproximationOrder_name = "_App_Order_" + name;
171  rval = moab.tag_get_handle(
172  Tag_ApproximationOrder_name.c_str(), sizeof(ApproximationOrder),
173  MB_TYPE_OPAQUE, th_AppOrder, MB_TAG_CREAT | MB_TAG_BYTES | tag_type,
174  &def_ApproximationOrder);
176  // rank
177  int def_rank = 1;
178  std::string Tag_rank_name = "_Field_Rank_" + name;
179  rval = moab.tag_get_handle(
180  Tag_rank_name.c_str(), sizeof(FieldCoefficientsNumber), MB_TYPE_OPAQUE,
181  th_Rank, MB_TAG_CREAT | MB_TAG_BYTES | tag_type, &def_rank);
183  rval = moab.tag_set_data(th_Rank, &meshset, 1, &nb_of_coefficients);
185  // add meshset
186  std::pair<Field_multiIndex::iterator, bool> p;
187  try {
188  CoordSystemsManager *cs_manger_ptr;
189  ierr = getInterface(cs_manger_ptr);
190  CHKERRG(ierr);
191  boost::shared_ptr<CoordSys> undefined_cs_ptr;
192  ierr = cs_manger_ptr->getCoordSysPtr("UNDEFINED", undefined_cs_ptr);
193  CHKERRG(ierr);
194  int sys_name_size[1];
195  sys_name_size[0] = undefined_cs_ptr->getName().size();
196  void const *sys_name[] = {&*undefined_cs_ptr->getNameRef().begin()};
197  rval = moab.tag_set_by_ptr(cs_manger_ptr->get_th_CoordSysName(), &meshset,
198  1, sys_name, sys_name_size);
200  EntityHandle coord_sys_id = undefined_cs_ptr->getMeshset();
201  rval = moab.add_entities(coord_sys_id, &meshset, 1);
203  p = fIelds.insert(
204  boost::make_shared<Field>(moab, meshset, undefined_cs_ptr));
205  if (bh == MF_EXCL) {
206  if (!p.second)
207  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND,
208  "field not inserted %s (top tip, it could be already there)",
209  Field(moab, meshset, undefined_cs_ptr).getName().c_str());
210  }
211  } catch (MoFEMException const &e) {
212  SETERRQ(PETSC_COMM_SELF, e.errorCode, e.errorMessage);
213  }
214  if (verbose > 0) {
215  std::ostringstream ss;
216  ss << "add: " << **p.first << std::endl;
217  PetscPrintf(cOmm, ss.str().c_str());
218  }
219  }
220  // unt
222 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:529
int FieldCoefficientsNumber
Number of field coefficients.
Definition: Common.hpp:132
Tag th_FieldSpace
Definition: Core.hpp:203
Tag th_FieldName_DataNamePrefix
Definition: Core.hpp:203
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
IFACE getInterface() const
Get interface pointer to pointer of interface.
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:558
std::bitset< BITFIELDID_SIZE > BitFieldId
Definition: Common.hpp:149
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
Tag th_FieldId
Definition: Core.hpp:203
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
Tag th_FieldBase
Definition: Core.hpp:203
Tag th_FieldName
Definition: Core.hpp:203
Field_multiIndex fIelds
fields
Definition: Core.hpp:246
int ApproximationOrder
Approximation on the entity.
Definition: Common.hpp:131
int verbose
Verbosity level.
Definition: Core.hpp:830
BitFieldId getFieldShift()
Return unique field Id.
Definition: Core.cpp:199

◆ add_finite_element()

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

add finite element

Parameters
namefinite element name

Example

ierr = mField.add_finite_element("ELASTIC"); CHKERRG(ierr);
ierr = mField.add_finite_element("PLASTIC"); CHKERRG(ierr);

Implements MoFEM::CoreInterface.

Definition at line 45 of file FECore.cpp.

46  {
48  *buildMoFEM &= 1 << 0;
49  typedef FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type
50  FiniteElements_by_name;
51  FiniteElements_by_name &finite_element_name_set =
52  finiteElements.get<FiniteElement_name_mi_tag>();
53  FiniteElements_by_name::iterator it_fe =
54  finite_element_name_set.find(fe_name);
55  if (bh == MF_EXCL) {
56  if (it_fe != finite_element_name_set.end()) {
57  SETERRQ1(cOmm, MOFEM_NOT_FOUND, "this < %s > is there", fe_name.c_str());
58  }
59  } else {
60  if (it_fe != finite_element_name_set.end())
62  }
63  EntityHandle meshset;
64  CHKERR moab.create_meshset(MESHSET_SET | MESHSET_TRACK_OWNER, meshset);
65 
66  // id
67  BitFEId id = getFEShift();
68  CHKERR moab.tag_set_data(th_FEId, &meshset, 1, &id);
69 
70  // id name
71  void const *tag_data[] = {fe_name.c_str()};
72  int tag_sizes[1];
73  tag_sizes[0] = fe_name.size();
74  CHKERR moab.tag_set_by_ptr(th_FEName, &meshset, 1, tag_data, tag_sizes);
75 
76  // add FiniteElement
77  std::pair<FiniteElement_multiIndex::iterator, bool> p = finiteElements.insert(
78  boost::shared_ptr<FiniteElement>(new FiniteElement(moab, meshset)));
79  if (!p.second)
80  SETERRQ(cOmm, MOFEM_OPERATION_UNSUCCESSFUL, "FiniteElement not inserted");
81  if (verbose > 0) {
82  std::ostringstream ss;
83  ss << "add finite element: " << fe_name << std::endl;
84  PetscPrintf(cOmm, ss.str().c_str());
85  // list_finiteElements();
86  }
88 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
std::bitset< BITFEID_SIZE > BitFEId
Definition: Common.hpp:150
Tag th_FEName
Definition: Core.hpp:205
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
BitFEId getFEShift()
Return unique finite element Id.
Definition: Core.cpp:212
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:250
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
Tag th_FEId
Definition: Core.hpp:205
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ add_problem() [1/2]

MoFEMErrorCode MoFEM::Core::add_problem ( const BitProblemId  id,
const std::string &  name 
)
protected

Definition at line 30 of file ProblemsCore.cpp.

31  {
33  EntityHandle meshset;
34  CHKERR moab.create_meshset(MESHSET_SET | MESHSET_TRACK_OWNER, meshset);
35  CHKERR moab.tag_set_data(th_ProblemId, &meshset, 1, &id);
36  void const *tag_data[] = {name.c_str()};
37  int tag_sizes[1];
38  tag_sizes[0] = name.size();
39  CHKERR moab.tag_set_by_ptr(th_ProblemName, &meshset, 1, tag_data, tag_sizes);
40  // create entry
41  std::pair<Problem_multiIndex::iterator, bool> p =
42  pRoblems.insert(Problem(moab, meshset));
43  NOT_USED(p);
44  assert(p.second);
45  if (verbose > 0) {
46  std::ostringstream ss;
47  ss << "add problem: " << name << std::endl;
48  PetscPrintf(cOmm, ss.str().c_str());
49  }
51 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
Tag th_ProblemName
Definition: Core.hpp:207
Tag th_ProblemId
Definition: Core.hpp:207
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:256
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436
#define NOT_USED(x)
Definition: definitions.h:331

◆ add_problem() [2/2]

MoFEMErrorCode MoFEM::Core::add_problem ( const std::string &  name,
enum MoFEMTypes  bh = MF_EXCL,
int  verb = -1 
)
protectedvirtual

Add problem.

Implements MoFEM::CoreInterface.

Definition at line 53 of file ProblemsCore.cpp.

54  {
56  if (verb == -1)
57  verb = verbose;
58  typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
59  const ProblemsByName &set = pRoblems.get<Problem_mi_tag>();
60  ProblemsByName::iterator miit = set.find(name);
61  if (miit == set.end()) {
63  ierr = add_problem(id, name);
64  CHKERRG(ierr);
65  } else if (bh == MF_EXCL) {
66  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "problem is in database %s",
67  name.c_str());
68  }
70 }
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Definition: Common.hpp:151
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:558
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
BitProblemId getProblemShift()
Return unique problem Id.
Definition: Core.cpp:217
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:256
int verbose
Verbosity level.
Definition: Core.hpp:830
MoFEMErrorCode add_problem(const BitProblemId id, const std::string &name)

◆ addEntsToFieldByDim()

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

Definition at line 224 of file FieldCore.cpp.

225  {
226 
227  *buildMoFEM = 0;
228  EntityHandle idm = no_handle;
229  if (verb == -1)
230  verb = verbose;
232  idm = get_field_meshset(name);
233  FieldSpace space;
234  CHKERR moab.tag_get_data(th_FieldSpace, &idm, 1, &space);
235  std::vector<int> nb_ents_on_dim(3, 0);
236  switch (space) {
237  case L2:
238  CHKERR moab.add_entities(idm, ents);
239  if (verb >= VERY_VERBOSE) {
240  std::ostringstream ss;
241  ss << "add entities to field " << name;
242  ss << " nb. add ents " << ents.size();
243  ss << std::endl;
244  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
245  }
246  break;
247  case H1:
248  CHKERR moab.add_entities(idm, ents);
249  for (int dd = 0; dd != dim; ++dd) {
250  Range adj_ents;
251  CHKERR moab.get_adjacencies(ents, dd, false, adj_ents,
252  moab::Interface::UNION);
253  if (dd == 0) {
254  Range topo_nodes;
255  CHKERR moab.get_connectivity(ents, topo_nodes, true);
256  Range mid_nodes;
257  CHKERR moab.get_connectivity(ents, mid_nodes, false);
258  mid_nodes = subtract(mid_nodes, topo_nodes);
259  adj_ents = subtract(adj_ents, mid_nodes);
260  }
261  CHKERR moab.add_entities(idm, adj_ents);
262  nb_ents_on_dim[dd] = adj_ents.size();
263  }
264  break;
265  case HCURL:
266  CHKERR moab.add_entities(idm, ents);
267  for (int dd = 1; dd != dim; ++dd) {
268  Range adj_ents;
269  CHKERR moab.get_adjacencies(ents, dd, false, adj_ents,
270  moab::Interface::UNION);
271  CHKERR moab.add_entities(idm, adj_ents);
272  nb_ents_on_dim[dd] = adj_ents.size();
273  }
274  break;
275  case HDIV:
276  CHKERR moab.add_entities(idm, ents);
277  if (dim > 2) {
278  Range adj_ents;
279  CHKERR moab.get_adjacencies(ents, 2, false, adj_ents,
280  moab::Interface::UNION);
281  CHKERR moab.add_entities(idm, adj_ents);
282  nb_ents_on_dim[2] = adj_ents.size();
283  }
284  break;
285  default:
286  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
287  "sorry, unknown space added to entity");
288  }
289  if (verb >= VERY_VERBOSE) {
290  std::ostringstream ss;
291  ss << "add entities to field " << name;
292  ss << " nb. add ents " << ents.size();
293  ss << " nb. add faces " << nb_ents_on_dim[2];
294  ss << " nb. add edges " << nb_ents_on_dim[1];
295  ss << " nb. add nodes " << nb_ents_on_dim[0];
296  ss << std::endl;
297  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
298  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
299  }
301 }
Tag th_FieldSpace
Definition: Core.hpp:203
field with continuous normal traction
Definition: definitions.h:178
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
const EntityHandle no_handle
Definition: Common.hpp:133
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
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:28
field with continuous tangents
Definition: definitions.h:177
FieldSpace
approximation spaces
Definition: definitions.h:173
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
EntityHandle get_field_meshset(const BitFieldId id) const
Definition: FieldCore.cpp:37
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436
continuous field
Definition: definitions.h:176
field with C-1 continuity
Definition: definitions.h:179

◆ addPrismToDatabase()

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

add prim element

FIXME: This is dirt solution, need to be fixed

Parameters
prismprim handle
verbverbosity level
Returns
error code

Definition at line 241 of file Core.cpp.

241  {
243  if (verb == -1)
244  verb = verbose;
245  std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
246  p_ent = refinedEntities.insert(
247  boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
248  if (p_ent.second) {
249  std::pair<RefElement_multiIndex::iterator, bool> p;
250  p = refinedFiniteElements.insert(
251  boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)));
252  int num_nodes;
253  const EntityHandle *conn;
254  CHKERR moab.get_connectivity(prism, conn, num_nodes, true);
255  Range face_side3, face_side4;
256  CHKERR moab.get_adjacencies(conn, 3, 2, false, face_side3);
257  CHKERR moab.get_adjacencies(&conn[3], 3, 2, false, face_side4);
258  if (face_side3.size() != 1)
259  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
260  "prism don't have side face 3");
261  if (face_side4.size() != 1)
262  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
263  "prims don't have side face 4");
264  p.first->get()->getSideNumberPtr(*face_side3.begin());
265  p.first->get()->getSideNumberPtr(*face_side4.begin());
266  }
268 }
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:243
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:244
#define CHKERR
Inline error check.
Definition: definitions.h:610
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:224
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ build_adjacencies() [1/3]

MoFEMErrorCode MoFEM::Core::build_adjacencies ( const Range &  ents,
int  verb = -1 
)
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 857 of file FECore.cpp.

857  {
859  if (verb == -1)
860  verb = verbose;
861  if (!((*buildMoFEM) & BUILD_FIELD))
862  SETERRQ(cOmm, MOFEM_NOT_FOUND, "field not build");
863  if (!((*buildMoFEM) & BUILD_FE))
864  SETERRQ(cOmm, MOFEM_NOT_FOUND, "fe not build");
865  for (Range::const_pair_iterator peit = ents.pair_begin();
866  peit != ents.pair_end();++peit) {
867  EntFiniteElement_multiIndex::index<Ent_mi_tag>::type::iterator fit, hi_fit;
868  fit = entsFiniteElements.get<Ent_mi_tag>().lower_bound(peit->first);
869  hi_fit = entsFiniteElements.get<Ent_mi_tag>().upper_bound(peit->second);
870  for (; fit != hi_fit; ++fit) {
871  if ((*fit)->getBitFieldIdRow().none() &&
872  (*fit)->getBitFieldIdCol().none() &&
873  (*fit)->getBitFieldIdData().none())
874  continue;
875  int by = BYROW;
876  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol())
877  by |= BYCOL;
878  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData())
879  by |= BYDATA;
880  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_row(by);
881  UId ent_uid = UId(0);
882  for (DofEntity_multiIndex_uid_view::iterator rvit =
883  (*fit)->row_dof_view->begin();
884  rvit != (*fit)->row_dof_view->end(); ++rvit) {
885  if (ent_uid == (*rvit)->getFieldEntityPtr()->getGlobalUniqueId())
886  continue;
887  ent_uid = (*rvit)->getFieldEntityPtr()->getGlobalUniqueId();
888  std::pair<FieldEntityEntFiniteElementAdjacencyMap_multiIndex::iterator,
889  bool>
890  p;
891  p = entFEAdjacencies.insert(FieldEntityEntFiniteElementAdjacencyMap(
892  (*rvit)->getFieldEntityPtr(), *fit));
893  bool success = entFEAdjacencies.modify(p.first, modify_row);
894  if (!success)
896  "modification unsuccessful");
897  }
898  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdCol()) {
899  int by = BYCOL;
900  if ((*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData())
901  by |= BYDATA;
902  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_col(by);
903  ent_uid = UId(0);
904  for (DofEntity_multiIndex_uid_view::iterator cvit =
905  (*fit)->col_dof_view->begin();
906  cvit != (*fit)->col_dof_view->end(); cvit++) {
907  if (ent_uid == (*cvit)->getFieldEntityPtr()->getGlobalUniqueId())
908  continue;
909  ent_uid = (*cvit)->getFieldEntityPtr()->getGlobalUniqueId();
910  std::pair<
911  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::iterator,
912  bool>
913  p;
914  p = entFEAdjacencies.insert(FieldEntityEntFiniteElementAdjacencyMap(
915  (*cvit)->getFieldEntityPtr(), *fit));
916  bool success = entFEAdjacencies.modify(p.first, modify_col);
917  if (!success)
919  "modification unsuccessful");
920  }
921  }
922  if ((*fit)->getBitFieldIdRow() != (*fit)->getBitFieldIdData() ||
923  (*fit)->getBitFieldIdCol() != (*fit)->getBitFieldIdData()) {
924  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_data(
925  BYDATA);
926  ent_uid = UId(0);
927  for (FEDofEntity_multiIndex::iterator dvit = (*fit)->data_dofs->begin();
928  dvit != (*fit)->data_dofs->end(); dvit++) {
929  if (ent_uid == (*dvit)->getFieldEntityPtr()->getGlobalUniqueId())
930  continue;
931  ent_uid = (*dvit)->getFieldEntityPtr()->getGlobalUniqueId();
932  std::pair<
933  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::iterator,
934  bool>
935  p;
936  p = entFEAdjacencies.insert(FieldEntityEntFiniteElementAdjacencyMap(
937  (*dvit)->getFieldEntityPtr(), *fit));
938  bool success = entFEAdjacencies.modify(p.first, modify_data);
939  if (!success)
941  "modification unsuccessful");
942  }
943  }
944  }
945  }
946  if (verbose > 1) {
948  }
949  if (verbose > 0) {
950  PetscSynchronizedPrintf(cOmm, "Nb. entFEAdjacencies %u\n",
951  entFEAdjacencies.size());
952  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
953  }
954  *buildMoFEM |= 1 << 2;
956 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
uint128_t UId
Unique Id.
Definition: Common.hpp:136
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:254
int verbose
Verbosity level.
Definition: Core.hpp:830
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:251
MoFEMErrorCode list_adjacencies() const
list adjacencies
Definition: FieldCore.cpp:1007

◆ build_adjacencies() [2/3]

MoFEMErrorCode MoFEM::Core::build_adjacencies ( const BitRefLevel bit,
int  verb = -1 
)
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 970 of file FECore.cpp.

970  {
972  if (verb == -1)
973  verb = verbose;
974  CHKERR build_adjacencies(bit, BitRefLevel().set(), verb);
975 
977 }
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=-1)
build adjacencies
Definition: FECore.cpp:857
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ build_adjacencies() [3/3]

MoFEMErrorCode MoFEM::Core::build_adjacencies ( const BitRefLevel bit,
const BitRefLevel mask,
int  verb = -1 
)
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 958 of file FECore.cpp.

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

◆ build_fields()

MoFEMErrorCode MoFEM::Core::build_fields ( int  verb = -1)
protectedvirtual

build fields

Implements MoFEM::CoreInterface.

Definition at line 886 of file FieldCore.cpp.

886  {
888  if (verb == -1)
889  verb = verbose;
890  typedef Field_multiIndex::index<BitFieldId_mi_tag>::type FieldSetById;
891  FieldSetById &set_id = fIelds.get<BitFieldId_mi_tag>();
892  FieldSetById::iterator miit = set_id.begin();
893  for (; miit != set_id.end(); miit++) {
894  std::map<EntityType, int> dof_counter;
895  std::map<EntityType, int> inactive_dof_counter;
896  if (verb > 0) {
897  PetscSynchronizedPrintf(cOmm, "Build Field %s (rank %d)\n",
898  (*miit)->getName().c_str(), rAnk);
899  }
900  switch ((*miit)->getSpace()) {
901  case NOFIELD:
902  ierr = buildFieldForNoField((*miit)->getId(), dof_counter, verb);
903  CHKERRG(ierr);
904  break;
905  case L2:
906  case H1:
907  case HCURL:
908  case HDIV:
909  ierr = buildFieldForL2H1HcurlHdiv((*miit)->getId(), dof_counter,
910  inactive_dof_counter, verb);
911  CHKERRG(ierr);
912  break;
913  default:
914  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
915  }
916  if (verb > 0) {
917  int nb_added_dofs = 0;
918  int nb_inactive_added_dofs = 0;
919  for (std::map<EntityType, int>::iterator it = dof_counter.begin();
920  it != dof_counter.end(); it++) {
921  switch (it->first) {
922  case MBVERTEX:
923  PetscSynchronizedPrintf(cOmm,
924  "nb added dofs (vertices) %d (inactive %d)\n",
925  it->second, inactive_dof_counter[it->first]);
926  break;
927  case MBEDGE:
928  PetscSynchronizedPrintf(cOmm,
929  "nb added dofs (edges) %d (inactive %d)\n",
930  it->second, inactive_dof_counter[it->first]);
931  break;
932  case MBTRI:
933  PetscSynchronizedPrintf(
934  cOmm, "nb added dofs (triangles) %d (inactive %d)\n", it->second,
935  inactive_dof_counter[it->first]);
936  break;
937  case MBQUAD:
938  PetscSynchronizedPrintf(cOmm,
939  "nb added dofs (quads) %d (inactive %d)\n",
940  it->second, inactive_dof_counter[it->first]);
941  break;
942  case MBTET:
943  PetscSynchronizedPrintf(cOmm,
944  "nb added dofs (tets) %d (inactive %d)\n",
945  it->second, inactive_dof_counter[it->first]);
946  break;
947  case MBPRISM:
948  PetscSynchronizedPrintf(cOmm,
949  "nb added dofs (prisms) %d (inactive %d)\n",
950  it->second, inactive_dof_counter[it->first]);
951  break;
952  case MBENTITYSET:
953  PetscSynchronizedPrintf(cOmm,
954  "nb added dofs (meshsets) %d (inactive %d)\n",
955  it->second, inactive_dof_counter[it->first]);
956  break;
957  default:
958  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
959  }
960  nb_added_dofs += it->second;
961  nb_inactive_added_dofs += inactive_dof_counter[it->first];
962  }
963  if (verbose > 0) {
964  PetscSynchronizedPrintf(
965  cOmm, "nb added dofs %d (number of inactive dofs %d)\n",
966  nb_added_dofs, nb_inactive_added_dofs);
967  }
968  }
969  }
970  *buildMoFEM = 1 << 0;
971  if (verb > 0) {
972  PetscSynchronizedPrintf(cOmm, "Nb. dofs %u\n", dofsField.size());
973  }
974  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
976  // return 0;
977 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:248
field with continuous normal traction
Definition: definitions.h:178
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
scalar or vector of scalars describe (no true field)
Definition: definitions.h:175
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:558
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:810
MoFEMErrorCode buildFieldForNoField(const BitFieldId id, std::map< EntityType, int > &dof_counter, int verb=-1)
Definition: FieldCore.cpp:674
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
field with continuous tangents
Definition: definitions.h:177
Field_multiIndex fIelds
fields
Definition: Core.hpp:246
MoFEMErrorCode buildFieldForL2H1HcurlHdiv(const BitFieldId id, std::map< EntityType, int > &dof_counter, std::map< EntityType, int > &inactive_dof_counter, int verb=-1)
Definition: FieldCore.cpp:769
int verbose
Verbosity level.
Definition: Core.hpp:830
continuous field
Definition: definitions.h:176
field with C-1 continuity
Definition: definitions.h:179

◆ build_finite_elements() [1/3]

MoFEMErrorCode MoFEM::Core::build_finite_elements ( int  verb = -1)
protectedvirtual

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

Parameters
verbVerbosity level
Returns
Error code

Implements MoFEM::CoreInterface.

Definition at line 774 of file FECore.cpp.

774  {
776  if (verb == -1)
777  verb = verbose;
778 
779  FiniteElement_multiIndex::iterator fe_miit = finiteElements.begin();
780 
781  // loop Finite Elements
782  for (; fe_miit != finiteElements.end(); fe_miit++) {
783  if (verb > 0)
784  PetscPrintf(cOmm, "Build Finite Elements %s\n",
785  (*fe_miit)->getName().c_str());
786  CHKERR buildFiniteElements(*fe_miit, NULL, verb);
787  }
788 
789  if (verb > 0) {
790  PetscSynchronizedPrintf(cOmm, "Nb. FEs %u\n", entsFiniteElements.size());
791  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
792  typedef EntFiniteElement_multiIndex::index<BitFEId_mi_tag>::type
793  FiniteElementById;
794  FiniteElementById &finite_elements_by_id =
795  entsFiniteElements.get<BitFEId_mi_tag>();
796  FiniteElement_multiIndex::iterator fe_id_it = finiteElements.begin();
797  for (; fe_id_it != finiteElements.end(); fe_id_it++) {
798  FiniteElementById::iterator miit =
799  finite_elements_by_id.lower_bound((*fe_id_it)->getId());
800  FiniteElementById::iterator hi_miit =
801  finite_elements_by_id.upper_bound((*fe_id_it)->getId());
802  int count = distance(miit, hi_miit);
803  std::ostringstream ss;
804  ss << *(*fe_id_it) << " Nb. FEs " << count << std::endl;
805  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
806  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
807  }
808  }
809 
810  *buildMoFEM |= 1 << 1;
812 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:250
#define CHKERR
Inline error check.
Definition: definitions.h:610
MoFEMErrorCode buildFiniteElements(const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=-1)
Definition: FECore.cpp:538
int verbose
Verbosity level.
Definition: Core.hpp:830
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:251

◆ build_finite_elements() [2/3]

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

Definition at line 814 of file FECore.cpp.

814  {
816  SETERRQ(cOmm, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
818 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521

◆ build_finite_elements() [3/3]

MoFEMErrorCode MoFEM::Core::build_finite_elements ( const string  fe_name,
const Range *  ents_ptr = NULL,
int  verb = -1 
)
protectedvirtual

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

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

Implements MoFEM::CoreInterface.

Definition at line 820 of file FECore.cpp.

821  {
823  if (verb == -1)
824  verb = verbose;
825 
826  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator
827  fe_miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
828  if (fe_miit == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
829  SETERRQ1(cOmm, MOFEM_NOT_FOUND, "Finite element <%s> not found",
830  fe_name.c_str());
831  }
832 
833  if (verb >= VERBOSE)
834  PetscPrintf(cOmm, "Build Finite Elements %s\n", fe_name.c_str());
835  CHKERR buildFiniteElements(*fe_miit, ents_ptr, verb);
836 
837  if (verb >= VERBOSE) {
838  typedef EntFiniteElement_multiIndex::index<BitFEId_mi_tag>::type
839  FiniteElementById;
840  FiniteElementById &finite_elements_by_id =
841  entsFiniteElements.get<BitFEId_mi_tag>();
842  FiniteElementById::iterator miit =
843  finite_elements_by_id.lower_bound((*fe_miit)->getId());
844  FiniteElementById::iterator hi_miit =
845  finite_elements_by_id.upper_bound((*fe_miit)->getId());
846  int count = distance(miit, hi_miit);
847  std::ostringstream ss;
848  ss << *(*fe_miit) << " Nb. FEs " << count << std::endl;
849  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
850  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
851  }
852 
853  *buildMoFEM |= 1 << 1;
855 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:250
#define CHKERR
Inline error check.
Definition: definitions.h:610
MoFEMErrorCode buildFiniteElements(const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=-1)
Definition: FECore.cpp:538
int verbose
Verbosity level.
Definition: Core.hpp:830
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:251

◆ build_problem_on_distributed_mesh()

MoFEMErrorCode MoFEM::Core::build_problem_on_distributed_mesh ( int  verb = -1)
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 230 of file ProblemsCore.cpp.

230  {
232  if (verb == -1)
233  verb = verbose;
234  DofEntity_multiIndex_active_view dofs_rows, dofs_cols;
235  Problem_multiIndex::iterator p_miit = pRoblems.begin();
236  for (; p_miit != pRoblems.end(); p_miit++) {
237  ierr = getInterface<ProblemsManager>()->buildProblemOnDistributedMesh(
238  const_cast<Problem *>(&*p_miit), verb);
239  CHKERRG(ierr);
240  }
242 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:558
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:256
int verbose
Verbosity level.
Definition: Core.hpp:830
multi_index_container< boost::shared_ptr< DofEntity >, indexed_by< ordered_unique< const_mem_fun< DofEntity, UId, &DofEntity::getGlobalUniqueId > >, ordered_non_unique< const_mem_fun< DofEntity, char, &DofEntity::getActive > > > > DofEntity_multiIndex_active_view
multi-index view on DofEntity activity

◆ build_problems()

MoFEMErrorCode MoFEM::Core::build_problems ( int  verb = -1)
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 292 of file ProblemsCore.cpp.

292  {
294  if (verb == -1)
295  verb = verbose;
296  if (!((*buildMoFEM) & BUILD_FIELD))
297  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "fields not build");
298  if (!((*buildMoFEM) & BUILD_FE))
299  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "FEs not build");
300  if (!((*buildMoFEM) & BUILD_ADJ))
301  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "adjacencies not build");
302  // iterate problems
303  Problem_multiIndex::iterator p_miit = pRoblems.begin();
304  for (; p_miit != pRoblems.end(); p_miit++) {
305  Problem *problem_ptr = const_cast<Problem *>(&*p_miit);
306  ierr = build_problem(problem_ptr, false, verb);
307  CHKERRG(ierr);
308  }
311 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:558
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:841
DEPRECATED MoFEMErrorCode build_problem(const std::string &name, const bool square_matrix, int verb=-1)
build problem data structures
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:256
int verbose
Verbosity level.
Definition: Core.hpp:830

◆ buildFieldForL2H1HcurlHdiv()

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

Definition at line 769 of file FieldCore.cpp.

771  {
773  if (verb == -1)
774  verb = verbose;
775 
776  // Field by ID
777  typedef Field_multiIndex::index<BitFieldId_mi_tag>::type FieldSetById;
778 
779  // Find field
780  const FieldSetById &set_id = fIelds.get<BitFieldId_mi_tag>();
781  FieldSetById::iterator field_it = set_id.find(id);
782  if (field_it == set_id.end()) {
783  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Field not found");
784  }
785  const int rank = field_it->get()->getNbOfCoeffs();
786  const boost::string_ref &field_name = field_it->get()->getNameRef();
787 
788  // Ents in the field meshset
789  Range ents_of_id_meshset;
790  CHKERR moab.get_entities_by_handle((*field_it)->meshSet, ents_of_id_meshset,
791  false);
792  if (verb > VERY_NOISY) {
793  PetscSynchronizedPrintf(PETSC_COMM_SELF, "Ents in field %s meshset %d\n",
794  (*field_it)->getName().c_str(),
795  ents_of_id_meshset.size());
796  }
797 
798  for (Range::pair_iterator p_eit = ents_of_id_meshset.pair_begin();
799  p_eit != ents_of_id_meshset.pair_end(); ++p_eit) {
800 
801  const EntityHandle first = p_eit->first;
802  const EntityHandle second = p_eit->second;
803 
804  typedef FieldEntity_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type
805  FieldEntByNameAndEnt;
806  FieldEntByNameAndEnt::iterator feit, hi_feit;
807  feit = entsFields.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
808  boost::make_tuple(field_name, first));
809  if (feit == entsFields.get<Composite_Name_And_Ent_mi_tag>().end())
810  continue;
811  hi_feit = entsFields.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
812  boost::make_tuple(field_name, second));
813 
814  // If there are DOFs in that range is more pragmatic to remove them rather
815  // than to find sub-ranges or make them inactive
816  typedef DofEntity_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type
817  DofByNameEnt;
818  DofByNameEnt::iterator dit, hi_dit;
819  dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
820  boost::make_tuple(field_name, first));
821  hi_dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
822  boost::make_tuple(field_name, second));
823  dofsField.get<Composite_Name_And_Ent_mi_tag>().erase(dit,hi_dit);
824 
825  // Add vertices DOFs by bulk
826  boost::shared_ptr<std::vector<DofEntity> > dofs_array =
827  boost::make_shared<std::vector<DofEntity> >(std::vector<DofEntity>());
828  // Add Sequence of DOFs to sequence container as weak_ptr
829  std::vector<boost::shared_ptr<DofEntity> > dofs_shared_array;
830  int nb_dofs_on_ents = 0;
831  for (FieldEntByNameAndEnt::iterator tmp_feit = feit; tmp_feit != hi_feit;
832  ++tmp_feit) {
833  nb_dofs_on_ents += rank * tmp_feit->get()->getOrderNbDofs(
834  tmp_feit->get()->getMaxOrder());
835  }
836  // Add Sequence of DOFs to sequence container as weak_ptr
837  dofs_array->reserve(nb_dofs_on_ents);
838  dofs_shared_array.reserve(dofs_array->size());
839  for (; feit != hi_feit; ++feit) {
840  // Create dofs instances and shared pointers
841  int DD = 0;
842  // Loop orders (loop until max entity order is set)
843  for (int oo = 0; oo <= feit->get()->getMaxOrder(); ++oo) {
844  // Loop nb. dofs at order oo
845  for (int dd = 0; dd < feit->get()->getOrderNbDofsDiff(oo); ++dd) {
846  // Loop rank
847  for (int rr = 0; rr < rank; ++rr, ++DD) {
848  dofs_array->push_back(DofEntity(*feit, oo, rr, DD, true));
849  dofs_shared_array.push_back(
850  boost::shared_ptr<DofEntity>(dofs_array, &dofs_array->back()));
851  ++dof_counter[feit->get()->getEntType()];
852  }
853  }
854  }
855  if (DD > feit->get()->getNbDofsOnEnt()) {
856  std::ostringstream ss;
857  ss << "rank " << rAnk << " ";
858  ss << **feit << std::endl;
859  SETERRQ3(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
860  "Expected number of DOFs on entity not equal to number added "
861  "to database (DD = %d != %d = "
862  "feit->get()->getNbDofsOnEnt())\n"
863  "%s",
864  DD, feit->get()->getNbDofsOnEnt(), ss.str().c_str());
865  }
866  }
867  // Insert into Multi-Index container
868  int dofs_field_size0 = dofsField.size();
869  dofsField.insert(dofs_shared_array.begin(), dofs_shared_array.end());
870  field_it->get()->getDofSequenceContainer()->push_back(dofs_array);
871  if (dofs_array.use_count() != 2 * dofs_shared_array.size() + 1) {
872  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
873  "Wrong use count %d != %d", dofs_array.use_count(),
874  2 * dofs_shared_array.size() + 1);
875  }
876  if (dofs_field_size0 + dofs_shared_array.size() != dofsField.size()) {
877  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
878  "Wrong number of inserted DOFs %d != %d",
879  dofs_shared_array.size(), dofsField.size() - dofs_field_size0);
880  }
881 
882  }
884 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:248
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:247
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:810
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:28
#define CHKERR
Inline error check.
Definition: definitions.h:610
Field_multiIndex fIelds
fields
Definition: Core.hpp:246
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ buildFieldForNoField()

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

Definition at line 674 of file FieldCore.cpp.

675  {
677  if (verb == -1)
678  verb = verbose;
679  // field it
680  typedef Field_multiIndex::index<BitFieldId_mi_tag>::type FieldSetById;
681  const FieldSetById &set_id = fIelds.get<BitFieldId_mi_tag>();
682  // find fiels
683  FieldSetById::iterator miit = set_id.find(id);
684  if (miit == set_id.end()) {
685  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "field not found");
686  }
687 
688  // ents in the field meshset
689  Range ents_of_id_meshset;
690  rval =
691  moab.get_entities_by_handle((*miit)->meshSet, ents_of_id_meshset, false);
693  if (verb > 5) {
694  PetscSynchronizedPrintf(cOmm, "ents in field %s meshset %d\n",
695  (*miit)->getName().c_str(),
696  ents_of_id_meshset.size());
697  }
698  for (Range::iterator eit = ents_of_id_meshset.begin();
699  eit != ents_of_id_meshset.end(); eit++) {
700  // serch if field meshset is in database
701  RefEntity_multiIndex::index<Ent_mi_tag>::type::iterator miit_ref_ent;
702  miit_ref_ent = refinedEntities.get<Ent_mi_tag>().find(*eit);
703  if (miit_ref_ent == refinedEntities.get<Ent_mi_tag>().end()) {
704  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
705  "Entity is not in MoFEM database, entities in field meshset need "
706  "to be seeded (i.e. bit ref level add to them)");
707  }
708  std::pair<FieldEntity_multiIndex::iterator, bool> e_miit;
709  try {
710  // create database entity
711  e_miit = entsFields.insert(
712  boost::make_shared<FieldEntity>(*miit, *miit_ref_ent));
713  } catch (MoFEMException const &e) {
714  SETERRQ(PETSC_COMM_SELF, e.errorCode, e.errorMessage);
715  } catch (const std::exception &ex) {
716  std::ostringstream ss;
717  ss << ex.what() << std::endl;
718  SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, ss.str().c_str());
719  }
720  // this is nor real field in space (set order to zero)
721  bool success = entsFields.modify(e_miit.first, FieldEntity_change_order(0));
722  if (!success)
723  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
724  "modification unsuccessful");
725  FieldCoefficientsNumber rank = 0;
726  // create dofs on this entity (nb. of dofs is equal to rank)
727  for (; rank < (*e_miit.first)->getNbOfCoeffs(); rank++) {
728  std::pair<DofEntity_multiIndex::iterator, bool> d_miit;
729  // check if dof is in darabase
730  d_miit.first = dofsField.project<0>(dofsField.get<Unique_mi_tag>().find(
731  DofEntity::getGlobalUniqueIdCalculate(rank, *(e_miit.first))));
732  // if dof is not in database
733  if (d_miit.first == dofsField.end()) {
734  // insert dof
735  d_miit = dofsField.insert(
736  boost::make_shared<DofEntity>(*(e_miit.first), 0, rank, rank));
737  if (d_miit.second) {
738  dof_counter[MBENTITYSET]++; // Count entities in the meshset
739  }
740  bool success =
741  dofsField.modify(d_miit.first, DofEntity_active_change(true));
742  if (!success)
743  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
744  "modification unsuccessful");
745  }
746  // check consistency
747  assert((*d_miit.first)->getEntType() == (*e_miit.first)->getEntType());
748  assert((*d_miit.first)->getId() == (*e_miit.first)->getId());
749  assert((*d_miit.first)->getMaxOrder() == 0);
750  }
751  }
752  if (verb > 2) {
753  typedef DofEntity_multiIndex::index<FieldName_mi_tag>::type DofsByName;
754  DofsByName &set = dofsField.get<FieldName_mi_tag>();
755  DofsByName::iterator miit2 = set.lower_bound(miit->get()->getNameRef());
756  DofsByName::iterator hi_miit2 = set.upper_bound(miit->get()->getNameRef());
757  assert(miit2 != hi_miit2);
758  for (; miit2 != hi_miit2; miit2++) {
759  std::ostringstream ss;
760  ss << *miit2 << std::endl;
761  ;
762  PetscSynchronizedPrintf(cOmm, ss.str().c_str());
763  }
764  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
765  }
767 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:529
int FieldCoefficientsNumber
Number of field coefficients.
Definition: Common.hpp:132
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:248
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:243
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:247
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
Field_multiIndex fIelds
fields
Definition: Core.hpp:246
int verbose
Verbosity level.
Definition: Core.hpp:830
static UId getGlobalUniqueIdCalculate(const DofIdx dof, const boost::shared_ptr< FieldEntity > &ent_ptr)
Calculate UId for DOF.

◆ buildFiniteElements()

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

Definition at line 538 of file FECore.cpp.

539  {
541  if (verb == -1)
542  verb = verbose;
543 
544  typedef RefElement_multiIndex::index<Ent_mi_tag>::type RefFiniteElementByEnt;
545  typedef Field_multiIndex::index<BitFieldId_mi_tag>::type FieldById;
546  FieldById &fields_by_id = fIelds.get<BitFieldId_mi_tag>();
547 
548  // get id of mofem fields for row, col and data
549  enum IntLoop { ROW = 0, COL, DATA, LAST };
550  BitFieldId fe_fields[LAST] = {fe.get()->getBitFieldIdRow(),
551  fe.get()->getBitFieldIdCol(),
552  fe.get()->getBitFieldIdData()};
553 
554  // get finite element meshset
555  EntityHandle meshset = get_finite_element_meshset(fe.get()->getId());
556  // get entities from finite element meshset // if meshset
557  Range fe_ents;
558  CHKERR moab.get_entities_by_handle(meshset, fe_ents, false);
559 
560  if (ents_ptr)
561  fe_ents = intersect(fe_ents, *ents_ptr);
562 
563  // map entity uid to pointers
564  typedef std::vector<boost::weak_ptr<EntFiniteElement> > VecOfWeakFEPtrs;
565  typedef std::pair<const UId *, VecOfWeakFEPtrs> EntUIdAndVecOfWeakFEPtrs;
566  typedef multi_index_container<
567  EntUIdAndVecOfWeakFEPtrs,
568  indexed_by<sequenced<>, hashed_non_unique<
569  member<EntUIdAndVecOfWeakFEPtrs, const UId *,
570  &EntUIdAndVecOfWeakFEPtrs::first> > > >
571  EntUIdAndVecOfWeakFEPtrs_multi_index;
572  EntUIdAndVecOfWeakFEPtrs_multi_index entUIdAndFEVec;
573 
574  std::map<EntityHandle, int> data_dofs_size;
575 
576  // loop meshset Ents and add finite elements
577  for (Range::const_pair_iterator peit = fe_ents.const_pair_begin();
578  peit != fe_ents.const_pair_end(); peit++) {
579 
580  EntityHandle first = peit->first;
581  EntityHandle second = peit->second;
582 
583  // note: iterator is a wrapper
584  // check if is in refinedFiniteElements database
585  RefFiniteElementByEnt::iterator ref_fe_miit, hi_ref_fe_miit;
586  ref_fe_miit = refinedFiniteElements.get<Ent_mi_tag>().lower_bound(first);
587  if (ref_fe_miit == refinedFiniteElements.get<Ent_mi_tag>().end()) {
588  std::ostringstream ss;
589  ss << "refinedFiniteElements not in database ent = " << first;
590  ss << " type " << moab.type_from_handle(first);
591  ss << " " << *fe;
592  SETERRQ(cOmm, MOFEM_DATA_INCONSISTENCY, ss.str().c_str());
593  }
594  hi_ref_fe_miit =
595  refinedFiniteElements.get<Ent_mi_tag>().upper_bound(second);
596 
597  for (; ref_fe_miit != hi_ref_fe_miit; ref_fe_miit++) {
598 
599  std::pair<EntFiniteElement_multiIndex::iterator, bool> p =
600  entsFiniteElements.insert(boost::make_shared<EntFiniteElement>(
601  *ref_fe_miit, fe));
602 
603  if (fe_fields[ROW] == fe_fields[COL]) {
604  p.first->get()->col_dof_view = p.first->get()->row_dof_view;
605  } else if (p.first->get()->col_dof_view == p.first->get()->row_dof_view) {
606  p.first->get()->col_dof_view =
607  boost::make_shared<DofEntity_multiIndex_uid_view>();
608  }
609 
610  p.first->get()->row_dof_view->clear();
611  p.first->get()->col_dof_view->clear();
612  p.first->get()->data_dofs->clear();
613 
614  for (unsigned int ii = 0; ii < BitFieldId().size(); ii++) {
615 
616  // Common field id for ROW, COL and DATA
617  BitFieldId id_common = 0;
618  // Check if the field (ii) is added to finite element
619  for (int ss = 0; ss < LAST; ss++) {
620  id_common |= fe_fields[ss] & BitFieldId().set(ii);
621  }
622  if (id_common.none())
623  continue;
624 
625  // Find in database data associated with the field (ii)
626  const BitFieldId field_id = BitFieldId().set(ii);
627  FieldById::iterator miit = fields_by_id.find(field_id);
628  if (miit == fields_by_id.end()) {
629  SETERRQ(cOmm, MOFEM_DATA_INCONSISTENCY, "Data inconsistency");
630  }
631 
632  // Entities adjacent to entities
633  Range adj_ents;
634 
635  // Resolve entities on element, those entities are used to build tag
636  // with dof uids on finite element tag
637  CHKERR p.first->get()->getElementAdjacency(*miit, adj_ents);
638 
639  // Loop over adjacencies of element and find field entities on those
640  // adjacencies, that create hash map map_uid_fe which is used later
641  const std::string field_name = miit->get()->getName();
642  const bool add_to_data =
643  (field_id & p.first->get()->getBitFieldIdData()).any();
644  FieldEntity_multiIndex::index<
645  Composite_Name_And_Ent_mi_tag>::type::iterator meit,hi_meit;
646  for (Range::pair_iterator p_eit = adj_ents.pair_begin();
647  p_eit != adj_ents.pair_end(); ++p_eit) {
648  const EntityHandle first = p_eit->first;
649  const EntityHandle second = p_eit->second;
650  meit = entsFields.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
651  boost::make_tuple(field_name, first));
652  if (meit == entsFields.get<Composite_Name_And_Ent_mi_tag>().end()) {
653  continue;
654  }
655  hi_meit = entsFields.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
656  boost::make_tuple(field_name, second));
657  for(;meit!=hi_meit;++meit) {
658  const UId *uid_ptr = &(meit->get()->getGlobalUniqueId());
659  EntUIdAndVecOfWeakFEPtrs_multi_index::nth_index<1>::type::iterator
660  e_uid_vec_fe_it;
661  e_uid_vec_fe_it = entUIdAndFEVec.get<1>().find(uid_ptr);
662  if (e_uid_vec_fe_it == entUIdAndFEVec.get<1>().end()) {
663  entUIdAndFEVec.insert(entUIdAndFEVec.end(),
664  std::pair<const UId *, VecOfWeakFEPtrs>(
665  uid_ptr, VecOfWeakFEPtrs(1, *p.first)));
666  } else {
667  const VecOfWeakFEPtrs &vec_fe_ptrs = e_uid_vec_fe_it->second;
668  const_cast<VecOfWeakFEPtrs &>(vec_fe_ptrs).push_back(*p.first);
669  }
670 
671  if (add_to_data) {
672  data_dofs_size[p.first->get()->getEnt()] +=
673  meit->get()->getNbDofsOnEnt();
674  }
675  }
676  }
677  }
678  }
679  }
680 
681  // Reserve memory
682  std::map<EntityHandle, boost::shared_ptr<std::vector<FEDofEntity> > >
683  data_dofs_array;
684  for (std::map<EntityHandle, int>::iterator mit = data_dofs_size.begin();
685  mit != data_dofs_size.end(); mit++) {
686  if (mit->second > 0) {
687  data_dofs_array[mit->first] =
688  boost::make_shared<std::vector<FEDofEntity> >();
689  data_dofs_array[mit->first]->reserve(mit->second);
690  }
691  }
692 
693  // Vector of (aliased) shared pointers
694  std::vector<boost::shared_ptr<FEDofEntity> > data_dofs_shared_array;
695 
696  typedef DofEntity_multiIndex::index<Unique_Ent_mi_tag>::type DofsByEntUId;
697  DofsByEntUId &dofs_by_ent_uid = dofsField.get<Unique_Ent_mi_tag>();
698 
699  // Loop over hash map, which has all entities on given elemnts
700  boost::shared_ptr<SideNumber> side_number_ptr;
701  for (EntUIdAndVecOfWeakFEPtrs_multi_index::iterator mit = entUIdAndFEVec.begin();
702  mit != entUIdAndFEVec.end(); mit++) {
703  DofsByEntUId::iterator dit, hi_dit;
704  dit = dofs_by_ent_uid.lower_bound(*mit->first);
705  hi_dit = dofs_by_ent_uid.upper_bound(*mit->first);
706  for (; dit != hi_dit; dit++) {
707  // cerr << mit->first << endl;
708  // cerr << **dit << endl;
709  // if(PetscUnlikely(!(*dit))) {
710  // SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
711  // "Null pointer to DOF");
712  // }
713  const BitFieldId field_id = dit->get()->getId();
714  const EntityHandle dof_ent = dit->get()->getEnt();
715  std::vector<boost::weak_ptr<EntFiniteElement> >::const_iterator fe_it,
716  hi_fe_it;
717  fe_it = mit->second.begin();
718  hi_fe_it = mit->second.end();
719  for (; fe_it != hi_fe_it; fe_it++) {
720 
721  // if rows and columns of finite element are the same, then
722  // we exploit that case
723  if ((field_id & fe_it->lock().get()->getBitFieldIdRow()).any()) {
724  fe_it->lock().get()->row_dof_view->insert(
725  fe_it->lock().get()->row_dof_view->end(), *dit);
726  }
727  if (fe_it->lock().get()->col_dof_view !=
728  fe_it->lock().get()->row_dof_view) {
729  if ((field_id & fe_it->lock().get()->getBitFieldIdCol()).any()) {
730  fe_it->lock().get()->col_dof_view->insert(
731  fe_it->lock().get()->col_dof_view->end(), *dit);
732  }
733  }
734 
735  // Add FEDofEntity, first create dofs, one by one, note that memory
736  // is already reserved. Then create shared pointers and finally add
737  // th_FEName to element multi-index
738  const EntityHandle fe_ent = fe_it->lock().get()->getEnt();
739  boost::shared_ptr<std::vector<FEDofEntity> > &data_dofs_array_vec =
740  data_dofs_array[fe_ent];
741  if (data_dofs_size[fe_ent] != 0 &&
742  (field_id & fe_it->lock().get()->getBitFieldIdData()).any()) {
743 
744  // There are data dofs on this element
745  side_number_ptr = fe_it->lock().get()->getSideNumberPtr(dof_ent);
746  data_dofs_array_vec->push_back(FEDofEntity(side_number_ptr, *dit));
747  if (data_dofs_array_vec->size() ==
748  (unsigned int)data_dofs_size[fe_ent]) {
749  // That means that FEDofEntity vector is full, and can be added to
750  // multi-index
751 
752  // Create shared pointers vector
753  data_dofs_shared_array.clear();
754  data_dofs_shared_array.reserve(data_dofs_size[fe_ent]);
755  for (std::vector<FEDofEntity>::iterator vit =
756  data_dofs_array_vec->begin();
757  vit != data_dofs_array_vec->end(); vit++) {
758  // Create aliased shared pointer
759  data_dofs_shared_array.push_back(
760  boost::shared_ptr<FEDofEntity>(data_dofs_array_vec, &(*vit)));
761  }
762  fe_it->lock().get()->data_dofs->insert(
763  data_dofs_shared_array.begin(), data_dofs_shared_array.end());
764  fe_it->lock().get()->getDofsSequence() = data_dofs_array_vec;
765  }
766  }
767  }
768  }
769  }
770 
772 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:248
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:279
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:806
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:247
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
std::bitset< BITFIELDID_SIZE > BitFieldId
Definition: Common.hpp:149
uint128_t UId
Unique Id.
Definition: Common.hpp:136
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:244
#define CHKERR
Inline error check.
Definition: definitions.h:610
Field_multiIndex fIelds
fields
Definition: Core.hpp:246
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:251

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

49  {
50  typedef Field_multiIndex::index<FieldName_mi_tag>::type FieldSetByName;
51  const FieldSetByName &set = fIelds.get<FieldName_mi_tag>();
52  FieldSetByName::iterator miit = set.find(name);
53  if (miit == set.end())
54  return false;
55  return true;
56 }
Field_multiIndex fIelds
fields
Definition: Core.hpp:246

◆ check_finite_element()

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

Check if finite element is in database.

Parameters
nameName of finite element
Returns
true if element is declared

Implements MoFEM::CoreInterface.

Definition at line 35 of file FECore.cpp.

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

◆ check_number_of_ents_in_ents_field() [1/2]

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

check data consistency in entitiesPtr

Implements MoFEM::CoreInterface.

Definition at line 1092 of file FieldCore.cpp.

1092  {
1094  Field_multiIndex::index<FieldName_mi_tag>::type::iterator it =
1095  fIelds.get<FieldName_mi_tag>().find(name);
1096  if (it == fIelds.get<FieldName_mi_tag>().end()) {
1097  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1098  "field not found < %s >", name.c_str());
1099  }
1100  EntityHandle meshset = (*it)->getMeshset();
1101 
1102  int num_entities;
1103 
1104  rval = moab.get_number_entities_by_handle(meshset, num_entities);
1105  CHKERRQ_MOAB(rval);
1106  if (entsFields.get<FieldName_mi_tag>().count((*it)->getName()) >
1107  (unsigned int)num_entities) {
1108  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1109  "not equal number of entities in meshset and field multiindex "
1110  "< %s >",
1111  name.c_str());
1112  }
1114 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:529
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:247
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
Field_multiIndex fIelds
fields
Definition: Core.hpp:246

◆ check_number_of_ents_in_ents_field() [2/2]

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

check data consistency in entitiesPtr

Implements MoFEM::CoreInterface.

Definition at line 1115 of file FieldCore.cpp.

1115  {
1117  Field_multiIndex::index<FieldName_mi_tag>::type::iterator it =
1118  fIelds.get<FieldName_mi_tag>().begin();
1119  for (; it != fIelds.get<FieldName_mi_tag>().end(); it++) {
1120  if ((*it)->getSpace() == NOFIELD)
1121  continue; // FIXME: should be treated properly, not test is just
1122  // skipped for this NOFIELD space
1123  EntityHandle meshset = (*it)->getMeshset();
1124 
1125  int num_entities;
1126  rval = moab.get_number_entities_by_handle(meshset, num_entities);
1127  CHKERRQ_MOAB(rval);
1128  if (entsFields.get<FieldName_mi_tag>().count((*it)->getName()) >
1129  (unsigned int)num_entities) {
1130  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1131  "not equal number of entities in meshset and field "
1132  "multiindex < %s >",
1133  (*it)->getName().c_str());
1134  }
1135  }
1137 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:529
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:247
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
scalar or vector of scalars describe (no true field)
Definition: definitions.h:175
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
Field_multiIndex fIelds
fields
Definition: Core.hpp:246

◆ check_number_of_ents_in_ents_finite_element() [1/2]

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

check data consistency in entsFiniteElements

Implements MoFEM::CoreInterface.

Definition at line 990 of file FECore.cpp.

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

◆ check_number_of_ents_in_ents_finite_element() [2/2]

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

check data consistency in entsFiniteElements

Implements MoFEM::CoreInterface.

Definition at line 1013 of file FECore.cpp.

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

◆ check_problem()

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

check if problem exist

Parameters
nameproblem name
Returns
true if problem is in database

Implements MoFEM::CoreInterface.

Definition at line 21 of file ProblemsCore.cpp.

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

◆ clear_adjacencies_entities() [1/3]

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

clear adjacency map for entities on given bit level

Parameters
bit
mask

Implements MoFEM::CoreInterface.

Definition at line 381 of file DeleteCore.cpp.

383  {
385  if (verb == -1)
386  verb = verbose;
387  Range ents;
388  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
391 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
MoFEMErrorCode clear_adjacencies_entities(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:381
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ clear_adjacencies_entities() [2/3]

MoFEMErrorCode MoFEM::Core::clear_adjacencies_entities ( const Range &  ents,
int  verb = -1 
)
protectedvirtual

clear adjacencies for field entities by entities

Implements MoFEM::CoreInterface.

Definition at line 393 of file DeleteCore.cpp.

393  {
395  if (verb == -1)
396  verb = verbose;
397  for (Range::const_pair_iterator p_eit = ents.pair_begin();
398  p_eit != ents.pair_end(); ++p_eit) {
399  const EntityHandle first = p_eit->first;
400  const EntityHandle second = p_eit->second;
401  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
402  Ent_mi_tag>::type::iterator ait,
403  hi_ait;
404  ait = entFEAdjacencies.get<Ent_mi_tag>().lower_bound(first);
405  hi_ait = entFEAdjacencies.get<Ent_mi_tag>().upper_bound(second);
406  entFEAdjacencies.get<Ent_mi_tag>().erase(ait, hi_ait);
407  }
409 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:254
int verbose
Verbosity level.
Definition: Core.hpp:830

◆ clear_adjacencies_entities() [3/3]

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

clear adjacencies for field entities by entities and field namd

Implements MoFEM::CoreInterface.

Definition at line 411 of file DeleteCore.cpp.

412  {
414  if (verb == -1)
415  verb = verbose;
416 
417  const Field *field_ptr = get_field_structure(name);
418  int field_bit_number = field_ptr->getBitNumber();
419  bool is_distributed_mesh = basicEntityDataPtr->trueIfDistributedMesh();
420  ParallelComm *pcomm =
421  ParallelComm::get_pcomm(&moab, basicEntityDataPtr->pcommID);
422 
423  for (Range::const_pair_iterator p_eit = ents.pair_begin();
424  p_eit != ents.pair_end(); p_eit++) {
425 
426  // First and last handle
427  const EntityHandle first = p_eit->first;
428  const EntityHandle second = p_eit->second;
429 
430  // Get owner proc and owner handle
431  int f_owner_proc;
432  EntityHandle f_moab_owner_handle;
433  CHKERR pcomm->get_owner_handle(first, f_owner_proc, f_moab_owner_handle);
434  int s_owner_proc;
435  EntityHandle s_moab_owner_handle;
436  CHKERR pcomm->get_owner_handle(second, s_owner_proc, s_moab_owner_handle);
437 
438  // Get UId
440  f_owner_proc, field_bit_number, f_moab_owner_handle,
441  is_distributed_mesh);
443  s_owner_proc, field_bit_number, s_moab_owner_handle,
444  is_distributed_mesh);
445 
446  // Find adjacencies
447  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
448  Unique_mi_tag>::type::iterator ait,
449  hi_ait;
450  ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound(first_uid);
451  hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound(second_uid);
452  entFEAdjacencies.get<Unique_mi_tag>().erase(ait, hi_ait);
453  }
455 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
UId getGlobalUniqueIdCalculate() const
Calculate global UId.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
const Field * get_field_structure(const std::string &name)
get field structure
Definition: FieldCore.cpp:58
uint128_t UId
Unique Id.
Definition: Common.hpp:136
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:254
#define CHKERR
Inline error check.
Definition: definitions.h:610
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:224
int verbose
Verbosity level.
Definition: Core.hpp:830

◆ clear_adjacencies_finite_elements() [1/3]

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

clear adjacency map for finite elements on given bit level

Parameters
bit
mask

Implements MoFEM::CoreInterface.

Definition at line 510 of file DeleteCore.cpp.

512  {
514  Range ents;
515  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
518 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
MoFEMErrorCode clear_adjacencies_finite_elements(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
clear adjacency map for finite elements on given bit level
Definition: DeleteCore.cpp:510
#define CHKERR
Inline error check.
Definition: definitions.h:610
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ clear_adjacencies_finite_elements() [2/3]

MoFEMErrorCode MoFEM::Core::clear_adjacencies_finite_elements ( const Range &  ents,
int  verb = -1 
)
protected

Definition at line 520 of file DeleteCore.cpp.

521  {
523  if (verb == -1)
524  verb = verbose;
525  for (Range::const_pair_iterator p_eit = ents.pair_begin();
526  p_eit != ents.pair_end(); p_eit++) {
527  EntityHandle first = p_eit->first;
528  EntityHandle second = p_eit->second;
529  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
530  FEEnt_mi_tag>::type::iterator ait,
531  hi_ait;
532  ait = entFEAdjacencies.get<FEEnt_mi_tag>().lower_bound(first);
533  hi_ait = entFEAdjacencies.get<FEEnt_mi_tag>().upper_bound(second);
534  entFEAdjacencies.get<FEEnt_mi_tag>().erase(ait, hi_ait);
535  }
537 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:254
int verbose
Verbosity level.
Definition: Core.hpp:830

◆ clear_adjacencies_finite_elements() [3/3]

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

Definition at line 539 of file DeleteCore.cpp.

541  {
543  if (verb == -1)
544  verb = verbose;
545 
546  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator
547  it_fe = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
548  if (it_fe != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
549 
550  const int fe_bit_number = it_fe->get()->getBitNumber();
551 
552  for (Range::const_pair_iterator p_eit = ents.pair_begin();
553  p_eit != ents.pair_end(); p_eit++) {
554 
555  // First and last handle
556  const EntityHandle first = p_eit->first;
557  const EntityHandle second = p_eit->second;
558 
559  // Get UId
560  UId first_uid =
561  EntFiniteElement::getGlobalUniqueIdCalculate(first, fe_bit_number);
562  UId second_uid =
563  EntFiniteElement::getGlobalUniqueIdCalculate(second, fe_bit_number);
564 
565  // Find and remove adjacencies
566  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
567  FE_Unique_mi_tag>::type::iterator ait,
568  hi_ait;
569  ait = entFEAdjacencies.get<FE_Unique_mi_tag>().lower_bound(first_uid);
570  hi_ait = entFEAdjacencies.get<FE_Unique_mi_tag>().upper_bound(second_uid);
571  entFEAdjacencies.get<FE_Unique_mi_tag>().erase(ait, hi_ait);
572  }
573  }
575 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
UId getGlobalUniqueIdCalculate() const
Generate UId for finite element entity.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
uint128_t UId
Unique Id.
Definition: Common.hpp:136
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:254
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:250
int verbose
Verbosity level.
Definition: Core.hpp:830

◆ clear_database()

MoFEMErrorCode MoFEM::Core::clear_database ( int  verb = -1)
protectedvirtual

Clear database.

Parameters
verbVerbosity level
Returns
Error code

Implements MoFEM::CoreInterface.

Definition at line 502 of file Core.cpp.

502  {
504  if (verb == -1)
505  verb = verbose;
506  CHKERR clearMap();
508 }
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:222
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ clear_dofs_fields() [1/2]

MoFEMErrorCode MoFEM::Core::clear_dofs_fields ( const Range &  ents,
int  verb = -1 
)
protectedvirtual

Clear dofs by ents

Implements MoFEM::CoreInterface.

Definition at line 78 of file DeleteCore.cpp.

78  {
80  if (verb == -1)
81  verb = verbose;
82 
83  for (Range::const_pair_iterator p_eit = ents.pair_begin();
84  p_eit != ents.pair_end(); p_eit++) {
85  EntityHandle first = p_eit->first;
86  EntityHandle second = p_eit->second;
87  // get dofs range
88  DofEntityByEnt::iterator dit, hi_dit;
89  dit = dofsField.get<Ent_mi_tag>().lower_bound(first);
90  if (dit == dofsField.get<Ent_mi_tag>().end())
91  continue;
92  hi_dit = dofsField.get<Ent_mi_tag>().upper_bound(second);
93  bool last_hi_dit;
94  if (hi_dit == dofsField.get<Ent_mi_tag>().end()) {
95  last_hi_dit = true;
96  } else {
97  last_hi_dit = false;
98  }
99 
100  // clear dofs in finite elements
101  // FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
102  // Ent_mi_tag>::type::iterator ait,
103  // hi_ait;
104  // ait = entFEAdjacencies.get<Ent_mi_tag>().lower_bound(first);
105  // hi_ait = entFEAdjacencies.get<Ent_mi_tag>().upper_bound(second);
106  // for (; ait != hi_ait; ++ait) {
107  // // Delete data dofs on element
108  // {
109  // FEDofEntity_multiIndex::iterator diit, hi_diit;
110  // diit = ait->entFePtr->data_dofs->lower_bound(
111  // dit->get()->getGlobalUniqueId());
112  // if (last_hi_dit) {
113  // hi_diit = ait->entFePtr->data_dofs->end();
114  // } else {
115  // hi_diit = ait->entFePtr->data_dofs->lower_bound(
116  // hi_dit->get()->getGlobalUniqueId());
117  // }
118  // ait->entFePtr->data_dofs->erase(diit, hi_diit);
119  // }
120  // // Delete dofs view on rows and columns on elements
121  // {
122  // DofEntity_multiIndex_uid_view::iterator diit, hi_diit;
123  // diit = ait->entFePtr->row_dof_view->lower_bound(
124  // dit->get()->getGlobalUniqueId());
125  // if (last_hi_dit) {
126  // hi_diit = ait->entFePtr->row_dof_view->end();
127  // } else {
128  // hi_diit = ait->entFePtr->row_dof_view->lower_bound(
129  // hi_dit->get()->getGlobalUniqueId());
130  // }
131  // ait->entFePtr->row_dof_view->erase(diit, hi_diit);
132  // if (ait->entFePtr->row_dof_view != ait->entFePtr->col_dof_view) {
133  // diit = ait->entFePtr->col_dof_view->lower_bound(
134  // dit->get()->getGlobalUniqueId());
135  // if (last_hi_dit) {
136  // hi_diit = ait->entFePtr->col_dof_view->end();
137  // } else {
138  // hi_diit = ait->entFePtr->col_dof_view->lower_bound(
139  // hi_dit->get()->getGlobalUniqueId());
140  // }
141  // ait->entFePtr->col_dof_view->erase(diit, hi_diit);
142  // }
143  // }
144  // }
145  // finally clear dofs
146  dofsField.get<Ent_mi_tag>().erase(dit,hi_dit);
147  }
149 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:248
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
int verbose
Verbosity level.
Definition: Core.hpp:830

◆ clear_dofs_fields() [2/2]

MoFEMErrorCode MoFEM::Core::clear_dofs_fields ( const std::string &  name,
const Range &  ents,
int  verb = -1 
)
protectedvirtual

Clear dofs by field name and ents

Implements MoFEM::CoreInterface.

Definition at line 151 of file DeleteCore.cpp.

152  {
154  if (verb == -1)
155  verb = verbose;
156 
157  // const Field *field_ptr = get_field_structure(name);
158  // int field_bit_number = field_ptr->getBitNumber();
159  // bool is_distributed_mesh = basicEntityDataPtr->trueIfDistributedMesh();
160  // ParallelComm *pcomm =
161  // ParallelComm::get_pcomm(&moab, basicEntityDataPtr->pcommID);
162 
163  for (Range::const_pair_iterator p_eit = ents.pair_begin();
164  p_eit != ents.pair_end(); p_eit++) {
165  EntityHandle first = p_eit->first;
166  EntityHandle second = p_eit->second;
167  DofEntityByNameAndEnt::iterator dit, hi_dit;
168  dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
169  boost::make_tuple(name, first));
170  hi_dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
171  boost::make_tuple(name, second));
172  // bool last_hi_dit;
173  // if (hi_dit == dofsField.get<Composite_Name_And_Ent_mi_tag>().end()) {
174  // last_hi_dit = true;
175  // } else {
176  // last_hi_dit = false;
177  // }
178 
179  // // Get owner proc and owner handle
180  // int f_owner_proc;
181  // EntityHandle f_moab_owner_handle;
182  // CHKERR pcomm->get_owner_handle(first, f_owner_proc, f_moab_owner_handle);
183  // int s_owner_proc;
184  // EntityHandle s_moab_owner_handle;
185  // CHKERR pcomm->get_owner_handle(second, s_owner_proc, s_moab_owner_handle);
186 
187  // // Get UId
188  // UId first_uid = FieldEntity::getGlobalUniqueIdCalculate(
189  // f_owner_proc, field_bit_number, f_moab_owner_handle,
190  // is_distributed_mesh);
191  // UId second_uid = FieldEntity::getGlobalUniqueIdCalculate(
192  // s_owner_proc, field_bit_number, s_moab_owner_handle,
193  // is_distributed_mesh);
194 
195  // FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
196  // Unique_mi_tag>::type::iterator ait,
197  // hi_ait;
198  // ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound(
199  // first_uid);
200  // hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound(
201  // second_uid);
202  // for (; ait != hi_ait; ++ait) {
203  // // Delete data dofs on element
204  // {
205  // FEDofEntity_multiIndex::iterator diit, hi_diit;
206  // diit = ait->entFePtr->data_dofs->lower_bound(
207  // dit->get()->getGlobalUniqueId());
208  // if (last_hi_dit) {
209  // hi_diit = ait->entFePtr->data_dofs->end();
210  // } else {
211  // hi_diit = ait->entFePtr->data_dofs->lower_bound(
212  // hi_dit->get()->getGlobalUniqueId());
213  // }
214  // ait->entFePtr->data_dofs->erase(diit, hi_diit);
215  // }
216  // // Delete dofs view on rows and columns on elements
217  // {
218  // DofEntity_multiIndex_uid_view::iterator diit, hi_diit;
219  // diit = ait->entFePtr->row_dof_view->lower_bound(
220  // dit->get()->getGlobalUniqueId());
221  // if (last_hi_dit) {
222  // hi_diit = ait->entFePtr->row_dof_view->end();
223  // } else {
224  // hi_diit = ait->entFePtr->row_dof_view->lower_bound(
225  // hi_dit->get()->getGlobalUniqueId());
226  // }
227  // ait->entFePtr->row_dof_view->erase(diit, hi_diit);
228  // if (ait->entFePtr->row_dof_view != ait->entFePtr->col_dof_view) {
229  // diit = ait->entFePtr->col_dof_view->lower_bound(
230  // dit->get()->getGlobalUniqueId());
231  // if (last_hi_dit) {
232  // hi_diit = ait->entFePtr->col_dof_view->end();
233  // } else {
234  // hi_diit = ait->entFePtr->col_dof_view->lower_bound(
235  // hi_dit->get()->getGlobalUniqueId());
236  // }
237  // ait->entFePtr->col_dof_view->erase(diit, hi_diit);
238  // }
239  // }
240  // }
241  dofsField.get<Composite_Name_And_Ent_mi_tag>().erase(dit, hi_dit);
242  }
244 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:248
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
int verbose
Verbosity level.
Definition: Core.hpp:830

◆ clear_dofs_fields_by_bit_ref()

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

Clear dofs by bit level

Implements MoFEM::CoreInterface.

Definition at line 67 of file DeleteCore.cpp.

68  {
70  if (verb == -1)
71  verb = verbose;
72  Range ents;
73  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
74  CHKERR clear_dofs_fields(ents, verb);
76 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:515
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:521
MoFEMErrorCode clear_dofs_fields(const Range &ents, int verb=-1)
Definition: DeleteCore.cpp:78
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830

◆ clear_ents_fields() [1/2]

MoFEMErrorCode MoFEM::Core::clear_ents_fields ( const Range &  ents,
int  verb = -1 
)
protectedvirtual

Clear entities by field name

Implements MoFEM::CoreInterface.

Definition at line 259 of file DeleteCore.cpp.

259  {
261  if (verb == -1)
262  verb = verbose;
263  CHKERR clear_dofs_fields(ents, verb);
265  for (Range::const_pair_iterator p_eit = ents.pair_begin();
266  p_eit != ents.pair_end(); p_eit++) {
267  EntityHandle first = p_eit->first;
268  EntityHandle second = p_eit->second;
269  FieldEntity_multiIndex::index<Ent_mi_tag>::type::iterator dit, hi_dit;
270  dit = entsFields.get<Ent_mi_tag>().lower_bound(first);
271  hi_dit = entsFields.get<Ent_mi_tag>().upper_bound(second);
272  entsFields.get<Ent_mi_tag>().erase(dit, hi_dit);
273  }
274  // TODO: FIXME: Tag are not deleteted, some additional set of interface functions
275  // need to be implemented for example tag_field_delete(...)
276  // for (Field_multiIndex::iterator fit = fIelds.begin(); fit != fIelds.end();
277  // fit++) {
278  // rval = moab.tag_delete_data(fit->get()->th_AppOrder, ents);
279  // if (rval != MB_SUCCESS && rval != MB_TAG_NOT_FOUND) {
280  // CHKERRG(rval);
281  // } else {
282  // rval = MB_SUCCESS;
283  // }
284  // rval = moab.tag_delete_data(fit->get()->th_FieldData, ents);
285  // if (rval != MB_SUCCESS && rval != MB_TAG_NOT_FOUND) {
286  // CHKERRG(rval);
287  // } else {
288  // rval = MB_SUCCESS;
289  // }
290  // }
292 }
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:247
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
MoFEMErrorCode clear_adjacencies_entities(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:381
MoFEMErrorCode clear_dofs_fields(const Range &ents, int verb=-1)
Definition: DeleteCore.cpp:78
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ clear_ents_fields() [2/2]

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

Clear entities by field name

Implements MoFEM::CoreInterface.

Definition at line 294 of file DeleteCore.cpp.

295  {
297  if (verb == -1)
298  verb = verbose;
299  CHKERR clear_dofs_fields(name, ents, verb);
300  CHKERR clear_adjacencies_entities(name, ents, verb);
301  for (Range::const_pair_iterator p_eit = ents.pair_begin();
302  p_eit != ents.pair_end(); p_eit++) {
303  EntityHandle first = p_eit->first;
304  EntityHandle second = p_eit->second;
305  FieldEntity_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type::iterator
306  dit,
307  hi_dit;
308  dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
309  boost::make_tuple(name, first));
310  hi_dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
311  boost::make_tuple(name, second));
312  entsFields.get<Composite_Name_And_Ent_mi_tag>().erase(dit, hi_dit);
313  }
314  // TODO: FIXME: Tag are not deleteted, some additional set of interface functions
315  // need to be implemented for example tag_field_delete(...)
316  // const Field *field_ptr = get_field_structure(name);
317  // rval = moab.tag_delete_data(field_ptr->th_AppOrder, ents);
318  // if (rval != MB_SUCCESS && rval != MB_TAG_NOT_FOUND) {
319  // CHKERRG(rval);
320  // } else {
321  // rval = MB_SUCCESS;
322  // }
323  // rval = moab.tag_delete_data(field_ptr->th_FieldData, ents);
324  // if (rval != MB_SUCCESS && rval != MB_TAG_NOT_FOUND) {
325  // CHKERRG(rval);
326  // } else {
327  // rval = MB_SUCCESS;
328  // }
330 }
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:247
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
MoFEMErrorCode clear_adjacencies_entities(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:381
MoFEMErrorCode clear_dofs_fields(const Range &ents, int verb=-1)
Definition: DeleteCore.cpp:78
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ clear_ents_fields_by_bit_ref()

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

Clear ents by bit level

Implements MoFEM::CoreInterface.

Definition at line 246 of file DeleteCore.cpp.

247  {
249  if (verb == -1)
250  verb = verbose;
251  Range ents;
252  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
253  CHKERR clear_dofs_fields(ents, verb);
255  CHKERR clear_ents_fields(ents, verb);
257 }
MoFEMErrorCode clear_ents_fields(const Range &ents, int verb=-1)
Definition: DeleteCore.cpp:259
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
MoFEMErrorCode clear_adjacencies_entities(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:381
MoFEMErrorCode clear_dofs_fields(const Range &ents, int verb=-1)
Definition: DeleteCore.cpp:78
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ clear_finite_elements() [1/2]

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 469 of file DeleteCore.cpp.

469  {
471  if (verb == -1)
472  verb = verbose;
474  for (Range::const_pair_iterator p_eit = ents.pair_begin();
475  p_eit != ents.pair_end(); p_eit++) {
476  EntityHandle first = p_eit->first;
477  EntityHandle second = p_eit->second;
478  EntFiniteElement_multiIndex::index<Ent_mi_tag>::type::iterator fit, hi_fit;
479  fit = entsFiniteElements.get<Ent_mi_tag>().lower_bound(first);
480  hi_fit = entsFiniteElements.get<Ent_mi_tag>().upper_bound(second);
481  entsFiniteElements.get<Ent_mi_tag>().erase(fit, hi_fit);
482  }
484 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
MoFEMErrorCode clear_adjacencies_finite_elements(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
clear adjacency map for finite elements on given bit level
Definition: DeleteCore.cpp:510
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:251

◆ clear_finite_elements() [2/2]

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 486 of file DeleteCore.cpp.

487  {
489  if (verb == -1)
490  verb = verbose;
491  CHKERR clear_adjacencies_finite_elements(name, ents, verb);
492  for (Range::const_pair_iterator p_eit = ents.pair_begin();
493  p_eit != ents.pair_end(); p_eit++) {
494  EntityHandle first = p_eit->first;
495  EntityHandle second = p_eit->second;
496  EntFiniteElement_multiIndex::index<
497  Composite_Name_And_Ent_mi_tag>::type::iterator fit,
498  hi_fit;
499  fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
500  boost::make_tuple(name, first));
501  hi_fit =
502  entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
503  boost::make_tuple(name, second));
504  fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().erase(fit,
505  hi_fit);
506  }
508 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
MoFEMErrorCode clear_adjacencies_finite_elements(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
clear adjacency map for finite elements on given bit level
Definition: DeleteCore.cpp:510
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:251

◆ clear_finite_elements_by_bit_ref()

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 457 of file DeleteCore.cpp.

459  {
461  if (verb == -1)
462  verb = verbose;
463  Range ents;
464  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
465  CHKERR clear_finite_elements(ents, verb);
467 }
MoFEMErrorCode clear_finite_elements(const Range &ents, int verb=-1)
Definition: DeleteCore.cpp:469
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ clear_inactive_dofs()

MoFEMErrorCode MoFEM::Core::clear_inactive_dofs ( int  verb = -1)
protectedvirtual

Clear inactive dofs

Implements MoFEM::CoreInterface.

Definition at line 34 of file DeleteCore.cpp.

34  {
36  if (verb == -1)
37  verb = verbose;
38  Range ents;
39  for (DofEntity_multiIndex::iterator dit = dofsField.begin();
40  dit != dofsField.end();) {
41  if (!dit->get()->getActive()) {
42  // FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
43  // Unique_mi_tag>::type::iterator ait,
44  // hi_ait;
45  // ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound(
46  // (*dit)->getFieldEntityPtr()->getGlobalUniqueId());
47  // hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound(
48  // (*dit)->getFieldEntityPtr()->getGlobalUniqueId());
49  // for (; ait != hi_ait; ait++) {
50  // boost::shared_ptr<EntFiniteElement> ent_fe_ptr;
51  // ent_fe_ptr = ait->entFePtr;
52  // ent_fe_ptr->row_dof_view->erase((*dit)->getGlobalUniqueId());
53  // if (ent_fe_ptr->row_dof_view != ent_fe_ptr->col_dof_view) {
54  // ent_fe_ptr->col_dof_view->erase((*dit)->getGlobalUniqueId());
55  // }
56  // ent_fe_ptr->data_dofs->get<Unique_mi_tag>().erase(
57  // (*dit)->getGlobalUniqueId());
58  // }
59  dit = dofsField.erase(dit);
60  } else {
61  ++dit;
62  }
63  }
65 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:248
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:491
int verbose
Verbosity level.
Definition: Core.hpp:830
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:436

◆ clear_problem()

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

clear problem

Implements MoFEM::CoreInterface.

Definition at line 244 of file ProblemsCore.cpp.

244  {
246  if (verb == -1)
247  verb = verbose;
248  typedef Problem_multiIndex::index<Problem_mi_tag>::type ProblemsByName;
249  ProblemsByName &prob_by_name = pRoblems.get<Problem_mi_tag>();
250  ProblemsByName::iterator p_miit = prob_by_name.find(problem_name);
251  if (p_miit == prob_by_name.end()) {
252  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
253  "problem < %s > not found, (top tip: check spelling)",
254  problem_name.c_str());
255  }
256  // zero rows
257  bool success = prob_by_name.modify(p_miit, ProblemZeroNbRowsChange());
258  if (!success)
259  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
260  "modification unsuccessful");
261  // zero cols
262  success = prob_by_name.modify(p_miit, ProblemZeroNbColsChange());
263  if (!success)
264  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
265  "modification unsuccessful");
266  // clear finite elements
267  success =
268  prob_by_name.modify(p_miit, ProblemClearNumeredFiniteElementsChange());
269  if (!success)
270  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
271  "modification unsuccessful");
272  // clear data structures
273  success = prob_by_name.modify(p_miit, ProblemClearSubProblemData());
274  if (!success)
275  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
276  "modification unsuccessful");
277  success = prob_by_name.modify(p_miit, ProblemClearComposedProblemData());
278  if (!success)
279  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
280  "modification unsuccessful");
281  if (p_miit->getRowDofsSequence())
282  p_miit->getRowDofsSequence()->clear();
283  if (p_miit->getColDofsSequence())
284  p_miit->getColDofsSequence()->clear();
285  if (p_miit->getSubData())
286  p_miit->getSubData().reset();
287  if (p_miit->getComposedProblemsData())
288  p_miit->getComposedProblemsData().reset();
290 }