v0.6.9
Public Member Functions | Static 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, int verbose=1)
 
 ~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 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...
 
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...
 
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...
 
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...
 
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...
 
- 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
 

Static Public Member Functions

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

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

Static Private Attributes

static bool isGloballyInitialised = false
 Core base globally initialized. 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
}
 
MoFEMErrorCode addPrismToDatabase (const EntityHandle prism, int verb=-1)
 add prim element More...
 
intgetBuildMoFEM () const
 Get flags/semaphores for different stages. 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...
 

Seed and synchronize entities (Following functions in future will be

deprecated)

MoFEMErrorCode seed_finite_elements (const Range &entities, int verb=-1)
 
MoFEMErrorCode seed_finite_elements (const EntityHandle meshset, int verb=-1)
 
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...
 
MoFEMErrorCode remove_ents_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 remove entities form mofem database More...
 
MoFEMErrorCode delete_finite_elements_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 remove finite element from mofem database More...
 
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...
 
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 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_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_QUADs (const Range &prisms, 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...
 

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

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)
 
MoFEMErrorCode clear_inactive_dofs (int verb=-1)
 
MoFEMErrorCode clear_dofs_fields (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
MoFEMErrorCode clear_ents_fields (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
MoFEMErrorCode clear_dofs_fields (const std::string &name, const Range ents, int verb=-1)
 
MoFEMErrorCode clear_ents_fields (const std::string &name, const Range ents, int verb=-1)
 

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 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_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 boost::shared_ptr< FiniteElement > fe, const Range *ents_ptr=NULL, 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 clear_finite_elements (const BitRefLevel &bit, const BitRefLevel &mask, 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_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_entities (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 clear adjacency map for entities on given bit level More...
 
MoFEMErrorCode clear_adjacencies_finite_elements (const std::string &name, const Range &ents, int verb=-1)
 
MoFEMErrorCode clear_adjacencies_entities (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, mesh_cut.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 153 of file Core.hpp.

Constructor & Destructor Documentation

◆ Core()

MoFEM::Core::Core ( moab::Interface &  moab,
MPI_Comm  comm = PETSC_COMM_WORLD,
int  verbose = 1 
)

Construct core database

Parameters
moabMoAB interface
commMPI communicator
verboseVerbosity level

Definition at line 78 of file Core.cpp.

78  :
79 moab(moab),
80 cOmm(0),
81 verbose(verbose) {
82 
83  // This is deprecated ONE should use MoFEM::Core::Initialize
84  if (!isGloballyInitialised) {
85  PetscPushErrorHandler(mofem_error_handler, PETSC_NULL);
86  isGloballyInitialised = true;
87  }
88 
89  // Register interfaces for this implementation
90  ierr = registerInterface<UnknownInterface>(IDD_MOFEMUnknown);
91  CHKERRABORT(PETSC_COMM_SELF, ierr);
92  ierr = registerInterface<CoreInterface>(IDD_MOFEMCoreInterface);
93  CHKERRABORT(PETSC_COMM_SELF, ierr);
94  ierr = registerInterface<DeprecatedCoreInterface>(
96  CHKERRABORT(PETSC_COMM_SELF, ierr);
97  // Register sub interfaces
98  ierr = regSubInterface<Simple>(IDD_MOFEMSimple);
99  CHKERRABORT(PETSC_COMM_SELF, ierr);
100  ierr = regSubInterface<ProblemsManager>(IDD_MOFEMProblemsManager);
101  CHKERRABORT(PETSC_COMM_SELF, ierr);
102  ierr = regSubInterface<ISManager>(IDD_MOFEMISManager);
103  CHKERRABORT(PETSC_COMM_SELF, ierr);
104  ierr = regSubInterface<VecManager>(IDD_MOFEMVEC);
105  CHKERRABORT(PETSC_COMM_SELF, ierr);
106  ierr = regSubInterface<FieldBlas>(IDD_MOFEMFieldBlas);
107  CHKERRABORT(PETSC_COMM_SELF, ierr);
108  ierr = regSubInterface<BitRefManager>(IDD_MOFEMBitRefManager);
109  CHKERRABORT(PETSC_COMM_SELF, ierr);
110  ierr = regSubInterface<Tools>(IDD_MOFEMTools);
111  CHKERRABORT(PETSC_COMM_SELF, ierr);
112  ierr = regSubInterface<MeshsetsManager>(IDD_MOFEMMeshsetsManager);
113  CHKERRABORT(PETSC_COMM_SELF, ierr);
114  ierr = regSubInterface<CoordSystemsManager>(IDD_MOFEMCoordsSystemsManager);
115  CHKERRABORT(PETSC_COMM_SELF, ierr);
116  ierr = regSubInterface<NodeMergerInterface>(IDD_MOFEMNodeMerger);
117  CHKERRABORT(PETSC_COMM_SELF, ierr);
118  ierr = regSubInterface<BitLevelCoupler>(IDD_MOFEMBitLevelCoupler);
119  CHKERRABORT(PETSC_COMM_SELF, ierr);
120  ierr =
121  regSubInterface<PrismsFromSurfaceInterface>(IDD_MOFEMPrismsFromSurface);
122  CHKERRABORT(PETSC_COMM_SELF, ierr);
123  ierr = regSubInterface<MeshRefinement>(IDD_MOFEMMeshRefine);
124  CHKERRABORT(PETSC_COMM_SELF, ierr);
125  ierr = regSubInterface<PrismInterface>(IDD_MOFEMPrismInterface);
126  CHKERRABORT(PETSC_COMM_SELF, ierr);
127  ierr = regSubInterface<CutMeshInterface>(IDD_MOFEMCutMesh);
128  CHKERRABORT(PETSC_COMM_SELF, ierr);
129  ierr = regSubInterface<SeriesRecorder>(IDD_MOFEMSeriesRecorder);
130  CHKERRABORT(PETSC_COMM_SELF, ierr);
131 #ifdef WITH_TETGEN
132  ierr = regSubInterface<TetGenInterface>(IDD_MOFEMTetGegInterface);
133  CHKERRABORT(PETSC_COMM_SELF, ierr);
134 #endif
135 #ifdef WITH_MED
136  ierr = regSubInterface<MedInterface>(IDD_MOFEMMedInterface);
137  CHKERRABORT(PETSC_COMM_SELF, ierr);
138 #endif
139 
140  // Register MOFEM events in PETSc
141  PetscLogEventRegister("FE_preProcess",0,&MOFEM_EVENT_preProcess);
142  PetscLogEventRegister("FE_operator",0,&MOFEM_EVENT_operator);
143  PetscLogEventRegister("FE_postProcess",0,&MOFEM_EVENT_postProcess);
144  PetscLogEventRegister("MoFEMCreateMat",0,&MOFEM_EVENT_createMat);
145 
146  // Duplicate PETSc communicator
147  ierr = PetscCommDuplicate(comm,&cOmm,NULL); CHKERRABORT(comm,ierr);
148  MPI_Comm_size(cOmm,&sIze);
149  MPI_Comm_rank(cOmm,&rAnk);
150  // CHeck if moab has set communicator if not set communicator interbally
151  ParallelComm* pComm = ParallelComm::get_pcomm(&moab,MYPCOMM_INDEX);
152  if(pComm == NULL) {
153  pComm = new ParallelComm(&moab,comm);
154  }
155 
156  // Initialize database
157  ierr = getTags(); CHKERRABORT(cOmm,ierr);
158  ierr = clearMap(); CHKERRABORT(cOmm,ierr);
159  basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
160  ierr = initialiseDatabaseFromMesh(verbose); CHKERRABORT(cOmm,ierr);
161 
162  // Print version
163  if (verbose > 0) {
164  char petsc_version[255];
165  ierr = PetscGetVersion(petsc_version, 255);
166  CHKERRABORT(cOmm, ierr);
167  ierr = PetscPrintf(cOmm, "MoFEM version %d.%d.%d (%s %s) \n",
169  MoFEM_VERSION_BUILD, MOAB_VERSION_STRING, petsc_version);
170  CHKERRABORT(cOmm, ierr);
171  ierr = PetscPrintf(cOmm, "git commit id %s\n", GIT_SHA1_NAME);
172  CHKERRABORT(cOmm, ierr);
173  }
174 }
static const MOFEMuuid IDD_MOFEMSeriesRecorder
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:214
static const MOFEMuuid IDD_MOFEMCoreInterface
Definition: Interface.hpp:24
#define MoFEM_VERSION_MAJOR
Definition: version.h:2
int sIze
MoFEM communicator size.
Definition: Core.hpp:806
static const MOFEMuuid IDD_MOFEMMeshsetsManager
PetscLogEvent MOFEM_EVENT_postProcess
Event for postProcess finite element.
Definition: Core.hpp:794
static const MOFEMuuid IDD_MOFEMProblemsManager
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
PetscLogEvent MOFEM_EVENT_operator
Event for evaluating operator of finite element.
Definition: Core.hpp:792
static const MOFEMuuid IDD_MOFEMUnknown
static const MOFEMuuid IDD_MOFEMBitRefManager
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:795
static const MOFEMuuid IDD_MOFEMNodeMerger
Definition: NodeMerger.hpp:23
MoFEMErrorCode getTags(int verb=-1)
Get tag handles.
Definition: Core.cpp:262
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:790
static const MOFEMuuid IDD_MOFEMSimple
Definition: Simple.hpp:27
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:807
static const MOFEMuuid IDD_MOFEMMeshRefine
moab::Interface & moab
moab database
Definition: Core.hpp:252
static const MOFEMuuid IDD_MOFEMTools
Definition: Tools.hpp:23
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:839
static const MOFEMuuid IDD_MOFEMTetGegInterface
static const MOFEMuuid IDD_MOFEMCutMesh
static const MOFEMuuid IDD_MOFEMCoordsSystemsManager
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:212
#define MoFEM_VERSION_MINOR
Definition: version.h:3
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:315
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:509
ParallelComm * pComm
MOAB communicator structure.
Definition: Core.hpp:804
int verbose
Verbosity level.
Definition: Core.hpp:827
static const MOFEMuuid IDD_MOFEMISManager
Definition: ISManager.hpp:26
static const MOFEMuuid IDD_MOFEMDeprecatedCoreInterface
Definition: Interface.hpp:25
static const MOFEMuuid IDD_MOFEMPrismInterface
#define GIT_SHA1_NAME
Definition: version.h:9
static const MOFEMuuid IDD_MOFEMMedInterface
static const MOFEMuuid IDD_MOFEMBitLevelCoupler
#define MoFEM_VERSION_BUILD
Definition: version.h:4

◆ ~Core()

MoFEM::Core::~Core ( )

Definition at line 176 of file Core.cpp.

176  {
177  PetscBool is_finalized;
178  PetscFinalized(&is_finalized);
179  // Destroy interfaces
180  iFaces.clear();
181  // This is deprecated ONE should use MoFEM::Core::Initialize
182  if (isGloballyInitialised && is_finalized) {
183  isGloballyInitialised = false;
184  }
185  // Destroy communicator
186  if (!is_finalized) {
187  ierr = PetscCommDestroy(&cOmm); CHKERRABORT(cOmm,ierr);
188  }
189 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:839
boost::ptr_map< unsigned long, UnknownInterface > iFaces
Hash map of pointers to interfaces.
Definition: Core.hpp:836

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

332  {
333  Range ents_dim = ents.subset_by_dimension(dim);
334  return addEntsToFieldByDim(ents_dim,dim,name,verb);
335 }
MoFEMErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=-1)
Definition: FieldCore.cpp:211

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

352  {
354  Range ents;
355  rval = moab.get_entities_by_dimension(meshset,dim,ents,recursive); CHKERRQ_MOAB(rval);
356  ierr = addEntsToFieldByDim(ents,dim,name,verb); CHKERRG(ierr);
358 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:211

◆ add_ents_to_field_by_EDGEs() [1/2]

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

set field entities form adjacencies of edgesThe lower dimension entities are added depending on the space type

Parameters
rangecontains set edges
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 373 of file FieldCore.cpp.

373  {
374  return add_ents_to_field_by_type(edges,MBEDGE,name,verb);
375 }
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...
Definition: FieldCore.cpp:337

◆ add_ents_to_field_by_EDGEs() [2/2]

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

set field entities form adjacencies of edgesThe lower dimension entities are added depending on the space type

Parameters
meshsetcontains set edges
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 376 of file FieldCore.cpp.

376  {
377  return add_ents_to_field_by_type(meshset,MBEDGE,name,true,verb);
378 }
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...
Definition: FieldCore.cpp:337

◆ add_ents_to_field_by_PRISMs() [1/2]

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

set field entities from adjacencies of prismsThe lower dimension entities are added depending on the space type

Parameters
prismsrange of prisms
idfield id set field entities from adjacencies of prisms

The lower dimension entities are added depending on the space type

Parameters
prismsrange contains set prisms
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 403 of file FieldCore.cpp.

403  {
404  return add_ents_to_field_by_type(prisms,MBPRISM,name,verb);
405 }
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...
Definition: FieldCore.cpp:337

◆ add_ents_to_field_by_PRISMs() [2/2]

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

set field entities from adjacencies of prismsThe lower dimension entities are added depending on the space type

Parameters
meshsetcontains set prisms
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 406 of file FieldCore.cpp.

406  {
407  return add_ents_to_field_by_type(meshset,MBPRISM,name,true,verb);
408 }
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...
Definition: FieldCore.cpp:337

◆ add_ents_to_field_by_QUADs() [1/2]

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

set field entities from adjacencies of quadsThe lower dimension entities are added depending on the space type

Parameters
quadsrange of quads
idfield id set field entities from adjacencies of quads

The lower dimension entities are added depending on the space type

Parameters
quadsrange contains set quads
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 397 of file FieldCore.cpp.

397  {
398  return add_ents_to_field_by_type(quads,MBQUAD,name,verb);
399 }
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...
Definition: FieldCore.cpp:337

◆ add_ents_to_field_by_QUADs() [2/2]

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

set field entities from adjacencies of quadsThe lower dimension entities are added depending on the space type

Parameters
meshsetcontains set quads
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 400 of file FieldCore.cpp.

400  {
401  return add_ents_to_field_by_type(meshset,MBQUAD,name,true,verb);
402 }
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...
Definition: FieldCore.cpp:337

◆ add_ents_to_field_by_TETs() [1/2]

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

set field entities from adjacencies of tetrahedronThe lower dimension entities are added depending on the space type

Parameters
rangecontains set tetrahedron
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 391 of file FieldCore.cpp.

391  {
392  return add_ents_to_field_by_type(tets,MBTET,name,verb);
393 }
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...
Definition: FieldCore.cpp:337

◆ add_ents_to_field_by_TETs() [2/2]

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

set field entities from adjacencies of tetrahedronThe lower dimension entities are added depending on the space type

Parameters
meshsetcontains set tetrahedron
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 394 of file FieldCore.cpp.

394  {
395  return add_ents_to_field_by_type(meshset,MBTET,name,true,verb);
396 }
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...
Definition: FieldCore.cpp:337

◆ add_ents_to_field_by_TRIs() [1/2]

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

set field entities form adjacencies of trianglesThe lower dimension entities are added depending on the space type

Parameters
meshsetcontains set triangles
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 379 of file FieldCore.cpp.

379  {
380  return add_ents_to_field_by_type(meshset,MBTRI,name,true,verb);
381 }
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...
Definition: FieldCore.cpp:337

◆ add_ents_to_field_by_TRIs() [2/2]

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

set field entities form adjacencies of trianglesThe lower dimension entities are added depending on the space type

Parameters
rangetriangles
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 382 of file FieldCore.cpp.

382  {
383  return add_ents_to_field_by_type(tris,MBTRI,name,verb);
384 }
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...
Definition: FieldCore.cpp:337

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

339  {
340 
342  Range ents_type = ents.subset_by_type(type);
343  if(!ents_type.empty()) {
344  const int dim = moab.dimension_from_handle(ents_type[0]);
345  ierr = addEntsToFieldByDim(ents_type,dim,name,verb); CHKERRG(ierr);
346  }
348 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:211

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

362  {
364  Range ents;
365  rval = moab.get_entities_by_type(meshset,type,ents,recursive); CHKERRQ_MOAB(rval);
366  if(!ents.empty()) {
367  const int dim = moab.dimension_from_handle(ents[0]);
368  ierr = addEntsToFieldByDim(ents,dim,name,verb); CHKERRG(ierr);
369  }
371 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:211

◆ add_ents_to_field_by_VERTICEs() [1/2]

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

set field entities on verticesThe lower dimension entities are added depending on the space type

Parameters
nodescontains set vertices
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 385 of file FieldCore.cpp.

385  {
386  return add_ents_to_field_by_type(nodes,MBVERTEX,name,verb);
387 }
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...
Definition: FieldCore.cpp:337

◆ add_ents_to_field_by_VERTICEs() [2/2]

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

set field entities on verticesThe lower dimension entities are added depending on the space type

Parameters
meshsetcontains set vertices
nameof the field

Implements MoFEM::CoreInterface.

Definition at line 388 of file FieldCore.cpp.

388  {
389  return add_ents_to_field_by_type(meshset,MBVERTEX,name,true,verb);
390 }
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...
Definition: FieldCore.cpp:337

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

391  {
393  try {
394  if(verb==-1) verb = verbose;
395  *buildMoFEM &= 1<<0;
396  const BitFEId id = getBitFEId(name);
398  typedef RefElement_multiIndex::index<EntType_mi_tag>::type refMoabFE_by_type;
399  refMoabFE_by_type &ref_MoFEMFiniteElement = refinedFiniteElements.get<EntType_mi_tag>();
400  refMoabFE_by_type::iterator miit = ref_MoFEMFiniteElement.lower_bound(type);
401  refMoabFE_by_type::iterator hi_miit = ref_MoFEMFiniteElement.upper_bound(type);
402  if(verb > 1) {
403  PetscSynchronizedPrintf(cOmm,"nb. ref elements in database %d\n",distance(miit,hi_miit));
404  }
405  int nb_add_FEs = 0;
406  for(;miit!=hi_miit;miit++) {
407  BitRefLevel bit2 = miit->getBitRefLevel();
408  if((bit2&mask) != bit2) continue;
409  if((bit2&bit).any()) {
410  EntityHandle ent = miit->getRefEnt();
411  rval = moab.add_entities(idm,&ent,1); CHKERRQ_MOAB(rval);
412  nb_add_FEs++;
413  }
414  }
415  if(verb > 0) {
416  std::ostringstream ss;
417  ss << "Add Nb. FEs " << nb_add_FEs << " form BitRef " << bit << std::endl;
418  PetscSynchronizedPrintf(cOmm,"%s",ss.str().c_str());
419  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
420  }
421  } catch (MoFEMException const &e) {
422  SETERRQ(cOmm,e.errorCode,e.errorMessage);
423  }
425  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:204
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
std::bitset< BITFEID_SIZE > BitFEId
Definition: Common.hpp:150
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:188
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:838
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:232
int verbose
Verbosity level.
Definition: Core.hpp:827

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

286  {
287  EntityHandle idm = no_handle;
288  *buildMoFEM &= 1<<0;
290  try {
292  } catch (MoFEMException const &e) {
293  SETERRQ(cOmm,e.errorCode,e.errorMessage);
294  }
295  Range ents;
296  rval = moab.get_entities_by_dimension(meshset,dim,ents,recursive); CHKERRQ_MOAB(rval);
297  ierr = seed_finite_elements(ents.subset_by_dimension(dim)); CHKERRG(ierr);
298  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
300  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:204
MoFEMErrorCode seed_finite_elements(const Range &entities, int verb=-1)
Definition: FECore.cpp:849
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
const EntityHandle no_handle
Definition: Common.hpp:133
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:188
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:838

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

320  {
321  EntityHandle idm = no_handle;
322  *buildMoFEM &= 1<<0;
324  try {
326  } catch (MoFEMException const &e) {
327  SETERRQ(cOmm,e.errorCode,e.errorMessage);
328  }
329  ierr = seed_finite_elements(ents.subset_by_dimension(dim)); CHKERRG(ierr);
330  rval = moab.add_entities(idm,ents.subset_by_dimension(dim)); CHKERRQ_MOAB(rval);
332  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:204
MoFEMErrorCode seed_finite_elements(const Range &entities, int verb=-1)
Definition: FECore.cpp:849
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
const EntityHandle no_handle
Definition: Common.hpp:133
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:188
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:838

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

337  {
338  return add_ents_to_finite_element_by_type(edges,MBEDGE,name);
340  }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:266

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

334  {
335  return add_ents_to_finite_element_by_type(meshset,MBEDGE,name,recursive);
336  }
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:266

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

427  {
429  *buildMoFEM &= 1<<0;
430  const BitFEId id = getBitFEId(name);
432  if(recursive==false){
433  rval = moab.add_entities(idm,&meshset,1); CHKERRQ_MOAB(rval);
434  } else {
435  Range meshsets;
436  rval = moab.get_entities_by_type(meshset,MBENTITYSET,meshsets,false); CHKERRQ_MOAB(rval);
437  rval = moab.add_entities(idm,meshsets); CHKERRQ_MOAB(rval);
438  }
440  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:204
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
std::bitset< BITFEID_SIZE > BitFEId
Definition: Common.hpp:150
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:188
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:838

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

364  {
366  return add_ents_to_finite_element_by_type(prims,MBPRISM,name);
368  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:266

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

369  {
370  return add_ents_to_finite_element_by_type(meshset,MBPRISM,name,recursive);
371  }
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:266

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

355  {
357  return add_ents_to_finite_element_by_type(tets,MBTET,name);
359  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:266

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

360  {
361  return add_ents_to_finite_element_by_type(meshset,MBTET,name,recursive);
363  }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:266

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

346  {
348  return add_ents_to_finite_element_by_type(tris,MBTRI,name);
350  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:266

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

351  {
352  return add_ents_to_finite_element_by_type(meshset,MBTRI,name,recursive);
354  }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:266

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

268  {
269  *buildMoFEM &= 1<<0;
270  EntityHandle idm = no_handle;
272  try {
274  } catch (MoFEMException const &e) {
275  SETERRQ(cOmm,e.errorCode,e.errorMessage);
276  }
277  Range ents;
278  rval = moab.get_entities_by_type(meshset,type,ents,recursive); CHKERRQ_MOAB(rval);
279  ierr = seed_finite_elements(ents.subset_by_type(MBEDGE)); CHKERRG(ierr);
280  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
282  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:204
MoFEMErrorCode seed_finite_elements(const Range &entities, int verb=-1)
Definition: FECore.cpp:849
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
const EntityHandle no_handle
Definition: Common.hpp:133
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:188
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:838

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

304  {
305  EntityHandle idm = no_handle;
306  *buildMoFEM &= 1<<0;
308  try {
310  } catch (MoFEMException const &e) {
311  SETERRQ(cOmm,e.errorCode,e.errorMessage);
312  }
313  ierr = seed_finite_elements(ents.subset_by_type(type)); CHKERRG(ierr);
314  rval = moab.add_entities(idm,ents.subset_by_type(type)); CHKERRQ_MOAB(rval);
316  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:204
MoFEMErrorCode seed_finite_elements(const Range &entities, int verb=-1)
Definition: FECore.cpp:849
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
const EntityHandle no_handle
Definition: Common.hpp:133
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:188
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:838

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

341  {
343  return add_ents_to_finite_element_by_type(vert,MBVERTEX,name);
345  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:266

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

375  {
377  ierr = add_ents_to_finite_element_by_bit_ref(bit,BitRefLevel().set(),name,type,verb); CHKERRG(ierr);
379  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
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:389

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

383  {
385  ierr = add_ents_to_finite_element_by_bit_ref(bit,mask,name,type,verb); CHKERRG(ierr);
387  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
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:389

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

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

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

41  {
43  *buildMoFEM &= 1<<0;
44  typedef FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type FiniteElements_by_name;
45  FiniteElements_by_name &finite_element_name_set = finiteElements.get<FiniteElement_name_mi_tag>();
46  FiniteElements_by_name::iterator it_fe = finite_element_name_set.find(fe_name);
47  if(bh == MF_EXCL) {
48  if(it_fe!=finite_element_name_set.end()) {
49  SETERRQ1(cOmm,MOFEM_NOT_FOUND,"this < %s > is there",fe_name.c_str());
50  }
51  } else {
52  if(it_fe!=finite_element_name_set.end()) MoFEMFunctionReturnHot(0);
53  }
54  EntityHandle meshset;
55  rval = moab.create_meshset(MESHSET_SET|MESHSET_TRACK_OWNER,meshset); CHKERRQ_MOAB(rval);
56  //id
57  BitFEId id = getFEShift();
58  rval = moab.tag_set_data(th_FEId,&meshset,1,&id); CHKERRQ_MOAB(rval);
59  //id name
60  void const* tag_data[] = { fe_name.c_str() };
61  int tag_sizes[1]; tag_sizes[0] = fe_name.size();
62  rval = moab.tag_set_by_ptr(th_FEName,&meshset,1,tag_data,tag_sizes); CHKERRQ_MOAB(rval);
63  //add FiniteElement
64  std::pair<FiniteElement_multiIndex::iterator,bool> p = finiteElements.insert(
65  boost::shared_ptr<FiniteElement>(new FiniteElement(moab,meshset))
66  );
67  if(!p.second) SETERRQ(cOmm,MOFEM_OPERATION_UNSUCCESSFUL,"FiniteElement not inserted");
68  if(verbose>0) {
69  std::ostringstream ss;
70  ss << "add finite element: " << fe_name << std::endl;
71  PetscPrintf(cOmm,ss.str().c_str());
72  //list_finiteElements();
73  }
75  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
std::bitset< BITFEID_SIZE > BitFEId
Definition: Common.hpp:150
Tag th_FEName
Definition: Core.hpp:193
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
BitFEId getFEShift()
Return unique finite element Id.
Definition: Core.cpp:204
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:838
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:238
int verbose
Verbosity level.
Definition: Core.hpp:827
Tag th_FEId
Definition: Core.hpp:193

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

30  {
32  EntityHandle meshset;
33  rval = moab.create_meshset(MESHSET_SET|MESHSET_TRACK_OWNER,meshset); CHKERRQ_MOAB(rval);
34  rval = moab.tag_set_data(th_ProblemId,&meshset,1,&id); CHKERRQ_MOAB(rval);
35  void const* tag_data[] = { name.c_str() };
36  int tag_sizes[1]; tag_sizes[0] = name.size();
37  rval = moab.tag_set_by_ptr(th_ProblemName,&meshset,1,tag_data,tag_sizes); CHKERRQ_MOAB(rval);
38  //create entry
39  std::pair<Problem_multiIndex::iterator,bool> p = pRoblems.insert(Problem(moab,meshset));
40  NOT_USED(p);
41  assert(p.second);
42  if(verbose>0) {
43  std::ostringstream ss;
44  ss << "add problem: " << name << std::endl;
45  PetscPrintf(cOmm,ss.str().c_str());
46  }
48 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
Tag th_ProblemName
Definition: Core.hpp:195
Tag th_ProblemId
Definition: Core.hpp:195
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:244
int verbose
Verbosity level.
Definition: Core.hpp:827
#define NOT_USED(x)
Definition: definitions.h:330

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

50  {
52  if(verb==-1) verb = verbose;
53  typedef Problem_multiIndex::index<Problem_mi_tag>::type mofem_problems_by_name;
54  const mofem_problems_by_name& set = pRoblems.get<Problem_mi_tag>();
55  mofem_problems_by_name::iterator miit = set.find(name);
56  if(miit==set.end()) {
58  ierr = add_problem(id,name); CHKERRG(ierr);
59  } else if(bh == MF_EXCL) {
60  SETERRQ1(PETSC_COMM_SELF,MOFEM_NOT_FOUND,"problem is in database %s",name.c_str());
61  }
63 }
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:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
BitProblemId getProblemShift()
Return unique problem Id.
Definition: Core.cpp:209
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:244
int verbose
Verbosity level.
Definition: Core.hpp:827
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 211 of file FieldCore.cpp.

213  {
214 
215  *buildMoFEM = 0;
216  EntityHandle idm = no_handle;
217  if(verb==-1) verb = verbose;
219  try {
220  idm = get_field_meshset(name);
221  } catch (MoFEMException const &e) {
222  SETERRQ(cOmm,e.errorCode,e.errorMessage);
223  }
224  FieldSpace space;
225  rval = moab.tag_get_data(th_FieldSpace,&idm,1,&space); CHKERRQ_MOAB(rval);
226  Range nodes,faces,edges;
227  switch(space) {
228  case L2:
229  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
230  if(verb>1) {
231  std::ostringstream ss;
232  ss << "add entities to field " << name;
233  ss << " nb. add ents " << ents.size();
234  ss << std::endl;
235  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
236  }
237  break;
238  case H1:
239  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
240  if(dim>0) {
241  rval = moab.get_adjacencies(
242  ents,0,false,nodes,moab::Interface::UNION
243  ); CHKERRQ_MOAB(rval);
244  {
245  Range topo_nodes;
246  rval = moab.get_connectivity(
247  ents,topo_nodes,true
248  ); CHKERRQ_MOAB(rval);
249  Range mid_nodes;
250  rval = moab.get_connectivity(
251  ents,mid_nodes,false
252  ); CHKERRQ_MOAB(rval);
253  mid_nodes = subtract(mid_nodes,topo_nodes);
254  nodes = subtract(nodes,mid_nodes);
255  }
256  rval = moab.add_entities(idm,nodes); CHKERRQ_MOAB(rval);
257  }
258  if(dim>2) {
259  rval = moab.get_adjacencies(
260  ents,2,false,faces,moab::Interface::UNION
261  ); CHKERRQ_MOAB(rval);
262  rval = moab.add_entities(idm,faces); CHKERRQ_MOAB(rval);
263  }
264  if(dim>1) {
265  rval = moab.get_adjacencies(
266  ents,1,false,edges,moab::Interface::UNION
267  ); CHKERRQ_MOAB(rval);
268  rval = moab.add_entities(idm,edges); CHKERRQ_MOAB(rval);
269  }
270  if(verb>1) {
271  std::ostringstream ss;
272  ss << "add entities to field " << name;
273  ss << " nb. add ents " << ents.size();
274  ss << " nb. add faces " << faces.size();
275  ss << " nb. add edges " << edges.size();
276  ss << " nb. add nodes " << nodes.size();
277  ss << std::endl;
278  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
279  }
280  break;
281  case HCURL:
282  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
283  if(dim>2) {
284  rval = moab.get_adjacencies(ents,2,false,faces,moab::Interface::UNION
285  ); CHKERRQ_MOAB(rval);
286  rval = moab.add_entities(idm,faces); CHKERRQ_MOAB(rval);
287  }
288  if(dim>1) {
289  rval = moab.get_adjacencies(
290  ents,1,false,edges,moab::Interface::UNION
291  ); CHKERRQ_MOAB(rval);
292  rval = moab.add_entities(idm,edges); CHKERRQ_MOAB(rval);
293  }
294  if(verb>1) {
295  std::ostringstream ss;
296  ss << "add entities to field " << name;
297  ss << " nb. add ents " << ents.size();
298  ss << " nb. add faces " << faces.size();
299  ss << " nb. add edges " << edges.size();
300  ss << std::endl;
301  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
302  }
303  break;
304  case HDIV:
305  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
306  if(dim>2) {
307  rval = moab.get_adjacencies(
308  ents,2,false,faces,moab::Interface::UNION
309  ); CHKERRQ_MOAB(rval);
310  rval = moab.add_entities(idm,faces); CHKERRQ_MOAB(rval);
311  }
312  if(verb>1) {
313  std::ostringstream ss;
314  ss << "add entities to field " << name;
315  ss << " nb. add ents " << ents.size();
316  ss << " nb. add faces " << faces.size();
317  ss << std::endl;
318  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
319  }
320  break;
321  default:
322  SETERRQ(cOmm,MOFEM_DATA_INCONSISTENCY,"sorry, unknown space added to entity");
323  }
324  if(verb>1) {
325  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
326  }
328 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
Tag th_FieldSpace
Definition: Core.hpp:191
field with continuous normal traction
Definition: definitions.h:176
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
const EntityHandle no_handle
Definition: Common.hpp:133
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:838
field with continuous tangents
Definition: definitions.h:177
FieldSpace
approximation spaces
Definition: definitions.h:172
int verbose
Verbosity level.
Definition: Core.hpp:827
EntityHandle get_field_meshset(const BitFieldId id) const
Definition: FieldCore.cpp:36
continuous field
Definition: definitions.h:175
field with C-1 continuity
Definition: definitions.h:178

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

233  {
235  if (verb == -1)
236  verb = verbose;
237  std::pair<RefEntity_multiIndex::iterator, bool> p_ent;
238  p_ent = refinedEntities.insert(
239  boost::make_shared<RefEntity>(basicEntityDataPtr, prism));
240  if (p_ent.second) {
241  std::pair<RefElement_multiIndex::iterator, bool> p_MoFEMFiniteElement;
242  p_MoFEMFiniteElement = refinedFiniteElements.insert(ptrWrapperRefElement(
243  boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first))));
244  int num_nodes;
245  const EntityHandle *conn;
246  CHKERR moab.get_connectivity(prism, conn, num_nodes, true);
247  Range face_side3, face_side4;
248  CHKERR moab.get_adjacencies(conn, 3, 2, false, face_side3);
249  CHKERR moab.get_adjacencies(&conn[3], 3, 2, false, face_side4);
250  if (face_side3.size() != 1)
251  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
252  "prism don't have side face 3");
253  if (face_side4.size() != 1)
254  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
255  "prims don't have side face 4");
256  p_MoFEMFiniteElement.first->getSideNumberPtr(*face_side3.begin());
257  p_MoFEMFiniteElement.first->getSideNumberPtr(*face_side4.begin());
258  }
260 }
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:231
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:444
interface_RefElement< RefElement > ptrWrapperRefElement
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:232
#define CHKERR
Inline error check.
Definition: definitions.h:563
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:212
int verbose
Verbosity level.
Definition: Core.hpp:827
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:389

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

753  {
755  if(verb==-1) verb = verbose;
756  if(!((*buildMoFEM)&BUILD_FIELD)) SETERRQ(cOmm,MOFEM_NOT_FOUND,"field not build");
757  if(!((*buildMoFEM)&BUILD_FE)) SETERRQ(cOmm,MOFEM_NOT_FOUND,"fe not build");
758  EntFiniteElement_multiIndex::iterator fit = entsFiniteElements.begin();
759  for(;fit!=entsFiniteElements.end();fit++) {
760  if(
761  (*fit)->getBitFieldIdRow().none() &&
762  (*fit)->getBitFieldIdCol().none() &&
763  (*fit)->getBitFieldIdData().none()
764  ) continue;
765  if(!ents.empty()) {
766  if(ents.find((*fit)->getEnt())==ents.end()) continue;
767  }
768  int by = BYROW;
769  if((*fit)->getBitFieldIdRow()!=(*fit)->getBitFieldIdCol()) by |= BYCOL;
770  if((*fit)->getBitFieldIdRow()!=(*fit)->getBitFieldIdData()) by |= BYDATA;
771  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_row(by);
772  UId ent_uid = UId(0);
773  DofEntity_multiIndex_uid_view::iterator rvit;
774  rvit = (*fit)->row_dof_view->begin();
775  for(;rvit!=(*fit)->row_dof_view->end();rvit++) {
776  if(ent_uid == (*rvit)->getFieldEntityPtr()->getGlobalUniqueId()) continue;
777  ent_uid = (*rvit)->getFieldEntityPtr()->getGlobalUniqueId();
778  std::pair<FieldEntityEntFiniteElementAdjacencyMap_multiIndex::iterator,bool> p;
779  p = entFEAdjacencies.insert(
780  FieldEntityEntFiniteElementAdjacencyMap((*rvit)->getFieldEntityPtr(),*fit)
781  );
782  bool success = entFEAdjacencies.modify(p.first,modify_row);
783  if(!success) SETERRQ(cOmm,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
784  }
785  if((*fit)->getBitFieldIdRow()!=(*fit)->getBitFieldIdCol()) {
786  int by = BYCOL;
787  if((*fit)->getBitFieldIdCol()!=(*fit)->getBitFieldIdData()) by |= BYDATA;
788  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_col(by);
789  ent_uid = UId(0);
790  DofEntity_multiIndex_uid_view::iterator cvit;
791  cvit = (*fit)->col_dof_view->begin();
792  for(;cvit!=(*fit)->col_dof_view->end();cvit++) {
793  if( ent_uid == (*cvit)->getFieldEntityPtr()->getGlobalUniqueId()) continue;
794  ent_uid = (*cvit)->getFieldEntityPtr()->getGlobalUniqueId();
795  std::pair<FieldEntityEntFiniteElementAdjacencyMap_multiIndex::iterator,bool> p;
796  p = entFEAdjacencies.insert(
797  FieldEntityEntFiniteElementAdjacencyMap((*cvit)->getFieldEntityPtr(),*fit)
798  );
799  bool success = entFEAdjacencies.modify(p.first,modify_col);
800  if(!success) SETERRQ(cOmm,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
801  }
802  }
803  if(
804  (*fit)->getBitFieldIdRow()!=(*fit)->getBitFieldIdData()||
805  (*fit)->getBitFieldIdCol()!=(*fit)->getBitFieldIdData()
806  ) {
807  FieldEntityEntFiniteElementAdjacencyMap_change_ByWhat modify_data(BYDATA);
808  ent_uid = UId(0);
809  FEDofEntity_multiIndex::iterator dvit;
810  dvit = (*fit)->data_dofs->begin();
811  for(;dvit!=(*fit)->data_dofs->end();dvit++) {
812  if(ent_uid == (*dvit)->getFieldEntityPtr()->getGlobalUniqueId()) continue;
813  ent_uid = (*dvit)->getFieldEntityPtr()->getGlobalUniqueId();
814  std::pair<FieldEntityEntFiniteElementAdjacencyMap_multiIndex::iterator,bool> p;
815  p = entFEAdjacencies.insert(
816  FieldEntityEntFiniteElementAdjacencyMap((*dvit)->getFieldEntityPtr(),*fit)
817  );
818  bool success = entFEAdjacencies.modify(p.first,modify_data);
819  if(!success) SETERRQ(cOmm,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
820  }
821  }
822  }
823  if(verbose>1) {
825  }
826  if(verbose>0) {
827  PetscSynchronizedPrintf(cOmm,"Nb. entFEAdjacencies %u\n",entFEAdjacencies.size());
828  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
829  }
830  *buildMoFEM |= 1<<2;
832  }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
uint128_t UId
Unique Id.
Definition: Common.hpp:136
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:838
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:242
int verbose
Verbosity level.
Definition: Core.hpp:827
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:239
MoFEMErrorCode list_adjacencies() const
list adjacencies
Definition: FieldCore.cpp:1190

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

842  {
844  if(verb==-1) verb = verbose;
845  ierr = build_adjacencies(bit,BitRefLevel().set(),verb); CHKERRG(ierr);
847  }
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=-1)
build adjacencies
Definition: FECore.cpp:753
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int verbose
Verbosity level.
Definition: Core.hpp:827

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

834  {
836  if(verb==-1) verb = verbose;
837  Range ents;
838  ierr = BitRefManager(*this).getEntitiesByRefLevel(bit,mask,ents); CHKERRG(ierr);
839  ierr = build_adjacencies(ents,verb); CHKERRG(ierr);
841  }
MoFEMErrorCode build_adjacencies(const Range &ents, int verb=-1)
build adjacencies
Definition: FECore.cpp:753
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int verbose
Verbosity level.
Definition: Core.hpp:827

◆ build_fields()

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

build fields

Implements MoFEM::CoreInterface.

Definition at line 1050 of file FieldCore.cpp.

1050  {
1052  if(verb==-1) verb = verbose;
1053  typedef Field_multiIndex::index<BitFieldId_mi_tag>::type FieldSetById;
1054  FieldSetById &set_id = fIelds.get<BitFieldId_mi_tag>();
1055  FieldSetById::iterator miit = set_id.begin();
1056  for(;miit!=set_id.end();miit++) {
1057  std::map<EntityType,int> dof_counter;
1058  std::map<EntityType,int> inactive_dof_counter;
1059  if (verb > 0) {
1060  PetscSynchronizedPrintf(
1061  cOmm,"Build Field %s (rank %d)\n",(*miit)->getName().c_str(),rAnk
1062  );
1063  }
1064  switch ((*miit)->getSpace()) {
1065  case NOFIELD:
1067  (*miit)->getId(),dof_counter,verb
1068  ); CHKERRG(ierr);
1069  break;
1070  case L2:
1071  case H1:
1072  case HCURL:
1073  case HDIV:
1075  (*miit)->getId(),
1076  dof_counter,
1077  inactive_dof_counter,
1078  verb
1079  ); CHKERRG(ierr);
1080  break;
1081  default:
1082  SETERRQ(cOmm,MOFEM_NOT_IMPLEMENTED,"not implemented");
1083  }
1084  if (verb > 0) {
1085  int nb_added_dofs = 0;
1086  int nb_inactive_added_dofs = 0;
1087  for(std::map<EntityType,int>::iterator it = dof_counter.begin();it!=dof_counter.end();it++) {
1088  switch (it->first) {
1089  case MBVERTEX:
1090  PetscSynchronizedPrintf(
1091  cOmm,
1092  "nb added dofs (vertices) %d (inactive %d)\n",
1093  it->second,inactive_dof_counter[it->first]
1094  );
1095  break;
1096  case MBEDGE:
1097  PetscSynchronizedPrintf(
1098  cOmm,
1099  "nb added dofs (edges) %d (inactive %d)\n",
1100  it->second,inactive_dof_counter[it->first]
1101  );
1102  break;
1103  case MBTRI:
1104  PetscSynchronizedPrintf(
1105  cOmm,
1106  "nb added dofs (triangles) %d (inactive %d)\n",
1107  it->second,inactive_dof_counter[it->first]
1108  );
1109  break;
1110  case MBQUAD:
1111  PetscSynchronizedPrintf(
1112  cOmm,
1113  "nb added dofs (quads) %d (inactive %d)\n",
1114  it->second,inactive_dof_counter[it->first]
1115  );
1116  break;
1117  case MBTET:
1118  PetscSynchronizedPrintf(
1119  cOmm,
1120  "nb added dofs (tets) %d (inactive %d)\n",
1121  it->second,inactive_dof_counter[it->first]
1122  );
1123  break;
1124  case MBPRISM:
1125  PetscSynchronizedPrintf(
1126  cOmm,
1127  "nb added dofs (prisms) %d (inactive %d)\n",
1128  it->second,inactive_dof_counter[it->first]
1129  );
1130  break;
1131  case MBENTITYSET:
1132  PetscSynchronizedPrintf(
1133  cOmm,
1134  "nb added dofs (meshsets) %d (inactive %d)\n",
1135  it->second,inactive_dof_counter[it->first]
1136  );
1137  break;
1138  default:
1139  SETERRQ(cOmm,MOFEM_NOT_IMPLEMENTED,"not implemented");
1140  }
1141  nb_added_dofs += it->second;
1142  nb_inactive_added_dofs += inactive_dof_counter[it->first];
1143  }
1144  if(verbose>0) {
1145  PetscSynchronizedPrintf(
1146  cOmm,
1147  "nb added dofs %d (number of inactive dofs %d)\n",
1148  nb_added_dofs,nb_inactive_added_dofs
1149  );
1150  }
1151  }
1152  }
1153  *buildMoFEM = 1<<0;
1154  if(verb>0) {
1155  PetscSynchronizedPrintf(cOmm,"Nb. dofs %u\n",dofsField.size());
1156  }
1157  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
1159  //return 0;
1160 }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:236
field with continuous normal traction
Definition: definitions.h:176
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
scalar or vector of scalars describe (no true field)
Definition: definitions.h:174
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:807
MoFEMErrorCode buildFieldForNoField(const BitFieldId id, std::map< EntityType, int > &dof_counter, int verb=-1)
Definition: FieldCore.cpp:729
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:838
field with continuous tangents
Definition: definitions.h:177
Field_multiIndex fIelds
fields
Definition: Core.hpp:234
MoFEMErrorCode buildFieldForL2H1HcurlHdiv(const BitFieldId id, std::map< EntityType, int > &dof_counter, std::map< EntityType, int > &inactive_dof_counter, int verb=-1)
Definition: FieldCore.cpp:818
int verbose
Verbosity level.
Definition: Core.hpp:827
continuous field
Definition: definitions.h:175
field with C-1 continuity
Definition: definitions.h:178

◆ build_finite_elements() [1/4]

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

683  {
685  if(verb==-1) verb = verbose;
686 
687  FiniteElement_multiIndex::iterator fe_miit = finiteElements.begin();
688 
689  // loop Finite Elements
690  for(;fe_miit!=finiteElements.end();fe_miit++) {
691  if(verb>0) PetscPrintf(cOmm,"Build Finite Elements %s\n",(*fe_miit)->getName().c_str());
692  ierr = build_finite_elements(*fe_miit,NULL,verb); CHKERRG(ierr);
693  }
694 
695  if(verb>0) {
696  PetscSynchronizedPrintf(cOmm,"Nb. FEs %u\n",entsFiniteElements.size());
697  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
698  typedef EntFiniteElement_multiIndex::index<BitFEId_mi_tag>::type FiniteElementById;
699  FiniteElementById &finite_elements_by_id = entsFiniteElements.get<BitFEId_mi_tag>();
700  FiniteElement_multiIndex::iterator fe_id_it = finiteElements.begin();
701  for(;fe_id_it!=finiteElements.end();fe_id_it++) {
702  FiniteElementById::iterator miit = finite_elements_by_id.lower_bound((*fe_id_it)->getId());
703  FiniteElementById::iterator hi_miit = finite_elements_by_id.upper_bound((*fe_id_it)->getId());
704  int count = distance(miit,hi_miit);
705  std::ostringstream ss;
706  ss << *(*fe_id_it) << " Nb. FEs " << count << std::endl;
707  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
708  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
709  }
710  }
711 
712  *buildMoFEM |= 1<<1;
714  }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:838
MoFEMErrorCode build_finite_elements(int verb=-1)
Build finite elementsBuild finite element data structures. Have to be run before problem and adjacenc...
Definition: FECore.cpp:683
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:238
int verbose
Verbosity level.
Definition: Core.hpp:827
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:239

◆ build_finite_elements() [2/4]

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

Definition at line 716 of file FECore.cpp.

716  {
718  SETERRQ(cOmm,MOFEM_NOT_IMPLEMENTED,"Not yet implemented");
720  }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474

◆ build_finite_elements() [3/4]

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

Definition at line 443 of file FECore.cpp.

444  {
446  if(verb==-1) verb = verbose;
447 
448  typedef RefElement_multiIndex::index<Ent_mi_tag>::type
449  RefFiniteElementByEnt;
450  typedef Field_multiIndex::index<BitFieldId_mi_tag>::type FieldById;
451  FieldById &fields_by_id = fIelds.get<BitFieldId_mi_tag>();
452 
453  //get id of mofem fields for row, col and data
454  enum IntLoop { ROW = 0, COL, DATA, LAST };
455  BitFieldId fe_fields[LAST] = {fe.get()->getBitFieldIdRow(),
456  fe.get()->getBitFieldIdCol(),
457  fe.get()->getBitFieldIdData()};
458 
459  //get finite element meshset
460  EntityHandle meshset = get_finite_element_meshset(fe.get()->getId());
461  // get entities from finite element meshset // if meshset
462  Range fe_ents;
463  rval = moab.get_entities_by_handle(meshset, fe_ents, false);
465  if (ents_ptr)
466  fe_ents = intersect(fe_ents, *ents_ptr);
467 
468  // map entity uid to pointers
469  typedef std::vector<boost::weak_ptr<EntFiniteElement> > VecOfWeakFEPtrs;
470  typedef std::pair<const UId *, VecOfWeakFEPtrs> EntUIdAndVecEakFEPtrs;
471  typedef multi_index_container<
472  EntUIdAndVecEakFEPtrs,
473  indexed_by<
474  sequenced<>,
475  hashed_non_unique<
476  member<EntUIdAndVecEakFEPtrs,const UId*,&EntUIdAndVecEakFEPtrs::first>
477  >
478  >
479  > EntUIdAndVecEakFEPtrs_multi_index;
480  EntUIdAndVecEakFEPtrs_multi_index entUIdAndFEVec;
481 
482  std::map<EntityHandle, int> data_dofs_size;
483 
484  //loop meshset Ents and add finite elements
485  for (Range::const_pair_iterator peit = fe_ents.const_pair_begin();
486  peit != fe_ents.const_pair_end(); peit++) {
487 
488  EntityHandle first = peit->first;
489  EntityHandle second = peit->second;
490 
491  // note: iterator is a wrapper
492  // check if is in refinedFiniteElements database
493  RefFiniteElementByEnt::iterator ref_fe_miit, hi_ref_fe_miit;
494  ref_fe_miit = refinedFiniteElements.get<Ent_mi_tag>().lower_bound(first);
495  if (ref_fe_miit == refinedFiniteElements.get<Ent_mi_tag>().end()) {
496  std::ostringstream ss;
497  ss << "refinedFiniteElements not in database ent = " << first;
498  ss << " type " << moab.type_from_handle(first);
499  ss << " " << *fe;
500  SETERRQ(cOmm, MOFEM_DATA_INCONSISTENCY, ss.str().c_str());
501  }
502  hi_ref_fe_miit =
503  refinedFiniteElements.get<Ent_mi_tag>().upper_bound(second);
504 
505  for (; ref_fe_miit != hi_ref_fe_miit; ref_fe_miit++) {
506 
507  std::pair<EntFiniteElement_multiIndex::iterator, bool> p =
508  entsFiniteElements.insert(boost::make_shared<EntFiniteElement>(
509  ref_fe_miit->getRefElement(), fe));
510 
511  if (fe_fields[ROW] == fe_fields[COL]) {
512  p.first->get()->col_dof_view = p.first->get()->row_dof_view;
513  }
514 
515  if (fe_fields[ROW] != fe_fields[COL] &&
516  p.first->get()->col_dof_view == p.first->get()->row_dof_view) {
517  p.first->get()->col_dof_view =
518  boost::make_shared<DofEntity_multiIndex_uid_view>();
519  }
520 
521  p.first->get()->row_dof_view->clear();
522  p.first->get()->col_dof_view->clear();
523  p.first->get()->data_dofs->clear();
524 
525  for (unsigned int ii = 0; ii < BitFieldId().size(); ii++) {
526 
527  // Common field id for ROW, COL and DATA
528  BitFieldId id_common = 0;
529  // Check if the field (ii) is added to finite element
530  for(int ss = 0;ss<LAST;ss++) {
531  id_common |= fe_fields[ss]&BitFieldId().set(ii);
532  }
533  if( id_common.none() ) continue;
534 
535  // Find in database data associated with the field (ii)
536  const BitFieldId field_id = BitFieldId().set(ii);
537  FieldById::iterator miit = fields_by_id.find(field_id);
538  if(miit==fields_by_id.end()) {
539  SETERRQ(cOmm,MOFEM_DATA_INCONSISTENCY,"Data inconsistency");
540  }
541 
542  // Entities adjacent to entities
543  Range adj_ents;
544 
545  // Resolve entities on element, those entities are used to build tag with dof
546  // uids on finite element tag
547  ierr = p.first->get()->getElementAdjacency(*miit, adj_ents);
548  CHKERRG(ierr);
549 
550  // Loop over adjacencies of element and find field entities on those
551  // adjacencies, that create hash map map_uid_fe which is used later
552  const std::string field_name = miit->get()->getName();
553  const bool add_to_data =
554  (field_id & p.first->get()->getBitFieldIdData()).any();
555  FieldEntity_multiIndex::index<
556  Composite_Name_And_Ent_mi_tag>::type::iterator meit;
557  for (Range::iterator eit = adj_ents.begin(); eit != adj_ents.end();
558  eit++) {
559  meit = entsFields.get<Composite_Name_And_Ent_mi_tag>().find(
560  boost::make_tuple(field_name, *eit));
561  if(meit!=entsFields.get<Composite_Name_And_Ent_mi_tag>().end()) {
562  const UId* uid_ptr = &(meit->get()->getGlobalUniqueId());
563  EntUIdAndVecEakFEPtrs_multi_index::nth_index<1>::type::iterator
564  e_uid_vec_fe_it;
565  e_uid_vec_fe_it = entUIdAndFEVec.get<1>().find(uid_ptr);
566  if(e_uid_vec_fe_it == entUIdAndFEVec.get<1>().end()) {
567  entUIdAndFEVec.insert(
568  entUIdAndFEVec.end(),
569  std::pair<const UId*, VecOfWeakFEPtrs>(
570  uid_ptr, VecOfWeakFEPtrs(1, *p.first)));
571  } else {
572  const VecOfWeakFEPtrs &vec_fe_ptrs = e_uid_vec_fe_it->second;
573  const_cast<VecOfWeakFEPtrs &>(vec_fe_ptrs).push_back(*p.first);
574  }
575 
576  if(add_to_data) {
577  data_dofs_size[p.first->get()->getEnt()] +=
578  meit->get()->getNbDofsOnEnt();
579  }
580  }
581  }
582  }
583  }
584  }
585 
586  std::map<
587  EntityHandle,
588  boost::shared_ptr<std::vector<FEDofEntity> >
589  > data_dofs_array;
590  for(
591  std::map<EntityHandle,int>::iterator
592  mit = data_dofs_size.begin();mit!=data_dofs_size.end();mit++
593  ) {
594  if(mit->second>0) {
595  data_dofs_array[mit->first] =
596  boost::make_shared<std::vector<FEDofEntity> >();
597  data_dofs_array[mit->first]->reserve(mit->second);
598  }
599  }
600  std::vector<boost::shared_ptr<FEDofEntity> > data_dofs_shared_array;
601 
602  typedef DofEntity_multiIndex::index<Unique_Ent_mi_tag>::type DofsByEntUId;
603  DofsByEntUId& dofs_by_ent_uid = dofsField.get<Unique_Ent_mi_tag>();
604 
605  // Loop over hash map, which has all entities on given elemnts
606  boost::shared_ptr<SideNumber> side_number_ptr;
607  for (EntUIdAndVecEakFEPtrs_multi_index::iterator mit =
608  entUIdAndFEVec.begin();
609  mit != entUIdAndFEVec.end(); mit++) {
610  DofsByEntUId::iterator dit,hi_dit;
611  dit = dofs_by_ent_uid.lower_bound(*mit->first);
612  hi_dit = dofs_by_ent_uid.upper_bound(*mit->first);
613  for(;dit!=hi_dit;dit++) {
614  // cerr << mit->first << endl;
615  // cerr << **dit << endl;
616  const BitFieldId field_id = dit->get()->getId();
617  const EntityHandle dof_ent = dit->get()->getEnt();
618  std::vector<boost::weak_ptr<EntFiniteElement> >::const_iterator fe_it,
619  hi_fe_it;
620  fe_it = mit->second.begin();
621  hi_fe_it = mit->second.end();
622  for(;fe_it!=hi_fe_it;fe_it++) {
623 
624  // if rows and columns of finite element are the same, then
625  // we exploit that case
626  if ((field_id & fe_it->lock().get()->getBitFieldIdRow()).any()) {
627  fe_it->lock().get()->row_dof_view->insert(
628  fe_it->lock().get()->row_dof_view->end(), *dit);
629  }
630  if (fe_it->lock().get()->col_dof_view !=
631  fe_it->lock().get()->row_dof_view) {
632  if((field_id&fe_it->lock().get()->getBitFieldIdCol()).any()) {
633  fe_it->lock().get()->col_dof_view->insert(
634  fe_it->lock().get()->col_dof_view->end(), *dit);
635  }
636  }
637 
638  // Add FEDofEntity, first create dofs, one by one, note that memory
639  // is already reserved. Then create shared pointers and finally add th_FEName
640  // to element multi-index
641  const EntityHandle fe_ent = fe_it->lock().get()->getEnt();
642  if(
643  data_dofs_size[fe_ent]!=0 &&
644  (field_id&fe_it->lock().get()->getBitFieldIdData()).any()
645  ) {
646  // There are data dofs on this element
647 
648  side_number_ptr = fe_it->lock().get()->getSideNumberPtr(dof_ent);
649  data_dofs_array[fe_ent]->push_back(FEDofEntity(side_number_ptr,*dit));
650  if(
651  data_dofs_array[fe_ent]->size()==(unsigned int)data_dofs_size[fe_ent]
652  ) {
653  // That means that FEDofEntity vector is full, and can be added to
654  // multi-index
655 
656  // Create shared pointers vector
657  data_dofs_shared_array.clear();
658  data_dofs_shared_array.reserve(data_dofs_size[fe_ent]);
659  for (std::vector<FEDofEntity>::iterator vit =
660  data_dofs_array[fe_ent]->begin();
661  vit != data_dofs_array[fe_ent]->end(); vit++) {
662  data_dofs_shared_array.push_back(boost::shared_ptr<FEDofEntity>(
663  data_dofs_array[fe_ent], &(*vit)));
664  }
665  fe_it->lock().get()->data_dofs->get<Unique_mi_tag>().insert(
666  data_dofs_shared_array.begin(),data_dofs_shared_array.end()
667  );
668  fe_it->lock().get()->getDofsSequence()=data_dofs_array[fe_ent];
669  }
670  // // add dofs to finite element multi_index database
671  // fe_it->lock().get()->data_dofs.get<Unique_mi_tag>().insert(
672  // boost::shared_ptr<FEDofEntity>(new FEDofEntity(side_number_ptr,*dit))
673  // );
674  }
675  }
676  }
677 
678  }
679 
681  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:236
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:204
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:235
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
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:474
uint128_t UId
Unique Id.
Definition: Common.hpp:136
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:232
Field_multiIndex fIelds
fields
Definition: Core.hpp:234
int verbose
Verbosity level.
Definition: Core.hpp:827
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:239

◆ build_finite_elements() [4/4]

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

722  {
724  if(verb==-1) verb = verbose;
725 
726  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator
727  fe_miit = finiteElements.get<FiniteElement_name_mi_tag>().find(fe_name);
728  if(fe_miit==finiteElements.get<FiniteElement_name_mi_tag>().end()) {
729  SETERRQ1(
731  "Finite element <%s> not found",fe_name.c_str()
732  );
733  }
734 
735  if(verb>0) PetscPrintf(cOmm,"Build Finite Elements %s\n",fe_name.c_str());
736  ierr = build_finite_elements(*fe_miit,ents_ptr,verb); CHKERRG(ierr);
737  if(verb>0) {
738  typedef EntFiniteElement_multiIndex::index<BitFEId_mi_tag>::type FiniteElementById;
739  FiniteElementById &finite_elements_by_id = entsFiniteElements.get<BitFEId_mi_tag>();
740  FiniteElementById::iterator miit = finite_elements_by_id.lower_bound((*fe_miit)->getId());
741  FiniteElementById::iterator hi_miit = finite_elements_by_id.upper_bound((*fe_miit)->getId());
742  int count = distance(miit,hi_miit);
743  std::ostringstream ss;
744  ss << *(*fe_miit) << " Nb. FEs " << count << std::endl;
745  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
746  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
747  }
748 
749  *buildMoFEM |= 1<<1;
751  }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:838
MoFEMErrorCode build_finite_elements(int verb=-1)
Build finite elementsBuild finite element data structures. Have to be run before problem and adjacenc...
Definition: FECore.cpp:683
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:238
int verbose
Verbosity level.
Definition: Core.hpp:827
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:239

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

174  {
176  if(verb==-1) verb = verbose;
177  DofEntity_multiIndex_active_view dofs_rows,dofs_cols;
178  Problem_multiIndex::iterator p_miit = pRoblems.begin();
179  for(;p_miit!=pRoblems.end();p_miit++) {
180  ierr = getInterface<ProblemsManager>()->buildProblemOnDistributedMesh(
181  const_cast<Problem*>(&*p_miit),verb
182  ); CHKERRG(ierr);
183  }
185 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:244
int verbose
Verbosity level.
Definition: Core.hpp:827

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

215  {
217  if(verb==-1) verb = verbose;
218  if(!((*buildMoFEM)&BUILD_FIELD)) SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"fields not build");
219  if(!((*buildMoFEM)&BUILD_FE)) SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"FEs not build");
220  if(!((*buildMoFEM)&BUILD_ADJ)) SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"adjacencies not build");
221  //iterate problems
222  Problem_multiIndex::iterator p_miit = pRoblems.begin();
223  for(;p_miit!=pRoblems.end();p_miit++) {
224  Problem *problem_ptr = const_cast<Problem*>(&*p_miit);
225  ierr = build_problem(problem_ptr,false,verb); CHKERRG(ierr);
226  }
229 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:838
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:244
int verbose
Verbosity level.
Definition: Core.hpp:827

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

823  {
825  if(verb==-1) verb = verbose;
826 
827  // Field by ID
828  typedef Field_multiIndex::index<BitFieldId_mi_tag>::type FieldSetById;
829 
830  // Find field
831  const FieldSetById &set_id = fIelds.get<BitFieldId_mi_tag>();
832  FieldSetById::iterator field_it = set_id.find(id);
833  if(field_it == set_id.end()) {
834  SETERRQ(cOmm,MOFEM_NOT_FOUND,"field not found");
835  }
836  const int rank = field_it->get()->getNbOfCoeffs();
837 
838  // Just check if there are any DOFs of given field are in database
839  const bool dofs_on_field =
840  dofsField.get<FieldName_mi_tag>().find(field_it->get()->getNameRef())!=
841  dofsField.get<FieldName_mi_tag>().end();
842 
843  // Ents in the field meshset
844  Range ents_of_id_meshset;
845  rval = moab.get_entities_by_handle((*field_it)->meshSet,ents_of_id_meshset,false); CHKERRQ_MOAB(rval);
846  if(verb>5) {
847  PetscSynchronizedPrintf(
848  cOmm,"ents in field %s meshset %d\n",(*field_it)->getName().c_str(),ents_of_id_meshset.size()
849  );
850  }
851 
852  // View of vertex entities to which dofs in given field are added
854  std::vector<boost::shared_ptr<DofEntity> > dofs_shared_array;
855 
856  // Loop over all entities and insert dofs by Sequences on edges, faces and volumes
857  Range::iterator eit = ents_of_id_meshset.begin();
858  for(;eit!=ents_of_id_meshset.end();eit++) {
859 
860  // Find mofem entity
861  FieldEntity_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type::iterator e_miit;
862  e_miit = entsFields.get<Composite_Name_And_Ent_mi_tag>().find(
863  boost::make_tuple((*field_it)->getNameRef(),*eit)
864  );
865  if(e_miit == entsFields.get<Composite_Name_And_Ent_mi_tag>().end()) continue;
866 
867  // Get shared ptr to entity
868  boost::shared_ptr<FieldEntity> field_ent = *e_miit;
869 
870  // Current dofs on entity
871  const int current_nb_dofs_on_ent =
872  !dofs_on_field ? 0 : dofsField.get<Composite_Name_And_Ent_mi_tag>().count(
873  boost::make_tuple(field_it->get()->getNameRef(),*eit)
874  );
875 
876  // Insert DOFs into databse
877  const int nb_dofs_on_ent = field_ent->getNbDofsOnEnt();
878  const int nb_active_dosf_on_ent = rank*field_ent->getOrderNbDofs(field_ent->getMaxOrder());
879 
880  if(
881  field_ent->getEntType() == MBVERTEX &&
882  current_nb_dofs_on_ent == 0
883  ) {
884 
885  ents_view.push_back(field_ent);
886 
887  // // Only one DOF on entity, simply add it and job done
888  // // boost::movelib::unique_ptr<DofEntity> mdof
889  // // = boost::movelib::make_unique<DofEntity>(field_ent,0,0,0,true);
890  // // dofsField.insert(boost::move(mdof));
891  // dofsField.insert(
892  // boost::make_shared<DofEntity>(field_ent,0,0,0,true)
893  // );
894 
895  } else if(current_nb_dofs_on_ent>nb_active_dosf_on_ent) {
896 
897  // This is when order is reduced, or no dofs on entity are deleted,
898  // then some DOFs are set to inactive.
899 
900  // Get all DOFs which index is bigger than number of active DOFs
901  DofEntity_multiIndex::index<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>::type::iterator
902  dit,hi_dit;
903  dit = dofsField.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().lower_bound(
904  boost::make_tuple(
905  field_it->get()->getNameRef(),*eit,nb_dofs_on_ent
906  )
907  );
908  hi_dit = dofsField.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().upper_bound(
909  boost::make_tuple(
910  field_it->get()->getNameRef(),*eit,current_nb_dofs_on_ent
911  )
912  );
913 
914  // Modify DOFs as inactive
915  for(;dit!=hi_dit;dit++) {
916  bool success = dofsField.modify(
917  dofsField.project<0>(dit),DofEntity_active_change(false)
918  );
919  if(!success) {
920  SETERRQ(
921  cOmm,
923  "modification unsuccessful"
924  );
925  }
926  ++inactive_dof_counter[dit->get()->getEntType()];
927  }
928 
929  } else {
930 
931  // Allocate space for all dofs on this entity
932  boost::shared_ptr<std::vector<DofEntity> > dofs_array
933  = boost::make_shared<std::vector<DofEntity> >(std::vector<DofEntity>());
934  dofs_array->reserve(nb_dofs_on_ent);
935 
936  // Set weak pointer on entity to vector/Sequence with allocated dofs on
937  // this entity
938  field_ent->getDofsSequence() = dofs_array;
939 
940  // Temerary vector to store shared pointers
941  dofs_shared_array.clear();
942  dofs_shared_array.reserve(nb_dofs_on_ent);
943 
944  // Create dofs instances and shared pointers
945  int DD = 0;
946  // Loop orders (loop until max entity order is set)
947  for(int oo = 0;oo<=field_ent->getMaxOrder();oo++) {
948  // Loop nb. dofs at order oo
949  for(int dd = 0;dd<field_ent->getOrderNbDofsDiff(oo);dd++) {
950  // Loop rank
951  for(int rr = 0;rr<rank;rr++,DD++) {
952  // push back dofs instanca
953  // dofs_array->emplace_back(
954  // DofEntity(field_ent,oo,rr,DD,true)
955  // );
956  dofs_array->push_back(
957  DofEntity(field_ent,oo,rr,DD,true)
958  );
959  // Push back shared_ptr for DoFS. Note shared pointer is aliased
960  // to vector keeping all DOFs on the entity
961  // dofs_shared_array.emplace_back(
962  // boost::shared_ptr<DofEntity>(dofs_array,&dofs_array->back())
963  // );
964  dofs_shared_array.push_back(
965  boost::shared_ptr<DofEntity>(dofs_array,&dofs_array->back())
966  );
967  }
968  }
969  }
970  if(DD != field_ent->getNbDofsOnEnt()) {
971  std::ostringstream ss;
972  ss << "rank " << rAnk << " ";
973  ss << *field_ent << std::endl;
974  SETERRQ3(
976  "Expected number of DOFs on entity not equal to number added to database (DD = %d != %d = field_ent->getNbDofsOnEnt())\n"
977  "%s",
978  DD,field_ent->getNbDofsOnEnt(),ss.str().c_str()
979  );
980  }
981 
982  // Finally add dofs to multi-index
983  if(!dofs_shared_array.empty()) {
984 
985  // This is in case if some DOFs are already there, then need to
986  // replace existing shared_ptr with new one. Then old sequence will be
987  // released. If this is not done old and new sequence will exist in
988  // memory, that will be waste of space.
989 
990  std::vector<boost::shared_ptr<DofEntity> >::iterator vit;
991  vit = dofs_shared_array.begin();
992  for(int ii = 0;ii!=current_nb_dofs_on_ent;ii++,vit++) {
993  DofEntity_multiIndex::iterator d_miit;
994  d_miit = dofsField.find(vit->get()->getGlobalUniqueId());
995  if(d_miit == dofsField.end()) {
996  SETERRQ(cOmm,MOFEM_DATA_INCONSISTENCY,"DOFs is not there, but should be");
997  }
998  bool success = dofsField.modify(
999  d_miit,Dof_shared_ptr_change<DofEntity>(*vit)
1000  );
1001  if(!success) {
1002  SETERRQ(
1003  cOmm,
1005  "modification unsuccessful"
1006  );
1007  }
1008  }
1009  if(vit!=dofs_shared_array.end()) {
1010  // Those DOFs are added
1011  dof_counter[vit->get()->getEntType()] += std::distance(vit,dofs_shared_array.end());
1012  // Finally insert DOFs to database
1013  dofsField.insert(vit,dofs_shared_array.end());
1014  }
1015 
1016  }
1017 
1018  }
1019 
1020  }
1021 
1022  // Add vertices DOFs by bulk
1023  boost::shared_ptr<std::vector<DofEntity> > dofs_array
1024  = boost::make_shared<std::vector<DofEntity> >(std::vector<DofEntity>());
1025  // Add Sequence of DOFs to sequence container as weak_ptr
1026  dofs_array->reserve(rank*ents_view.size());
1027  // Add Sequence of DOFs to sequence container as weak_ptr
1028  field_it->get()->getDofSequenceContainer()->push_back(dofs_array);
1029  dofs_shared_array.clear();
1030  dofs_shared_array.reserve(dofs_array->size());
1031  for(
1032  FieldEntity_multiIndex_ent_view::iterator
1033  eit = ents_view.begin();eit!=ents_view.end();eit++
1034  ) {
1035  for(int r = 0;r!=rank;r++) {
1036  // Construct DOF
1037  dofs_array->push_back(DofEntity(*eit,1,r,r,true));
1038  // Construct aliased shared pointer
1039  dofs_shared_array.push_back(
1040  boost::shared_ptr<DofEntity>(dofs_array,&dofs_array->back())
1041  );
1042  ++dof_counter[MBVERTEX];
1043  }
1044  }
1045  // Insert into Multi-Index container
1046  dofsField.insert(dofs_shared_array.begin(),dofs_shared_array.end());
1047 
1049 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:236
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:235
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:807
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
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
multi_index_container< boost::shared_ptr< FieldEntity >, indexed_by< sequenced<>, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FieldEntity, EntityHandle,&FieldEntity::getEnt > > >> FieldEntity_multiIndex_ent_view
Field_multiIndex fIelds
fields
Definition: Core.hpp:234
int verbose
Verbosity level.
Definition: Core.hpp:827

◆ buildFieldForNoField()

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

Definition at line 729 of file FieldCore.cpp.

731  {
733  if(verb==-1) verb = verbose;
734  //field it
735  typedef Field_multiIndex::index<BitFieldId_mi_tag>::type FieldSetById;
736  const FieldSetById &set_id = fIelds.get<BitFieldId_mi_tag>();
737  //find fiels
738  FieldSetById::iterator miit = set_id.find(id);
739  if(miit == set_id.end()) {
740  SETERRQ(cOmm,MOFEM_NOT_FOUND,"field not found");
741  }
742 
743  //ents in the field meshset
744  Range ents_of_id_meshset;
745  rval = moab.get_entities_by_handle((*miit)->meshSet,ents_of_id_meshset,false); CHKERRQ_MOAB(rval);
746  if(verb>5) {
747  PetscSynchronizedPrintf(
748  cOmm,"ents in field %s meshset %d\n",(*miit)->getName().c_str(),ents_of_id_meshset.size()
749  );
750  }
751  for(
752  Range::iterator eit = ents_of_id_meshset.begin();
753  eit != ents_of_id_meshset.end();eit++
754  ) {
755  //serch if field meshset is in database
756  RefEntity_multiIndex::index<Ent_mi_tag>::type::iterator miit_ref_ent;
757  miit_ref_ent = refinedEntities.get<Ent_mi_tag>().find(*eit);
758  if(miit_ref_ent==refinedEntities.get<Ent_mi_tag>().end()) {
759  SETERRQ(
760  cOmm,
762  "Entity is not in MoFEM databse, entities in field meshset need to be seeded (i.e. bit ref level add to them)"
763  );
764  }
765  std::pair<FieldEntity_multiIndex::iterator,bool> e_miit;
766  try {
767  //create database entity
768  e_miit = entsFields.insert(boost::make_shared<FieldEntity>(*miit,*miit_ref_ent));
769  } catch (MoFEMException const &e) {
770  SETERRQ(cOmm,e.errorCode,e.errorMessage);
771  } catch (const std::exception& ex) {
772  std::ostringstream ss;
773  ss << ex.what() << std::endl;
774  SETERRQ(cOmm,MOFEM_STD_EXCEPTION_THROW,ss.str().c_str());
775  }
776  //this is nor real field in space (set order to zero)
777  bool success = entsFields.modify(e_miit.first,FieldEntity_change_order(0));
778  if(!success) SETERRQ(cOmm,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
779  FieldCoefficientsNumber rank = 0;
780  //create dofs on this entity (nb. of dofs is equal to rank)
781  for(;rank<(*e_miit.first)->getNbOfCoeffs();rank++) {
782  std::pair<DofEntity_multiIndex::iterator,bool> d_miit;
783  //check if dof is in darabase
784  d_miit.first = dofsField.project<0>(
785  dofsField.get<Unique_mi_tag>().find(DofEntity::getGlobalUniqueIdCalculate(rank,*(e_miit.first)))
786  );
787  //if dof is not in databse
788  if(d_miit.first==dofsField.end()) {
789  //insert dof
790  d_miit = dofsField.insert(boost::make_shared<DofEntity>(*(e_miit.first),0,rank,rank));
791  if(d_miit.second) {
792  dof_counter[MBENTITYSET]++; // Count entities in the meshset
793  }
794  bool success = dofsField.modify(d_miit.first,DofEntity_active_change(true));
795  if(!success) SETERRQ(cOmm,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
796  }
797  //check consistency
798  assert((*d_miit.first)->getEntType()==(*e_miit.first)->getEntType());
799  assert((*d_miit.first)->getId()==(*e_miit.first)->getId());
800  assert((*d_miit.first)->getMaxOrder()==0);
801  }
802  }
803  if(verb>2) {
804  typedef DofEntity_multiIndex::index<FieldName_mi_tag>::type DofsByName;
805  DofsByName &set = dofsField.get<FieldName_mi_tag>();
806  DofsByName::iterator miit2 = set.lower_bound(miit->get()->getNameRef());
807  DofsByName::iterator hi_miit2 = set.upper_bound(miit->get()->getNameRef());
808  assert(miit2!=hi_miit2);
809  for(;miit2!=hi_miit2;miit2++) {
810  std::ostringstream ss;
811  ss << *miit2 << std::endl;;
812  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
813  }
814  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
815  }
817 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
int FieldCoefficientsNumber
Number of field coefficients.
Definition: Common.hpp:132
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:236
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:231
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:235
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
Field_multiIndex fIelds
fields
Definition: Core.hpp:234
int verbose
Verbosity level.
Definition: Core.hpp:827
static UId getGlobalUniqueIdCalculate(const DofIdx dof, const boost::shared_ptr< FieldEntity > &ent_ptr)
Calculate UId for DOF.

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

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

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

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

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

1247  {
1249  Field_multiIndex::index<FieldName_mi_tag>::type::iterator it = fIelds.get<FieldName_mi_tag>().find(name);
1250  if(it == fIelds.get<FieldName_mi_tag>().end()) {
1251  SETERRQ1(cOmm,1,"field not found < %s >",name.c_str());
1252  }
1253  EntityHandle meshset = (*it)->getMeshset();
1254 
1255  int num_entities;
1256 
1257  rval = moab.get_number_entities_by_handle(meshset,num_entities); CHKERRQ_MOAB(rval);
1258  if(
1259  entsFields.get<FieldName_mi_tag>().count((*it)->getName()) > (unsigned int)num_entities
1260  ) {
1261  SETERRQ1(cOmm,1,"not equal number of entities in meshset and field multiindex < %s >",name.c_str());
1262  }
1264 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:235
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
Field_multiIndex fIelds
fields
Definition: Core.hpp:234

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

1265  {
1267  Field_multiIndex::index<FieldName_mi_tag>::type::iterator it = fIelds.get<FieldName_mi_tag>().begin();
1268  for(;it!=fIelds.get<FieldName_mi_tag>().end();it++) {
1269  if((*it)->getSpace() == NOFIELD) continue; //FIXME: should be treated properly, not test is just skipped for this NOFIELD space
1270  EntityHandle meshset = (*it)->getMeshset();
1271 
1272  int num_entities;
1273  rval = moab.get_number_entities_by_handle(meshset,num_entities); CHKERRQ_MOAB(rval);
1274  if(entsFields.get<FieldName_mi_tag>().count((*it)->getName()) > (unsigned int)num_entities) {
1275  SETERRQ1(cOmm,1,"not equal number of entities in meshset and field multiindex < %s >",(*it)->getName().c_str());
1276  }
1277  }
1279 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:235
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
scalar or vector of scalars describe (no true field)
Definition: definitions.h:174
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
Field_multiIndex fIelds
fields
Definition: Core.hpp:234

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

918  {
920  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
921  it = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
922  if(it == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
923  SETERRQ1(cOmm,1,"finite element not found < %s >",name.c_str());
924  }
925  EntityHandle meshset = (*it)->getMeshset();
926 
927  int num_entities;
928  rval = moab.get_number_entities_by_handle(meshset,num_entities); CHKERRQ_MOAB(rval);
929  if(
930  entsFiniteElements.get<FiniteElement_name_mi_tag>().count((*it)->getName().c_str())
931  != (unsigned int)num_entities
932  ) {
933  SETERRQ1(cOmm,1,"not equal number of entities in meshset and finite elements multiindex < %s >",(*it)->getName().c_str());
934  }
936  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:238
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:239

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

938  {
940  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
941  it = finiteElements.get<FiniteElement_name_mi_tag>().begin();
942  for(;it!=finiteElements.get<FiniteElement_name_mi_tag>().end();it++) {
943  EntityHandle meshset = (*it)->getMeshset();
944 
945  int num_entities;
946  rval = moab.get_number_entities_by_handle(meshset,num_entities); CHKERRQ_MOAB(rval);
947  if(entsFiniteElements.get<FiniteElement_name_mi_tag>().count((*it)->getName().c_str())
948  != (unsigned int)num_entities) {
949  SETERRQ1(cOmm,1,"not equal number of entities in meshset and finite elements multiindex < %s >",(*it)->getName().c_str());
950  }
951  }
953  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:803
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:238
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:239

◆ 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:244

◆ clear_adjacencies_entities() [1/2]

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

243  {
245  if(verb==-1) verb = verbose;
246  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::iterator ait;
247  ait = entFEAdjacencies.begin();
248  for(;ait!=entFEAdjacencies.end();) {
249  BitRefLevel bit2 = ait->entFieldPtr->getBitRefLevel();
250  if(ait->entFieldPtr->getEntType()==MBENTITYSET) {
251  ait++;
252  continue;
253  }
254  if((bit2&mask)!=bit2) {
255  ait++;
256  continue;
257  }
258  if((bit2&bit).none()) {
259  ait++;
260  continue;
261  }
262  ait = entFEAdjacencies.erase(ait);
263  }
265  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:242
int verbose
Verbosity level.
Definition: Core.hpp:827

◆ clear_adjacencies_entities() [2/2]

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

Definition at line 267 of file DeleteCore.cpp.

267  {
269  if(verb==-1) verb = verbose;
270  Range::iterator eit = ents.begin();
271  for(;eit!=ents.end();eit++) {
272  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<Ent_mi_tag>::type::iterator ait,hi_ait;
273  ait = entFEAdjacencies.get<Ent_mi_tag>().lower_bound(*eit);
274  hi_ait = entFEAdjacencies.get<Ent_mi_tag>().upper_bound(*eit);
275  for(;ait!=hi_ait;) {
276  if(ait->entFieldPtr->getName() == name) {
277  ait = entFEAdjacencies.get<Ent_mi_tag>().erase(ait);
278  } else {
279  ait++;
280  }
281  }
282  }
284  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:242
int verbose
Verbosity level.
Definition: Core.hpp:827

◆ clear_adjacencies_finite_elements() [1/2]

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

202  {
204  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::iterator ait;
205  ait = entFEAdjacencies.begin();
206  for(;ait!=entFEAdjacencies.end();) {
207  BitRefLevel bit2 = ait->entFePtr->getBitRefLevel();
208  if(ait->entFePtr->getEntType()==MBENTITYSET) {
209  ait++;
210  continue;
211  }
212  if((bit2&mask)!=bit2) {
213  ait++;
214  continue;
215  }
216  if((bit2&bit).none()) {
217  ait++;
218  continue;
219  }
220  ait = entFEAdjacencies.erase(ait);
221  }
223  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:242

◆ clear_adjacencies_finite_elements() [2/2]

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

Definition at line 224 of file DeleteCore.cpp.

224  {
226  if(verb==-1) verb = verbose;
227  Range::iterator eit = ents.begin();
228  for(;eit!=ents.end();eit++) {
229  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<FEEnt_mi_tag>::type::iterator ait,hi_ait;
230  ait = entFEAdjacencies.get<FEEnt_mi_tag>().lower_bound(*eit);
231  hi_ait = entFEAdjacencies.get<FEEnt_mi_tag>().upper_bound(*eit);
232  for(;ait!=hi_ait;) {
233  if(ait->entFePtr->getName() == name) {
234  ait = entFEAdjacencies.get<FEEnt_mi_tag>().erase(ait);
235  } else {
236  ait++;
237  }
238  }
239  }
241  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:242
int verbose
Verbosity level.
Definition: Core.hpp:827

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

494  {
496  if(verb==-1) verb = verbose;
497  ierr = clearMap(); CHKERRG(ierr);
499 }
MoFEMErrorCode clearMap()
Cleaning database.
Definition: Core.cpp:214
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int verbose
Verbosity level.
Definition: Core.hpp:827

◆ clear_dofs_fields() [1/2]

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

Clear dofs by bit level

Implements MoFEM::CoreInterface.

Definition at line 47 of file DeleteCore.cpp.

47  {
49  if(verb==-1) verb = verbose;
50  {
51  DofEntity_multiIndex::iterator dit;
52  dit = dofsField.begin();
53  for(;dit!=dofsField.end();) {
54  BitRefLevel bit2 = (*dit)->getBitRefLevel();
55  if((*dit)->getEntType()==MBENTITYSET) {
56  dit++;
57  continue;
58  }
59  if((bit2&mask)!=bit2) {
60  dit++;
61  continue;
62  }
63  if((bit2&bit).none()) {
64  dit++;
65  continue;
66  }
67  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<Unique_mi_tag>::type::iterator ait,hi_ait;
68  ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
69  hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
70  for(;ait!=hi_ait;ait++) {
71  boost::shared_ptr<EntFiniteElement> ent_fe_ptr;
72  ent_fe_ptr = ait->entFePtr;
73  ent_fe_ptr->row_dof_view->erase((*dit)->getGlobalUniqueId());
74  if(ent_fe_ptr->row_dof_view!=ent_fe_ptr->col_dof_view) {
75  ent_fe_ptr->col_dof_view->erase((*dit)->getGlobalUniqueId());
76  }
77  ent_fe_ptr->data_dofs->get<Unique_mi_tag>().erase((*dit)->getGlobalUniqueId());
78  }
79  dit = dofsField.erase(dit);
80  }
81  }
83  }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:236
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:242
int verbose
Verbosity level.
Definition: Core.hpp:827

◆ 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

Implements MoFEM::CoreInterface.

Definition at line 85 of file DeleteCore.cpp.

85  {
87  if(verb==-1) verb = verbose;
88  Range::iterator eit = ents.begin();
89  for(;eit!=ents.end();eit++) {
90  DofEntityByNameAndEnt::iterator dit,hi_dit;
91  dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().lower_bound(boost::make_tuple(name,*eit));
92  hi_dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().upper_bound(boost::make_tuple(name,*eit));
93  for(;dit!=hi_dit;) {
94  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<Unique_mi_tag>::type::iterator ait,hi_ait;
95  ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
96  hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
97  for(;ait!=hi_ait;ait++) {
98  boost::shared_ptr<EntFiniteElement> ent_fe_ptr;
99  ent_fe_ptr = ait->entFePtr;
100  ent_fe_ptr->row_dof_view->erase((*dit)->getGlobalUniqueId());
101  if(ent_fe_ptr->row_dof_view!=ent_fe_ptr->col_dof_view) {
102  ent_fe_ptr->col_dof_view->erase((*dit)->getGlobalUniqueId());
103  }
104  }
105  dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().erase(dit);
106  }
107  }
109  }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:236
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:242
int verbose
Verbosity level.
Definition: Core.hpp:827

◆ clear_ents_fields() [1/2]

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

Clear ents by bit level

Implements MoFEM::CoreInterface.

Definition at line 111 of file DeleteCore.cpp.

111  {
113  if(verb==-1) verb = verbose;
114  ierr = clear_dofs_fields(bit,mask,verb); CHKERRG(ierr);
115  ierr = clear_adjacencies_entities(bit,mask,verb); CHKERRG(ierr);
116  FieldEntity_multiIndex::iterator eit;
117  eit = entsFields.begin();
118  for(;eit!=entsFields.end();) {
119  if((*eit)->getEntType()==MBENTITYSET) {
120  eit++;
121  continue;
122  }
123  BitRefLevel bit2 = (*eit)->getBitRefLevel();
124  if((bit2&mask)!=bit2) {
125  eit++;
126  continue;
127  }
128  if((bit2&bit).none()) {
129  eit++;
130  continue;
131  }
132  EntityHandle ent = (*eit)->getEnt();
133  rval = moab.tag_delete_data((*eit)->sFieldPtr->th_AppOrder,&ent,1); CHKERRQ_MOAB(rval);
134  if((*eit)->tag_FieldData_size>0) {
135  rval = moab.tag_delete_data((*eit)->sFieldPtr->th_FieldData,&ent,1); CHKERRQ_MOAB(rval);
136  }
137  eit = entsFields.erase(eit);
138  }
140  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:482
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:235
MoFEMErrorCode clear_dofs_fields(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
Definition: DeleteCore.cpp:47
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
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:243
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
int verbose
Verbosity level.
Definition: Core.hpp:827

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

142  {
144  if(verb==-1) verb = verbose;
145  ierr = clear_dofs_fields(name,ents,verb); CHKERRG(ierr);
146  ierr = clear_adjacencies_entities(name,ents,verb); CHKERRG(ierr);
147  Range::iterator eit = ents.begin();
148  for(;eit!=ents.end();eit++) {
149  FieldEntity_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type::iterator dit,hi_dit;
150  dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().find(boost::make_tuple(name,*eit));
151  if(dit!=entsFields.get<Composite_Name_And_Ent_mi_tag>().end()) {
152  entsFields.get<Composite_Name_And_Ent_mi_tag>().erase(dit);
153  }
154  // hi_dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().upper_bound(boost::make_tuple(name,*eit));
155  // for(;dit!=hi_dit;) {
156  // dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().erase(dit);
157  // }
158  }
160  }
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:235
MoFEMErrorCode clear_dofs_fields(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
Definition: DeleteCore.cpp:47
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
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:243
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int verbose
Verbosity level.
Definition: Core.hpp:827

◆ clear_finite_elements() [1/2]

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

clear finite elements

Implements MoFEM::CoreInterface.

Definition at line 162 of file DeleteCore.cpp.

162  {
164  if(verb==-1) verb = verbose;
166  EntFiniteElement_multiIndex::iterator fe_it = entsFiniteElements.begin();
167  for(;fe_it!=entsFiniteElements.end();) {
168  BitRefLevel bit2 = (*fe_it)->getBitRefLevel();
169  if((*fe_it)->getEntType()==MBENTITYSET) {
170  fe_it++;
171  continue;
172  }
173  if((bit2&mask)!=bit2) {
174  fe_it++;
175  continue;
176  }
177  if((bit2&bit).none()) {
178  fe_it++;
179  continue;
180  }
181  fe_it = entsFiniteElements.erase(fe_it);
182  }
184  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:202
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int verbose
Verbosity level.
Definition: Core.hpp:827
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:239

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

186  {
188  if(verb==-1) verb = verbose;
190  Range::iterator eit = ents.begin();
191  for(;eit!=ents.end();eit++) {
192  EntFiniteElement_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type::iterator fit,hi_fit;
193  fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().lower_bound(boost::make_tuple(name,*eit));
194  hi_fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().upper_bound(boost::make_tuple(name,*eit));
195  for(;fit!=hi_fit;) {
196  fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().erase(fit);
197  }
198  }
200  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
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:202
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int verbose
Verbosity level.
Definition: Core.hpp:827
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:239

◆ clear_inactive_dofs()

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

Clear inactive dofs

Implements MoFEM::CoreInterface.

Definition at line 21 of file DeleteCore.cpp.

21  {
23  if(verb==-1) verb = verbose;
24  DofEntity_multiIndex::iterator dit;
25  dit = dofsField.begin();
26  for(;dit!=dofsField.end();dit++) {
27  if(!(*dit)->getActive()) {
28  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<Unique_mi_tag>::type::iterator ait,hi_ait;
29  ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
30  hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
31  for(;ait!=hi_ait;ait++) {
32  boost::shared_ptr<EntFiniteElement> ent_fe_ptr;
33  ent_fe_ptr = ait->entFePtr;
34  ent_fe_ptr->row_dof_view->erase((*dit)->getGlobalUniqueId());
35  if(ent_fe_ptr->row_dof_view!=ent_fe_ptr->col_dof_view) {
36  ent_fe_ptr->col_dof_view->erase((*dit)->getGlobalUniqueId());
37  }
38  ent_fe_ptr->data_dofs->get<Unique_mi_tag>().erase((*dit)->getGlobalUniqueId());
39  }
40  dit = dofsField.erase(dit);
41  if(dit==dofsField.end()) break;
42  }
43  }
45  }
DofEntity_multiIndex dofsField
dofs on fields
Definition: Core.hpp:236
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:242
int verbose
Verbosity level.
Definition: Core.hpp:827

◆ clear_problem()

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

clear problem

Implements MoFEM::CoreInterface.

Definition at line 187 of file ProblemsCore.cpp.

187  {
189  if(verb==-1) verb = verbose;
190  typedef Problem_multiIndex::index<Problem_mi_tag>::type pRoblemsByName;
191  pRoblemsByName &prob_by_name = pRoblems.get<Problem_mi_tag>();
192  pRoblemsByName::iterator p_miit = prob_by_name.find(problem_name);
193  if(p_miit == prob_by_name.end()) {
194  SETERRQ1(
195  PETSC_COMM_SELF,MOFEM_OPERATION_UNSUCCESSFUL,
196  "problem < %s > not found, (top tip: check spelling)",problem_name.c_str()
197  );
198  }
199  //zero rows
200  bool success = prob_by_name.modify(p_miit,ProblemZeroNbRowsChange());
201  if(!success) SETERRQ(PETSC_COMM_SELF,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
202  //zero cols
203  success = prob_by_name.modify(p_miit,ProblemZeroNbColsChange());
204  if(!success) SETERRQ(PETSC_COMM_SELF,