v0.8.13
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=-1)
 Create matrix adjacencies. More...
 
template<typename TAG >
MoFEMErrorCode createMat (const std::string &name, Mat *M, const MatType type, PetscInt **_i, PetscInt **_j, PetscScalar **_v, const bool no_diagonals=true, int verb=-1)
 
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)
 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)
 
- 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...
 
- Public Member Functions inherited from MoFEM::CoreInterface
template<typename DIT >
MoFEMErrorCode get_field_dof_data (const std::string &name, const EntityHandle *ent, const int num_ents, DIT dit, int *count=NULL)
 get field data from entity and fieldthis function is not recommended to be used in finite element implementation More...
 
template<typename DIT >
MoFEMErrorCode get_field_dof_data (const std::string &name, const Range &ents, DIT dit, int *count=NULL)
 get field data from entity and fieldthis function is not recommended to be used in finite element implementation More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (const MOFEMuuid &uuid, bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE , bool VERIFY = 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 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)
 
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 meshsetcollective. 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
 
std::string getBitFieldIdName (const BitFieldId id) const
 
EntityHandle get_field_meshset (const BitFieldId id) const
 
EntityHandle get_field_meshset (const std::string &name) const
 get field meshset More...
 
MoFEMErrorCode get_field_entities_by_dimension (const std::string name, int dim, Range &ents) const
 get entities in the field by dimension More...
 
MoFEMErrorCode get_field_entities_by_type (const std::string name, EntityType type, Range &ents) const
 get entities in the field by type More...
 
MoFEMErrorCode get_field_entities_by_handle (const std::string name, Range &ents) const
 get entities in the field by handle More...
 
bool check_field (const std::string &name) const
 check if field is in database More...
 
const Fieldget_field_structure (const std::string &name)
 get field structure More...
 
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 *ents_ptr=NULL, 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 resolve_shared_ents (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_ents (const std::string &name, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
 resolve shared entities for finite elements in the problem More...
 
MoFEMErrorCode get_problem_finite_elements_entities (const std::string &name, const std::string &fe_name, const EntityHandle meshset)
 add finite elements to the meshset More...
 
DEPRECATED MoFEMErrorCode build_problem_on_distributed_mesh (int verb=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 partition_check_matrix_fill_in (const std::string &problem_name, int row, int col, int verb)
 check if matrix fill in correspond to finite element indices More...
 
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 MatCreateMPIAIJWithArrays (const std::string &name, Mat *Aij, int verb=DEFAULT_VERBOSITY)
 create Mat (MPIAIJ) for problem (collective) More...
 
MoFEMErrorCode MatCreateMPIAdj_with_Idx_mi_tag (const std::string &name, Mat *Adj, int verb=DEFAULT_VERBOSITY)
 Create Adj matrix. More...
 
MoFEMErrorCode MatCreateSeqAIJWithArrays (const std::string &name, Mat *Aij, PetscInt **i, PetscInt **j, PetscScalar **v, int verb=DEFAULT_VERBOSITY)
 create Mat (AIJ) for problem 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, 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, 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, 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 std::string &field_name, EntityMethod &method, int verb=DEFAULT_VERBOSITY)
 Make a loop over 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
 
- 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 similar to problem manager.
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 CreateMat.cpp.

Member Typedef Documentation

◆ AdjByEnt

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

Definition at line 40 of file CreateMat.cpp.

◆ DofByGlobalPetscIndex

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

Definition at line 43 of file CreateMat.cpp.

◆ ProblemsByName

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

Definition at line 41 of file CreateMat.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 CreateMat.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:78
int verbose
Verbosity level.
Definition: Core.hpp:888

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 
)

Definition at line 81 of file CreateMat.cpp.

84  {
86 
87  if (!ent_fe_ptr) {
89  "Pointer to EntFiniteElement not given");
90  }
91  // if element is not part of problem
92  if ((ent_fe_ptr->getId() & p_miit->getBitFEId()).none())
94 
95  BitRefLevel prb_bit = p_miit->getBitRefLevel();
96  BitRefLevel prb_mask = p_miit->getMaskBitRefLevel();
97  BitRefLevel fe_bit = ent_fe_ptr->getBitRefLevel();
98  // if entity is not problem refinement level
99  if ((fe_bit & prb_mask) != fe_bit)
101  if ((fe_bit & prb_bit) != prb_bit)
103 
104  NumeredEntFiniteElement_multiIndex::iterator fe_it =
105  p_miit->numeredFiniteElements.find(ent_fe_ptr->getGlobalUniqueId());
106 
107  // Create element if is not there
108  if (fe_it == p_miit->numeredFiniteElements.end()) {
109  std::pair<NumeredEntFiniteElement_multiIndex::iterator, bool> p;
110  p = p_miit->numeredFiniteElements.insert(
111  boost::make_shared<NumeredEntFiniteElement>(ent_fe_ptr));
112  if (!p.second) {
114  "Data inconsistency, this element should be created");
115  }
116  fe_it = p.first;
117  }
118  fe_ptr = *fe_it;
119 
120  if (fe_ptr) {
121 
122  // Build DOFs on columns
123  if (fe_ptr->cols_dofs->empty()) {
124 
125  // Get dofs on columns
127  CHKERR fe_ptr->getEntFiniteElement()->getColDofView(
128  *(p_miit->numeredDofsCols), cols_view, moab::Interface::UNION);
129 
130  // Reserve memory for field dofs
131  boost::shared_ptr<std::vector<FENumeredDofEntity>> dofs_array =
132  boost::make_shared<std::vector<FENumeredDofEntity>>();
133  fe_ptr->getColDofsSequence() = dofs_array;
134  dofs_array->reserve(cols_view.size());
135  // Reserve memory for shared pointers now
136  std::vector<boost::shared_ptr<FENumeredDofEntity>> dofs_shared_array;
137  dofs_shared_array.reserve(dofs_array->size());
138  // Create dofs objects
139  for (NumeredDofEntity_multiIndex_uid_view_ordered::iterator it =
140  cols_view.begin();
141  it != cols_view.end(); it++) {
142  if (!*it) {
143  SETERRQ(cOmm, MOFEM_DATA_INCONSISTENCY, "Null pointer to dof");
144  }
145  boost::shared_ptr<SideNumber> side_number_ptr;
146  side_number_ptr = fe_ptr->getSideNumberPtr(it->get()->getEnt());
147  dofs_array->push_back(FENumeredDofEntity(side_number_ptr, *it));
148  dofs_shared_array.push_back(boost::shared_ptr<FENumeredDofEntity>(
149  dofs_array, &dofs_array->back()));
150  }
151  // Finally add DoFS to multi-indices
152  fe_ptr->cols_dofs->insert(dofs_shared_array.begin(),
153  dofs_shared_array.end());
154  }
155 
156  } else {
158  "At that point ptr to finite element should be well known");
159  }
160 
162 }
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
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:864
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:495
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:526
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
#define CHKERR
Inline error check.
Definition: definitions.h:614
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:439

