v0.5.86
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MoFEM::Core Struct Reference

Core (interface) classThis 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. More...

#include <src/interfaces/Core.hpp>

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

Public Types

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
}
 

Public Member Functions

PetscErrorCode queryInterface (const MOFEMuuid &uuid, UnknownInterface **iface)
 
PetscErrorCode query_interface_type (const std::type_info &iface_type, void *&ptr) const
 
 Core (moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, int verbose=1)
 
 ~Core ()
 
Tag get_th_RefParentHandle () const
 
Tag get_th_RefBitLevel () const
 
Tag get_th_RefBitEdge () const
 
Tag get_th_RefType () const
 
intgetBuildMoFEM () const
 Get flags/semaphores for different stages. More...
 
PetscErrorCode addPrismToDatabase (const EntityHandle prism, int verb=-1)
 
- Public Member Functions inherited from MoFEM::Interface
template<class IFace >
PetscErrorCode query_interface (IFace *&ptr) const
 
template<class IFace >
IFace * query_interface () const
 
template<typename DIT >
PetscErrorCode 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 funciont is not recommended to be used in finite elemeny implementation More...
 
template<typename DIT >
PetscErrorCode 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
virtual ~UnknownInterface ()
 
virtual PetscErrorCode getLibVersion (Version &version) const
 Get library version. More...
 
virtual const PetscErrorCode getFileVersion (moab::Interface &moab, Version &version) const
 Get database major version. More...
 
virtual PetscErrorCode getInterfaceVersion (Version &version) const
 Get database major version. More...
 

Public Attributes

moab::Interface & moab
 

Protected Member Functions

boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr ()
 Get pointer to basic entity data. More...
 
moab interface
moab::Interface & get_moab ()
 
const moab::Interface & get_moab () const
 
check consistency
PetscErrorCode check_number_of_ents_in_ents_field (const std::string &name) const
 check data consistency in entitiesPtr More...
 
PetscErrorCode check_number_of_ents_in_ents_field () const
 check data consistency in entitiesPtr More...
 
PetscErrorCode check_number_of_ents_in_ents_finite_element (const std::string &name) const
 check data consistency in entsFiniteElements More...
 
PetscErrorCode check_number_of_ents_in_ents_finite_element () const
 check data consistency in entsFiniteElements More...
 
clear database
PetscErrorCode clear_database (int verb=-1)
 Clear database. More...
 
PetscErrorCode rebuild_database (int verb=-1)
 Clear database and initialize it once again. More...
 
cubit meshsets
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...
 
DEPRECATED bool check_msId_meshset (const int ms_id, const CubitBCType cubit_bc_type)
 check for CUBIT Id and CUBIT type More...
 
