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

Definition at line 21 of file CreateMat.cpp.

Member Typedef Documentation

◆ AdjByEnt

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

Definition at line 29 of file CreateMat.cpp.

◆ DofByGlobalPetscIndex

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

Definition at line 31 of file CreateMat.cpp.

◆ ProblemsByName

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

Definition at line 30 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 23 of file CreateMat.cpp.

25  :
26  Core(moab,comm,verbose) {
27  }
Core(moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE, const bool distributed_mesh=true)
Definition: Core.cpp:78

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

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

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

660  {
662 
663  ProblemsByName &pRoblems_set = pRoblems.get<Problem_mi_tag>();
664  ProblemsByName::iterator p_miit = pRoblems_set.find(name);
665  if(p_miit==pRoblems_set.end()) {
666  SETERRQ1(cOmm,MOFEM_NOT_FOUND,"problem < %s > is not found (top tip: check spelling)",name.c_str());
667  }
668 
669  std::vector<PetscInt> i,j;
670  ierr = createMatArrays<TAG>(p_miit,type,i,j,no_diagonals,verb); CHKERRG(ierr);
671 
672  ierr = PetscMalloc(i.size()*sizeof(PetscInt),_i); CHKERRG(ierr);
673  ierr = PetscMalloc(j.size()*sizeof(PetscInt),_j); CHKERRG(ierr);
674  copy(i.begin(),i.end(),*_i);
675  copy(j.begin(),j.end(),*_j);
676 
677  PetscInt nb_row_dofs = p_miit->getNbDofsRow();
678  PetscInt nb_col_dofs = p_miit->getNbDofsCol();
679 
680  if(strcmp(type,MATMPIADJ)==0) {
681 
682  // Adjacency matrix used to partition problems, f.e. METIS
683  ierr = MatCreateMPIAdj(cOmm,i.size()-1,nb_col_dofs,*_i,*_j,PETSC_NULL,M); CHKERRG(ierr);
684  ierr = MatSetOption(*M,MAT_STRUCTURALLY_SYMMETRIC,PETSC_TRUE); CHKERRG(ierr);
685 
686  } else if(strcmp(type,MATMPIAIJ)==0) {
687  if(_v!=PETSC_NULL) {
688  ierr = PetscMalloc(j.size()*sizeof(PetscScalar),_v); CHKERRG(ierr);
689  }
690  PetscScalar *v = (_v!=PETSC_NULL) ? *_v : PETSC_NULL;
691  // Compressed MPIADJ matrix
692  PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
693  PetscInt nb_local_dofs_col = p_miit->getNbLocalDofsCol();
695  cOmm,nb_local_dofs_row,nb_local_dofs_col,nb_row_dofs,nb_col_dofs,*_i,*_j,v,M
696  ); CHKERRG(ierr);
697 
698  } else if(strcmp(type,MATAIJ)==0) {
699  if(_v!=PETSC_NULL) {
700  ierr = PetscMalloc(j.size()*sizeof(PetscScalar),_v); CHKERRG(ierr);
701  }
702  PetscScalar *v = (_v!=PETSC_NULL) ? *_v : PETSC_NULL;
703  // Sequential compressed AIJ matrix
704  PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
705  PetscInt nb_local_dofs_col = p_miit->getNbLocalDofsCol();
706  ierr = ::MatCreateSeqAIJWithArrays(cOmm,nb_local_dofs_row,nb_local_dofs_col,*_i,*_j,v,M); CHKERRG(ierr);
707 
708  } else {
709 
710  SETERRQ(cOmm,PETSC_ERR_ARG_NULL,"not implemented");
711 
712  }
713  //MatView(*M,PETSC_VIEWER_STDOUT_WORLD);
714 
716 }
MoFEMErrorCode MatCreateMPIAIJWithArrays(const std::string &name, Mat *Aij, int verb=DEFAULT_VERBOSITY)
create Mat (MPIAIJ) for problem (collective)
Definition: CreateMat.cpp:718
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:864
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:565
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
Problem_multiIndex pRoblems
problems multi-index
Definition: Core.hpp:257
MoFEMErrorCode MatCreateSeqAIJWithArrays(const std::string &name, Mat *Aij, PetscInt **i, PetscInt **j, PetscScalar **v, int verb=DEFAULT_VERBOSITY)
create Mat (AIJ) for problem
Definition: CreateMat.cpp:752
Problem_multiIndex::index< Problem_mi_tag >::type ProblemsByName
Definition: CreateMat.cpp:30

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

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

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