◆ createMat()

template<typename TAG >
MoFEMErrorCode MoFEM::CreateRowComressedADJMatrix::createMat ( const std::string &  name,
Mat *  M,
const MatType  type,
PetscInt **  _i,
PetscInt **  _j,
PetscScalar **  _v,
const bool  no_diagonals = true,
int  verb = -1 
)

Definition at line 648 of file CreateMat.cpp.

650  {
652 
653  ProblemsByName &pRoblems_set = pRoblems.get<Problem_mi_tag>();
654  ProblemsByName::iterator p_miit = pRoblems_set.find(name);
655  if (p_miit == pRoblems_set.end()) {
656  SETERRQ1(cOmm, MOFEM_NOT_FOUND,
657  "problem < %s > is not found (top tip: check spelling)",
658  name.c_str());
659  }
660 
661  std::vector<PetscInt> i, j;
662  CHKERR createMatArrays<TAG>(p_miit, type, i, j, no_diagonals, verb);
663 
664  CHKERR PetscMalloc(i.size() * sizeof(PetscInt), _i);
665  CHKERR PetscMalloc(j.size() * sizeof(PetscInt), _j);
666  copy(i.begin(), i.end(), *_i);
667  copy(j.begin(), j.end(), *_j);
668 
669  PetscInt nb_row_dofs = p_miit->getNbDofsRow();
670  PetscInt nb_col_dofs = p_miit->getNbDofsCol();
671 
672  if (strcmp(type, MATMPIADJ) == 0) {
673 
674  // Adjacency matrix used to partition problems, f.e. METIS
675  CHKERR MatCreateMPIAdj(cOmm, i.size() - 1, nb_col_dofs, *_i, *_j,
676  PETSC_NULL, M);
677  CHKERR MatSetOption(*M, MAT_STRUCTURALLY_SYMMETRIC, PETSC_TRUE);
678 
679  } else if (strcmp(type, MATMPIAIJ) == 0) {
680  if (_v != PETSC_NULL) {
681  CHKERR PetscMalloc(j.size() * sizeof(PetscScalar), _v);
682  }
683  PetscScalar *v = (_v != PETSC_NULL) ? *_v : PETSC_NULL;
684  // Compressed MPIADJ matrix
685  PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
686  PetscInt nb_local_dofs_col = p_miit->getNbLocalDofsCol();
687  CHKERR ::MatCreateMPIAIJWithArrays(cOmm, nb_local_dofs_row,
688  nb_local_dofs_col, nb_row_dofs,
689  nb_col_dofs, *_i, *_j, v, M);
690 
691  } else if (strcmp(type, MATAIJ) == 0) {
692  if (_v != PETSC_NULL) {
693  CHKERR PetscMalloc(j.size() * sizeof(PetscScalar), _v);
694  }
695  PetscScalar *v = (_v != PETSC_NULL) ? *_v : PETSC_NULL;
696  // Sequential compressed AIJ matrix
697  PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
698  PetscInt nb_local_dofs_col = p_miit->getNbLocalDofsCol();
699  CHKERR ::MatCreateSeqAIJWithArrays(cOmm, nb_local_dofs_row,
700  nb_local_dofs_col, *_i, *_j, v, M);
701 
702  } else {
703 
704  SETERRQ(cOmm, PETSC_ERR_ARG_NULL, "not implemented");
705  }
706  // MatView(*M,PETSC_VIEWER_STDOUT_WORLD);
707 
709 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:864
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:495
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:257
#define CHKERR
Inline error check.
Definition: definitions.h:614
Problem_multiIndex::index< Problem_mi_tag >::type ProblemsByName
Definition: CreateMat.cpp:41
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:439

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

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 255 of file CreateMat.cpp.

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

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

Get element adjacencies.

Definition at line 165 of file CreateMat.cpp.

170  {
172 
173  // check if dofs and columns are the same, i.e. structurally symmetric problem
174  bool do_cols_prob = true;
175  if (p_miit->numeredDofsRows == p_miit->numeredDofsCols) {
176  do_cols_prob = false;
177  }
178 
179  AdjByEnt::iterator adj_miit, hi_adj_miit;
180  adj_miit = entFEAdjacencies.get<Unique_mi_tag>().lower_bound(
181  mofem_ent_ptr->getGlobalUniqueId());
182  hi_adj_miit = entFEAdjacencies.get<Unique_mi_tag>().upper_bound(
183  mofem_ent_ptr->getGlobalUniqueId());
184 
185  dofs_col_view.clear();
186  for (; adj_miit != hi_adj_miit; adj_miit++) {
187 
188  if (adj_miit->byWhat & BYROW) {
189 
190  if ((adj_miit->entFePtr->getId() & p_miit->getBitFEId()).none()) {
191  // if element is not part of problem
192  continue;
193  }
194 
195  BitRefLevel prb_bit = p_miit->getBitRefLevel();
196  BitRefLevel prb_mask = p_miit->getMaskBitRefLevel();
197  BitRefLevel fe_bit = adj_miit->entFePtr->getBitRefLevel();
198  // if entity is not problem refinement level
199  if ((fe_bit & prb_mask) != fe_bit)
200  continue;
201  if ((fe_bit & prb_bit) != prb_bit)
202  continue;
203  BitRefLevel dof_bit = mit_row->get()->getBitRefLevel();
204  // if entity is not problem refinement level
205  if ((fe_bit & dof_bit).none())
206  continue;
207 
208  boost::shared_ptr<NumeredEntFiniteElement> fe_ptr;
209  // get element, if element is not in database build columns dofs
210  CHKERR buildFECol(p_miit, adj_miit->entFePtr, do_cols_prob, fe_ptr);
211 
212  if (fe_ptr) {
213  for (FENumeredDofEntity_multiIndex::iterator vit =
214  fe_ptr.get()->cols_dofs->begin();
215  vit != fe_ptr.get()->cols_dofs->end(); vit++) {
216  const int idx = TAG::get_index(vit);
217  dofs_col_view.push_back(idx);
218  // Only check if index is correct
219  if (idx < 0) {
220  std::ostringstream zz;
221  zz << "rank " << rAnk << " ";
222  zz << *(*vit) << std::endl;
223  SETERRQ(cOmm, PETSC_ERR_ARG_SIZ, zz.str().c_str());
224  }
225  if (idx >= p_miit->getNbDofsCol()) {
226  std::ostringstream zz;
227  zz << "rank " << rAnk << " ";
228  zz << *(*vit) << std::endl;
229  SETERRQ(cOmm, PETSC_ERR_ARG_SIZ, zz.str().c_str());
230  }
231  }
232  if (verb >= NOISY) {
233  std::stringstream ss;
234  ss << "rank " << rAnk << ": numeredDofsCols" << std::endl;
235  FENumeredDofEntity_multiIndex::iterator dit, hi_dit;
236  dit = fe_ptr.get()->cols_dofs->begin();
237  hi_dit = fe_ptr.get()->cols_dofs->end();
238  for (; dit != hi_dit; dit++) {
239  ss << "\t" << **dit << std::endl;
240  }
241  PetscSynchronizedPrintf(cOmm, "%s", ss.str().c_str());
242  }
243  } else {
245  "Element should be here, otherwise matrix will have missing "
246  "elements");
247  }
248  }
249  }
250 
252 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:864
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:495
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:868
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
#define CHKERR
Inline error check.
Definition: definitions.h:614
MoFEMErrorCode buildFECol(ProblemsByName::iterator p_miit, boost::shared_ptr< EntFiniteElement > ent_fe_ptr, bool do_cols_prob, boost::shared_ptr< NumeredEntFiniteElement > &fe_ptr)
Definition: CreateMat.cpp:81
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:439

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