DEPRECATED PetscErrorCode add_cubit_msId (const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
 add cubit meshset More...
 
DEPRECATED PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode delete_cubit_msId (const CubitBCType cubit_bc_type, const int ms_id)
 delete cubit meshset More...
 
DEPRECATED PetscErrorCode get_cubit_msId (const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr)
 get cubit meshset More...
 
DEPRECATED PetscErrorCode 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 PetscErrorCode get_cubit_msId_entities_by_dimension (const int ms_id, const CubitBCType cubit_bc_type, Range &entities, const bool recursive=false)
 
DEPRECATED PetscErrorCode get_cubit_msId_entities_by_dimension (const int ms_id, 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 PetscErrorCode get_cubit_msId_entities_by_dimension (const int ms_id, const unsigned int cubit_bc_type, Range &entities, const bool recursive=false)
 get entities related to CUBIT/meshset, More...
 
DEPRECATED PetscErrorCode get_cubit_msId_meshset (const int ms_id, const unsigned int cubit_bc_type, EntityHandle &meshset)
 get meshset from CUBIT Id and CUBIT type More...
 
DEPRECATED PetscErrorCode get_cubit_meshsets (const unsigned int cubit_bc_type, Range &meshsets)
 get all CUBIT meshsets by CUBIT type More...
 
DEPRECATED PetscErrorCode print_cubit_displacement_set () const
 
DEPRECATED PetscErrorCode print_cubit_pressure_set () const
 
DEPRECATED PetscErrorCode print_cubit_force_set () const
 
DEPRECATED PetscErrorCode print_cubit_temperature () const
 
DEPRECATED PetscErrorCode print_cubit_heat_flux_set () const
 
DEPRECATED PetscErrorCode print_cubit_materials_set () const
 
PetscErrorCode seed_finite_elements (const Range &entities, int verb=-1)
 
PetscErrorCode seed_finite_elements (const EntityHandle meshset, int verb=-1)
 
DEPRECATED PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode seed_ref_level_MESHSET (const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode update_field_meshset_by_entities_children (const BitRefLevel &child_bit, int verb=-1)
 update fields meshesets by child entities More...
 
PetscErrorCode update_field_meshset_by_entities_children (const std::string name, const BitRefLevel &child_bit, int verb=-1)
 update field mesheset by child entities More...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode remove_ents_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 remove entities form mofem database More...
 
PetscErrorCode delete_finite_elements_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 remove finite element from mofem database More...
 
PetscErrorCode shift_left_bit_ref (const int shif, int verb=-1)
 left shift bit ref level this results of deletion of entities on far left side More...
 
PetscErrorCode shift_right_bit_ref (const int shift, int verb=-1)
 right shift bit ref level More...
 
PetscErrorCode synchronise_entities (Range &ent, int verb=-1)
 
PetscErrorCode synchronise_field_entities (const BitFieldId id, int verb=-1)
 
PetscErrorCode synchronise_field_entities (const std::string &name, int verb=-1)
 
PetscErrorCode add_field (const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_cooficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=-1)
 Add filed. More...
 
PetscErrorCode addEntsToFieldByDim (const Range &ents, const int dim, const std::string &name, int verb=-1)
 
PetscErrorCode add_ents_to_field_by_dim (const Range &ents, const int dim, const std::string &name, int verb=-1)
 Add field with default AINSWORTH_LEGENDRE_BASE approximation base. More...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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
PetscErrorCode remove_ents_from_field_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 remove entities from field More...
 
PetscErrorCode remove_ents_from_field (const std::string &name, const EntityHandle meshset, const EntityType type, int verb=-1)
 remove entities from field More...
 
PetscErrorCode remove_ents_from_field (const std::string &name, const Range &ents, int verb=-1)
 remove entities from field More...
 
PetscErrorCode set_field_order (const Range &ents, const BitFieldId id, const ApproximationOrder order, int verb=-1)
 set approximation order More...
 
PetscErrorCode set_field_order (const EntityHandle meshset, const EntityType type, const BitFieldId id, const ApproximationOrder order, int verb=-1)
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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)
 
PetscErrorCode 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
PetscErrorCode buildFieldForNoField (const BitFieldId id, std::map< EntityType, int > &dof_counter, int verb=-1)
 
PetscErrorCode buildFieldForL2H1HcurlHdiv (const BitFieldId id, std::map< EntityType, int > &dof_counter, std::map< EntityType, int > &inactive_dof_counter, int verb=-1)
 
PetscErrorCode build_fields (int verb=-1)
 
PetscErrorCode clear_inactive_dofs (int verb=-1)
 
PetscErrorCode clear_dofs_fields (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
PetscErrorCode clear_ents_fields (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
PetscErrorCode clear_dofs_fields (const std::string &name, const Range ents, int verb=-1)
 
PetscErrorCode clear_ents_fields (const std::string &name, const Range enst, int verb=-1)
 
other auxiliary functions for fields
PetscErrorCode list_dofs_by_field_name (const std::string &name) const
 
PetscErrorCode 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...
 
PetscErrorCode get_field_entities_by_dimension (const std::string name, int dim, Range &ents) const
 get entities in the field by dimension More...
 
PetscErrorCode get_field_entities_by_type (const std::string name, EntityType type, Range &ents) const
 get entities in the field by type More...
 
PetscErrorCode 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...
 
PetscErrorCode add_finite_element (const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL)
 add finite element More...
 
PetscErrorCode 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...
 
PetscErrorCode modify_finite_element_add_field_data (const std::string &fe_name, const std::string &name_filed)
 set finite element field data More...
 
PetscErrorCode modify_finite_element_add_field_row (const std::string &fe_name, const std::string &name_row)
 set field row which finite element use More...
 
PetscErrorCode modify_finite_element_add_field_col (const std::string &fe_name, const std::string &name_col)
 set field col which finite element use More...
 
PetscErrorCode modify_finite_element_off_field_data (const std::string &fe_name, const std::string &name_filed)
 unset finite element field data More...
 
PetscErrorCode modify_finite_element_off_field_row (const std::string &fe_name, const std::string &name_row)
 unset field row which finite element use More...
 
PetscErrorCode modify_finite_element_off_field_col (const std::string &fe_name, const std::string &name_col)
 unset field col which finite element use More...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode add_ents_to_finite_element_by_type (const Range &ents, const EntityType type, const std::string &name)
 add entities to finite elements More...
 
PetscErrorCode add_ents_to_finite_element_by_dim (const Range &ents, const int dim, const std::string &name)
 add entities to finite elements More...
 
PetscErrorCode 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...
 
PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode add_ents_to_finite_element_by_EDGEs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add EDGES finite elements More...
 
DEPRECATED PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode add_ents_to_finite_element_by_PRISMs (const Range &prims, const BitFEId id)
 
DEPRECATED PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode remove_ents_from_finite_element (const std::string &name, const Range &ents, int verb=-1)
 remove entities from finite element database More...
 
PetscErrorCode 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
 
EntityHandle get_finite_element_meshset (const BitFEId id) const
 
EntityHandle get_finite_element_meshset (const std::string &name) const
 
PetscErrorCode get_finite_element_entities_by_dimension (const std::string name, int dim, Range &ents) const
 get entities in the finite element by dimension More...
 
PetscErrorCode get_finite_element_entities_by_type (const std::string name, EntityType type, Range &ents) const
 get entities in the finite element by type More...
 
PetscErrorCode get_finite_element_entities_by_handle (const std::string name, Range &ents) const
 get entities in the finite element by handle More...
 
PetscErrorCode list_finite_elements () const
 list finite elements in database More...
 
problems
PetscErrorCode add_problem (const BitProblemId id, const std::string &name)
 
PetscErrorCode 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...
 
PetscErrorCode delete_problem (const std::string name)
 Delete problem. More...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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
 
PetscErrorCode list_problem () const
 list problems More...
 
PetscErrorCode clear_problem (const std::string &name, int verb=-1)
 clear problem More...
 
PetscErrorCode clear_problems (int verb=-1)
 clear problems More...
 
PetscErrorCode build_finite_elements (int verb=-1)
 add entity EntFe to finite element data databse and resolve dofs on that entity More...
 
PetscErrorCode build_finite_elements (const BitRefLevel &bit, int verb=-1)
 
PetscErrorCode build_finite_elements (const boost::shared_ptr< FiniteElement > fe, const Range *ents_ptr=NULL, int verb=-1)
 
PetscErrorCode 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...
 
PetscErrorCode clear_finite_elements (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 
PetscErrorCode clear_finite_elements (const std::string &name, const Range &ents, int verb=-1)
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
DEPRECATED PetscErrorCode 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...
 
PetscErrorCode get_problem_finite_elements_entities (const std::string &name, const std::string &fe_name, const EntityHandle meshset)
 add finite elements to the meshset More...
 
build adjacencies
PetscErrorCode build_adjacencies (const Range &ents, int verb=-1)
 build adjacencies More...
 
PetscErrorCode build_adjacencies (const BitRefLevel &bit, int verb=-1)
 build adjacencies More...
 
PetscErrorCode build_adjacencies (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 build adjacencies More...
 
PetscErrorCode clear_adjacencies_finite_elements (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 clear adjacency map for finite elements on given bit level More...
 
PetscErrorCode clear_adjacencies_entities (const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
 clear adjacency map for entities on given bit level More...
 
PetscErrorCode clear_adjacencies_finite_elements (const std::string &name, const Range &ents, int verb=-1)
 
PetscErrorCode clear_adjacencies_entities (const std::string &name, const Range &ents, int verb=-1)
 
PetscErrorCode list_adjacencies () const
 list adjacencies More...
 
DEPRECATED PetscErrorCode build_problem_on_distributed_mesh (int verb=-1)
 build problem data structures, assuming that mesh is distributed (collective) More...
 
DEPRECATED PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode build_problem (const std::string &name, const bool square_matrix, int verb=-1)
 build problem data structures More...
 
DEPRECATED PetscErrorCode build_problem (Problem *problem_ptr, const bool square_matrix, int verb=-1)
 build problem data structures More...
 
DEPRECATED PetscErrorCode build_problems (int verb=-1)
 build problem data structures More...
 
DEPRECATED PetscErrorCode partition_simple_problem (const std::string &name, int verb=-1)
 partition problem dofs More...
 
DEPRECATED PetscErrorCode partition_problem (const std::string &name, int verb=-1)
 partition problem dofs (collective) More...
 
DEPRECATED PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode printPartitionedProblem (const Problem *problem_ptr, int verb=-1)
 
DEPRECATED PetscErrorCode debugPartitionedProblem (const Problem *problem_ptr, int verb=-1)
 
DEPRECATED PetscErrorCode partition_ghost_dofs (const std::string &name, int verb=-1)
 determine ghost nodes More...
 
DEPRECATED PetscErrorCode 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...
 
PetscErrorCode partition_check_matrix_fill_in (const std::string &problem_neme, int row, int col, int verb)
 check if matrix fill in correspond to finite element indices More...
 
vector and matrices
PetscErrorCode MatCreateMPIAIJWithArrays (const std::string &name, Mat *Aij, int verb=-1)
 create Mat (MPIAIJ) for problem (collective) More...
 
PetscErrorCode MatCreateMPIAdj_with_Idx_mi_tag (const std::string &name, Mat *Adj, int verb=-1)
 Create Adj matrix. More...
 
PetscErrorCode MatCreateSeqAIJWithArrays (const std::string &name, Mat *Aij, PetscInt **i, PetscInt **j, PetscScalar **v, int verb=-1)
 create Mat (AIJ) for problem More...
 
DEPRECATED PetscErrorCode VecCreateSeq (const std::string &name, RowColData rc, Vec *V) const
 create local vector for problem More...
 
DEPRECATED PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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...
 
scatter from problem filed to other problem field
DEPRECATED PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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 PetscErrorCode 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...
 
PetscErrorCode 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 PetscErrorCode ISCreateFromProblemToOtherProblem (const std::string &x_problem, RowColData x_rc, const std::string &y_problem, RowColData y_rc, std::vector< int > &idx, std::vector< int > &idy, int verb=-1) const
 
DEPRECATED PetscErrorCode ISCreateFromProblemToOtherProblem (const std::string &x_problem, RowColData x_rc, const std::string &y_problem, RowColData y_rc, IS *ix, IS *iy, int verb=-1) const
 
DEPRECATED PetscErrorCode 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...
 
vector local and global projection
DEPRECATED PetscErrorCode 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 PetscErrorCode set_other_local_ghost_vector (const std::string &name, 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 PetscErrorCode set_other_global_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 (collective)collective - need tu be run on all processors in communicator. More...
 
DEPRECATED PetscErrorCode set_other_global_ghost_vector (const std::string &name, 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 (collective)collective - need tu be run on all processors in communicator. More...
 
looping over finite elements
PetscErrorCode problem_basic_method_preProcess (const Problem *problem_ptr, BasicMethod &method, int verb=-1)
 Set data for BasicMethod. More...
 
PetscErrorCode problem_basic_method_preProcess (const std::string &problem_name, BasicMethod &method, int verb=-1)
 Set data for BasicMethod. More...
 
PetscErrorCode 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 MultIindices 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...
 
PetscErrorCode 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 MultIindices 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode loop_dofs (const std::string &field_name, EntMethod &method, int verb=-1)
 Make a loop over entities. More...
 
get multi_index form database
PetscErrorCode get_fields (const Field_multiIndex **fields_ptr) const
 Get fields multi-index from database. More...
 
PetscErrorCode get_ref_ents (const RefEntity_multiIndex **refined_entities_ptr) const
 Get ref entities multi-index from database. More...
 
PetscErrorCode get_ref_finite_elements (const RefElement_multiIndex **refined_finite_elements_ptr) const
 Get ref finite elements multi-index form database. More...
 
PetscErrorCode get_finite_elements (const FiniteElement_multiIndex **fe_ptr) const
 Get finite elements multi-index. More...
 
PetscErrorCode get_ents_finite_elements (const EntFiniteElement_multiIndex **fe_ent_ptr) const
 Get entities finite elements multi-index. More...
 
PetscErrorCode get_field_ents (const FieldEntity_multiIndex **field_ents) const
 Get field multi index. More...
 
PetscErrorCode get_dofs (const DofEntity_multiIndex **dofs_ptr) const
 Get dofs multi index. More...
 
PetscErrorCode get_problem (const std::string &problem_name, const Problem **problem_ptr) const
 Get problem database (data structure) More...
 
PetscErrorCode get_problems (const Problem_multiIndex **problems_ptr) const
 Get pointer to problems multi-index. More...
 
FieldEntityByFieldName::iterator get_ent_moabfield_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)for(IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
FieldEntityByFieldName::iterator get_ent_moabfield_by_name_end (const std::string &field_name) const
 get begin iterator of filed dofs of given name (instead you can use IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)for(IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
DofEntityByFieldName::iterator get_dofs_by_name_begin (const std::string &field_name) const
 get begin iterator of filed dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)for(IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
DofEntityByFieldName::iterator get_dofs_by_name_end (const std::string &field_name) const
 get begin iterator of filed dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)for(IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
DofEntityByNameAndEnt::iterator get_dofs_by_name_and_ent_begin (const std::string &field_name, const EntityHandle ent) const
 get begin iterator of filed dofs of given name and ent(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,ENT,IT)for(IT_GET_DOFS_FIELD_BY_NAME_AND_ENT_FOR_LOOP(MFIELD,NAME,ENT,IT)) { ... } More...
 
DofEntityByNameAndEnt::iterator get_dofs_by_name_and_ent_end (const std::string &field_name, const EntityHandle ent) const
 get begin iterator of filed dofs of given name and ent (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,ENT,IT)for(IT_GET_DOFS_FIELD_BY_NAME_AND_ENT_FOR_LOOP(MFIELD,NAME,ENT,IT)) { ... } More...
 
DofEntityByNameAndType::iterator get_dofs_by_name_and_type_begin (const std::string &field_name, const EntityType type) const
 get begin iterator of filed dofs of given name and ent type (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT)for(IT_GET_DOFS_FIELD_BY_NAME_AND_TYPE_FOR_LOOP(MFIELD,NAME,TYPE,IT)) { ... } More...
 
DofEntityByNameAndType::iterator get_dofs_by_name_and_type_end (const std::string &field_name, const EntityType ent) const
 get begin iterator of filed dofs of given name end ent type(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT)for(IT_GET_DOFS_FIELD_BY_NAME_AND_TYPE_FOR_LOOP(MFIELD,NAME,TYPE,IT)) { ... } More...
 
EntFiniteElementbyName::iterator get_fe_by_name_begin (const std::string &fe_name) const
 get begin iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)for(IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
EntFiniteElementbyName::iterator get_fe_by_name_end (const std::string &fe_name) const
 get end iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)for(IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
field axpy functions
DEPRECATED PetscErrorCode 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 PetscErrorCode field_scale (const double alpha, const std::string &fiel_name)
 scale field More...
 
DEPRECATED PetscErrorCode set_field (const double val, const EntityType type, const std::string &fiel_name)
 use FieldBlas More...
 
DEPRECATED PetscErrorCode set_field (const double val, const EntityType type, const Range &ents, const std::string &field_name)
 set field More...
 
get adjacencies
PetscErrorCode 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. More...
 
PetscErrorCode 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...
 
PetscErrorCode 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. More...
 
PetscErrorCode 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. More...
 

Protected Attributes

boost::ptr_map< unsigned long, UnknownInterfaceiFaces
 
intbuildMoFEM
 keeps flags/semaphores for different stages More...
 
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...
 
boost::shared_ptr< BasicEntityDatabasicEntityDataPtr
 
intfShift
 
intfeShift
 
intpShift
 Counting indexes. More...
 
int verbose
 Verbosity level. More...
 
Managing and storing basic entities
RefEntity_multiIndex refinedEntities
 refined entities More...
 
RefElement_multiIndex refinedFiniteElements
 refined elements More...
 
Managing and storung DOFs
Field_multiIndex fIelds
 field More...
 
FieldEntity_multiIndex entsFields
 entities on field More...
 
DofEntity_multiIndex dofsField
 dofs on fiels More...
 
Managing and storing finite elements
FiniteElement_multiIndex finiteElements
 finite elements More...
 
EntFiniteElement_multiIndex entsFiniteElements
 finite element entities More...
 
Managing and storing adjacencies
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
 adjacencies of elements to dofs More...
 
Managing problems
Problem_multiIndex pRoblems
 problems multi-index More...
 
logging events
PetscLogEvent USER_EVENT_preProcess
 
PetscLogEvent USER_EVENT_operator
 
PetscLogEvent USER_EVENT_postProcess
 
PetscLogEvent USER_EVENT_createMat
 
PetscLogEvent USER_EVENT_buildProblem
 

Core methods

Tag th_MoFEMBuild
 Internal use storing state, used to detect error and inconsistencies. More...
 
PetscErrorCode getTags (int verb=-1)
 
PetscErrorCode clearMap ()
 
BitFieldId getFieldShift ()
 
BitFEId getFEShift ()
 
BitProblemId getProblemShift ()
 
PetscErrorCode initialiseDatabseInformationFromMesh (int verb=-1)
 

Communication

MPI_Comm cOmm
 MoFEM communicator. More...
 
ParallelComm * pComm
 MOAB communicator structure. More...
 
int sIze
 MoFEM communicator size. More...
 
int rAnk
 MOFEM communicator rank. More...
 
static bool isGloballyInitialised = false
 Core base globally initialized. More...
 
MPI_Comm & get_comm () const
 
int get_comm_size () const
 
int get_comm_rank () const
 

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.

Examples:
analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, cell_forces.cpp, elasticity.cpp, hello_world.cpp, simple_interface.cpp, and unsaturated_transport.cpp.

Definition at line 44 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 70 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 339 of file Core.cpp.

339  :
340 moab(moab),
341 verbose(verbose),
342 cOmm(0) {
343  if(!isGloballyInitialised) {
344  PetscPushErrorHandler(mofem_error_handler,PETSC_NULL);
345  isGloballyInitialised = true;
346  }
347  // Duplicate petsc communicator
348  ierr = PetscCommDuplicate(comm,&cOmm,NULL); CHKERRABORT(comm,ierr);
349  MPI_Comm_size(cOmm,&sIze);
350  MPI_Comm_rank(cOmm,&rAnk);
351  // CHeck if moab has set communicator if not set communicator interbally
352  ParallelComm* pComm = ParallelComm::get_pcomm(&moab,MYPCOMM_INDEX);
353  if(pComm == NULL) {
354  pComm = new ParallelComm(&moab,comm);
355  }
356  ierr = getTags(); CHKERRABORT(cOmm,ierr);
357  ierr = clearMap(); CHKERRABORT(cOmm,ierr);
358  basicEntityDataPtr = boost::make_shared<BasicEntityData>(moab);
359  ierr = initialiseDatabseInformationFromMesh(verbose); CHKERRABORT(cOmm,ierr);
360  // Petsc Logs
361  PetscLogEventRegister("FE_preProcess",0,&USER_EVENT_preProcess);
362  PetscLogEventRegister("FE_operator",0,&USER_EVENT_operator);
363  PetscLogEventRegister("FE_postProcess",0,&USER_EVENT_postProcess);
364  PetscLogEventRegister("MoFEMCreateMat",0,&USER_EVENT_createMat);
365  PetscLogEventRegister("MoFEMBuildProblem",0,&USER_EVENT_buildProblem);
366 
367  // Print version
368  if(verbose>0) {
369  ierr = PetscPrintf(
370  cOmm,
371  "lib version %d.%d.%d\n",
373  ); CHKERRABORT(cOmm,ierr);
374  ierr = PetscPrintf(cOmm,"git commit id %s\n",GIT_SHA1_NAME); CHKERRABORT(cOmm,ierr);
375  }
376 
377 }
#define MoFEM_VERSION_MAJOR
Definition: version.h:2
int sIze
MoFEM communicator size.
Definition: Core.hpp:822
static PetscErrorCode ierr
Definition: Common.hpp:26
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
PetscLogEvent USER_EVENT_createMat
Definition: Core.hpp:812
PetscLogEvent USER_EVENT_postProcess
Definition: Core.hpp:811
PetscErrorCode initialiseDatabseInformationFromMesh(int verb=-1)
Definition: Core.cpp:738
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:823
moab::Interface & moab
Definition: Core.hpp:46
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:834
PetscErrorCode clearMap()
Definition: Core.cpp:419
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:110
#define MoFEM_VERSION_MINOR
Definition: version.h:3
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:305
PetscLogEvent USER_EVENT_buildProblem
Definition: Core.hpp:813
PetscErrorCode getTags(int verb=-1)
Definition: Core.cpp:477
ParallelComm * pComm
MOAB communicator structure.
Definition: Core.hpp:820
int verbose
Verbosity level.
Definition: Core.hpp:124
PetscLogEvent USER_EVENT_operator
Definition: Core.hpp:810
PetscLogEvent USER_EVENT_preProcess
Definition: Core.hpp:809
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)
Definition: Core.cpp:283
#define GIT_SHA1_NAME
Definition: version.h:9
#define MoFEM_VERSION_BUILD
Definition: version.h:4

◆ ~Core()

MoFEM::Core::~Core ( )

Definition at line 378 of file Core.cpp.

378  {
379  int flg;
380  MPI_Finalized(&flg);
381  // Destroy interfaces
382  iFaces.clear();
383  // Pop error hanlder
385  if(!flg) {
386  PetscPopErrorHandler();
387  }
388  isGloballyInitialised = false;
389  }
390  // Destroy communictaor
391  if(!flg) {
392  ierr = PetscCommDestroy(&cOmm); CHKERRABORT(cOmm,ierr);
393  }
394 }
static PetscErrorCode ierr
Definition: Common.hpp:26
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
boost::ptr_map< unsigned long, UnknownInterface > iFaces
Definition: Core.hpp:91
static bool isGloballyInitialised
Core base globally initialized.
Definition: Core.hpp:834

Member Function Documentation

◆ add_cubit_msId()

PetscErrorCode MoFEM::Core::add_cubit_msId ( const CubitBCType  cubit_bc_tyep,
const int  msId,
const std::string  name = "" 
)
protectedvirtual

add cubit meshset

Deprecated:
use MeshsetsManager
Parameters
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
ms_idid of the BLOCKSET/SIDESET/BLOCKSET
nameof set

Implements MoFEM::Interface.

Definition at line 1036 of file Core.cpp.

1036  {
1037  return get_meshsets_manager_ptr()->addMeshset(cubit_bc_type,ms_id,name);
1038 }
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition: Core.cpp:1156
PetscErrorCode addMeshset(const CubitBCType cubit_bc_tyep, const int ms_id, const std::string name="")
add cubit meshset

◆ add_ents_to_field_by_dim() [1/2]

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

Add field with default AINSWORTH_LEGENDRE_BASE approximation base.

Deprecated:
Note
This function is deprecated, use version where base argument is spevified explicityly.
Parameters
namename of the filed
spacespace (L2,H1,Hdiv,Hcurl)
nb_of_cooficientsnumber of field coefficients
bhif MF_EXCL throws error if field exits, MF_ZERO no error if field exist
verbverbosity level
Returns
error code Add entities to field meshset

The lower dimension entities are added depending on the space type

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

Implements MoFEM::Interface.

Definition at line 360 of file FieldCore.cpp.

362  {
363  Range ents_dim = ents.subset_by_dimension(dim);
364  return addEntsToFieldByDim(ents_dim,dim,name,verb);
365 }
PetscErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=-1)
Definition: FieldCore.cpp:241

◆ add_ents_to_field_by_dim() [2/2]

PetscErrorCode 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
dimdiemsipm
namename of field
recursivetake entities recursively from embaded entities
verbverbosity level
Returns
error code

Implements MoFEM::Interface.

Definition at line 380 of file FieldCore.cpp.

382  {
383  PetscFunctionBegin;
384  Range ents;
385  rval = moab.get_entities_by_dimension(meshset,dim,ents,recursive); CHKERRQ_MOAB(rval);
386  ierr = addEntsToFieldByDim(ents,dim,name,verb); CHKERRQ(ierr);
387  PetscFunctionReturn(0);
388 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
PetscErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=-1)
Definition: FieldCore.cpp:241
CHKERRQ(ierr)

◆ add_ents_to_field_by_EDGEs() [1/2]

PetscErrorCode 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
tangecontains set edges
nameof the field

Implements MoFEM::Interface.

Definition at line 403 of file FieldCore.cpp.

403  {
404  return add_ents_to_field_by_type(edges,MBEDGE,name,verb);
405 }
PetscErrorCode 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:367

◆ add_ents_to_field_by_EDGEs() [2/2]

PetscErrorCode 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::Interface.

Definition at line 406 of file FieldCore.cpp.

406  {
407  return add_ents_to_field_by_type(meshset,MBEDGE,name,true,verb);
408 }
PetscErrorCode 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:367

◆ add_ents_to_field_by_PRISMs() [1/2]

PetscErrorCode 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::Interface.

Definition at line 433 of file FieldCore.cpp.

433  {
434  return add_ents_to_field_by_type(prisms,MBPRISM,name,verb);
435 }
PetscErrorCode 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:367

◆ add_ents_to_field_by_PRISMs() [2/2]

PetscErrorCode 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::Interface.

Definition at line 436 of file FieldCore.cpp.

436  {
437  return add_ents_to_field_by_type(meshset,MBPRISM,name,true,verb);
438 }
PetscErrorCode 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:367

◆ add_ents_to_field_by_QUADs() [1/2]

PetscErrorCode 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::Interface.

Definition at line 427 of file FieldCore.cpp.

427  {
428  return add_ents_to_field_by_type(quads,MBQUAD,name,verb);
429 }
PetscErrorCode 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:367

◆ add_ents_to_field_by_QUADs() [2/2]

PetscErrorCode 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::Interface.

Definition at line 430 of file FieldCore.cpp.

430  {
431  return add_ents_to_field_by_type(meshset,MBQUAD,name,true,verb);
432 }
PetscErrorCode 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:367

◆ add_ents_to_field_by_TETs() [1/2]

PetscErrorCode 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::Interface.

Definition at line 421 of file FieldCore.cpp.

421  {
422  return add_ents_to_field_by_type(tets,MBTET,name,verb);
423 }
PetscErrorCode 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:367

◆ add_ents_to_field_by_TETs() [2/2]

PetscErrorCode 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::Interface.

Definition at line 424 of file FieldCore.cpp.

424  {
425  return add_ents_to_field_by_type(meshset,MBTET,name,true,verb);
426 }
PetscErrorCode 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:367

◆ add_ents_to_field_by_TRIs() [1/2]

PetscErrorCode 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::Interface.

Definition at line 409 of file FieldCore.cpp.

409  {
410  return add_ents_to_field_by_type(meshset,MBTRI,name,true,verb);
411 }
PetscErrorCode 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:367

◆ add_ents_to_field_by_TRIs() [2/2]

PetscErrorCode 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::Interface.

Definition at line 412 of file FieldCore.cpp.

412  {
413  return add_ents_to_field_by_type(tris,MBTRI,name,verb);
414 }
PetscErrorCode 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:367

◆ add_ents_to_field_by_type() [1/2]

PetscErrorCode 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
entsrnage of entities
typetype of entities
namename of field
verbverbosity level
Returns
error code

Implements MoFEM::Interface.

Definition at line 367 of file FieldCore.cpp.

369  {
370 
371  PetscFunctionBegin;
372  Range ents_type = ents.subset_by_type(type);
373  if(!ents_type.empty()) {
374  const int dim = moab.dimension_from_handle(ents_type[0]);
375  ierr = addEntsToFieldByDim(ents_type,dim,name,verb); CHKERRQ(ierr);
376  }
377  PetscFunctionReturn(0);
378 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=-1)
Definition: FieldCore.cpp:241
CHKERRQ(ierr)

◆ add_ents_to_field_by_type() [2/2]

PetscErrorCode 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 entoties
namename of field
recursivetake entities recursively from embaded entities
verbverbosity level
Returns
error code

Implements MoFEM::Interface.

Definition at line 390 of file FieldCore.cpp.

392  {
393  PetscFunctionBegin;
394  Range ents;
395  rval = moab.get_entities_by_type(meshset,type,ents,recursive); CHKERRQ_MOAB(rval);
396  if(!ents.empty()) {
397  const int dim = moab.dimension_from_handle(ents[0]);
398  ierr = addEntsToFieldByDim(ents,dim,name,verb); CHKERRQ(ierr);
399  }
400  PetscFunctionReturn(0);
401 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
PetscErrorCode addEntsToFieldByDim(const Range &ents, const int dim, const std::string &name, int verb=-1)
Definition: FieldCore.cpp:241
CHKERRQ(ierr)

◆ add_ents_to_field_by_VERTICEs() [1/2]

PetscErrorCode 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::Interface.

Definition at line 415 of file FieldCore.cpp.

415  {
416  return add_ents_to_field_by_type(nodes,MBVERTEX,name,verb);
417 }
PetscErrorCode 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:367

◆ add_ents_to_field_by_VERTICEs() [2/2]

PetscErrorCode 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::Interface.

Definition at line 418 of file FieldCore.cpp.

418  {
419  return add_ents_to_field_by_type(meshset,MBVERTEX,name,true,verb);
420 }
PetscErrorCode 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:367

◆ add_ents_to_finite_element_by_bit_ref()

PetscErrorCode 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
verrboselevel

Implements MoFEM::Interface.

Definition at line 419 of file FECore.cpp.

421  {
422  PetscFunctionBegin;
423  try {
424  if(verb==-1) verb = verbose;
425  *buildMoFEM &= 1<<0;
426  const BitFEId id = getBitFEId(name);
428  typedef RefElement_multiIndex::index<EntType_mi_tag>::type refMoabFE_by_type;
429  refMoabFE_by_type &ref_MoFEMFiniteElement = refinedFiniteElements.get<EntType_mi_tag>();
430  refMoabFE_by_type::iterator miit = ref_MoFEMFiniteElement.lower_bound(type);
431  refMoabFE_by_type::iterator hi_miit = ref_MoFEMFiniteElement.upper_bound(type);
432  if(verb > 1) {
433  PetscSynchronizedPrintf(cOmm,"nb. ref elements in database %d\n",distance(miit,hi_miit));
434  }
435  int nb_add_FEs = 0;
436  for(;miit!=hi_miit;miit++) {
437  BitRefLevel bit2 = miit->getBitRefLevel();
438  if((bit2&mask) != bit2) continue;
439  if((bit2&bit).any()) {
440  EntityHandle ent = miit->getRefEnt();
441  rval = moab.add_entities(idm,&ent,1); CHKERRQ_MOAB(rval);
442  nb_add_FEs++;
443  }
444  }
445  if(verb > 0) {
446  std::ostringstream ss;
447  ss << "Add Nb. FEs " << nb_add_FEs << " form BitRef " << bit << std::endl;
448  PetscSynchronizedPrintf(cOmm,"%s",ss.str().c_str());
449  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
450  }
451  } catch (MoFEMException const &e) {
452  SETERRQ(cOmm,e.errorCode,e.errorMessage);
453  }
454  PetscFunctionReturn(0);
455  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:234
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
std::bitset< BITFEID_SIZE > BitFEId
Definition: Common.hpp:51
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:218
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:48
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:129
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ add_ents_to_finite_element_by_dim() [1/2]

PetscErrorCode 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::Interface.

Definition at line 314 of file FECore.cpp.

316  {
317  EntityHandle idm = no_handle;
318  *buildMoFEM &= 1<<0;
319  PetscFunctionBegin;
320  try {
322  } catch (MoFEMException const &e) {
323  SETERRQ(cOmm,e.errorCode,e.errorMessage);
324  }
325  Range ents;
326  rval = moab.get_entities_by_dimension(meshset,dim,ents,recursive); CHKERRQ_MOAB(rval);
327  ierr = seed_finite_elements(ents.subset_by_dimension(dim)); CHKERRQ(ierr);
328  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
329  PetscFunctionReturn(0);
330  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:234
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
const EntityHandle no_handle
Definition: Common.hpp:35
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:218
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92
CHKERRQ(ierr)
PetscErrorCode seed_finite_elements(const Range &entities, int verb=-1)
Definition: FECore.cpp:853

◆ add_ents_to_finite_element_by_dim() [2/2]

PetscErrorCode 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::Interface.

Definition at line 348 of file FECore.cpp.

350  {
351  EntityHandle idm = no_handle;
352  *buildMoFEM &= 1<<0;
353  PetscFunctionBegin;
354  try {
356  } catch (MoFEMException const &e) {
357  SETERRQ(cOmm,e.errorCode,e.errorMessage);
358  }
359  ierr = seed_finite_elements(ents.subset_by_dimension(dim)); CHKERRQ(ierr);
360  rval = moab.add_entities(idm,ents.subset_by_dimension(dim)); CHKERRQ_MOAB(rval);
361  PetscFunctionReturn(0);
362  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:234
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
const EntityHandle no_handle
Definition: Common.hpp:35
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:218
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92
CHKERRQ(ierr)
PetscErrorCode seed_finite_elements(const Range &entities, int verb=-1)
Definition: FECore.cpp:853

◆ add_ents_to_finite_element_by_EDGEs() [1/2]

PetscErrorCode 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::Interface.

Definition at line 367 of file FECore.cpp.

367  {
368  return add_ents_to_finite_element_by_type(edges,MBEDGE,name);
369  PetscFunctionReturn(0);
370  }
PetscErrorCode 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:296

◆ add_ents_to_finite_element_by_EDGEs() [2/2]

PetscErrorCode 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::Interface.

Definition at line 364 of file FECore.cpp.

364  {
365  return add_ents_to_finite_element_by_type(meshset,MBEDGE,name,recursive);
366  }
PetscErrorCode 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:296

◆ add_ents_to_finite_element_by_MESHSET()

PetscErrorCode 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::Interface.

Definition at line 457 of file FECore.cpp.

457  {
458  PetscFunctionBegin;
459  *buildMoFEM &= 1<<0;
460  const BitFEId id = getBitFEId(name);
462  if(recursive==false){
463  rval = moab.add_entities(idm,&meshset,1); CHKERRQ_MOAB(rval);
464  } else {
465  Range meshsets;
466  rval = moab.get_entities_by_type(meshset,MBENTITYSET,meshsets,false); CHKERRQ_MOAB(rval);
467  rval = moab.add_entities(idm,meshsets); CHKERRQ_MOAB(rval);
468  }
469  PetscFunctionReturn(0);
470  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:234
static MoABErrorCode rval
Definition: Common.hpp:25
std::bitset< BITFEID_SIZE > BitFEId
Definition: Common.hpp:51
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:218
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92

◆ add_ents_to_finite_element_by_PRISMs() [1/3]

DEPRECATED PetscErrorCode 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]

PetscErrorCode 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::Interface.

Definition at line 394 of file FECore.cpp.

394  {
395  PetscFunctionBegin;
396  return add_ents_to_finite_element_by_type(prims,MBPRISM,name);
397  PetscFunctionReturn(0);
398  }
PetscErrorCode 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:296

◆ add_ents_to_finite_element_by_PRISMs() [3/3]

PetscErrorCode 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::Interface.

Definition at line 399 of file FECore.cpp.

399  {
400  return add_ents_to_finite_element_by_type(meshset,MBPRISM,name,recursive);
401  }
PetscErrorCode 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:296

◆ add_ents_to_finite_element_by_TETs() [1/2]

PetscErrorCode 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::Interface.

Definition at line 385 of file FECore.cpp.

385  {
386  PetscFunctionBegin;
387  return add_ents_to_finite_element_by_type(tets,MBTET,name);
388  PetscFunctionReturn(0);
389  }
PetscErrorCode 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:296

◆ add_ents_to_finite_element_by_TETs() [2/2]

PetscErrorCode 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::Interface.

Definition at line 390 of file FECore.cpp.

390  {
391  return add_ents_to_finite_element_by_type(meshset,MBTET,name,recursive);
392  PetscFunctionReturn(0);
393  }
PetscErrorCode 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:296

◆ add_ents_to_finite_element_by_TRIs() [1/2]

PetscErrorCode 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::Interface.

Definition at line 376 of file FECore.cpp.

376  {
377  PetscFunctionBegin;
378  return add_ents_to_finite_element_by_type(tris,MBTRI,name);
379  PetscFunctionReturn(0);
380  }
PetscErrorCode 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:296

◆ add_ents_to_finite_element_by_TRIs() [2/2]

PetscErrorCode 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::Interface.

Definition at line 381 of file FECore.cpp.

381  {
382  return add_ents_to_finite_element_by_type(meshset,MBTRI,name,recursive);
383  PetscFunctionReturn(0);
384  }
PetscErrorCode 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:296

◆ add_ents_to_finite_element_by_type() [1/2]

PetscErrorCode 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::Interface.

Definition at line 296 of file FECore.cpp.

298  {
299  *buildMoFEM &= 1<<0;
300  EntityHandle idm = no_handle;
301  PetscFunctionBegin;
302  try {
304  } catch (MoFEMException const &e) {
305  SETERRQ(cOmm,e.errorCode,e.errorMessage);
306  }
307  Range ents;
308  rval = moab.get_entities_by_type(meshset,type,ents,recursive); CHKERRQ_MOAB(rval);
309  ierr = seed_finite_elements(ents.subset_by_type(MBEDGE)); CHKERRQ(ierr);
310  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
311  PetscFunctionReturn(0);
312  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:234
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
const EntityHandle no_handle
Definition: Common.hpp:35
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:218
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92
CHKERRQ(ierr)
PetscErrorCode seed_finite_elements(const Range &entities, int verb=-1)
Definition: FECore.cpp:853

◆ add_ents_to_finite_element_by_type() [2/2]

PetscErrorCode 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::Interface.

Definition at line 332 of file FECore.cpp.

334  {
335  EntityHandle idm = no_handle;
336  *buildMoFEM &= 1<<0;
337  PetscFunctionBegin;
338  try {
340  } catch (MoFEMException const &e) {
341  SETERRQ(cOmm,e.errorCode,e.errorMessage);
342  }
343  ierr = seed_finite_elements(ents.subset_by_type(type)); CHKERRQ(ierr);
344  rval = moab.add_entities(idm,ents.subset_by_type(type)); CHKERRQ_MOAB(rval);
345  PetscFunctionReturn(0);
346  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:234
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
const EntityHandle no_handle
Definition: Common.hpp:35
BitFEId getBitFEId(const std::string &name) const
Get field Id.
Definition: FECore.cpp:218
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92
CHKERRQ(ierr)
PetscErrorCode seed_finite_elements(const Range &entities, int verb=-1)
Definition: FECore.cpp:853

◆ add_ents_to_finite_element_by_VERTICEs()

PetscErrorCode 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::Interface.

Definition at line 371 of file FECore.cpp.

371  {
372  PetscFunctionBegin;
373  return add_ents_to_finite_element_by_type(vert,MBVERTEX,name);
374  PetscFunctionReturn(0);
375  }
PetscErrorCode 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:296

◆ add_ents_to_finite_element_EntType_by_bit_ref() [1/2]

PetscErrorCode 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::Interface.

Definition at line 403 of file FECore.cpp.

405  {
406  PetscFunctionBegin;
407  ierr = add_ents_to_finite_element_by_bit_ref(bit,BitRefLevel().set(),name,type,verb); CHKERRQ(ierr);
408  PetscFunctionReturn(0);
409  }
static PetscErrorCode ierr
Definition: Common.hpp:26
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:48
PetscErrorCode 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:419
CHKERRQ(ierr)

◆ add_ents_to_finite_element_EntType_by_bit_ref() [2/2]

PetscErrorCode 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::Interface.

Definition at line 411 of file FECore.cpp.

413  {
414  PetscFunctionBegin;
415  ierr = add_ents_to_finite_element_by_bit_ref(bit,mask,name,type,verb); CHKERRQ(ierr);
416  PetscFunctionReturn(0);
417  }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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:419
CHKERRQ(ierr)

◆ add_field()

PetscErrorCode MoFEM::Core::add_field ( const std::string &  name,
const FieldSpace  space,
const FieldApproximationBase  base,
const FieldCoefficientsNumber  nb_cooficients,
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_cooficientsNumber 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::Interface.

Definition at line 134 of file FieldCore.cpp.

142  {
143  PetscFunctionBegin;
144  if(verb==-1) verb = verbose;
145  *buildMoFEM = 0;
146  Field_multiIndex::index<FieldName_mi_tag>::type::iterator fit;
147  fit = fIelds.get<FieldName_mi_tag>().find(name);
148  if(fit != fIelds.get<FieldName_mi_tag>().end() ) {
149  if(bh == MF_EXCL) {
150  SETERRQ1(cOmm,MOFEM_OPERATION_UNSUCCESSFUL,"field is <%s> in database",name.c_str());
151  }
152  } else {
153  EntityHandle meshset;
154  rval = moab.create_meshset(MESHSET_SET|MESHSET_TRACK_OWNER,meshset); CHKERRQ_MOAB(rval);
155  //id
156  BitFieldId id = getFieldShift();
157  rval = moab.tag_set_data(th_FieldId,&meshset,1,&id); CHKERRQ_MOAB(rval);
158  //space
159  rval = moab.tag_set_data(th_FieldSpace,&meshset,1,&space); CHKERRQ_MOAB(rval);
160  //base
161  rval = moab.tag_set_data(th_FieldBase,&meshset,1,&base); CHKERRQ_MOAB(rval);
162  //name
163  void const* tag_data[] = { name.c_str() };
164  int tag_sizes[1]; tag_sizes[0] = name.size();
165  rval = moab.tag_set_by_ptr(th_FieldName,&meshset,1,tag_data,tag_sizes); CHKERRQ_MOAB(rval);
166  //name data prefix
167  std::string name_data_prefix("_App_Data");
168  void const* tag_prefix_data[] = { name_data_prefix.c_str() };
169  int tag_prefix_sizes[1]; tag_prefix_sizes[0] = name_data_prefix.size();
170  rval = moab.tag_set_by_ptr(th_FieldName_DataNamePrefix,&meshset,1,tag_prefix_data,tag_prefix_sizes); CHKERRQ_MOAB(rval);
171  Tag th_AppOrder,th_FieldData,th_Rank;
172  //data
173  std::string Tag_data_name = name_data_prefix+name;
174  const int def_len = 0;
175  rval = moab.tag_get_handle(
176  Tag_data_name.c_str(),
177  def_len,
178  MB_TYPE_OPAQUE,
179  th_FieldData,
180  MB_TAG_CREAT|MB_TAG_BYTES|MB_TAG_VARLEN|MB_TAG_SPARSE,
181  NULL
182  ); CHKERRQ_MOAB(rval);
183  //order
184  ApproximationOrder def_ApproximationOrder = -1;
185  std::string Tag_ApproximationOrder_name = "_App_Order_"+name;
186  rval = moab.tag_get_handle(
187  Tag_ApproximationOrder_name.c_str(),
188  sizeof(ApproximationOrder),
189  MB_TYPE_OPAQUE,
190  th_AppOrder,MB_TAG_CREAT|MB_TAG_BYTES|tag_type,
191  &def_ApproximationOrder
192  ); CHKERRQ_MOAB(rval);
193  //rank
194  int def_rank = 1;
195  std::string Tag_rank_name = "_Field_Rank_"+name;
196  rval = moab.tag_get_handle(
197  Tag_rank_name.c_str(),
198  sizeof(FieldCoefficientsNumber),
199  MB_TYPE_OPAQUE,
200  th_Rank,
201  MB_TAG_CREAT|MB_TAG_BYTES|tag_type,
202  &def_rank
203  ); CHKERRQ_MOAB(rval);
204  rval = moab.tag_set_data(th_Rank,&meshset,1,&nb_of_coefficients); CHKERRQ_MOAB(rval);
205  //add meshset
206  std::pair<Field_multiIndex::iterator,bool> p;
207  try {
208  CoordSystemsManager *cs_manger_ptr;
209  ierr = query_interface(cs_manger_ptr); CHKERRQ(ierr);
210  boost::shared_ptr<CoordSys > undefined_cs_ptr;
211  ierr = cs_manger_ptr->getCoordSysPtr("UNDEFINED",undefined_cs_ptr); CHKERRQ(ierr);
212  int sys_name_size[1];
213  sys_name_size[0] = undefined_cs_ptr->getName().size();
214  void const* sys_name[] = { &*undefined_cs_ptr->getNameRef().begin() };
215  rval = moab.tag_set_by_ptr(
216  cs_manger_ptr->get_th_CoordSysName(),&meshset,1,sys_name,sys_name_size
217  ); CHKERRQ_MOAB(rval);
218  EntityHandle coord_sys_id = undefined_cs_ptr->getMeshset();
219  rval = moab.add_entities(coord_sys_id,&meshset,1); CHKERRQ_MOAB(rval);
220  p = fIelds.insert(boost::make_shared<Field>(moab,meshset,undefined_cs_ptr));
221  if(bh == MF_EXCL) {
222  if(!p.second) SETERRQ1(
224  "field not inserted %s (top tip, it could be already there)",
225  Field(moab,meshset,undefined_cs_ptr).getName().c_str()
226  );
227  }
228  } catch (MoFEMException const &e) {
229  SETERRQ(cOmm,e.errorCode,e.errorMessage);
230  }
231  if(verbose > 0) {
232  std::ostringstream ss;
233  ss << "add: " << **p.first << std::endl;
234  PetscPrintf(cOmm,ss.str().c_str());
235  }
236  }
237  //unt
238  PetscFunctionReturn(0);
239 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
int FieldCoefficientsNumber
Number of field coefficients.
Definition: Common.hpp:34
Tag th_FieldSpace
Definition: Core.hpp:100
Tag th_FieldName_DataNamePrefix
Definition: Core.hpp:100
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
std::bitset< BITFIELDID_SIZE > BitFieldId
Definition: Common.hpp:50
Tag th_FieldId
Definition: Core.hpp:100
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92
CHKERRQ(ierr)
Tag th_FieldBase
Definition: Core.hpp:100
Tag th_FieldName
Definition: Core.hpp:100
Field_multiIndex fIelds
field
Definition: Core.hpp:133
int ApproximationOrder
Approximation on the entity.
Definition: Common.hpp:33
int verbose
Verbosity level.
Definition: Core.hpp:124
BitFieldId getFieldShift()
Definition: Core.cpp:396
IFace * query_interface() const
Definition: Interface.hpp:56

◆ add_finite_element()

PetscErrorCode 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"); CHKERRQ(ierr);
ierr = mField.add_finite_element("PLASTIC"); CHKERRQ(ierr);

Implements MoFEM::Interface.

Definition at line 71 of file FECore.cpp.

71  {
72  PetscFunctionBegin;
73  *buildMoFEM &= 1<<0;
74  typedef FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type FiniteElements_by_name;
75  FiniteElements_by_name &finite_element_name_set = finiteElements.get<FiniteElement_name_mi_tag>();
76  FiniteElements_by_name::iterator it_fe = finite_element_name_set.find(fe_name);
77  if(bh == MF_EXCL) {
78  if(it_fe!=finite_element_name_set.end()) {
79  SETERRQ1(cOmm,MOFEM_NOT_FOUND,"this < %s > is there",fe_name.c_str());
80  }
81  } else {
82  if(it_fe!=finite_element_name_set.end()) PetscFunctionReturn(0);
83  }
84  EntityHandle meshset;
85  rval = moab.create_meshset(MESHSET_SET|MESHSET_TRACK_OWNER,meshset); CHKERRQ_MOAB(rval);
86  //id
87  BitFEId id = getFEShift();
88  rval = moab.tag_set_data(th_FEId,&meshset,1,&id); CHKERRQ_MOAB(rval);
89  //id name
90  void const* tag_data[] = { fe_name.c_str() };
91  int tag_sizes[1]; tag_sizes[0] = fe_name.size();
92  rval = moab.tag_set_by_ptr(th_FEName,&meshset,1,tag_data,tag_sizes); CHKERRQ_MOAB(rval);
93  //add FiniteElement
94  std::pair<FiniteElement_multiIndex::iterator,bool> p = finiteElements.insert(
95  boost::shared_ptr<FiniteElement>(new FiniteElement(moab,meshset))
96  );
97  if(!p.second) SETERRQ(cOmm,MOFEM_OPERATION_UNSUCCESSFUL,"FiniteElement not inserted");
98  if(verbose>0) {
99  std::ostringstream ss;
100  ss << "add finite element: " << fe_name << std::endl;
101  PetscPrintf(cOmm,ss.str().c_str());
102  //list_finiteElements();
103  }
104  PetscFunctionReturn(0);
105  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
std::bitset< BITFEID_SIZE > BitFEId
Definition: Common.hpp:51
Tag th_FEName
Definition: Core.hpp:101
BitFEId getFEShift()
Definition: Core.cpp:409
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:139
int verbose
Verbosity level.
Definition: Core.hpp:124
Tag th_FEId
Definition: Core.hpp:101

◆ add_problem() [1/2]

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

Definition at line 64 of file ProblemsCore.cpp.

64  {
65  PetscFunctionBegin;
66  EntityHandle meshset;
67  rval = moab.create_meshset(MESHSET_SET|MESHSET_TRACK_OWNER,meshset); CHKERRQ_MOAB(rval);
68  rval = moab.tag_set_data(th_ProblemId,&meshset,1,&id); CHKERRQ_MOAB(rval);
69  void const* tag_data[] = { name.c_str() };
70  int tag_sizes[1]; tag_sizes[0] = name.size();
71  rval = moab.tag_set_by_ptr(th_ProblemName,&meshset,1,tag_data,tag_sizes); CHKERRQ_MOAB(rval);
72  //create entry
73  std::pair<Problem_multiIndex::iterator,bool> p = pRoblems.insert(Problem(moab,meshset));
74  NOT_USED(p);
75  assert(p.second);
76  if(verbose>0) {
77  std::ostringstream ss;
78  ss << "add problem: " << name << std::endl;
79  PetscPrintf(cOmm,ss.str().c_str());
80  }
81  PetscFunctionReturn(0);
82 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
Tag th_ProblemName
Definition: Core.hpp:103
Tag th_ProblemId
Definition: Core.hpp:103
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:148
int verbose
Verbosity level.
Definition: Core.hpp:124
#define NOT_USED(x)
Definition: definitions.h:320

◆ add_problem() [2/2]

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

Add problem.

Implements MoFEM::Interface.

Definition at line 84 of file ProblemsCore.cpp.

84  {
85  PetscFunctionBegin;
86  if(verb==-1) verb = verbose;
87  typedef Problem_multiIndex::index<Problem_mi_tag>::type mofem_problems_by_name;
88  const mofem_problems_by_name& set = pRoblems.get<Problem_mi_tag>();
89  mofem_problems_by_name::iterator miit = set.find(name);
90  if(miit==set.end()) {
92  ierr = add_problem(id,name); CHKERRQ(ierr);
93  } else if(bh == MF_EXCL) {
94  SETERRQ1(PETSC_COMM_SELF,MOFEM_NOT_FOUND,"problem is in database %s",name.c_str());
95  }
96  PetscFunctionReturn(0);
97 }
static PetscErrorCode ierr
Definition: Common.hpp:26
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Definition: Common.hpp:52
BitProblemId getProblemShift()
Definition: Core.cpp:414
CHKERRQ(ierr)
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:148
PetscErrorCode add_problem(const BitProblemId id, const std::string &name)
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ addEntsToFieldByDim()

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

Definition at line 241 of file FieldCore.cpp.

243  {
244 
245  *buildMoFEM = 0;
246  EntityHandle idm = no_handle;
247  if(verb==-1) verb = verbose;
248  PetscFunctionBegin;
249  try {
250  idm = get_field_meshset(name);
251  } catch (MoFEMException const &e) {
252  SETERRQ(cOmm,e.errorCode,e.errorMessage);
253  }
254  FieldSpace space;
255  rval = moab.tag_get_data(th_FieldSpace,&idm,1,&space); CHKERRQ_MOAB(rval);
256  Range nodes,faces,edges;
257  switch(space) {
258  case L2:
259  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
260  if(verb>1) {
261  std::ostringstream ss;
262  ss << "add entities to field " << name;
263  ss << " nb. add ents " << ents.size();
264  ss << std::endl;
265  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
266  }
267  break;
268  case H1:
269  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
270  if(dim>0) {
271  rval = moab.get_adjacencies(
272  ents,0,false,nodes,moab::Interface::UNION
273  ); CHKERRQ_MOAB(rval);
274  {
275  Range topo_nodes;
276  rval = moab.get_connectivity(
277  ents,topo_nodes,true
278  ); CHKERRQ_MOAB(rval);
279  Range mid_nodes;
280  rval = moab.get_connectivity(
281  ents,mid_nodes,false
282  ); CHKERRQ_MOAB(rval);
283  mid_nodes = subtract(mid_nodes,topo_nodes);
284  nodes = subtract(nodes,mid_nodes);
285  }
286  rval = moab.add_entities(idm,nodes); CHKERRQ_MOAB(rval);
287  }
288  if(dim>2) {
289  rval = moab.get_adjacencies(
290  ents,2,false,faces,moab::Interface::UNION
291  ); CHKERRQ_MOAB(rval);
292  rval = moab.add_entities(idm,faces); CHKERRQ_MOAB(rval);
293  }
294  if(dim>1) {
295  rval = moab.get_adjacencies(
296  ents,1,false,edges,moab::Interface::UNION
297  ); CHKERRQ_MOAB(rval);
298  rval = moab.add_entities(idm,edges); CHKERRQ_MOAB(rval);
299  }
300  if(verb>1) {
301  std::ostringstream ss;
302  ss << "add entities to field " << name;
303  ss << " nb. add ents " << ents.size();
304  ss << " nb. add faces " << faces.size();
305  ss << " nb. add edges " << edges.size();
306  ss << " nb. add nodes " << nodes.size();
307  ss << std::endl;
308  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
309  }
310  break;
311  case HCURL:
312  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
313  if(dim>2) {
314  rval = moab.get_adjacencies(ents,2,false,faces,moab::Interface::UNION
315  ); CHKERRQ_MOAB(rval);
316  rval = moab.add_entities(idm,faces); CHKERRQ_MOAB(rval);
317  }
318  if(dim>1) {
319  rval = moab.get_adjacencies(
320  ents,1,false,edges,moab::Interface::UNION
321  ); CHKERRQ_MOAB(rval);
322  rval = moab.add_entities(idm,edges); CHKERRQ_MOAB(rval);
323  }
324  if(verb>1) {
325  std::ostringstream ss;
326  ss << "add entities to field " << name;
327  ss << " nb. add ents " << ents.size();
328  ss << " nb. add faces " << faces.size();
329  ss << " nb. add edges " << edges.size();
330  ss << std::endl;
331  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
332  }
333  break;
334  case HDIV:
335  rval = moab.add_entities(idm,ents); CHKERRQ_MOAB(rval);
336  if(dim>2) {
337  rval = moab.get_adjacencies(
338  ents,2,false,faces,moab::Interface::UNION
339  ); CHKERRQ_MOAB(rval);
340  rval = moab.add_entities(idm,faces); CHKERRQ_MOAB(rval);
341  }
342  if(verb>1) {
343  std::ostringstream ss;
344  ss << "add entities to field " << name;
345  ss << " nb. add ents " << ents.size();
346  ss << " nb. add faces " << faces.size();
347  ss << std::endl;
348  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
349  }
350  break;
351  default:
352  SETERRQ(cOmm,MOFEM_DATA_INCONSISTENCY,"sorry, unknown space added to entity");
353  }
354  if(verb>1) {
355  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
356  }
357  PetscFunctionReturn(0);
358 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
Tag th_FieldSpace
Definition: Core.hpp:100
field with continuous normal traction
Definition: definitions.h:160
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
const EntityHandle no_handle
Definition: Common.hpp:35
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92
field with continuous tangents
Definition: definitions.h:161
FieldSpace
approximation spaces
Definition: definitions.h:156
int verbose
Verbosity level.
Definition: Core.hpp:124
EntityHandle get_field_meshset(const BitFieldId id) const
Definition: FieldCore.cpp:66
continuous field
Definition: definitions.h:159
field with C-1 continuity
Definition: definitions.h:162

◆ addPrismToDatabase()

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

Definition at line 449 of file Core.cpp.

449  {
450  PetscFunctionBegin;
451  if(verb==-1) verb = verbose;
452  try {
453  std::pair<RefEntity_multiIndex::iterator,bool> p_ent;
454  p_ent = refinedEntities.insert(boost::make_shared<RefEntity>(basicEntityDataPtr,prism));
455  if(p_ent.second) {
456  std::pair<RefElement_multiIndex::iterator,bool> p_MoFEMFiniteElement;
457  p_MoFEMFiniteElement = refinedFiniteElements.insert(
458  ptrWrapperRefElement(boost::shared_ptr<RefElement>(new RefElement_PRISM(*p_ent.first)))
459  );
460  int num_nodes;
461  const EntityHandle* conn;
462  rval = moab.get_connectivity(prism,conn,num_nodes,true); MOAB_THROW(rval);
463  Range face_side3,face_side4;
464  rval = moab.get_adjacencies(conn,3,2,false,face_side3); CHKERRQ_MOAB(rval);
465  rval = moab.get_adjacencies(&conn[3],3,2,false,face_side4); CHKERRQ_MOAB(rval);
466  if(face_side3.size()!=1) SETERRQ(PETSC_COMM_SELF,1,"prism don't have side face 3");
467  if(face_side4.size()!=1) SETERRQ(PETSC_COMM_SELF,1,"prims don't have side face 4");
468  p_MoFEMFiniteElement.first->getSideNumberPtr(*face_side3.begin());
469  p_MoFEMFiniteElement.first->getSideNumberPtr(*face_side4.begin());
470  }
471  } catch (MoFEMException const &e) {
472  SETERRQ(PETSC_COMM_SELF,e.errorCode,e.errorMessage);
473  }
474  PetscFunctionReturn(0);
475 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:128
interface_RefElement< RefElement > ptrWrapperRefElement
#define MOAB_THROW(a)
Definition: definitions.h:376
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:129
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:110
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ build_adjacencies() [1/3]

PetscErrorCode 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::Interface.

Definition at line 757 of file FECore.cpp.

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

◆ build_adjacencies() [2/3]

PetscErrorCode 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::Interface.

Definition at line 846 of file FECore.cpp.

846  {
847  PetscFunctionBegin;
848  if(verb==-1) verb = verbose;
849  ierr = build_adjacencies(bit,BitRefLevel().set(),verb); CHKERRQ(ierr);
850  PetscFunctionReturn(0);
851  }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode build_adjacencies(const Range &ents, int verb=-1)
build adjacencies
Definition: FECore.cpp:757
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:48
CHKERRQ(ierr)
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ build_adjacencies() [3/3]

PetscErrorCode 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::Interface.

Definition at line 838 of file FECore.cpp.

838  {
839  PetscFunctionBegin;
840  if(verb==-1) verb = verbose;
841  Range ents;
842  ierr = get_entities_by_ref_level(bit,mask,ents); CHKERRQ(ierr);
843  ierr = build_adjacencies(ents,verb); CHKERRQ(ierr);
844  PetscFunctionReturn(0);
845  }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode build_adjacencies(const Range &ents, int verb=-1)
build adjacencies
Definition: FECore.cpp:757
CHKERRQ(ierr)
int verbose
Verbosity level.
Definition: Core.hpp:124
PetscErrorCode 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
Definition: FieldCore.cpp:1293

◆ build_fields()

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

build fields

Implements MoFEM::Interface.

Definition at line 1080 of file FieldCore.cpp.

1080  {
1081  PetscFunctionBegin;
1082  if(verb==-1) verb = verbose;
1083  typedef Field_multiIndex::index<BitFieldId_mi_tag>::type FieldSetById;
1084  FieldSetById &set_id = fIelds.get<BitFieldId_mi_tag>();
1085  FieldSetById::iterator miit = set_id.begin();
1086  for(;miit!=set_id.end();miit++) {
1087  std::map<EntityType,int> dof_counter;
1088  std::map<EntityType,int> inactive_dof_counter;
1089  if (verb > 0) {
1090  PetscSynchronizedPrintf(
1091  cOmm,"Build Field %s (rank %d)\n",(*miit)->getName().c_str(),rAnk
1092  );
1093  }
1094  switch ((*miit)->getSpace()) {
1095  case NOFIELD:
1097  (*miit)->getId(),dof_counter,verb
1098  ); CHKERRQ(ierr);
1099  break;
1100  case L2:
1101  case H1:
1102  case HCURL:
1103  case HDIV:
1105  (*miit)->getId(),
1106  dof_counter,
1107  inactive_dof_counter,
1108  verb
1109  ); CHKERRQ(ierr);
1110  break;
1111  default:
1112  SETERRQ(cOmm,MOFEM_NOT_IMPLEMENTED,"not implemented");
1113  }
1114  if (verb > 0) {
1115  int nb_added_dofs = 0;
1116  int nb_inactive_added_dofs = 0;
1117  for(std::map<EntityType,int>::iterator it = dof_counter.begin();it!=dof_counter.end();it++) {
1118  switch (it->first) {
1119  case MBVERTEX:
1120  PetscSynchronizedPrintf(
1121  cOmm,
1122  "nb added dofs (vertices) %d (inactive %d)\n",
1123  it->second,inactive_dof_counter[it->first]
1124  );
1125  break;
1126  case MBEDGE:
1127  PetscSynchronizedPrintf(
1128  cOmm,
1129  "nb added dofs (edges) %d (inactive %d)\n",
1130  it->second,inactive_dof_counter[it->first]
1131  );
1132  break;
1133  case MBTRI:
1134  PetscSynchronizedPrintf(
1135  cOmm,
1136  "nb added dofs (triangles) %d (inactive %d)\n",
1137  it->second,inactive_dof_counter[it->first]
1138  );
1139  break;
1140  case MBQUAD:
1141  PetscSynchronizedPrintf(
1142  cOmm,
1143  "nb added dofs (quads) %d (inactive %d)\n",
1144  it->second,inactive_dof_counter[it->first]
1145  );
1146  break;
1147  case MBTET:
1148  PetscSynchronizedPrintf(
1149  cOmm,
1150  "nb added dofs (tets) %d (inactive %d)\n",
1151  it->second,inactive_dof_counter[it->first]
1152  );
1153  break;
1154  case MBPRISM:
1155  PetscSynchronizedPrintf(
1156  cOmm,
1157  "nb added dofs (prisms) %d (inactive %d)\n",
1158  it->second,inactive_dof_counter[it->first]
1159  );
1160  break;
1161  case MBENTITYSET:
1162  PetscSynchronizedPrintf(
1163  cOmm,
1164  "nb added dofs (meshsets) %d (inactive %d)\n",
1165  it->second,inactive_dof_counter[it->first]
1166  );
1167  break;
1168  default:
1169  SETERRQ(cOmm,MOFEM_NOT_IMPLEMENTED,"not implemented");
1170  }
1171  nb_added_dofs += it->second;
1172  nb_inactive_added_dofs += inactive_dof_counter[it->first];
1173  }
1174  if(verbose>0) {
1175  PetscSynchronizedPrintf(
1176  cOmm,
1177  "nb added dofs %d (number of inactive dofs %d)\n",
1178  nb_added_dofs,nb_inactive_added_dofs
1179  );
1180  }
1181  }
1182  }
1183  *buildMoFEM = 1<<0;
1184  if(verb>0) {
1185  PetscSynchronizedPrintf(cOmm,"Nb. dofs %u\n",dofsField.size());
1186  }
1187  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
1188  PetscFunctionReturn(0);
1189  //return 0;
1190 }
DofEntity_multiIndex dofsField
dofs on fiels
Definition: Core.hpp:135
field with continuous normal traction
Definition: definitions.h:160
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode buildFieldForNoField(const BitFieldId id, std::map< EntityType, int > &dof_counter, int verb=-1)
Definition: FieldCore.cpp:759
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
scalar or vector of scalars describe (no true field)
Definition: definitions.h:158
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:823
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92
CHKERRQ(ierr)
PetscErrorCode buildFieldForL2H1HcurlHdiv(const BitFieldId id, std::map< EntityType, int > &dof_counter, std::map< EntityType, int > &inactive_dof_counter, int verb=-1)
Definition: FieldCore.cpp:848
field with continuous tangents
Definition: definitions.h:161
Field_multiIndex fIelds
field
Definition: Core.hpp:133
int verbose
Verbosity level.
Definition: Core.hpp:124
continuous field
Definition: definitions.h:159
field with C-1 continuity
Definition: definitions.h:162

◆ build_finite_elements() [1/4]

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

add entity EntFe to finite element data databse and resolve dofs on that entity

Implements MoFEM::Interface.

Definition at line 687 of file FECore.cpp.

687  {
688  PetscFunctionBegin;
689  if(verb==-1) verb = verbose;
690 
691  FiniteElement_multiIndex::iterator fe_miit = finiteElements.begin();
692 
693  // loop Finite Elements
694  for(;fe_miit!=finiteElements.end();fe_miit++) {
695  if(verb>0) PetscPrintf(cOmm,"Build Finite Elements %s\n",(*fe_miit)->getName().c_str());
696  ierr = build_finite_elements(*fe_miit,NULL,verb); CHKERRQ(ierr);
697  }
698 
699  if(verb>0) {
700  PetscSynchronizedPrintf(cOmm,"Nb. FEs %u\n",entsFiniteElements.size());
701  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
702  typedef EntFiniteElement_multiIndex::index<BitFEId_mi_tag>::type FiniteElementById;
703  FiniteElementById &finite_elements_by_id = entsFiniteElements.get<BitFEId_mi_tag>();
704  FiniteElement_multiIndex::iterator fe_id_it = finiteElements.begin();
705  for(;fe_id_it!=finiteElements.end();fe_id_it++) {
706  FiniteElementById::iterator miit = finite_elements_by_id.lower_bound((*fe_id_it)->getId());
707  FiniteElementById::iterator hi_miit = finite_elements_by_id.upper_bound((*fe_id_it)->getId());
708  int count = distance(miit,hi_miit);
709  std::ostringstream ss;
710  ss << *(*fe_id_it) << " Nb. FEs " << count << std::endl;
711  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
712  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
713  }
714  }
715 
716  *buildMoFEM |= 1<<1;
717  PetscFunctionReturn(0);
718  }
static PetscErrorCode ierr
Definition: Common.hpp:26
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
PetscErrorCode build_finite_elements(int verb=-1)
add entity EntFe to finite element data databse and resolve dofs on that entity
Definition: FECore.cpp:687
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92
CHKERRQ(ierr)
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:139
int verbose
Verbosity level.
Definition: Core.hpp:124
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:140

◆ build_finite_elements() [2/4]

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

Definition at line 720 of file FECore.cpp.

720  {
721  PetscFunctionBegin;
722  SETERRQ(cOmm,MOFEM_NOT_IMPLEMENTED,"Not yet implemented");
723  PetscFunctionReturn(0);
724  }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819

◆ build_finite_elements() [3/4]

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

Definition at line 472 of file FECore.cpp.

474  {
475  PetscFunctionBegin;
476  if(verb==-1) verb = verbose;
477 
478  typedef RefElement_multiIndex::index<Ent_mi_tag>::type RefFiniteElementByEnt;
479  typedef Field_multiIndex::index<BitFieldId_mi_tag>::type FieldById;
480  FieldById &fields_by_id = fIelds.get<BitFieldId_mi_tag>();
481 
482  //get id of mofem fields for row, col and data
483  enum IntLoop { ROW = 0,COL,DATA,LAST };
484  BitFieldId fe_fields[LAST] = {
485  fe.get()->getBitFieldIdRow(),
486  fe.get()->getBitFieldIdCol(),
487  fe.get()->getBitFieldIdData()
488  };
489 
490  //get finite element meshset
491  EntityHandle meshset = get_finite_element_meshset(fe.get()->getId());
492  // get entities from finite element meshset // if meshset
493  Range fe_ents;
494  rval = moab.get_entities_by_handle(meshset,fe_ents,false); CHKERRQ_MOAB(rval);
495  if(ents_ptr) fe_ents = intersect(fe_ents,*ents_ptr);
496 
497  // map entity uid to pointers
498  std::map<UId,std::vector<boost::weak_ptr<EntFiniteElement> > > map_uid_fe;
499  std::map<EntityHandle,int> data_dofs_size;
500 
501  //loop meshset Ents and add finite elements
502  for(
503  Range::const_pair_iterator
504  peit = fe_ents.const_pair_begin();peit!=fe_ents.const_pair_end();peit++
505  ) {
506 
507  EntityHandle first = peit->first;
508  EntityHandle second = peit->second;
509 
510  // note: iterator is a wrapper
511  // check if is in refinedFiniteElements database
512  RefFiniteElementByEnt::iterator ref_fe_miit,hi_ref_fe_miit;
513  ref_fe_miit = refinedFiniteElements.get<Ent_mi_tag>().lower_bound(first);
514  if(ref_fe_miit == refinedFiniteElements.get<Ent_mi_tag>().end()) {
515  std::ostringstream ss;
516  ss << "refinedFiniteElements not in database ent = " << first;
517  ss << " type " << moab.type_from_handle(first);
518  ss << " " << *fe;
519  SETERRQ(cOmm,MOFEM_DATA_INCONSISTENCY,ss.str().c_str());
520  }
521  hi_ref_fe_miit = refinedFiniteElements.get<Ent_mi_tag>().upper_bound(second);
522 
523  for(;ref_fe_miit!=hi_ref_fe_miit;ref_fe_miit++) {
524 
525  std::pair<EntFiniteElement_multiIndex::iterator,bool> p = entsFiniteElements.insert(
526  boost::make_shared<EntFiniteElement>(ref_fe_miit->getRefElement(),fe)
527  );
528 
529  if(fe_fields[ROW]==fe_fields[COL]) {
530  p.first->get()->col_dof_view = p.first->get()->row_dof_view;
531  }
532 
533  if(
534  fe_fields[ROW]!=fe_fields[COL] &&
535  p.first->get()->col_dof_view == p.first->get()->row_dof_view
536  ) {
537  p.first->get()->col_dof_view = boost::make_shared<DofEntity_multiIndex_uid_view>();
538  }
539 
540  p.first->get()->row_dof_view->clear();
541  p.first->get()->col_dof_view->clear();
542  p.first->get()->data_dofs->clear();
543 
544  for(unsigned int ii = 0;ii<BitFieldId().size();ii++) {
545 
546  // Common field id for ROW, COL and DATA
547  BitFieldId id_common = 0;
548  // Check if the field (ii) is added to finite element
549  for(int ss = 0;ss<LAST;ss++) {
550  id_common |= fe_fields[ss]&BitFieldId().set(ii);
551  }
552  if( id_common.none() ) continue;
553 
554  // Find in database data associated with the field (ii)
555  const BitFieldId field_id = BitFieldId().set(ii);
556  FieldById::iterator miit = fields_by_id.find(field_id);
557  if(miit==fields_by_id.end()) {
558  SETERRQ(cOmm,MOFEM_DATA_INCONSISTENCY,"Data inconsistency");
559  }
560 
561  // Entities adjacent to entities
562  Range adj_ents;
563 
564  // Resolve entities on element, those entities are used to build tag with dof
565  // uids on finite element tag
566  ierr = p.first->get()->getElementAdjacency(*miit,adj_ents); CHKERRQ(ierr);
567 
568  // Loop over adjacencies of element and find field entities on those
569  // adjacencies, that create hash map map_uid_fe which is used later
570  const std::string field_name = miit->get()->getName();
571  const bool add_to_data = (field_id&p.first->get()->getBitFieldIdData()).any();
572  FieldEntity_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type::iterator meit;
573  for(Range::iterator eit = adj_ents.begin();eit!=adj_ents.end();eit++) {
574  meit = entsFields.get<Composite_Name_And_Ent_mi_tag>().find(boost::make_tuple(field_name,*eit));
575  if(meit!=entsFields.get<Composite_Name_And_Ent_mi_tag>().end()) {
576  UId uid = meit->get()->getGlobalUniqueId();
577  map_uid_fe[uid].push_back(*p.first);
578  if(add_to_data) {
579  data_dofs_size[p.first->get()->getEnt()] += meit->get()->getNbDofsOnEnt();
580  }
581  }
582  }
583 
584  }
585 
586  }
587 
588  }
589 
590  std::map<
591  EntityHandle,
592  boost::shared_ptr<std::vector<FEDofEntity> >
593  > data_dofs_array;
594  for(
595  std::map<EntityHandle,int>::iterator
596  mit = data_dofs_size.begin();mit!=data_dofs_size.end();mit++
597  ) {
598  if(mit->second>0) {
599  data_dofs_array[mit->first]=boost::make_shared<std::vector<FEDofEntity> >();
600  data_dofs_array[mit->first]->reserve(mit->second);
601  }
602  }
603  std::vector<boost::shared_ptr<FEDofEntity> > data_dofs_shared_array;
604 
605  typedef DofEntity_multiIndex::index<Unique_Ent_mi_tag>::type DofsByEntUId;
606  DofsByEntUId& dofs_by_ent_uid = dofsField.get<Unique_Ent_mi_tag>();
607 
608  // Loop over hash map, which has all entities on given elemnts
609  boost::shared_ptr<SideNumber> side_number_ptr;
610  for(
611  std::map<UId,std::vector<boost::weak_ptr<EntFiniteElement> > >::iterator
612  mit = map_uid_fe.begin();mit!=map_uid_fe.end();mit++
613  ) {
614  DofsByEntUId::iterator dit,hi_dit;
615  dit = dofs_by_ent_uid.lower_bound(mit->first);
616  hi_dit = dofs_by_ent_uid.upper_bound(mit->first);
617  for(;dit!=hi_dit;dit++) {
618  // cerr << mit->first << endl;
619  // cerr << **dit << endl;
620  const BitFieldId field_id = dit->get()->getId();
621  const EntityHandle dof_ent = dit->get()->getEnt();
622  std::vector<boost::weak_ptr<EntFiniteElement> >::iterator fe_it,hi_fe_it;
623  fe_it = mit->second.begin();
624  hi_fe_it = mit->second.end();
625  for(;fe_it!=hi_fe_it;fe_it++) {
626 
627  // if rows and columns of finite element are the same, then
628  // we exploit that case
629  if((field_id&fe_it->lock().get()->getBitFieldIdRow()).any()) {
630  fe_it->lock().get()->row_dof_view->insert(fe_it->lock().get()->row_dof_view->end(),*dit);
631  }
632  if(fe_it->lock().get()->col_dof_view!=fe_it->lock().get()->row_dof_view) {
633  if((field_id&fe_it->lock().get()->getBitFieldIdCol()).any()) {
634  fe_it->lock().get()->col_dof_view->insert(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(
660  std::vector<FEDofEntity>::iterator
661  vit=data_dofs_array[fe_ent]->begin();
662  vit!=data_dofs_array[fe_ent]->end();
663  vit++
664  ) {
665  data_dofs_shared_array.push_back(
666  boost::shared_ptr<FEDofEntity>(data_dofs_array[fe_ent],&(*vit))
667  );
668  }
669  fe_it->lock().get()->data_dofs->get<Unique_mi_tag>().insert(
670  data_dofs_shared_array.begin(),data_dofs_shared_array.end()
671  );
672  fe_it->lock().get()->getDofsSeqence()=data_dofs_array[fe_ent];
673  }
674  // // add dofs to finite element multi_index database
675  // fe_it->lock().get()->data_dofs.get<Unique_mi_tag>().insert(
676  // boost::shared_ptr<FEDofEntity>(new FEDofEntity(side_number_ptr,*dit))
677  // );
678  }
679  }
680  }
681 
682  }
683 
684  PetscFunctionReturn(0);
685  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
DofEntity_multiIndex dofsField
dofs on fiels
Definition: Core.hpp:135
EntityHandle get_finite_element_meshset(const BitFEId id) const
Definition: FECore.cpp:234
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
FieldEntity_multiIndex entsFields
entities on field
Definition: Core.hpp:134
std::bitset< BITFIELDID_SIZE > BitFieldId
Definition: Common.hpp:50
uint128_t UId
Unique Id.
Definition: Common.hpp:38
CHKERRQ(ierr)
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:129
Field_multiIndex fIelds
field
Definition: Core.hpp:133
int verbose
Verbosity level.
Definition: Core.hpp:124
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:140

◆ build_finite_elements() [4/4]

PetscErrorCode 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::Interface.

◆ build_problem() [1/2]

PetscErrorCode MoFEM::Core::build_problem ( const std::string &  name,
const bool  square_matrix,
int  verb = -1 
)
protectedvirtual

build problem data structures

Note
If square_matrix is set to true, that indicate that problem is structurally symmetric, i.e. rows and columns have the same dofs and are indexed in the same way.
Deprecated:
Use ProblemsManager to build and partition problems
Parameters
problempointer
square_matrixstructurally symmetric problem
verbverbosity level
Returns
error code

Implements MoFEM::Interface.

Definition at line 284 of file ProblemsCore.cpp.

284  {
285  ProblemsManager *problem_manager_ptr;
286  PetscFunctionBegin;
287  // Note: Only allowe changes on problem_ptr structure which not influence multindex
288  // indexing are allowd.
289  if(verb==-1) verb = verbose;
290  ierr = query_interface(problem_manager_ptr); CHKERRQ(ierr);
291  ierr = problem_manager_ptr->buildProblem(problem_name,square_matrix,verb); CHKERRQ(ierr);
292  PetscFunctionReturn(0);
293 }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
int verbose
Verbosity level.
Definition: Core.hpp:124
IFace * query_interface() const
Definition: Interface.hpp:56

◆ build_problem() [2/2]

PetscErrorCode MoFEM::Core::build_problem ( Problem problem_ptr,
const bool  square_matrix,
int  verb = -1 
)
protectedvirtual

build problem data structures

Note
If square_matrix is set to true, that indicate that problem is structurally symmetric, i.e. rows and columns have the same dofs and are indexed in the same way.
Deprecated:
Use ProblemsManager to build and partition problems
Parameters
nameproblem name
square_matrixstructurally symmetric problem
verbverbosity level
Returns
error code

Implements MoFEM::Interface.

Definition at line 274 of file ProblemsCore.cpp.

274  {
275  ProblemsManager *problem_manager_ptr;
276  PetscFunctionBegin;
277  // Note: Only allowe changes on problem_ptr structure which not influence multindex
278  // indexing are allowd.
279  if(verb==-1) verb = verbose;
280  ierr = query_interface(problem_manager_ptr); CHKERRQ(ierr);
281  ierr = problem_manager_ptr->buildProblem(problem_ptr,square_matrix,verb); CHKERRQ(ierr);
282  PetscFunctionReturn(0);
283 }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
int verbose
Verbosity level.
Definition: Core.hpp:124
IFace * query_interface() const
Definition: Interface.hpp:56

◆ build_problem_on_distributed_mesh() [1/3]

PetscErrorCode 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::Interface.

Definition at line 231 of file ProblemsCore.cpp.

231  {
232  PetscFunctionBegin;
233  if(verb==-1) verb = verbose;
234  DofEntity_multiIndex_active_view dofs_rows,dofs_cols;
235  Problem_multiIndex::iterator p_miit = pRoblems.begin();
236  for(;p_miit!=pRoblems.end();p_miit++) {
237  ierr = build_problem_on_distributed_mesh(const_cast<Problem*>(&*p_miit),verb); CHKERRQ(ierr);
238  }
239  PetscFunctionReturn(0);
240 }
static PetscErrorCode ierr
Definition: Common.hpp:26
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
DEPRECATED PetscErrorCode build_problem_on_distributed_mesh(int verb=-1)
build problem data structures, assuming that mesh is distributed (collective)
CHKERRQ(ierr)
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:148
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ build_problem_on_distributed_mesh() [2/3]

PetscErrorCode MoFEM::Core::build_problem_on_distributed_mesh ( const std::string &  name,
const bool  square_matrix = true,
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::Interface.

Definition at line 208 of file ProblemsCore.cpp.

210  {
211  ProblemsManager *problems_manager_ptr;
212  PetscFunctionBegin;
213  if(verb==-1) verb = verbose;
214  ierr = query_interface(problems_manager_ptr); CHKERRQ(ierr);
215  ierr = problems_manager_ptr->buildProblemOnDistributedMesh(
216  name,square_matrix,verb
217  ); CHKERRQ(ierr);
218  PetscFunctionReturn(0);
219 }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
int verbose
Verbosity level.
Definition: Core.hpp:124
IFace * query_interface() const
Definition: Interface.hpp:56

◆ build_problem_on_distributed_mesh() [3/3]

PetscErrorCode MoFEM::Core::build_problem_on_distributed_mesh ( Problem problem_ptr,
const bool  square_matrix = true,
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::Interface.

Definition at line 220 of file ProblemsCore.cpp.

222  {
223  ProblemsManager *problems_manager_ptr;
224  PetscFunctionBegin;
225  ierr = query_interface(problems_manager_ptr); CHKERRQ(ierr);
226  ierr = problems_manager_ptr->buildProblemOnDistributedMesh(
227  problem_ptr,square_matrix,verb
228  ); CHKERRQ(ierr);
229  PetscFunctionReturn(0);
230 }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
IFace * query_interface() const
Definition: Interface.hpp:56

◆ build_problems()

PetscErrorCode 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::Interface.

Definition at line 294 of file ProblemsCore.cpp.

294  {
295  PetscFunctionBegin;
296  if(verb==-1) verb = verbose;
297  if(!((*buildMoFEM)&BUILD_FIELD)) SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"fields not build");
298  if(!((*buildMoFEM)&BUILD_FE)) SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"FEs not build");
299  if(!((*buildMoFEM)&BUILD_ADJ)) SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"adjacencies not build");
300  //iterate problems
301  Problem_multiIndex::iterator p_miit = pRoblems.begin();
302  for(;p_miit!=pRoblems.end();p_miit++) {
303  Problem *problem_ptr = const_cast<Problem*>(&*p_miit);
304  ierr = build_problem(problem_ptr,false,verb); CHKERRQ(ierr);
305  }
307  PetscFunctionReturn(0);
308 }
static PetscErrorCode ierr
Definition: Common.hpp:26
int * buildMoFEM
keeps flags/semaphores for different stages
Definition: Core.hpp:92
CHKERRQ(ierr)
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:148
int verbose
Verbosity level.
Definition: Core.hpp:124
DEPRECATED PetscErrorCode build_problem(const std::string &name, const bool square_matrix, int verb=-1)
build problem data structures

◆ build_sub_problem()

PetscErrorCode MoFEM::Core::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 
)
protectedvirtual

build sub problem

Deprecated:
Use ProblemsManager to build and partition problems
Parameters
out_nameproblem
fields_rowvector of fields composing problem
fields_colvector of fields composing problem
main_problemmain problem
Returns
error code

Implements MoFEM::Interface.

Definition at line 354 of file ProblemsCore.cpp.

361  {
362  ProblemsManager *problem_manager_ptr;
363  PetscFunctionBegin;
364  ierr = query_interface(problem_manager_ptr); CHKERRQ(ierr);
365 
366  if(verb==-1) verb = verbose;
367  ierr = problem_manager_ptr->buildSubProblem(
368  out_name,fields_row,fields_col,main_problem,square_matrix,verb
369  ); CHKERRQ(ierr);
370 
371  PetscFunctionReturn(0);
372 }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
int verbose
Verbosity level.
Definition: Core.hpp:124
IFace * query_interface() const
Definition: Interface.hpp:56

◆ buildFieldForL2H1HcurlHdiv()

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

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

◆ buildFieldForNoField()

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

Definition at line 759 of file FieldCore.cpp.

761  {
762  PetscFunctionBegin;
763  if(verb==-1) verb = verbose;
764  //field it
765  typedef Field_multiIndex::index<BitFieldId_mi_tag>::type FieldSetById;
766  const FieldSetById &set_id = fIelds.get<BitFieldId_mi_tag>();
767  //find fiels
768  FieldSetById::iterator miit = set_id.find(id);
769  if(miit == set_id.end()) {
770  SETERRQ(cOmm,MOFEM_NOT_FOUND,"field not found");
771  }
772 
773  //ents in the field meshset
774  Range ents_of_id_meshset;
775  rval = moab.get_entities_by_handle((*miit)->meshSet,ents_of_id_meshset,false); CHKERRQ_MOAB(rval);
776  if(verb>5) {
777  PetscSynchronizedPrintf(
778  cOmm,"ents in field %s meshset %d\n",(*miit)->getName().c_str(),ents_of_id_meshset.size()
779  );
780  }
781  for(
782  Range::iterator eit = ents_of_id_meshset.begin();
783  eit != ents_of_id_meshset.end();eit++
784  ) {
785  //serch if field meshset is in database
786  RefEntity_multiIndex::index<Ent_mi_tag>::type::iterator miit_ref_ent;
787  miit_ref_ent = refinedEntities.get<Ent_mi_tag>().find(*eit);
788  if(miit_ref_ent==refinedEntities.get<Ent_mi_tag>().end()) {
789  SETERRQ(
790  cOmm,
792  "Entity is not in MoFEM databse, entities in field meshset need to be seeded (i.e. bit ref level add to them)"
793  );
794  }
795  std::pair<FieldEntity_multiIndex::iterator,bool> e_miit;
796  try {
797  //create database entity
798  e_miit = entsFields.insert(boost::make_shared<FieldEntity>(*miit,*miit_ref_ent));
799  } catch (MoFEMException const &e) {
800  SETERRQ(cOmm,e.errorCode,e.errorMessage);
801  } catch (const std::exception& ex) {
802  std::ostringstream ss;
803  ss << ex.what() << std::endl;
804  SETERRQ(cOmm,MOFEM_STD_EXCEPTION_THROW,ss.str().c_str());
805  }
806  //this is nor real field in space (set order to zero)
807  bool success = entsFields.modify(e_miit.first,FieldEntity_change_order(0));
808  if(!success) SETERRQ(cOmm,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
809  FieldCoefficientsNumber rank = 0;
810  //create dofs on this entity (nb. of dofs is equal to rank)
811  for(;rank<(*e_miit.first)->getNbOfCoeffs();rank++) {
812  std::pair<DofEntity_multiIndex::iterator,bool> d_miit;
813  //check if dof is in darabase
814  d_miit.first = dofsField.project<0>(
815  dofsField.get<Unique_mi_tag>().find(DofEntity::getGlobalUniqueIdCalculate(rank,*(e_miit.first)))
816  );
817  //if dof is not in databse
818  if(d_miit.first==dofsField.end()) {
819  //insert dof
820  d_miit = dofsField.insert(boost::make_shared<DofEntity>(*(e_miit.first),0,rank,rank));
821  if(d_miit.second) {
822  dof_counter[MBENTITYSET]++; // Count entities in the meshset
823  }
824  bool success = dofsField.modify(d_miit.first,DofEntity_active_change(true));
825  if(!success) SETERRQ(cOmm,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
826  }
827  //check consistency
828  assert((*d_miit.first)->getEntType()==(*e_miit.first)->getEntType());
829  assert((*d_miit.first)->getId()==(*e_miit.first)->getId());
830  assert((*d_miit.first)->getMaxOrder()==0);
831  }
832  }
833  if(verb>2) {
834  typedef DofEntity_multiIndex::index<FieldName_mi_tag>::type DofsByName;
835  DofsByName &set = dofsField.get<FieldName_mi_tag>();
836  DofsByName::iterator miit2 = set.lower_bound(miit->get()->getNameRef());
837  DofsByName::iterator hi_miit2 = set.upper_bound(miit->get()->getNameRef());
838  assert(miit2!=hi_miit2);
839  for(;miit2!=hi_miit2;miit2++) {
840  std::ostringstream ss;
841  ss << *miit2 << std::endl;;
842  PetscSynchronizedPrintf(cOmm,ss.str().c_str());
843  }
844  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
845  }
846  PetscFunctionReturn(0);
847 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
int FieldCoefficientsNumber
Number of field coefficients.
Definition: Common.hpp:34
DofEntity_multiIndex dofsField
dofs on fiels
Definition: Core.hpp:135
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:128
FieldEntity_multiIndex entsFields
entities on field
Definition: Core.hpp:134
Field_multiIndex fIelds
field
Definition: Core.hpp:133
int verbose
Verbosity level.
Definition: Core.hpp:124
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::Interface.

Definition at line 77 of file FieldCore.cpp.

77  {
78  typedef Field_multiIndex::index<FieldName_mi_tag>::type FieldSetByName;
79  const FieldSetByName &set = fIelds.get<FieldName_mi_tag>();
80  FieldSetByName::iterator miit = set.find(name);
81  if(miit==set.end()) return false;
82  return true;
83 }
Field_multiIndex fIelds
field
Definition: Core.hpp:133

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

Definition at line 63 of file FECore.cpp.

63  {
64  typedef FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type FeSetByName;
65  const FeSetByName &set = finiteElements.get<FiniteElement_name_mi_tag>();
66  FeSetByName::iterator miit = set.find(name);
67  if(miit==set.end()) return false;
68  return true;
69  }
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:139

◆ check_msId_meshset()

bool MoFEM::Core::check_msId_meshset ( const int  msId,
const CubitBCType  cubit_bc_type 
)
protectedvirtual

check for CUBIT Id and CUBIT type

Deprecated:
use MeshsetsManager
Todo:
All cubit interface functions should be outsourced to dedicated interface
Parameters
msIdid of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)

Implements MoFEM::Interface.

Definition at line 1032 of file Core.cpp.

1032  {
1033  return get_meshsets_manager_ptr()->checkMeshset(ms_id,cubit_bc_type);
1034 }
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition: Core.cpp:1156
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type

◆ check_number_of_ents_in_ents_field() [1/2]

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

check data consistency in entitiesPtr

Implements MoFEM::Interface.

Definition at line 1489 of file FieldCore.cpp.

1489  {
1490  PetscFunctionBegin;
1491  Field_multiIndex::index<FieldName_mi_tag>::type::iterator it = fIelds.get<FieldName_mi_tag>().find(name);
1492  if(it == fIelds.get<FieldName_mi_tag>().end()) {
1493  SETERRQ1(cOmm,1,"field not found < %s >",name.c_str());
1494  }
1495  EntityHandle meshset = (*it)->getMeshset();
1496 
1497  int num_entities;
1498 
1499  rval = moab.get_number_entities_by_handle(meshset,num_entities); CHKERRQ_MOAB(rval);
1500  if(
1501  entsFields.get<FieldName_mi_tag>().count((*it)->getName()) > (unsigned int)num_entities
1502  ) {
1503  SETERRQ1(cOmm,1,"not equal number of entities in meshset and field multiindex < %s >",name.c_str());
1504  }
1505  PetscFunctionReturn(0);
1506 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
FieldEntity_multiIndex entsFields
entities on field
Definition: Core.hpp:134
Field_multiIndex fIelds
field
Definition: Core.hpp:133

◆ check_number_of_ents_in_ents_field() [2/2]

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

check data consistency in entitiesPtr

Implements MoFEM::Interface.

Definition at line 1507 of file FieldCore.cpp.

1507  {
1508  PetscFunctionBegin;
1509  Field_multiIndex::index<FieldName_mi_tag>::type::iterator it = fIelds.get<FieldName_mi_tag>().begin();
1510  for(;it!=fIelds.get<FieldName_mi_tag>().end();it++) {
1511  if((*it)->getSpace() == NOFIELD) continue; //FIXME: should be treated properly, not test is just skipped for this NOFIELD space
1512  EntityHandle meshset = (*it)->getMeshset();
1513 
1514  int num_entities;
1515  rval = moab.get_number_entities_by_handle(meshset,num_entities); CHKERRQ_MOAB(rval);
1516  if(entsFields.get<FieldName_mi_tag>().count((*it)->getName()) > (unsigned int)num_entities) {
1517  SETERRQ1(cOmm,1,"not equal number of entities in meshset and field multiindex < %s >",(*it)->getName().c_str());
1518  }
1519  }
1520  PetscFunctionReturn(0);
1521 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
FieldEntity_multiIndex entsFields
entities on field
Definition: Core.hpp:134
scalar or vector of scalars describe (no true field)
Definition: definitions.h:158
Field_multiIndex fIelds
field
Definition: Core.hpp:133

◆ check_number_of_ents_in_ents_finite_element() [1/2]

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

check data consistency in entsFiniteElements

Implements MoFEM::Interface.

Definition at line 922 of file FECore.cpp.

922  {
923  PetscFunctionBegin;
924  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
925  it = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
926  if(it == finiteElements.get<FiniteElement_name_mi_tag>().end()) {
927  SETERRQ1(cOmm,1,"finite element not found < %s >",name.c_str());
928  }
929  EntityHandle meshset = (*it)->getMeshset();
930 
931  int num_entities;
932  rval = moab.get_number_entities_by_handle(meshset,num_entities); CHKERRQ_MOAB(rval);
933  if(
934  entsFiniteElements.get<FiniteElement_name_mi_tag>().count((*it)->getName().c_str())
935  != (unsigned int)num_entities
936  ) {
937  SETERRQ1(cOmm,1,"not equal number of entities in meshset and finite elements multiindex < %s >",(*it)->getName().c_str());
938  }
939  PetscFunctionReturn(0);
940  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:139
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:140

◆ check_number_of_ents_in_ents_finite_element() [2/2]

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

check data consistency in entsFiniteElements

Implements MoFEM::Interface.

Definition at line 942 of file FECore.cpp.

942  {
943  PetscFunctionBegin;
944  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator it;
945  it = finiteElements.get<FiniteElement_name_mi_tag>().begin();
946  for(;it!=finiteElements.get<FiniteElement_name_mi_tag>().end();it++) {
947  EntityHandle meshset = (*it)->getMeshset();
948 
949  int num_entities;
950  rval = moab.get_number_entities_by_handle(meshset,num_entities); CHKERRQ_MOAB(rval);
951  if(entsFiniteElements.get<FiniteElement_name_mi_tag>().count((*it)->getName().c_str())
952  != (unsigned int)num_entities) {
953  SETERRQ1(cOmm,1,"not equal number of entities in meshset and finite elements multiindex < %s >",(*it)->getName().c_str());
954  }
955  }
956  PetscFunctionReturn(0);
957  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:139
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:140

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

Definition at line 55 of file ProblemsCore.cpp.

55  {
56  Problem_multiIndex::index<Problem_mi_tag>::type::iterator pit;
57  pit = pRoblems.get<Problem_mi_tag>().find(name);
58  if(pit==pRoblems.get<Problem_mi_tag>().end()) {
59  return false;
60  }
61  return true;
62 }
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:148

◆ clear_adjacencies_entities() [1/2]

PetscErrorCode 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::Interface.

Definition at line 273 of file DeleteCore.cpp.

273  {
274  PetscFunctionBegin;
275  if(verb==-1) verb = verbose;
276  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::iterator ait;
277  ait = entFEAdjacencies.begin();
278  for(;ait!=entFEAdjacencies.end();) {
279  BitRefLevel bit2 = ait->entFieldPtr->getBitRefLevel();
280  if(ait->entFieldPtr->getEntType()==MBENTITYSET) {
281  ait++;
282  continue;
283  }
284  if((bit2&mask)!=bit2) {
285  ait++;
286  continue;
287  }
288  if((bit2&bit).none()) {
289  ait++;
290  continue;
291  }
292  ait = entFEAdjacencies.erase(ait);
293  }
294  PetscFunctionReturn(0);
295  }
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:48
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:144
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ clear_adjacencies_entities() [2/2]

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

Definition at line 297 of file DeleteCore.cpp.

297  {
298  PetscFunctionBegin;
299  if(verb==-1) verb = verbose;
300  Range::iterator eit = ents.begin();
301  for(;eit!=ents.end();eit++) {
302  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<Ent_mi_tag>::type::iterator ait,hi_ait;
303  ait = entFEAdjacencies.get<Ent_mi_tag>().lower_bound(*eit);
304  hi_ait = entFEAdjacencies.get<Ent_mi_tag>().upper_bound(*eit);
305  for(;ait!=hi_ait;) {
306  if(ait->entFieldPtr->getName() == name) {
307  ait = entFEAdjacencies.get<Ent_mi_tag>().erase(ait);
308  } else {
309  ait++;
310  }
311  }
312  }
313  PetscFunctionReturn(0);
314  }
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:144
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ clear_adjacencies_finite_elements() [1/2]

PetscErrorCode 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::Interface.

Definition at line 232 of file DeleteCore.cpp.

232  {
233  PetscFunctionBegin;
234  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::iterator ait;
235  ait = entFEAdjacencies.begin();
236  for(;ait!=entFEAdjacencies.end();) {
237  BitRefLevel bit2 = ait->entFePtr->getBitRefLevel();
238  if(ait->entFePtr->getEntType()==MBENTITYSET) {
239  ait++;
240  continue;
241  }
242  if((bit2&mask)!=bit2) {
243  ait++;
244  continue;
245  }
246  if((bit2&bit).none()) {
247  ait++;
248  continue;
249  }
250  ait = entFEAdjacencies.erase(ait);
251  }
252  PetscFunctionReturn(0);
253  }
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:48
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:144

◆ clear_adjacencies_finite_elements() [2/2]

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

Definition at line 254 of file DeleteCore.cpp.

254  {
255  PetscFunctionBegin;
256  if(verb==-1) verb = verbose;
257  Range::iterator eit = ents.begin();
258  for(;eit!=ents.end();eit++) {
259  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<FEEnt_mi_tag>::type::iterator ait,hi_ait;
260  ait = entFEAdjacencies.get<FEEnt_mi_tag>().lower_bound(*eit);
261  hi_ait = entFEAdjacencies.get<FEEnt_mi_tag>().upper_bound(*eit);
262  for(;ait!=hi_ait;) {
263  if(ait->entFePtr->getName() == name) {
264  ait = entFEAdjacencies.get<FEEnt_mi_tag>().erase(ait);
265  } else {
266  ait++;
267  }
268  }
269  }
270  PetscFunctionReturn(0);
271  }
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:144
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ clear_database()

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

Clear database.

Parameters
verbVerbosity level
Returns
Error code

Implements MoFEM::Interface.

Definition at line 723 of file Core.cpp.

723  {
724  PetscFunctionBegin;
725  if(verb==-1) verb = verbose;
726  ierr = clearMap(); CHKERRQ(ierr);
727  PetscFunctionReturn(0);
728 }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
PetscErrorCode clearMap()
Definition: Core.cpp:419
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ clear_dofs_fields() [1/2]

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

Clear dofs by bit level

Implements MoFEM::Interface.

Definition at line 77 of file DeleteCore.cpp.

77  {
78  PetscFunctionBegin;
79  if(verb==-1) verb = verbose;
80  {
81  DofEntity_multiIndex::iterator dit;
82  dit = dofsField.begin();
83  for(;dit!=dofsField.end();) {
84  BitRefLevel bit2 = (*dit)->getBitRefLevel();
85  if((*dit)->getEntType()==MBENTITYSET) {
86  dit++;
87  continue;
88  }
89  if((bit2&mask)!=bit2) {
90  dit++;
91  continue;
92  }
93  if((bit2&bit).none()) {
94  dit++;
95  continue;
96  }
97  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<Unique_mi_tag>::type::iterator ait,hi_ait;
98  ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
99  hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
100  for(;ait!=hi_ait;ait++) {
101  boost::shared_ptr<EntFiniteElement> ent_fe_ptr;
102  ent_fe_ptr = ait->entFePtr;
103  ent_fe_ptr->row_dof_view->erase((*dit)->getGlobalUniqueId());
104  if(ent_fe_ptr->row_dof_view!=ent_fe_ptr->col_dof_view) {
105  ent_fe_ptr->col_dof_view->erase((*dit)->getGlobalUniqueId());
106  }
107  ent_fe_ptr->data_dofs->get<Unique_mi_tag>().erase((*dit)->getGlobalUniqueId());
108  }
109  dit = dofsField.erase(dit);
110  }
111  }
112  PetscFunctionReturn(0);
113  }
DofEntity_multiIndex dofsField
dofs on fiels
Definition: Core.hpp:135
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:48
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:144
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ clear_dofs_fields() [2/2]

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

Clear dofs by field name

Implements MoFEM::Interface.

Definition at line 115 of file DeleteCore.cpp.

115  {
116  PetscFunctionBegin;
117  if(verb==-1) verb = verbose;
118  Range::iterator eit = ents.begin();
119  for(;eit!=ents.end();eit++) {
120  DofEntityByNameAndEnt::iterator dit,hi_dit;
121  dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().lower_bound(boost::make_tuple(name,*eit));
122  hi_dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().upper_bound(boost::make_tuple(name,*eit));
123  for(;dit!=hi_dit;) {
124  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<Unique_mi_tag>::type::iterator ait,hi_ait;
125  ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
126  hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
127  for(;ait!=hi_ait;ait++) {
128  boost::shared_ptr<EntFiniteElement> ent_fe_ptr;
129  ent_fe_ptr = ait->entFePtr;
130  ent_fe_ptr->row_dof_view->erase((*dit)->getGlobalUniqueId());
131  if(ent_fe_ptr->row_dof_view!=ent_fe_ptr->col_dof_view) {
132  ent_fe_ptr->col_dof_view->erase((*dit)->getGlobalUniqueId());
133  }
134  }
135  dit = dofsField.get<Composite_Name_And_Ent_mi_tag>().erase(dit);
136  }
137  }
138  PetscFunctionReturn(0);
139  }
DofEntity_multiIndex dofsField
dofs on fiels
Definition: Core.hpp:135
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:144
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ clear_ents_fields() [1/2]

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

Clear ents by bit level

Implements MoFEM::Interface.

Definition at line 141 of file DeleteCore.cpp.

141  {
142  PetscFunctionBegin;
143  if(verb==-1) verb = verbose;
144  ierr = clear_dofs_fields(bit,mask,verb); CHKERRQ(ierr);
145  ierr = clear_adjacencies_entities(bit,mask,verb); CHKERRQ(ierr);
146  FieldEntity_multiIndex::iterator eit;
147  eit = entsFields.begin();
148  for(;eit!=entsFields.end();) {
149  if((*eit)->getEntType()==MBENTITYSET) {
150  eit++;
151  continue;
152  }
153  BitRefLevel bit2 = (*eit)->getBitRefLevel();
154  if((bit2&mask)!=bit2) {
155  eit++;
156  continue;
157  }
158  if((bit2&bit).none()) {
159  eit++;
160  continue;
161  }
162  EntityHandle ent = (*eit)->getEnt();
163  rval = moab.tag_delete_data((*eit)->sFieldPtr->th_AppOrder,&ent,1); CHKERRQ_MOAB(rval);
164  if((*eit)->tag_FieldData_size>0) {
165  rval = moab.tag_delete_data((*eit)->sFieldPtr->th_FieldData,&ent,1); CHKERRQ_MOAB(rval);
166  }
167  eit = entsFields.erase(eit);
168  }
169  PetscFunctionReturn(0);
170  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
FieldEntity_multiIndex entsFields
entities on field
Definition: Core.hpp:134
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:48
CHKERRQ(ierr)
PetscErrorCode clear_dofs_fields(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
Definition: DeleteCore.cpp:77
int verbose
Verbosity level.
Definition: Core.hpp:124
PetscErrorCode clear_adjacencies_entities(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:273

◆ clear_ents_fields() [2/2]

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

Clear entities by field name

Implements MoFEM::Interface.

Definition at line 172 of file DeleteCore.cpp.

172  {
173  PetscFunctionBegin;
174  if(verb==-1) verb = verbose;
175  ierr = clear_dofs_fields(name,ents,verb); CHKERRQ(ierr);
176  ierr = clear_adjacencies_entities(name,ents,verb); CHKERRQ(ierr);
177  Range::iterator eit = ents.begin();
178  for(;eit!=ents.end();eit++) {
179  FieldEntity_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type::iterator dit,hi_dit;
180  dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().find(boost::make_tuple(name,*eit));
181  if(dit!=entsFields.get<Composite_Name_And_Ent_mi_tag>().end()) {
182  entsFields.get<Composite_Name_And_Ent_mi_tag>().erase(dit);
183  }
184  // hi_dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().upper_bound(boost::make_tuple(name,*eit));
185  // for(;dit!=hi_dit;) {
186  // dit = entsFields.get<Composite_Name_And_Ent_mi_tag>().erase(dit);
187  // }
188  }
189  PetscFunctionReturn(0);
190  }
static PetscErrorCode ierr
Definition: Common.hpp:26
FieldEntity_multiIndex entsFields
entities on field
Definition: Core.hpp:134
CHKERRQ(ierr)
PetscErrorCode clear_dofs_fields(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
Definition: DeleteCore.cpp:77
int verbose
Verbosity level.
Definition: Core.hpp:124
PetscErrorCode clear_adjacencies_entities(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:273

◆ clear_finite_elements() [1/2]

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

clear finite elements

Implements MoFEM::Interface.

Definition at line 192 of file DeleteCore.cpp.

192  {
193  PetscFunctionBegin;
194  if(verb==-1) verb = verbose;
196  EntFiniteElement_multiIndex::iterator fe_it = entsFiniteElements.begin();
197  for(;fe_it!=entsFiniteElements.end();) {
198  BitRefLevel bit2 = (*fe_it)->getBitRefLevel();
199  if((*fe_it)->getEntType()==MBENTITYSET) {
200  fe_it++;
201  continue;
202  }
203  if((bit2&mask)!=bit2) {
204  fe_it++;
205  continue;
206  }
207  if((bit2&bit).none()) {
208  fe_it++;
209  continue;
210  }
211  fe_it = entsFiniteElements.erase(fe_it);
212  }
213  PetscFunctionReturn(0);
214  }
PetscErrorCode 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:232
static PetscErrorCode ierr
Definition: Common.hpp:26
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:48
CHKERRQ(ierr)
int verbose
Verbosity level.
Definition: Core.hpp:124
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:140

◆ clear_finite_elements() [2/2]

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

clear finite elements

Implements MoFEM::Interface.

Definition at line 216 of file DeleteCore.cpp.

216  {
217  PetscFunctionBegin;
218  if(verb==-1) verb = verbose;
220  Range::iterator eit = ents.begin();
221  for(;eit!=ents.end();eit++) {
222  EntFiniteElement_multiIndex::index<Composite_Name_And_Ent_mi_tag>::type::iterator fit,hi_fit;
223  fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().lower_bound(boost::make_tuple(name,*eit));
224  hi_fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().upper_bound(boost::make_tuple(name,*eit));
225  for(;fit!=hi_fit;) {
226  fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().erase(fit);
227  }
228  }
229  PetscFunctionReturn(0);
230  }
PetscErrorCode 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:232
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
int verbose
Verbosity level.
Definition: Core.hpp:124
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:140

◆ clear_inactive_dofs()

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

Clear inactive dofs

Implements MoFEM::Interface.

Definition at line 51 of file DeleteCore.cpp.

51  {
52  PetscFunctionBegin;
53  if(verb==-1) verb = verbose;
54  DofEntity_multiIndex::iterator dit;
55  dit = dofsField.begin();
56  for(;dit!=dofsField.end();dit++) {
57  if(!(*dit)->getActive()) {
58  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<Unique_mi_tag>::type::iterator ait,hi_ait;
59  ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
60  hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound((*dit)->getFieldEntityPtr()->getGlobalUniqueId());
61  for(;ait!=hi_ait;ait++) {
62  boost::shared_ptr<EntFiniteElement> ent_fe_ptr;
63  ent_fe_ptr = ait->entFePtr;
64  ent_fe_ptr->row_dof_view->erase((*dit)->getGlobalUniqueId());
65  if(ent_fe_ptr->row_dof_view!=ent_fe_ptr->col_dof_view) {
66  ent_fe_ptr->col_dof_view->erase((*dit)->getGlobalUniqueId());
67  }
68  ent_fe_ptr->data_dofs->get<Unique_mi_tag>().erase((*dit)->getGlobalUniqueId());
69  }
70  dit = dofsField.erase(dit);
71  if(dit==dofsField.end()) break;
72  }
73  }
74  PetscFunctionReturn(0);
75  }
DofEntity_multiIndex dofsField
dofs on fiels
Definition: Core.hpp:135
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:144
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ clear_problem()

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

clear problem

Implements MoFEM::Interface.

Definition at line 250 of file ProblemsCore.cpp.

250  {
251  PetscFunctionBegin;
252  if(verb==-1) verb = verbose;
253  typedef Problem_multiIndex::index<Problem_mi_tag>::type pRoblemsByName;
254  pRoblemsByName &prob_by_name = pRoblems.get<Problem_mi_tag>();
255  pRoblemsByName::iterator p_miit = prob_by_name.find(problem_name);
256  if(p_miit == prob_by_name.end()) {
257  SETERRQ1(
258  PETSC_COMM_SELF,MOFEM_OPERATION_UNSUCCESSFUL,
259  "problem < %s > not found, (top tip: check spelling)",problem_name.c_str()
260  );
261  }
262  //zero rows
263  bool success = prob_by_name.modify(p_miit,ProblemZeroNbRowsChange());
264  if(!success) SETERRQ(PETSC_COMM_SELF,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
265  //zero cols
266  success = prob_by_name.modify(p_miit,ProblemZeroNbColsChange());
267  if(!success) SETERRQ(PETSC_COMM_SELF,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
268  //clear finite elements
269  success = prob_by_name.modify(p_miit,ProblemClearNumeredFiniteElementsChange());
270  if(!success) SETERRQ(PETSC_COMM_SELF,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
271 
272  PetscFunctionReturn(0);
273 }
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:148
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ clear_problems()

PetscErrorCode MoFEM::Core::clear_problems ( int  verb = -1)
protectedvirtual

clear problems

Implements MoFEM::Interface.

Definition at line 309 of file ProblemsCore.cpp.

309  {
310  PetscFunctionBegin;
311  if(verb==-1) verb = verbose;
312  Problem_multiIndex::iterator p_miit = pRoblems.begin();
313  //iterate problems
314  for(;p_miit!=pRoblems.end();p_miit++) {
315  //zero rows
316  bool success = pRoblems.modify(p_miit,ProblemZeroNbRowsChange());
317  if(!success) SETERRQ(PETSC_COMM_SELF,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
318  //zero cols
319  success = pRoblems.modify(p_miit,ProblemZeroNbColsChange());
320  if(!success) SETERRQ(PETSC_COMM_SELF,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
321  //clear finite elements
322  success = pRoblems.modify(p_miit,ProblemClearNumeredFiniteElementsChange());
323  if(!success) SETERRQ(PETSC_COMM_SELF,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
324  }
325  PetscFunctionReturn(0);
326 }
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:148
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ clearMap()

PetscErrorCode MoFEM::Core::clearMap ( )
protected

Definition at line 419 of file Core.cpp.

419  {
420 
421  PetscFunctionBegin;
422 
423  // Cleaning databases in iterfaces
424  SeriesRecorder *series_recorder_ptr;
425  ierr = query_interface(series_recorder_ptr); CHKERRQ(ierr);
426  ierr = series_recorder_ptr->clearMap(); CHKERRQ(ierr);
427  MeshsetsManager *m_manger_ptr;
428  ierr = query_interface(m_manger_ptr); CHKERRQ(ierr);
429  ierr = m_manger_ptr->clearMap(); CHKERRQ(ierr);
430  CoordSystemsManager *cs_manger_ptr;
431  ierr = query_interface(cs_manger_ptr); CHKERRQ(ierr);
432  ierr = cs_manger_ptr->clearMap(); CHKERRQ(ierr);
433 
434  // Cleaning databases
435  refinedEntities.clear();
436  refinedFiniteElements.clear();
437  fIelds.clear();
438  entsFields.clear();
439  dofsField.clear();
440  finiteElements.clear();
441  entsFiniteElements.clear();
442  entFEAdjacencies.clear();
443  pRoblems.clear();
444 
445 
446  PetscFunctionReturn(0);
447 }
DofEntity_multiIndex dofsField
dofs on fiels
Definition: Core.hpp:135
static PetscErrorCode ierr
Definition: Common.hpp:26
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:128
FieldEntity_multiIndex entsFields
entities on field
Definition: Core.hpp:134
CHKERRQ(ierr)
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:144
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:129
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:139
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:148
Field_multiIndex fIelds
field
Definition: Core.hpp:133
EntFiniteElement_multiIndex entsFiniteElements
finite element entities
Definition: Core.hpp:140
IFace * query_interface() const
Definition: Interface.hpp:56

◆ debugPartitionedProblem()

PetscErrorCode MoFEM::Core::debugPartitionedProblem ( const Problem problem_ptr,
int  verb = -1 
)
protected

Definition at line 383 of file ProblemsCore.cpp.

383  {
384  ProblemsManager *problem_manager_ptr;
385  PetscFunctionBegin;
386  if(verb==-1) verb = verbose;
387  ierr = query_interface(problem_manager_ptr); CHKERRQ(ierr);
388  ierr = problem_manager_ptr->debugPartitionedProblem(problem_ptr,verb); CHKERRQ(ierr);
389  PetscFunctionReturn(0);
390 }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
int verbose
Verbosity level.
Definition: Core.hpp:124
IFace * query_interface() const
Definition: Interface.hpp:56

◆ delete_cubit_msId()

PetscErrorCode MoFEM::Core::delete_cubit_msId ( const CubitBCType  cubit_bc_type,
const int  msId 
)
protectedvirtual

delete cubit meshset

Deprecated:
use MeshsetsManager
Todo:
All cubit interface functions should be outsourced to dedicated interface
Parameters
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
msIdid of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT

Implements MoFEM::Interface.

Definition at line 1055 of file Core.cpp.

1055  {
1056  return get_meshsets_manager_ptr()->deleteMeshset(cubit_bc_type,ms_id);
1057 }
PetscErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id)
delete cubit meshset
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition: Core.cpp:1156

◆ delete_ents_by_bit_ref()

PetscErrorCode MoFEM::Core::delete_ents_by_bit_ref ( const BitRefLevel bit,
const BitRefLevel mask,
const bool  remove_parent = false,
int  verb = -1 
)
protectedvirtual

delete entities form mofem and moab database

Implements MoFEM::Interface.

Definition at line 481 of file DeleteCore.cpp.

483  {
484  PetscFunctionBegin;
485  Range ents_to_delete;
486  rval = moab.get_entities_by_handle(0,ents_to_delete,false); CHKERRQ_MOAB(rval);
487  {
488  Range::iterator eit = ents_to_delete.begin();
489  for(;eit!=ents_to_delete.end();) {
490  if(moab.type_from_handle(*eit)==MBENTITYSET) {
491  eit = ents_to_delete.erase(eit);
492  continue;
493  }
494  BitRefLevel bit2;
495  rval = moab.tag_get_data(th_RefBitLevel,&*eit,1,&bit2); CHKERRQ_MOAB(rval);
496  if((bit2&mask)!=bit2) {
497  eit = ents_to_delete.erase(eit);
498  continue;
499  }
500  if((bit2&bit).none()) {
501  eit = ents_to_delete.erase(eit);
502  continue;
503  }
504  eit++;
505  }
506  }
507  if(remove_parent) { //remove parent
508  Range::iterator eit = ents_to_delete.begin();
509  for(;eit != ents_to_delete.end();eit++) {
510  RefEntity_multiIndex::index<Ent_Ent_mi_tag>::type::iterator pit,hi_pit;
511  pit = refinedEntities.get<Ent_Ent_mi_tag>().lower_bound(*eit);
512  hi_pit = refinedEntities.get<Ent_Ent_mi_tag>().upper_bound(*eit);
513  for(;pit!=hi_pit;pit++) {
514  EntityHandle ent = (*pit)->getRefEnt();
515  if(ents_to_delete.find(ent) != ents_to_delete.end()) {
516  continue;
517  }
518  /*if(rAnk==0) {
519  EntityHandle out_meshset;
520  rval = moab.create_meshset(MESHSET_SET|MESHSET_TRACK_OWNER,out_meshset); CHKERRQ_MOAB(rval);
521  rval = moab.add_entities(out_meshset,&ent,1); CHKERRQ_MOAB(rval);
522  rval = moab.add_entities(out_meshset,&*eit,1); CHKERRQ_MOAB(rval);
523  rval = moab.write_file("error.vtk","VTK","",&out_meshset,1); CHKERRQ_MOAB(rval);
524  rval = moab.delete_entities(&out_meshset,1); CHKERRQ_MOAB(rval);
525  }
526  std::ostringstream ss;
527  ss << "child:\n" << *pit << std::endl;
528  ss << "parent:\n" << RefEntity(moab,*eit) << std::endl;
529  SETERRQ1(PETSC_COMM_SELF,1,
530  "entity can not be removed, it is parent for some other entity\n%s",ss.str().c_str());*/
531  bool success = refinedEntities.modify(
532  refinedEntities.project<0>(pit),RefEntity_change_remove_parent()
533  );
534  if(!success) {
535  SETERRQ(PETSC_COMM_SELF,MOFEM_OPERATION_UNSUCCESSFUL,"modification unsuccessful");
536  }
537  }
538  }
539  }
540  { //remove deleted entities form cubit meshsets
541  CubitMeshSet_multiIndex::iterator cubit_it;
542  cubit_it = get_meshsets_manager_ptr()->getBegin();
543  for(;cubit_it!=get_meshsets_manager_ptr()->getEnd();cubit_it++) {
544  EntityHandle cubit_meshset = cubit_it->meshset;
545  rval = moab.remove_entities(cubit_meshset,ents_to_delete); CHKERRQ_MOAB(rval);
546  Range meshsets;
547  rval = moab.get_entities_by_type(cubit_meshset,MBENTITYSET,meshsets); CHKERRQ_MOAB(rval);
548  for(Range::iterator mit = meshsets.begin();mit!=meshsets.end();mit++) {
549  rval = moab.remove_entities(*mit,ents_to_delete); CHKERRQ_MOAB(rval);
550  }
551  }
552  }
553  ierr = remove_ents_by_bit_ref(bit,mask,verb); CHKERRQ(ierr);
554  if(verb>0) {
555  PetscSynchronizedPrintf(cOmm,"number of deleted entities = %u\n",ents_to_delete.size());
556  PetscSynchronizedFlush(cOmm,PETSC_STDOUT);
557  }
558  if(verb>2) {
559  EntityHandle out_meshset;
560  rval = moab.create_meshset(MESHSET_SET|MESHSET_TRACK_OWNER,out_meshset); CHKERRQ_MOAB(rval);
561  rval = moab.add_entities(out_meshset,ents_to_delete.subset_by_type(MBTET)); CHKERRQ_MOAB(rval);
562  rval = moab.write_file("debug_ents_to_delete.vtk","VTK","",&out_meshset,1); CHKERRQ_MOAB(rval);
563  rval = moab.delete_entities(&out_meshset,1); CHKERRQ_MOAB(rval);
564  }
565  Range meshsets;
566  rval = moab.get_entities_by_type(0,MBENTITYSET,meshsets,true);
567  for(Range::iterator mit = meshsets.begin();mit!=meshsets.end();mit++) {
568  rval = moab.remove_entities(*mit,ents_to_delete);
569  }
570  // rval = moab.delete_entities(ents_to_delete); CHKERRQ_MOAB(rval);
571  for(int dd = 3;dd>=0;dd--) {
572  rval = moab.delete_entities(ents_to_delete.subset_by_dimension(dd)); CHKERRQ_MOAB(rval);
573  }
574  PetscFunctionReturn(0);
575  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
RefEntity_multiIndex refinedEntities
refined entities
Definition: Core.hpp:128
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:48
CHKERRQ(ierr)
MeshsetsManager * get_meshsets_manager_ptr()
get MeshsetsManager pointer
Definition: Core.cpp:1156
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
PetscErrorCode remove_ents_by_bit_ref(const BitRefLevel &bit, const BitRefLevel &mask, int verb=-1)
remove entities form mofem database
Definition: DeleteCore.cpp:456
Tag th_RefBitLevel
Definition: Core.hpp:98
CubitMeshSet_multiIndex::iterator getBegin() const
get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(...
CubitMeshSet_multiIndex::iterator getEnd() const
get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(...

◆ delete_finite_element()

PetscErrorCode MoFEM::Core::delete_finite_element ( const std::string  name,
int  verb = -1 
)
protectedvirtual

delete finite element from mofem database

Implements MoFEM::Interface.

Definition at line 601 of file DeleteCore.cpp.

601  {
602  PetscFunctionBegin;
603  typedef FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type FiniteElements_by_name;
604  FiniteElements_by_name& fe = finiteElements.get<FiniteElement_name_mi_tag>();
605  FiniteElements_by_name::iterator miit = fe.find(name);
606  if(miit==fe.end()) {
607  SETERRQ1(
608  PETSC_COMM_SELF,MOFEM_OPERATION_UNSUCCESSFUL,
609  "finite element <%s> not found",name.c_str()
610  );
611  }
612  EntityHandle meshset = (*miit)->getMeshset();
613  Range ents;
614  rval = moab.get_entities_by_handle(meshset,ents,false); CHKERRQ_MOAB(rval);
615  ierr = remove_ents_from_finite_element(name,ents,verb); CHKERRQ(ierr);
616  fe.erase(miit);
617  rval = moab.delete_entities(&meshset,1); CHKERRQ_MOAB(rval);
618  PetscFunctionReturn(0);
619  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
CHKERRQ(ierr)
FiniteElement_multiIndex finiteElements
finite elements
Definition: Core.hpp:139
PetscErrorCode 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
Definition: DeleteCore.cpp:437

◆ delete_finite_elements_by_bit_ref()

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

remove finite element from mofem database

Implements MoFEM::Interface.

Definition at line 576 of file DeleteCore.cpp.

578  {
579  PetscFunctionBegin;
580  if(verb==-1) verb = verbose;
582  RefElement_multiIndex::iterator fe_it = refinedFiniteElements.begin();
583  for(;fe_it!=refinedFiniteElements.end();) {
584  BitRefLevel bit2 = fe_it->getBitRefLevel();
585  if(fe_it->getEntType()==MBENTITYSET) {
586  fe_it++;
587  continue;
588  }
589  if((bit2&mask)!=bit2) {
590  fe_it++;
591  continue;
592  }
593  if((bit2&bit).none()) {
594  fe_it++;
595  continue;
596  }
597  fe_it = refinedFiniteElements.erase(fe_it);
598  }
599  PetscFunctionReturn(0);
600  }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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
Definition: DeleteCore.cpp:390
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:48
CHKERRQ(ierr)
RefElement_multiIndex refinedFiniteElements
refined elements
Definition: Core.hpp:129
int verbose
Verbosity level.
Definition: Core.hpp:124

◆ delete_problem()

PetscErrorCode MoFEM::Core::delete_problem ( const std::string  name)
protectedvirtual

Delete problem.

Implements MoFEM::Interface.

Definition at line 99 of file ProblemsCore.cpp.

99  {
100  PetscFunctionBegin;
101  typedef Problem_multiIndex::index<Problem_mi_tag>::type mofem_problems_by_name;
102  mofem_problems_by_name &mofem_problems_set = pRoblems.get<Problem_mi_tag>();
103  mofem_problems_by_name::iterator p_miit = mofem_problems_set.find(name);
104  if(p_miit == mofem_problems_set.end()) {
105  SETERRQ1(PETSC_COMM_SELF,1,"no such problem like < %s >",name.c_str());
106  }
107  EntityHandle meshset = p_miit->meshset;
108  mofem_problems_set.erase(p_miit);
109  rval = moab.delete_entities(&meshset,1); CHKERRQ_MOAB(rval);
110  PetscFunctionReturn(0);
111 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:148

◆ field_axpy()

PetscErrorCode MoFEM::Core::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 
)
protectedvirtual

axpy fields

Deprecated:
use FieldBlas
Todo:
should be moved to independent interface, i.e. FieldAlgebra

field_y = field_y + alpha*field_x

Parameters
alpha
field_name_xname of field_x
field_name_yname of field_y
error_if_missingthrow error if entity/dof exist in field_x but not on field_y
create_if_missingcreat dof in field_y from fiedl_x if it is not database

Implements MoFEM::Interface.

Definition at line 54 of file FieldBlasCore.cpp.

56  {
57  return FieldBlas(*this).fieldAxpy(alpha,field_name_x,field_name_y,error_if_missing,creat_if_missing);
58 }

◆ field_scale()

PetscErrorCode MoFEM::Core::field_scale ( const double  alpha,
const std::string &  field_name 
)
protectedvirtual

scale field

Deprecated:
use FieldBlas
Todo:
should be moved to independent interface, i.e. FieldAlgebra
Parameters
alphais a scaling factor is a field name

Implements MoFEM::Interface.

Definition at line 66 of file FieldBlasCore.cpp.

66  {
67  return FieldBlas(*this).fieldScale(alpha,field_name);
68  PetscFunctionReturn(0);
69 }

◆ get_adjacencies() [1/2]

PetscErrorCode MoFEM::Core::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
protectedvirtual

Get the adjacencies associated with a entity to entities of a specified dimension.

Todo:
Should be outsourced to separate interface, i.e. BitLevelManage

bit ref level of adjacent entities is equal to bit ref level of adjacent entities

Implements MoFEM::Interface.

Definition at line 104 of file GetAdjacancies.cpp.

112  {
113 
114  PetscFunctionBegin;
115  BitRefLevel bit = problem_ptr->getBitRefLevel();
116  ierr = get_adjacencies(bit,from_entities,num_netities,to_dimension,adj_entities,operation_type); CHKERRQ(ierr);
117  PetscFunctionReturn(0);
118 }
static PetscErrorCode ierr
Definition: Common.hpp:26
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:48
CHKERRQ(ierr)
PetscErrorCode 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.

◆ get_adjacencies() [2/2]

PetscErrorCode MoFEM::Core::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
protectedvirtual

Get the adjacencies associated with a entity to entities of a specified dimension.

Todo:
Should be outsourced to separate interface, i.e. BitLevelManage

bit ref level of adjacent entities is equal to bit ref level of adjacent entities

Implements MoFEM::Interface.

Definition at line 119 of file GetAdjacancies.cpp.

127  {
128 
129  PetscFunctionBegin;
130  if(verb>0) {
131  std::ostringstream ss;
132  ss << "from: " << bit << std::endl << "to: " << std::endl;
133  PetscPrintf(cOmm,ss.str().c_str());
134  }
135  rval = moab.get_adjacencies(
136  from_entities,num_netities,to_dimension,false,adj_entities,operation_type
137  ); CHKERRQ_MOAB(rval);
138  std::vector<BitRefLevel> bit_levels(adj_entities.size());
139  rval = moab.tag_get_data(th_RefBitLevel,adj_entities,&*bit_levels.begin());
140  std::vector<BitRefLevel>::iterator b_it = bit_levels.begin();
141  Range::iterator eit = adj_entities.begin();
142  //std::cerr << "to:\n";
143  for(;eit!=adj_entities.end();b_it++) {
144  if(verb>0) {
145  RefEntity adj_entiti(basicEntityDataPtr,*eit);
146  std::ostringstream ss;
147  ss << "\t" << adj_entiti << std::endl;
148  PetscPrintf(cOmm,ss.str().c_str());
149  }
150  if(!((*b_it)&bit).any() ) {
151  eit = adj_entities.erase(eit);
152  } else {
153  eit++;
154  }
155  }
156  if(b_it!=bit_levels.end()) {
157  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"Data inconsistency");
158  }
159  PetscFunctionReturn(0);
160 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:819
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:110
Tag th_RefBitLevel
Definition: Core.hpp:98

◆ get_adjacencies_any()

PetscErrorCode MoFEM::Core::get_adjacencies_any ( const EntityHandle  from_entiti,
const int  to_dimension,
Range &  adj_entities 
) const
protectedvirtual

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.

Implements MoFEM::Interface.

Definition at line 78 of file GetAdjacancies.cpp.

78  {
79 
80  PetscFunctionBegin;
81  RefEntity from_ref_entiti(basicEntityDataPtr,from_entiti);
82  //std::cerr << "from:\n";
83  //std::cerr << from_ref_entiti << std::endl;
84  rval = moab.get_adjacencies(&from_entiti,1,to_dimension,false,adj_entities); CHKERRQ_MOAB(rval);
85  std::vector<BitRefLevel> bit_levels(adj_entities.size());
86  rval = moab.tag_get_data(th_RefBitLevel,adj_entities,&*bit_levels.begin());
87  std::vector<BitRefLevel>::iterator b_it = bit_levels.begin();
88  Range::iterator eit = adj_entities.begin();
89  //std::cerr << "to:\n";
90  for(;eit!=adj_entities.end();b_it++) {
91  // RefEntity adj_entiti(moab,*eit);
92  //std::cerr << "\t" << adj_entiti << std::endl;
93  if(!(from_ref_entiti.getBitRefLevel()&(*b_it)).any()/*adj_entiti.getBitRefLevel()).any()*/) {
94  eit = adj_entities.erase(eit);
95  } else {
96  eit++;
97  }
98  }
99  if(b_it!=bit_levels.end()) {
100  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"Data inconsistency");
101  }
102  PetscFunctionReturn(0);
103 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
boost::shared_ptr< BasicEntityData > basicEntityDataPtr
Definition: Core.hpp:110
Tag th_RefBitLevel
Definition: Core.hpp:98

◆ get_adjacencies_equality()

PetscErrorCode MoFEM::Core::get_adjacencies_equality ( const EntityHandle  from_entiti,
const int  to_dimension,
Range &  adj_entities 
) const
protectedvirtual

Get the adjacencies associated with a entity to entities of a specified dimension.

Todo:
Should be outsourced to separate interface, i.e. BitLevelManager

bit ref level of adjacent entities is equal to bit ref level of adjacent entities

Implements MoFEM::Interface.

Definition at line 52 of file GetAdjacancies.cpp.

52  {
53 
54  PetscFunctionBegin;
55  RefEntity from_ref_entiti(basicEntityDataPtr,from_entiti);
56  //std::cerr << "from:\n";
57  //std::cerr << from_ref_entiti << std::endl;
58  rval = moab.get_adjacencies(&from_entiti,1,to_dimension,false,adj_entities); CHKERRQ_MOAB(rval);
59  std::vector<BitRefLevel> bit_levels(adj_entities.size());
60  rval = moab.tag_get_data(th_RefBitLevel,adj_entities,&*bit_levels.begin());
61  std::vector<BitRefLevel>::iterator b_it = bit_levels.begin();
62  Range::iterator eit = adj_entities.begin();
63  //std::cerr << "to:\n";
64  for(;eit!=adj_entities.end();b_it++) {
65  //RefEntity adj_entiti(moab,*eit);
66  //std::cerr << "\t" << adj_entiti << std::endl;
67  if(from_ref_entiti.getBitRefLevel() != *b_it/*adj_entiti.getBitRefLevel()*/) {
68  eit = adj_entities.erase(eit);
69  } else {
70  eit++;
71  }
72  }
73  if(b_it!=bit_levels.end()) {
74  SETERRQ(PETSC_COMM_SELF,