186  {
188 
189  // check if dofs and columns are the same, i.e. structurally symmetric problem
190  bool do_cols_prob = true;
191  if(p_miit->numeredDofsRows == p_miit->numeredDofsCols) {
192  do_cols_prob = false;
193  }
194 
195  AdjByEnt::iterator adj_miit,hi_adj_miit;
196  adj_miit = entFEAdjacencies.get<Unique_mi_tag>().lower_bound(mofem_ent_ptr->getGlobalUniqueId());
197  hi_adj_miit = entFEAdjacencies.get<Unique_mi_tag>().upper_bound(mofem_ent_ptr->getGlobalUniqueId());
198 
199  dofs_col_view.clear();
200  for(;adj_miit!=hi_adj_miit;adj_miit++) {
201 
202  if (adj_miit->byWhat&BYROW) {
203 
204  if((adj_miit->entFePtr->getId()&p_miit->getBitFEId()).none()) {
205  // if element is not part of problem
206  continue;
207  }
208 
209  BitRefLevel prb_bit = p_miit->getBitRefLevel();
210  BitRefLevel prb_mask = p_miit->getMaskBitRefLevel();
211  BitRefLevel fe_bit = adj_miit->entFePtr->getBitRefLevel();
212  // if entity is not problem refinement level
213  if((fe_bit&prb_mask)!=fe_bit) continue;
214  if((fe_bit&prb_bit)!=prb_bit) continue;
215  BitRefLevel dof_bit = mit_row->get()->getBitRefLevel();
216  // if entity is not problem refinement level
217  if((fe_bit&dof_bit).none()) continue;
218 
219  boost::shared_ptr<NumeredEntFiniteElement> fe_ptr;
220  // get element, if element is not in database build columns dofs
221  ierr = buildFECol(p_miit,adj_miit->entFePtr,do_cols_prob,fe_ptr); CHKERRG(ierr);
222 
223  if(fe_ptr) {
224  for(
225  FENumeredDofEntity_multiIndex::iterator
226  vit = fe_ptr.get()->cols_dofs->begin();vit!= fe_ptr.get()->cols_dofs->end();vit++
227  ) {
228  const int idx = TAG::get_index(vit);
229  dofs_col_view.push_back(idx);
230  // Only check if index is correct
231  if(idx<0) {
232  std::ostringstream zz;
233  zz << "rank " << rAnk << " ";
234  zz << *(*vit) << std::endl;
235  SETERRQ(cOmm,PETSC_ERR_ARG_SIZ,zz.str().c_str());
236  }
237  if(idx>=p_miit->getNbDofsCol()) {
238  std::ostringstream zz;
239  zz << "rank " << rAnk << " ";
240  zz << *(*vit) << std::endl;
241  SETERRQ(cOmm,PETSC_ERR_ARG_SIZ,zz.str().c_str());
242  }
243  }
244  if(verb>2) {
245  std::stringstream ss;
246  ss << "rank " << rAnk << ": numeredDofsCols" << std::endl;
247  FENumeredDofEntity_multiIndex::iterator dit,hi_dit;
248  dit = fe_ptr.get()->cols_dofs->begin();
249  hi_dit = fe_ptr.get()->cols_dofs->end();
250  for(;dit!=hi_dit;dit++) {
251  ss << "\t" << **dit << std::endl;
252  }
253  PetscSynchronizedPrintf(cOmm, "%s", ss.str().c_str());
254  }
255  } else {
257  "Element should be here, otherwise matrix will have missing elements"
258  );
259  }
260 
261  }
262 
263  }
264 
266 }
MPI_Comm cOmm
MoFEM communicator.
Definition: Core.hpp:864
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:565
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Common.hpp:147
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:868
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:255
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:79

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