v0.8.23
Public Types | Public Member Functions | List of all members
MoFEM::CreateRowComressedADJMatrix Struct Reference

Create compressed matrix. More...

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

Public Types

typedef FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index< Unique_mi_tag >::type AdjByEnt
 
typedef Problem_multiIndex::index< Problem_mi_tag >::type ProblemsByName
 
typedef NumeredDofEntity_multiIndex::index< PetscGlobalIdx_mi_tag >::type DofByGlobalPetscIndex
 
- Public Types inherited from MoFEM::Core
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

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

Additional Inherited Members

- Static Public Member Functions inherited from MoFEM::Core
static MoFEMErrorCode Initialize (int *argc, char ***args, const char file[], const char help[])
 Initializes the MoFEM database PETSc, MOAB and MPI. More...
 
static MoFEMErrorCode Finalize ()
 Checks for options to be called at the conclusion of the program. More...
 
- Protected Member Functions inherited from MoFEM::Core
boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr ()
 Get pointer to basic entity data. More...
 
moab::Interface & get_moab ()
 
const moab::Interface & get_moab () const
 
MoFEMErrorCode set_moab_interface (moab::Interface &new_moab, int verb=VERBOSE, const bool distributed_mesh=true)
 Set the moab interface object. More...
 
MoFEMErrorCode check_number_of_ents_in_ents_field (const std::string &name) const
 check data consistency in entitiesPtr More...
 
MoFEMErrorCode check_number_of_ents_in_ents_field () const
 check data consistency in entitiesPtr More...
 
MoFEMErrorCode check_number_of_ents_in_ents_finite_element (const std::string &name) const
 check data consistency in entsFiniteElements More...
 
MoFEMErrorCode check_number_of_ents_in_ents_finite_element () const
 check data consistency in entsFiniteElements More...
 
MoFEMErrorCode clear_database (int verb=DEFAULT_VERBOSITY)
 Clear database. More...
 
MoFEMErrorCode rebuild_database (int verb=DEFAULT_VERBOSITY)
 Clear database and initialize it once again. More...
 
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...
 
MoFEMErrorCode remove_parents_by_ents (const Range &ents, int verb=DEFAULT_VERBOSITY)
 Remove parents from entities. More...
 
MoFEMErrorCode remove_parents_by_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode remove_parents_by_parents (const Range &ents, int verb=DEFAULT_VERBOSITY)
 Remove paremts from entities having parents in passed range. More...
 
MoFEMErrorCode remove_ents (const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities form mofem database More...
 
MoFEMErrorCode remove_ents_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 remove entities form mofem database More...
 
MoFEMErrorCode delete_ents_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, const bool remove_parent=false, int verb=DEFAULT_VERBOSITY)
 delete entities form mofem and moab database More...
 
MoFEMErrorCode add_field (const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 Add filed. More...
 
MoFEMErrorCode addEntsToFieldByDim (const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode add_ents_to_field_by_dim (const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. More...
 
MoFEMErrorCode add_ents_to_field_by_type (const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. More...
 
MoFEMErrorCode add_ents_to_field_by_dim (const EntityHandle meshset, const int dim, const std::string &name, const bool recursive=true, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset\not collective. More...
 
MoFEMErrorCode add_ents_to_field_by_type (const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. More...
 
MoFEMErrorCode set_field_order (const Range &ents, const BitFieldId id, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode set_field_order (const EntityHandle meshset, const EntityType type, const BitFieldId id, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode set_field_order (const Range &ents, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
 Set order approximation of the entities in the field. More...
 
MoFEMErrorCode set_field_order (const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
 Set order approximation of the entities in the field. More...
 
MoFEMErrorCode set_field_order_by_entity_type_and_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, const EntityType type, const BitFieldId id, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode set_field_order_by_entity_type_and_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)
 Set order approximation of the entities in the field. More...
 
MoFEMErrorCode buildFieldForNoField (const BitFieldId id, std::map< EntityType, int > &dof_counter, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode buildFieldForL2H1HcurlHdiv (const BitFieldId id, std::map< EntityType, int > &dof_counter, std::map< EntityType, int > &inactive_dof_counter, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode buildField (const boost::shared_ptr< Field > &field, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode build_fields (int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode build_field (const std::string field_name, int verb=DEFAULT_VERBOSITY)
 build field by name More...
 
MoFEMErrorCode clear_inactive_dofs (int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_dofs_fields_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_dofs_fields (const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_dofs_fields (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_ents_fields_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_ents_fields (const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_ents_fields (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode remove_ents_from_field_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 remove entities from field More...
 
MoFEMErrorCode remove_ents_from_field (const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
 remove entities from field More...
 
MoFEMErrorCode remove_ents_from_field (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from field More...
 
MoFEMErrorCode remove_ents_from_field (const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from all fields More...
 
MoFEMErrorCode list_dofs_by_field_name (const std::string &name) const
 
MoFEMErrorCode list_fields () const
 list entities in the field More...
 
BitFieldId getBitFieldId (const std::string &name) const
 
EntityHandle get_field_meshset (const BitFieldId id) const
 
EntityHandle get_field_meshset (const std::string &name) const
 get field meshset More...
 
MoFEMErrorCode get_field_entities_by_dimension (const std::string name, int dim, Range &ents) const
 get entities in the field by dimension More...
 
MoFEMErrorCode get_field_entities_by_type (const std::string name, EntityType type, Range &ents) const
 get entities in the field by type More...
 
MoFEMErrorCode get_field_entities_by_handle (const std::string name, Range &ents) const
 get entities in the field by handle More...
 
bool check_field (const std::string &name) const
 check if field is in database More...
 
const Fieldget_field_structure (const std::string &name)
 get field structure More...
 
bool check_finite_element (const std::string &name) const
 Check if finite element is in database. More...
 
MoFEMErrorCode add_finite_element (const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 add finite element More...
 
MoFEMErrorCode modify_finite_element_adjacency_table (const std::string &fe_name, const EntityType type, ElementAdjacencyFunct function)
 modify finite element table, only for advanced user More...
 
MoFEMErrorCode modify_finite_element_add_field_data (const std::string &fe_name, const std::string &name_filed)
 set finite element field data More...
 
MoFEMErrorCode modify_finite_element_add_field_row (const std::string &fe_name, const std::string &name_row)
 set field row which finite element use More...
 
MoFEMErrorCode modify_finite_element_add_field_col (const std::string &fe_name, const std::string &name_col)
 set field col which finite element use More...
 
MoFEMErrorCode modify_finite_element_off_field_data (const std::string &fe_name, const std::string &name_filed)
 unset finite element field data More...
 
MoFEMErrorCode modify_finite_element_off_field_row (const std::string &fe_name, const std::string &name_row)
 unset field row which finite element use More...
 
MoFEMErrorCode modify_finite_element_off_field_col (const std::string &fe_name, const std::string &name_col)
 unset field col which finite element use More...
 
MoFEMErrorCode add_ents_to_finite_element_by_type (const EntityHandle meshset, const EntityType type, const std::string &name, const bool recursive=true)
 add entities to finite element More...
 
MoFEMErrorCode add_ents_to_finite_element_by_dim (const EntityHandle meshset, const int dim, const std::string &name, const bool recursive=true)
 add entities to finite element More...
 
MoFEMErrorCode add_ents_to_finite_element_by_type (const Range &ents, const EntityType type, const std::string &name)
 add entities to finite elements More...
 
MoFEMErrorCode add_ents_to_finite_element_by_dim (const Range &ents, const int dim, const std::string &name)
 add entities to finite elements More...
 
MoFEMErrorCode add_ents_to_finite_element_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
 add TET entities from given refinement level to finite element database given by name More...
 
MoFEMErrorCode add_ents_to_finite_element_by_MESHSET (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add MESHSET element to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_VERTICEs (const Range &vert, const std::string &name)
 add VERTICES entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_EDGEs (const Range &vert, const std::string &name)
 add EDGES entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_EDGEs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add EDGES finite elements More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TRIs (const Range &tris, const std::string &name)
 add TRI entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TRIs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add TRI entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TETs (const Range &tets, const std::string &name)
 add TET entities from range to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_TETs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add TET entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_PRISMs (const Range &prims, const BitFEId id)
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_PRISMs (const Range &prims, const std::string &name)
 add PRISM entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_by_PRISMs (const EntityHandle meshset, const std::string &name, const bool recursive=false)
 add TET entities from meshset to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_EntType_by_bit_ref (const BitRefLevel &bit, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
 add TET elements from given refinement level to finite element database given by name More...
 
DEPRECATED MoFEMErrorCode add_ents_to_finite_element_EntType_by_bit_ref (const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
 add TET entities from given refinement level to finite element database given by name More...
 
MoFEMErrorCode remove_ents_from_finite_element_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 remove elements from given refinement level to finite element database More...
 
MoFEMErrorCode remove_ents_from_finite_element (const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
 remove entities from given refinement level to finite element database More...
 
MoFEMErrorCode remove_ents_from_finite_element (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from finite element database More...
 
MoFEMErrorCode remove_ents_from_finite_element (const Range ents, int verb=DEFAULT_VERBOSITY)
 remove entities from finite elements in database More...
 
MoFEMErrorCode delete_finite_element (const std::string name, int verb=DEFAULT_VERBOSITY)
 delete finite element from mofem database More...
 
BitFEId getBitFEId (const std::string &name) const
 Get field Id. More...
 
std::string getBitFEIdName (const BitFEId id) const
 Get field name. More...
 
EntityHandle get_finite_element_meshset (const BitFEId id) const
 
EntityHandle get_finite_element_meshset (const std::string &name) const
 
MoFEMErrorCode get_finite_element_entities_by_dimension (const std::string name, int dim, Range &ents) const
 get entities in the finite element by dimension More...
 
MoFEMErrorCode get_finite_element_entities_by_type (const std::string name, EntityType type, Range &ents) const
 get entities in the finite element by type More...
 
MoFEMErrorCode get_finite_element_entities_by_handle (const std::string name, Range &ents) const
 get entities in the finite element by handle More...
 
MoFEMErrorCode list_finite_elements () const
 list finite elements in database More...
 
MoFEMErrorCode add_problem (const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)
 Add problem. More...
 
bool check_problem (const std::string name)
 check if problem exist More...
 
MoFEMErrorCode delete_problem (const std::string name)
 Delete problem. More...
 
MoFEMErrorCode modify_problem_add_finite_element (const std::string &name_problem, const std::string &MoFEMFiniteElement_name)
 add finite element to problem, this add entities assigned to finite element to a particular problem More...
 
MoFEMErrorCode modify_problem_unset_finite_element (const std::string &name_problem, const std::string &MoFEMFiniteElement_name)
 unset finite element from problem, this remove entities assigned to finite element to a particular problemNote: If problem is build, it need to be cleaned to make this effective More...
 
MoFEMErrorCode modify_problem_ref_level_add_bit (const std::string &name_problem, const BitRefLevel &bit)
 add ref level to problem More...
 
MoFEMErrorCode modify_problem_ref_level_set_bit (const std::string &name_problem, const BitRefLevel &bit)
 set ref level for problem More...
 
MoFEMErrorCode modify_problem_mask_ref_level_add_bit (const std::string &name_problem, const BitRefLevel &bit)
 set dof mask ref level for problem More...
 
MoFEMErrorCode modify_problem_mask_ref_level_set_bit (const std::string &name_problem, const BitRefLevel &bit)
 set dof mask ref level for problem More...
 
BitProblemId getBitProblemId (const std::string &name) const
 
MoFEMErrorCode list_problem () const
 list problems More...
 
MoFEMErrorCode clear_problem (const std::string name, int verb=DEFAULT_VERBOSITY)
 clear problem More...
 
MoFEMErrorCode clear_problems (int verb=DEFAULT_VERBOSITY)
 clear problems More...
 
MoFEMErrorCode build_finite_elements (int verb=DEFAULT_VERBOSITY)
 Build finite elementsBuild finite element data structures. Have to be run before problem and adjacencies are constructed. More...
 
MoFEMErrorCode build_finite_elements (const BitRefLevel &bit, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode build_finite_elements (const string fe_name, const Range *const ents_ptr=nullptr, int verb=DEFAULT_VERBOSITY)
 Build finite elementsBuild finite element data structures. Have to be run before problem and adjacencies are constructed. More...
 
MoFEMErrorCode buildFiniteElements (const boost::shared_ptr< FiniteElement > &fe, const Range *ents_ptr=NULL, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_finite_elements_by_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_finite_elements (const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_finite_elements (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode get_problem_finite_elements_entities (const std::string &name, const std::string &fe_name, const EntityHandle meshset)
 add finite elements to the meshset More...
 
DEPRECATED MoFEMErrorCode build_problem_on_distributed_mesh (int verb=DEFAULT_VERBOSITY)
 build problem data structures, assuming that mesh is distributed (collective) More...
 
DEPRECATED MoFEMErrorCode build_problems (int verb=DEFAULT_VERBOSITY)
 build problem data structures More...
 
MoFEMErrorCode build_adjacencies (const Range &ents, int verb=DEFAULT_VERBOSITY)
 build adjacencies More...
 
MoFEMErrorCode build_adjacencies (const BitRefLevel &bit, int verb=DEFAULT_VERBOSITY)
 build adjacencies More...
 
MoFEMErrorCode build_adjacencies (const BitRefLevel &bit, const BitRefLevel &mask, int verb=DEFAULT_VERBOSITY)
 build adjacencies More...
 
MoFEMErrorCode clear_adjacencies_entities (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 clear adjacency map for entities on given bit level More...
 
MoFEMErrorCode clear_adjacencies_entities (const Range ents, int verb=DEFAULT_VERBOSITY)
 clear adjacencies for field entities by entities More...
 
MoFEMErrorCode clear_adjacencies_entities (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 clear adjacencies for field entities by entities and field namd More...
 
MoFEMErrorCode clear_adjacencies_finite_elements (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 clear adjacency map for finite elements on given bit level More...
 
MoFEMErrorCode clear_adjacencies_finite_elements (const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode clear_adjacencies_finite_elements (const std::string name, const Range ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode list_adjacencies () const
 list adjacencies More...
 
MoFEMErrorCode problem_basic_method_preProcess (const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethod. More...
 
MoFEMErrorCode problem_basic_method_preProcess (const std::string &problem_name, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethod. More...
 
MoFEMErrorCode problem_basic_method_postProcess (const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethodThis function set data about problem, adjacencies and other multi-indices in database. This function can be used a special case when user need to do some pre- and post-processing before matrix or vector is initiated, or to assemble matrix for group of FEMethods. Is used by classes SnesCtx and TsCtx. Look for more details there. More...
 
MoFEMErrorCode problem_basic_method_postProcess (const std::string &problem_name, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethodThis function set data about problem, adjacencies and other multi-indices in database. This function can be used a special case when user need to do some pre- and post-processing before matrix or vector is initiated, or to assemble matrix for group of FEMethods. Is used by classes SnesCtx and TsCtx. Look for more details there. More...
 
MoFEMErrorCode loop_finite_elements (const Problem *problem_ptr, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, int verb=DEFAULT_VERBOSITY)
 Make a loop over finite elements on partitions from upper to lower rank. More...
 
MoFEMErrorCode loop_finite_elements (const std::string &problem_name, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, int verb=DEFAULT_VERBOSITY)
 Make a loop over finite elements on partitions from upper to lower rank. More...
 
MoFEMErrorCode loop_finite_elements (const std::string &problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, int verb=DEFAULT_VERBOSITY)
 Make a loop over finite elements. More...
 
MoFEMErrorCode loop_dofs (const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs. More...
 
MoFEMErrorCode loop_dofs (const std::string &problem_name, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs. More...
 
MoFEMErrorCode loop_dofs (const std::string &problem_name, const std::string &field_name, RowColData rc, DofMethod &method, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs. More...
 
MoFEMErrorCode loop_dofs (const std::string &field_name, DofMethod &method, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs. More...
 
MoFEMErrorCode loop_entities (const Problem *problem_ptr, const std::string field_name, RowColData rc, EntityMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
 Loop over field entities in the problem. More...
 
MoFEMErrorCode loop_entities (const std::string problem_name, const std::string field_name, RowColData rc, EntityMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
 Loop over field entities in the problem. More...
 
MoFEMErrorCode loop_entities (const std::string problem_name, const std::string field_name, RowColData rc, EntityMethod &method, int verb=DEFAULT_VERBOSITY)
 Loop over field entities in the problem. More...
 
MoFEMErrorCode loop_entities (const std::string field_name, EntityMethod &method, Range const *const ents=nullptr, int verb=DEFAULT_VERBOSITY)
 Loop over field entities. More...
 
MoFEMErrorCode get_fields (const Field_multiIndex **fields_ptr) const
 Get fields multi-index from database. More...
 
MoFEMErrorCode get_ref_ents (const RefEntity_multiIndex **refined_entities_ptr) const
 Get ref entities multi-index from database. More...
 
MoFEMErrorCode get_ref_finite_elements (const RefElement_multiIndex **refined_finite_elements_ptr) const
 Get ref finite elements multi-index form database. More...
 
MoFEMErrorCode get_finite_elements (const FiniteElement_multiIndex **fe_ptr) const
 Get finite elements multi-index. More...
 
MoFEMErrorCode get_ents_finite_elements (const EntFiniteElement_multiIndex **fe_ent_ptr) const
 Get entities finite elements multi-index. More...
 
MoFEMErrorCode get_field_ents (const FieldEntity_multiIndex **field_ents) const
 Get field multi index. More...
 
MoFEMErrorCode get_dofs (const DofEntity_multiIndex **dofs_ptr) const
 Get dofs multi index. More...
 
MoFEMErrorCode get_problem (const std::string &problem_name, const Problem **problem_ptr) const
 Get problem database (data structure) More...
 
MoFEMErrorCode get_problems (const Problem_multiIndex **problems_ptr) const
 Get pointer to problems multi-index. More...
 
FieldEntityByFieldName::iterator get_ent_field_by_name_begin (const std::string &field_name) const
 get begin iterator of filed ents of given name (instead you can use IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) More...
 
FieldEntityByFieldName::iterator get_ent_field_by_name_end (const std::string &field_name) const
 get begin iterator of filed dofs of given name (instead you can use IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)for(IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
DofEntityByFieldName::iterator get_dofs_by_name_begin (const std::string &field_name) const
 get begin iterator of filed dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)for(IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
DofEntityByFieldName::iterator get_dofs_by_name_end (const std::string &field_name) const
 get begin iterator of filed dofs of given name (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)for(IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,IT)) { ... } More...
 
DofEntityByNameAndEnt::iterator get_dofs_by_name_and_ent_begin (const std::string &field_name, const EntityHandle ent) const
 get begin iterator of filed dofs of given name and ent(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,ENT,IT) More...
 
DofEntityByNameAndEnt::iterator get_dofs_by_name_and_ent_end (const std::string &field_name, const EntityHandle ent) const
 get begin iterator of filed dofs of given name and ent (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,ENT,IT)for(IT_GET_DOFS_FIELD_BY_NAME_AND_ENT_FOR_LOOP(MFIELD,NAME,ENT,IT)) { ... } More...
 
DofEntityByNameAndType::iterator get_dofs_by_name_and_type_begin (const std::string &field_name, const EntityType type) const
 get begin iterator of filed dofs of given name and ent type (instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT) More...
 
DofEntityByNameAndType::iterator get_dofs_by_name_and_type_end (const std::string &field_name, const EntityType ent) const
 get begin iterator of filed dofs of given name end ent type(instead you can use IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP(MFIELD,NAME,TYPE,IT) More...
 
EntFiniteElementByName::iterator get_fe_by_name_begin (const std::string &fe_name) const
 get begin iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) More...
 
EntFiniteElementByName::iterator get_fe_by_name_end (const std::string &fe_name) const
 get end iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(MFIELD,NAME,IT) More...
 
MPI_Comm & get_comm () const
 
int get_comm_size () const
 
int get_comm_rank () const
 
MoFEMErrorCode resolve_shared_finite_elements (const Problem *problem_ptr, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
 resolve shared entities for finite elements in the problem More...
 
MoFEMErrorCode resolve_shared_finite_elements (const std::string &name, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
 resolve shared entities for finite elements in the problem More...
 
MoFEMErrorCode synchronise_entities (Range &ent, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode synchronise_field_entities (const BitFieldId id, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode synchronise_field_entities (const std::string &name, int verb=DEFAULT_VERBOSITY)
 
- Protected Member Functions inherited from MoFEM::UnknownInterface
boost::typeindex::type_index getClassIdx (const MOFEMuuid &uid) const
 Get type name for interface Id. More...
 
MOFEMuuid getUId (const boost::typeindex::type_index &class_idx) const
 Get interface Id for class name. More...
 
- Protected Attributes inherited from MoFEM::Core
Tag th_Part
 Tag for partition number. More...
 
Tag th_RefParentHandle
 
Tag th_RefBitLevel
 
Tag th_RefBitLevel_Mask
 
Tag th_RefBitEdge
 
Tag th_RefFEMeshset
 
Tag th_RefType
 
Tag th_FieldId
 
Tag th_FieldName
 
Tag th_FieldName_DataNamePrefix
 
Tag th_FieldSpace
 
Tag th_FieldBase
 
Tag th_FEId
 
Tag th_FEName
 
Tag th_FEIdCol
 
Tag th_FEIdRow
 
Tag th_FEIdData
 
Tag th_ProblemId
 
Tag th_ProblemName
 
Tag th_ProblemFEId
 
Tag th_ProblemNbDofsRow
 
Tag th_ProblemNbDofsCol
 
Tag th_ProblemLocalNbDofRow
 
Tag th_ProblemGhostNbDofRow
 
Tag th_ProblemLocalNbDofCol
 
Tag th_ProblemGhostNbDofCol
 
Tag th_ProblemShift
 
Tag th_FieldShift
 
Tag th_FEShift
 
Tag th_ElemType
 Needed for VTK files. More...
 
Tag th_MoFEMBuild
 
boost::shared_ptr< BasicEntityDatabasicEntityDataPtr
 
RefEntity_multiIndex refinedEntities
 refined entities More...
 
RefElement_multiIndex refinedFiniteElements
 refined elements More...
 
Field_multiIndex fIelds
 fields More...
 
FieldEntity_multiIndex entsFields
 entities on fields More...
 
DofEntity_multiIndex dofsField
 dofs on fields More...
 
FiniteElement_multiIndex finiteElements
 finite elements More...
 
EntFiniteElement_multiIndex entsFiniteElements
 finite element entities More...
 
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
 adjacencies of elements to dofs More...
 
Problem_multiIndex pRoblems
 problems multi-index More...
 
std::reference_wrapper< moab::Interface > moab
 moab database More...
 
PetscLogEvent MOFEM_EVENT_preProcess
 Event for preProcess finite element. More...
 
PetscLogEvent MOFEM_EVENT_operator
 Event for evaluating operator of finite element. More...
 
PetscLogEvent MOFEM_EVENT_postProcess
 Event for postProcess finite element. More...
 
PetscLogEvent MOFEM_EVENT_createMat
 
MPI_Comm cOmm
 MoFEM communicator. More...
 
ParallelComm * pComm
 MOAB communicator structure. More...
 
int sIze
 MoFEM communicator size. More...
 
int rAnk
 MOFEM communicator rank. More...
 

Detailed Description

Create compressed matrix.

Note
Only function class members are allowed in this class. NO VARIABLES.
Todo:
It is obsolete implementation, code should be moved to interface MatrixManager.
Todo:
While matrix is created is assumed that all entities on element are adjacent to each other, in some cases, this is created denser matrices than it should be. Some kind of filtering can be added.
Todo:
Creation of the block matrices
Todo:
Some efficiency improvemnt are possible

Definition at line 33 of file MatrixManager.cpp.

Member Typedef Documentation

◆ AdjByEnt

typedef FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index< Unique_mi_tag>::type MoFEM::CreateRowComressedADJMatrix::AdjByEnt

Definition at line 40 of file MatrixManager.cpp.

◆ DofByGlobalPetscIndex

typedef NumeredDofEntity_multiIndex::index<PetscGlobalIdx_mi_tag>::type MoFEM::CreateRowComressedADJMatrix::DofByGlobalPetscIndex

Definition at line 43 of file MatrixManager.cpp.

◆ ProblemsByName

typedef Problem_multiIndex::index<Problem_mi_tag>::type MoFEM::CreateRowComressedADJMatrix::ProblemsByName

Definition at line 41 of file MatrixManager.cpp.

Constructor & Destructor Documentation

◆ CreateRowComressedADJMatrix()

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

Definition at line 35 of file MatrixManager.cpp.

37  : Core(moab, comm, verbose) {}
Core(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE, const bool distributed_mesh=true)
Definition: Core.cpp:106
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:265
int verbose
Verbosity level.
Definition: Core.hpp:905

Member Function Documentation

◆ buildFECol()

MoFEMErrorCode MoFEM::CreateRowComressedADJMatrix::buildFECol ( ProblemsByName::iterator  p_miit,
boost::shared_ptr< EntFiniteElement ent_fe_ptr,
bool  do_cols_prob,
boost::shared_ptr< NumeredEntFiniteElement > &  fe_ptr 
) const

Definition at line 76 of file MatrixManager.cpp.

79  {
81 
82  if (!ent_fe_ptr)
83  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
84  "Pointer to EntFiniteElement not given");
85 
86  // if element is not part of problem
87  if ((ent_fe_ptr->getId() & p_miit->getBitFEId()).none())
89 
90  BitRefLevel prb_bit = p_miit->getBitRefLevel();
91  BitRefLevel prb_mask = p_miit->getMaskBitRefLevel();
92  BitRefLevel fe_bit = ent_fe_ptr->getBitRefLevel();
93  // if entity is not problem refinement level
94  if ((fe_bit & prb_mask) != fe_bit)
96  if ((fe_bit & prb_bit) != prb_bit)
98 
99  auto fe_it =
100  p_miit->numeredFiniteElements->find(ent_fe_ptr->getGlobalUniqueId());
101 
102  // Create element if is not there
103  if (fe_it == p_miit->numeredFiniteElements->end()) {
104  auto p = p_miit->numeredFiniteElements->insert(
105  boost::make_shared<NumeredEntFiniteElement>(ent_fe_ptr));
106  fe_it = p.first;
107  }
108  fe_ptr = *fe_it;
109 
110  if (fe_ptr) {
111 
112  // Build DOFs on columns
113  if (fe_ptr->cols_dofs->empty()) {
114 
115  // Get dofs on columns
117  CHKERR fe_ptr->getEntFiniteElement()->getColDofView(
118  *(p_miit->numeredDofsCols), cols_view, moab::Interface::UNION);
119 
120  // Reserve memory for field dofs
121  boost::shared_ptr<std::vector<FENumeredDofEntity>> dofs_array(
122  new std::vector<FENumeredDofEntity>());
123  fe_ptr->getColDofsSequence() = dofs_array;
124  dofs_array->reserve(cols_view.size());
125 
126  // Create dofs objects
127  for (auto &dof : cols_view) {
128  auto side_number_ptr = fe_ptr->getSideNumberPtr(dof->getEnt());
129  dofs_array->emplace_back(side_number_ptr, dof);
130  }
131 
132  // Finally add DoFS to multi-indices
133  auto hint = fe_ptr->cols_dofs->end();
134  for (auto &dof : *dofs_array)
135  hint = fe_ptr->cols_dofs->emplace_hint(hint, dofs_array, &dof);
136  }
137 
138  } else
139  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
140  "At that point ptr to finite element should be well known");
141 
143 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:507
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_unique< const_mem_fun< NumeredDofEntity::interface_type_DofEntity, const UId &, &NumeredDofEntity::getGlobalUniqueId > > > > NumeredDofEntity_multiIndex_uid_view_ordered
#define CHKERR
Inline error check.
Definition: definitions.h:595
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406

◆ createMatArrays()

template<typename TAG >
MoFEMErrorCode MoFEM::CreateRowComressedADJMatrix::createMatArrays ( ProblemsByName::iterator  p_miit,
const MatType  type,
std::vector< PetscInt > &  i,
std::vector< PetscInt > &  j,
const bool  no_diagonals = true,
int  verb = QUIET 
) const

Create matrix adjacencies.

Depending on TAG type, which some structure used to number dofs, matrix is partitioned using part number stored in multi-index, or is partitioned on parts based only on index number.

See: Idx_mi_tag PetscGlobalIdx_mi_tag and PetscLocalIdx_mi_tag

Definition at line 227 of file MatrixManager.cpp.

230  {
232  PetscLogEventBegin(MOFEM_EVENT_createMat, 0, 0, 0, 0);
233 
234  typedef
235  typename boost::multi_index::index<NumeredDofEntity_multiIndex, TAG>::type
236  NumeredDofEntitysByIdx;
237 
238  // Get multi-indices for rows and columns
239  const NumeredDofEntitysByIdx &dofs_row_by_idx =
240  p_miit->numeredDofsRows->get<TAG>();
241  int nb_dofs_row = p_miit->getNbDofsRow();
242  if (nb_dofs_row == 0) {
243  SETERRQ1(cOmm, MOFEM_DATA_INCONSISTENCY, "problem <%s> has zero rows",
244  p_miit->getName().c_str());
245  }
246 
247  // Get adjacencies form other processors
248  std::map<int, std::vector<int>> adjacent_dofs_on_other_parts;
249 
250  // If not partitioned set petsc layout for matrix. If partitioned need to get
251  // adjacencies form other parts. Note if algebra is only partitioned no need
252  // to collect adjacencies form other entities. Those are already on mesh
253  // which is assumed that is on each processor the same.
254  typename boost::multi_index::index<NumeredDofEntity_multiIndex,
255  TAG>::type::iterator miit_row,
256  hi_miit_row;
257 
258  if (TAG::IamNotPartitioned) {
259 
260  // Get range of local indices
261  PetscLayout layout;
262  CHKERR PetscLayoutCreate(cOmm, &layout);
263  CHKERR PetscLayoutSetBlockSize(layout, 1);
264  CHKERR PetscLayoutSetSize(layout, nb_dofs_row);
265  CHKERR PetscLayoutSetUp(layout);
266  PetscInt rstart, rend;
267  CHKERR PetscLayoutGetRange(layout, &rstart, &rend);
268  CHKERR PetscLayoutDestroy(&layout);
269  if (verb >= VERBOSE) {
270  PetscSynchronizedPrintf(cOmm, "\tcreate_Mat: row lower %d row upper %d\n",
271  rstart, rend);
272  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
273  }
274  miit_row = dofs_row_by_idx.lower_bound(rstart);
275  hi_miit_row = dofs_row_by_idx.lower_bound(rend);
276  if (std::distance(miit_row, hi_miit_row) != rend - rstart) {
277  SETERRQ4(
278  cOmm, PETSC_ERR_ARG_SIZ,
279  "data inconsistency, std::distance(miit_row,hi_miit_row) != rend - "
280  "rstart (%d != %d - %d = %d) ",
281  std::distance(miit_row, hi_miit_row), rend, rstart, rend - rstart);
282  }
283 
284  } else {
285 
286  // Make sure it is a PETSc cOmm
287  CHKERR PetscCommDuplicate(cOmm, &cOmm, NULL);
288 
289  // get adjacent nodes on other partitions
290  std::vector<std::vector<int>> dofs_vec(sIze);
291 
292  boost::shared_ptr<FieldEntity> mofem_ent_ptr;
293  std::vector<int> dofs_col_view;
294 
295  typename boost::multi_index::index<NumeredDofEntity_multiIndex,
296  TAG>::type::iterator mit_row,
297  hi_mit_row;
298 
299  mit_row = dofs_row_by_idx.begin();
300  hi_mit_row = dofs_row_by_idx.end();
301  for (; mit_row != hi_mit_row; mit_row++) {
302 
303  // Shared or multishared row and not owned. Those data should be send to
304  // other side.
305 
306  // Get entity adjacencies, no need to repeat that operation for dofs when
307  // are on the same entity. For simplicity is assumed that those sheered
308  // the same adjacencies.
309  unsigned char pstatus = (*mit_row)->getPStatus();
310  if ((pstatus & PSTATUS_NOT_OWNED) &&
311  (pstatus & (PSTATUS_SHARED | PSTATUS_MULTISHARED))) {
312 
313  bool get_adj_col = true;
314  if (mofem_ent_ptr) {
315  if (mofem_ent_ptr->getGlobalUniqueId() ==
316  (*mit_row)->getFieldEntityPtr()->getGlobalUniqueId()) {
317  get_adj_col = false;
318  }
319  }
320 
321  if (get_adj_col) {
322  // Get entity adjacencies
323  mofem_ent_ptr = (*mit_row)->getFieldEntityPtr();
324  CHKERR getEntityAdjacenies<TAG>(p_miit, mit_row, mofem_ent_ptr,
325  dofs_col_view, verb);
326  // Sort, unique and resize dofs_col_view
327  {
328  std::sort(dofs_col_view.begin(), dofs_col_view.end());
329  std::vector<int>::iterator new_end =
330  std::unique(dofs_col_view.begin(), dofs_col_view.end());
331  int new_size = std::distance(dofs_col_view.begin(), new_end);
332  dofs_col_view.resize(new_size);
333  }
334  // Add that row. Patterns is that first index is row index, second is
335  // size of adjacencies after that follows column adjacencies.
336  int owner = (*mit_row)->getOwnerProc();
337  dofs_vec[owner].emplace_back(TAG::get_index(mit_row)); // row index
338  dofs_vec[owner].emplace_back(
339  dofs_col_view.size()); // nb. of column adjacencies
340  // add adjacent cools
341  dofs_vec[owner].insert(dofs_vec[owner].end(), dofs_col_view.begin(),
342  dofs_col_view.end());
343  }
344  }
345  }
346 
347  int nsends = 0; // number of messages to send
348  std::vector<int> dofs_vec_length(sIze); // length of the message to proc
349  for (int proc = 0; proc < sIze; proc++) {
350 
351  if (!dofs_vec[proc].empty()) {
352 
353  dofs_vec_length[proc] = dofs_vec[proc].size();
354  nsends++;
355 
356  } else {
357 
358  dofs_vec_length[proc] = 0;
359  }
360  }
361 
362  std::vector<MPI_Status> status(sIze);
363 
364  // Computes the number of messages a node expects to receive
365  int nrecvs; // number of messages received
366  CHKERR PetscGatherNumberOfMessages(cOmm, NULL, &dofs_vec_length[0],
367  &nrecvs);
368 
369  // Computes info about messages that a MPI-node will receive, including
370  // (from-id,length) pairs for each message.
371  int *onodes; // list of node-ids from which messages are expected
372  int *olengths; // corresponding message lengths
373  CHKERR PetscGatherMessageLengths(cOmm, nsends, nrecvs, &dofs_vec_length[0],
374  &onodes, &olengths);
375 
376  // Gets a unique new tag from a PETSc communicator.
377  int tag;
378  CHKERR PetscCommGetNewTag(cOmm, &tag);
379 
380  // Allocate a buffer sufficient to hold messages of size specified in
381  // olengths. And post Irecvs on these buffers using node info from onodes
382  int **rbuf; // must bee freed by user
383  MPI_Request *r_waits; // must bee freed by user
384 
385  // rbuf has a pointers to messages. It has size of of nrecvs (number of
386  // messages) +1. In the first index a block is allocated,
387  // such that rbuf[i] = rbuf[i-1]+olengths[i-1].
388  CHKERR PetscPostIrecvInt(cOmm, tag, nrecvs, onodes, olengths, &rbuf,
389  &r_waits);
390 
391  MPI_Request *s_waits; // status of sens messages
392  CHKERR PetscMalloc1(nsends, &s_waits);
393 
394  // Send messages
395  for (int proc = 0, kk = 0; proc < sIze; proc++) {
396  if (!dofs_vec_length[proc])
397  continue; // no message to send to this proc
398  CHKERR MPI_Isend(&(dofs_vec[proc])[0], // buffer to send
399  dofs_vec_length[proc], // message length
400  MPIU_INT, proc, // to proc
401  tag, cOmm, s_waits + kk);
402  kk++;
403  }
404 
405  // Wait for received
406  if (nrecvs) {
407  CHKERR MPI_Waitall(nrecvs, r_waits, &status[0]);
408  }
409  // Wait for send messages
410  if (nsends) {
411  CHKERR MPI_Waitall(nsends, s_waits, &status[0]);
412  }
413 
414  for (int kk = 0; kk < nrecvs; kk++) {
415 
416  int len = olengths[kk];
417  int *data_from_proc = rbuf[kk];
418 
419  for (int ii = 0; ii < len;) {
420 
421  int row_idx = data_from_proc[ii++]; // get row number
422  int nb_adj_dofs = data_from_proc[ii++]; // get nb. of adjacent dofs
423 
424  if (debug) {
425 
426  DofByGlobalPetscIndex::iterator dit;
427  dit = p_miit->numeredDofsRows->get<PetscGlobalIdx_mi_tag>().find(
428  row_idx);
429  if (dit ==
430  p_miit->numeredDofsRows->get<PetscGlobalIdx_mi_tag>().end()) {
431  SETERRQ1(cOmm, MOFEM_DATA_INCONSISTENCY,
432  "dof %d can not be found in problem", row_idx);
433  }
434  }
435 
436  for (int jj = 0; jj < nb_adj_dofs; jj++) {
437  adjacent_dofs_on_other_parts[row_idx].push_back(data_from_proc[ii++]);
438  }
439  }
440  }
441 
442  // Cleaning
443  CHKERR PetscFree(s_waits);
444  CHKERR PetscFree(rbuf[0]);
445  CHKERR PetscFree(rbuf);
446  CHKERR PetscFree(r_waits);
447  CHKERR PetscFree(onodes);
448  CHKERR PetscFree(olengths);
449 
450  miit_row = dofs_row_by_idx.begin();
451  hi_miit_row = dofs_row_by_idx.end();
452  }
453 
454  boost::shared_ptr<FieldEntity> mofem_ent_ptr;
455  int row_last_evaluated_idx = -1;
456 
457  std::vector<int> dofs_vec;
458  std::vector<int> dofs_col_view;
459 
460  // loop local rows
461  int nb_loc_row_from_iterators = 0;
462  unsigned int rows_to_fill = p_miit->getNbLocalDofsRow();
463  i.reserve(rows_to_fill + 1);
464  for (; miit_row != hi_miit_row; miit_row++) {
465 
466  if (!TAG::IamNotPartitioned) {
467  if (static_cast<int>((*miit_row)->getPart()) != rAnk)
468  continue;
469  }
470  // This is only for cross-check if everything is ok
471  nb_loc_row_from_iterators++;
472 
473  // add next row to compressed matrix
474  i.push_back(j.size());
475 
476  // Get entity adjacencies, no need to repeat that operation for dofs when
477  // are on the same entity. For simplicity is assumed that those share the
478  // same adjacencies.
479  if ((!mofem_ent_ptr)
480  ? 1
481  : (mofem_ent_ptr->getGlobalUniqueId() !=
482  (*miit_row)->getFieldEntityPtr()->getGlobalUniqueId())) {
483 
484  if (verb >= NOISY) {
485  std::stringstream ss;
486  ss << "rank " << rAnk << ": row " << **miit_row << std::endl;
487  PetscSynchronizedPrintf(cOmm, "%s", ss.str().c_str());
488  }
489 
490  // get entity adjacencies
491  mofem_ent_ptr = (*miit_row)->getFieldEntityPtr();
492  CHKERR getEntityAdjacenies<TAG>(p_miit, miit_row, mofem_ent_ptr,
493  dofs_col_view, verb);
494  row_last_evaluated_idx = TAG::get_index(miit_row);
495 
496  dofs_vec.resize(0);
497  // insert dofs_col_view
498  dofs_vec.insert(dofs_vec.end(), dofs_col_view.begin(),
499  dofs_col_view.end());
500 
501  unsigned char pstatus = (*miit_row)->getPStatus();
502  if (pstatus > 0) {
503  std::map<int, std::vector<int>>::iterator mit;
504  mit = adjacent_dofs_on_other_parts.find(row_last_evaluated_idx);
505  if (mit == adjacent_dofs_on_other_parts.end()) {
506  // NOTE: Dof can adjacent to other part but no elements are there
507  // which use that dof std::cerr << *miit_row << std::endl; SETERRQ1(
508  // cOmm,MOFEM_DATA_INCONSISTENCY,
509  // "data inconsistency row_last_evaluated_idx = %d",
510  // row_last_evaluated_idx
511  // );
512  } else {
513  dofs_vec.insert(dofs_vec.end(), mit->second.begin(),
514  mit->second.end());
515  }
516  }
517 
518  // sort and make unique
519  sort(dofs_vec.begin(), dofs_vec.end());
520  std::vector<int>::iterator new_end =
521  unique(dofs_vec.begin(), dofs_vec.end());
522  int new_size = std::distance(dofs_vec.begin(), new_end);
523  dofs_vec.resize(new_size);
524  if (verb >= NOISY) {
525  std::stringstream ss;
526  ss << "rank " << rAnk << ": dofs_vec for " << *mofem_ent_ptr
527  << std::endl;
528  PetscSynchronizedPrintf(cOmm, "%s", ss.str().c_str());
529  }
530  }
531 
532  // Try to be smart reserving memory
533  if (j.capacity() < j.size() + dofs_vec.size()) {
534 
535  unsigned int nb_nonzero = j.size() + dofs_vec.size();
536  unsigned int average_row_fill =
537  nb_nonzero / i.size() + nb_nonzero % i.size();
538  if (j.capacity() < rows_to_fill * average_row_fill) {
539  j.reserve(rows_to_fill * average_row_fill);
540  }
541  }
542 
543  // add indices to compressed matrix
544  if (verb >= VERY_VERBOSE) {
545  PetscSynchronizedPrintf(cOmm, "rank %d: ", rAnk);
546  }
547  std::vector<int>::iterator diit, hi_diit;
548  diit = dofs_vec.begin();
549  hi_diit = dofs_vec.end();
550  for (; diit != hi_diit; diit++) {
551 
552  if (no_diagonals) {
553  if (*diit == TAG::get_index(miit_row)) {
554  continue;
555  }
556  }
557  j.push_back(*diit);
558 
559  if (verb >= VERY_VERBOSE) {
560  PetscSynchronizedPrintf(cOmm, "%d ", *diit);
561  }
562  }
563  if (verb >= VERY_VERBOSE) {
564  PetscSynchronizedPrintf(cOmm, "\n", *diit);
565  }
566  }
567 
568  if (verb >= VERY_VERBOSE) {
569  PetscSynchronizedFlush(cOmm, PETSC_STDOUT);
570  }
571 
572  // build adj matrix
573  i.push_back(j.size());
574 
575  if (strcmp(type, MATMPIADJ) == 0) {
576 
577  // Adjacency matrix used to partition problems, f.e. METIS
578  if (i.size() - 1 != (unsigned int)nb_loc_row_from_iterators) {
579  SETERRQ(cOmm, PETSC_ERR_ARG_SIZ, "data inconsistency");
580  }
581 
582  } else if (strcmp(type, MATMPIAIJ) == 0) {
583 
584  // Compressed MPIADJ matrix
585  if (i.size() - 1 != (unsigned int)nb_loc_row_from_iterators) {
586  SETERRQ(cOmm, PETSC_ERR_ARG_SIZ, "data inconsistency");
587  }
588  PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
589  if ((unsigned int)nb_local_dofs_row != i.size() - 1) {
590  SETERRQ(cOmm, PETSC_ERR_ARG_SIZ, "data inconsistency");
591  }
592 
593  } else if (strcmp(type, MATAIJ) == 0) {
594 
595  // Sequential compressed ADJ matrix
596  if (i.size() - 1 != (unsigned int)nb_loc_row_from_iterators) {
597  SETERRQ(cOmm, PETSC_ERR_ARG_SIZ, "data inconsistency");
598  }
599  PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
600  if ((unsigned int)nb_local_dofs_row != i.size() - 1) {
601  SETERRQ(cOmm, PETSC_ERR_ARG_SIZ, "data inconsistency");
602  }
603 
604  } else {
605 
606  SETERRQ(cOmm, PETSC_ERR_ARG_NULL, "not implemented");
607  }
608 
609  PetscLogEventEnd(MOFEM_EVENT_createMat, 0, 0, 0, 0);
611 }
int sIze
MoFEM communicator size.
Definition: Core.hpp:845
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:842
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:834
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:846
static const bool debug
#define CHKERR
Inline error check.
Definition: definitions.h:595
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, const UId &, &NumeredDofEntity::getGlobalUniqueId > >, ordered_non_unique< tag< Unique_Ent_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, const UId &, &NumeredDofEntity::getEntGlobalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > >, ordered_non_unique< tag< Idx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::dofIdx > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef > >, ordered_non_unique< tag< PetscGlobalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscGloablDofIdx > >, ordered_non_unique< tag< PetscLocalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscLocalDofIdx > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Ent_And_EntDofIdx_mi_tag >, composite_key< NumeredDofEntity, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, DofIdx, &NumeredDofEntity::getEntDofIdx > > >, ordered_non_unique< tag< Composite_Name_And_Part_mi_tag >, composite_key< NumeredDofEntity, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > > >, ordered_non_unique< tag< Composite_Name_Ent_And_Part_mi_tag >, composite_key< NumeredDofEntity, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > > > > > NumeredDofEntity_multiIndex
MultiIndex container keeps NumeredDofEntity.

◆ getEntityAdjacenies()

template<typename TAG >
MoFEMErrorCode MoFEM::CreateRowComressedADJMatrix::getEntityAdjacenies ( ProblemsByName::iterator  p_miit,
typename boost::multi_index::index< NumeredDofEntity_multiIndex, TAG >::type::iterator  mit_row,
boost::shared_ptr< FieldEntity mofem_ent_ptr,
std::vector< int > &  dofs_col_view,
int  verb 
) const

Get element adjacencies.

Definition at line 146 of file MatrixManager.cpp.

151  {
153 
154  BitRefLevel prb_bit = p_miit->getBitRefLevel();
155  BitRefLevel prb_mask = p_miit->getMaskBitRefLevel();
156 
157  // check if dofs and columns are the same, i.e. structurally symmetric problem
158  bool do_cols_prob;
159  if (p_miit->numeredDofsRows == p_miit->numeredDofsCols)
160  do_cols_prob = false;
161  else
162  do_cols_prob = true;
163 
164  dofs_col_view.clear();
165  for (auto r = entFEAdjacencies.get<Unique_mi_tag>().equal_range(
166  mofem_ent_ptr->getGlobalUniqueId());
167  r.first != r.second; ++r.first) {
168 
169  if (r.first->byWhat & BYROW) {
170 
171  if ((r.first->entFePtr->getId() & p_miit->getBitFEId()).none()) {
172  // if element is not part of problem
173  continue;
174  }
175 
176  BitRefLevel fe_bit = r.first->entFePtr->getBitRefLevel();
177  // if entity is not problem refinement level
178  if ((fe_bit & prb_mask) != fe_bit)
179  continue;
180  if ((fe_bit & prb_bit) != prb_bit)
181  continue;
182  BitRefLevel dof_bit = mit_row->get()->getBitRefLevel();
183  // if entity is not problem refinement level
184  if ((fe_bit & dof_bit).none())
185  continue;
186 
187  boost::shared_ptr<NumeredEntFiniteElement> fe_ptr;
188  // get element, if element is not in database build columns dofs
189  CHKERR buildFECol(p_miit, r.first->entFePtr, do_cols_prob, fe_ptr);
190 
191  if (fe_ptr) {
192  for (FENumeredDofEntity_multiIndex::iterator vit =
193  fe_ptr.get()->cols_dofs->begin();
194  vit != fe_ptr.get()->cols_dofs->end(); vit++) {
195  const int idx = TAG::get_index(vit);
196  if (idx >= 0)
197  dofs_col_view.push_back(idx);
198  if (idx >= p_miit->getNbDofsCol()) {
199  std::ostringstream zz;
200  zz << "rank " << rAnk << " ";
201  zz << *(*vit) << std::endl;
202  SETERRQ(cOmm, PETSC_ERR_ARG_SIZ, zz.str().c_str());
203  }
204  }
205  if (verb >= NOISY) {
206  std::stringstream ss;
207  ss << "rank " << rAnk << ": numeredDofsCols" << std::endl;
208  FENumeredDofEntity_multiIndex::iterator dit, hi_dit;
209  dit = fe_ptr.get()->cols_dofs->begin();
210  hi_dit = fe_ptr.get()->cols_dofs->end();
211  for (; dit != hi_dit; dit++) {
212  ss << "\t" << **dit << std::endl;
213  }
214  PetscSynchronizedPrintf(cOmm, "%s", ss.str().c_str());
215  }
216  } else
217  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
218  "Element should be here, otherwise matrix will have missing "
219  "elements");
220  }
221  }
222 
224 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:842
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:846
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
#define CHKERR
Inline error check.
Definition: definitions.h:595
MoFEMErrorCode buildFECol(ProblemsByName::iterator p_miit, boost::shared_ptr< EntFiniteElement > ent_fe_ptr, bool do_cols_prob, boost::shared_ptr< NumeredEntFiniteElement > &fe_ptr) const
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406

The documentation for this struct was generated from the following file: