v0.13.2
Loading...
Searching...
No Matches
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::CoreTmp< 0 >
enum  SemaphoresBuildMofem {
  BUILD_FIELD = 1 << 0 , BUILD_FE = 1 << 1 , BUILD_ADJ = 1 << 2 , BUILD_PROBLEM = 1 << 3 ,
  PARTITION_PROBLEM = 1 << 4 , PARTITION_FE = 1 << 5 , PARTITION_GHOST_DOFS = 1 << 6 , PARTITION_MESH = 1 << 7
}
 

Public Member Functions

 CreateRowComressedADJMatrix (moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, int verbose=1)
 
template<typename TAG >
MoFEMErrorCode createMatArrays (ProblemsByName::iterator p_miit, const MatType type, std::vector< PetscInt > &i, std::vector< PetscInt > &j, const bool no_diagonals=true, int verb=QUIET) const
 Create matrix adjacencies. More...
 
template<typename TAG >
MoFEMErrorCode getEntityAdjacenies (ProblemsByName::iterator p_miit, typename boost::multi_index::index< NumeredDofEntity_multiIndex, TAG >::type::iterator mit_row, boost::shared_ptr< FieldEntity > mofem_ent_ptr, std::vector< int > &dofs_col_view, int verb) const
 Get element adjacencies. More...
 
- Public Member Functions inherited from MoFEM::CoreTmp< 0 >
const int getValue () const
 Get the core. More...
 
RefEntityTmp< 0 > getRefEntity (const EntityHandle ent)
 
virtual boost::shared_ptr< RefEntityTmp< 0 > > make_shared_ref_entity (const EntityHandle ent)
 Get RefEntity. More...
 
 CoreTmp (moab::Interface &moab, MPI_Comm comm=PETSC_COMM_WORLD, const int verbose=VERBOSE)
 
 ~CoreTmp ()
 
int & getBuildMoFEM () const
 Get flags/semaphores for different stages. More...
 
MoFEMErrorCode addPrismToDatabase (const EntityHandle prism, int verb=DEFAULT_VERBOSITY)
 add prim element More...
 
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Getting interface of core database. More...
 
Tag get_th_RefParentHandle () const
 
Tag get_th_RefBitLevel () const
 
Tag get_th_RefBitEdge () const
 
- Public Member Functions inherited from MoFEM::DeprecatedCoreInterface
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 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 synchronise_entities (Range &ent, int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode synchronise_field_entities (const std::string &name, int verb=DEFAULT_VERBOSITY)
 
- Public Member Functions inherited from MoFEM::CoreInterface
virtual ~CoreInterface ()=default
 
virtual const int getValue () const =0
 Get the core. More...
 
virtual boost::shared_ptr< RefEntityTmp< 0 > > make_shared_ref_entity (const EntityHandle ent)=0
 Get RefEntity. More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
virtual MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const =0
 
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register 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 ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from MoFEM::CoreTmp< 0 >
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...
 
static void setRefEntBasicDataPtr (MoFEM::Interface &m_field, boost::shared_ptr< BasicEntityData > &ptr)
 
static boost::shared_ptr< RefEntityTmp< 0 > > makeSharedRefEntity (MoFEM::Interface &m_field, const EntityHandle ent)
 
- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 
- Static Public Attributes inherited from MoFEM::CoreTmp< 0 >
static constexpr int value = 0
 
- Protected Member Functions inherited from MoFEM::CoreTmp< 0 >
template<int V>
 CoreTmp (moab::Interface &moab, MPI_Comm comm, const int verbose, CoreValue< V >)
 
MoFEMErrorCode coreGenericConstructor (moab::Interface &moab, MPI_Comm comm, const int verbose)
 
MoFEMErrorCode addProblem (const BitProblemId id, const std::string &name, int verb=DEFAULT_VERBOSITY)
 add problem More...
 
MoFEMErrorCode getTags (int verb=DEFAULT_VERBOSITY)
 Get tag handles. More...
 
MoFEMErrorCode clearMap ()
 Cleaning database. More...
 
MoFEMErrorCode registerSubInterfaces ()
 Register insterfaces. More...
 
BitProblemId getProblemShift ()
 Return unique problem Id. More...
 
MoFEMErrorCode initialiseDatabaseFromMesh (int verb=DEFAULT_VERBOSITY)
 Initialize database getting information on mesh. More...
 
MoFEMErrorCode getOptions (int verb=DEFAULT_VERBOSITY)
 Get core options from command line. More...
 
template<class IFACE >
MoFEMErrorCode regSubInterface ()
 Register subinterfac in core interface. More...
 
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)
 Set the moab interface object. More...
 
MoFEMErrorCode setMoabInterface (moab::Interface &new_moab, int verb=VERBOSE)
 
MPI_Comm & get_comm () const
 
int get_comm_size () const
 
int get_comm_rank () const
 
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_bit_ref (const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
 Remove parent from entities on bit level. More...
 
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, MoFEMTypes mf=MF_ZERO)
 delete entities form mofem and moab database More...
 
virtual 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 delete_field (const std::string name, int verb=DEFAULT_VERBOSITY)
 Delete field. More...
 
MoFEMErrorCode addField (const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_coefficients, const TagType tag_type, const enum MoFEMTypes bh, int verb)
 Template for add_field. More...
 
MoFEMErrorCode addEntsToFieldByDim (const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode add_ents_to_field_by_dim (const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. More...
 
MoFEMErrorCode add_ents_to_field_by_type (const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. More...
 
MoFEMErrorCode add_ents_to_field_by_dim (const EntityHandle meshset, const int dim, const std::string &name, const bool recursive=true, int verb=DEFAULT_VERBOSITY)
 Add entities to field meshset. 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 create_vertices_and_add_to_field (const std::string name, const double coords[], int size, int verb=DEFAULT_VERBOSITY)
 Create a vertices and add to field object. More...
 
MoFEMErrorCode setFieldOrder (const Range &ents, const BitFieldId id, const ApproximationOrder order, int ver)
 
MoFEMErrorCode setFieldOrderImpl (boost::shared_ptr< Field > field_ptr, const Range &ents, const ApproximationOrder order, int verb)
 
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 buildFieldForNoFieldImpl (boost::shared_ptr< Field > field_ptr, std::map< EntityType, int > &dof_counter, int verb)
 
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 get_field_id (const std::string &name) const
 Get field Id. More...
 
FieldBitNumber get_field_bit_number (const std::string name) const
 get field bit number More...
 
std::string get_field_name (const BitFieldId id) const
 get field name from id More...
 
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, enum MoFEMTypes bh=MF_EXIST) const
 get field structure More...
 
const FiniteElementget_finite_element_structure (const std::string &name, enum MoFEMTypes bh=MF_EXCL) const
 get finite element struture 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_EntType_by_bit_ref (const BitRefLevel &bit, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)
 
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)
 
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 &fe_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 &fe_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 &fe_name)
 unset finite element from problem, this remove entities assigned to finite element to a particular problem 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 elements. More...
 
MoFEMErrorCode build_finite_elements (const BitRefLevel &bit, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode build_finite_elements (const string fe_name, const Range *const ents_ptr=nullptr, int verb=DEFAULT_VERBOSITY)
 Build finite elements. 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 &fe_name, const Range &ents, int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode get_problem_finite_elements_entities (const std::string name, const std::string &fe_name, const EntityHandle meshset)
 add finite elements to the meshset More...
 
DEPRECATED MoFEMErrorCode build_problem_on_distributed_mesh (int verb=DEFAULT_VERBOSITY)
 
DEPRECATED MoFEMErrorCode build_problems (int verb=DEFAULT_VERBOSITY)
 
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 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 BasicMethod. More...
 
MoFEMErrorCode problem_basic_method_postProcess (const std::string &problem_name, BasicMethod &method, int verb=DEFAULT_VERBOSITY)
 Set data for BasicMethod. More...
 
MoFEMErrorCode cache_problem_entities (const std::string prb_name, CacheTupleWeakPtr cache_ptr)
 Cache variables. More...
 
MoFEMErrorCode loop_finite_elements (const Problem *problem_ptr, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)
 Make a loop over finite elements on partitions from upper to lower rank. More...
 
MoFEMErrorCode loop_finite_elements (const std::string problem_name, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)
 Make a loop over finite elements on partitions from upper to lower rank. More...
 
MoFEMErrorCode loop_finite_elements (const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)
 Make a loop over finite elements. More...
 
MoFEMErrorCode loop_dofs (const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs. More...
 
MoFEMErrorCode loop_dofs (const std::string &problem_name, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs. More...
 
MoFEMErrorCode loop_dofs (const std::string &problem_name, const std::string &field_name, RowColData rc, DofMethod &method, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs. More...
 
MoFEMErrorCode loop_dofs (const std::string &field_name, DofMethod &method, int verb=DEFAULT_VERBOSITY)
 Make a loop over dofs. More...
 
MoFEMErrorCode loop_entities (const Problem *problem_ptr, const std::string field_name, RowColData rc, EntityMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
 Loop over field entities in the problem. More...
 
MoFEMErrorCode loop_entities (const std::string problem_name, const std::string field_name, RowColData rc, EntityMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)
 Loop over field entities in the problem. More...
 
MoFEMErrorCode loop_entities (const std::string problem_name, const std::string field_name, RowColData rc, EntityMethod &method, int verb=DEFAULT_VERBOSITY)
 Loop over field entities in the problem. More...
 
MoFEMErrorCode loop_entities (const std::string field_name, EntityMethod &method, Range const *const ents=nullptr, int verb=DEFAULT_VERBOSITY)
 Loop over field entities. More...
 
MoFEMErrorCode get_fields (const Field_multiIndex **fields_ptr) const
 Get fields multi-index from database. More...
 
MoFEMErrorCode get_ref_ents (const RefEntity_multiIndex **refined_entities_ptr) const
 Get ref entities multi-index from database. More...
 
MoFEMErrorCode get_ref_finite_elements (const RefElement_multiIndex **refined_finite_elements_ptr) const
 Get ref finite elements multi-index form database. More...
 
MoFEMErrorCode get_finite_elements (const FiniteElement_multiIndex **fe_ptr) const
 Get finite elements multi-index. More...
 
MoFEMErrorCode get_ents_finite_elements (const EntFiniteElement_multiIndex **fe_ent_ptr) const
 Get entities finite elements multi-index. More...
 
MoFEMErrorCode get_field_ents (const FieldEntity_multiIndex **field_ents) const
 Get field multi index. More...
 
MoFEMErrorCode get_dofs (const DofEntity_multiIndex **dofs_ptr) const
 Get dofs multi index. More...
 
MoFEMErrorCode get_problem (const std::string &problem_name, const Problem **problem_ptr) const
 Get problem database (data structure) More...
 
MoFEMErrorCode get_problems (const Problem_multiIndex **problems_ptr) const
 Get pointer to problems multi-index. More...
 
MoFEMErrorCode get_ents_elements_adjacency (const FieldEntityEntFiniteElementAdjacencyMap_multiIndex **dofs_elements_adjacency) const
 Get the dofs elements adjacency object. More...
 
const Field_multiIndexget_fields () const
 Get the fields object. More...
 
const RefEntity_multiIndexget_ref_ents () const
 Get the ref ents object. More...
 
const RefElement_multiIndexget_ref_finite_elements () const
 Get the ref finite elements object. More...
 
const FiniteElement_multiIndexget_finite_elements () const
 Get the finite elements object. More...
 
const EntFiniteElement_multiIndexget_ents_finite_elements () const
 Get the ents finite elements object. More...
 
const FieldEntity_multiIndexget_field_ents () const
 Get the field ents object. More...
 
const DofEntity_multiIndexget_dofs () const
 Get the dofs object. More...
 
const Problemget_problem (const std::string problem_name) const
 Get the problem object. More...
 
const Problem_multiIndexget_problems () const
 Get the problems object. More...
 
const FieldEntityEntFiniteElementAdjacencyMap_multiIndexget_ents_elements_adjacency () const
 Get the dofs elements adjacency object. More...
 
FieldEntityByUId::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...
 
FieldEntityByUId::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) More...
 
DofEntityByUId::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) More...
 
DofEntityByUId::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) More...
 
DofEntityByUId::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...
 
DofEntityByUId::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) More...
 
DofEntityByUId::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...
 
DofEntityByUId::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...
 
EntFiniteElement_multiIndex::index< Unique_mi_tag >::type::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...
 
EntFiniteElement_multiIndex::index< Unique_mi_tag >::type::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...
 
- Protected Attributes inherited from MoFEM::CoreTmp< 0 >
boost::shared_ptr< WrapMPICommwrapMPIMOABComm
 manage creation and destruction of MOAB communicator More...
 
int verbose
 Verbosity level. More...
 
boost::ptr_map< boost::typeindex::type_index, UnknownInterfaceiFaces
 Hash map of pointers to interfaces. More...
 
int * buildMoFEM
 keeps flags/semaphores for different stages More...
 
std::string optionsPrefix
 Prefix for options on command line. More...
 
PetscBool initaliseAndBuildField
 
PetscBool initaliseAndBuildFiniteElements
 
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_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_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 mofemComm
 MoFEM communicator. More...
 
ParallelComm * pComm
 MOAB communicator structure. More...
 
int sIze
 MoFEM communicator size. More...
 
int rAnk
 MOFEM communicator rank. More...
 
- Static Protected Attributes inherited from MoFEM::CoreTmp< 0 >
static bool isGloballyInitialised = false
 Core base globally initialized. More...
 
static int mpiInitialised
 mpi was initialised by other agent More...
 
static PetscBool isInitialized
 petsc was initialised by other agent More...
 

Detailed Description

Create compressed matrix.

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

Definition at line 33 of file MatrixManager.cpp.

Member Typedef Documentation

◆ AdjByEnt

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

Definition at line 40 of file MatrixManager.cpp.

◆ DofByGlobalPetscIndex

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

Definition at line 43 of file MatrixManager.cpp.

◆ ProblemsByName

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

Definition at line 41 of file MatrixManager.cpp.

Constructor & Destructor Documentation

◆ CreateRowComressedADJMatrix()

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

Definition at line 35 of file MatrixManager.cpp.

37 : Core(moab, comm, verbose) {}
CoreTmp< 0 > Core
Definition: Core.hpp:1094
int verbose
Verbosity level.
Definition: Core.hpp:993
std::reference_wrapper< moab::Interface > moab
moab database
Definition: Core.hpp:321

Member Function Documentation

◆ createMatArrays()

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

Create matrix adjacencies.

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

See: Idx_mi_tag PetscGlobalIdx_mi_tag and PetscLocalIdx_mi_tag

Definition at line 146 of file MatrixManager.cpp.

149 {
151
152 PetscLogEventBegin(MOFEM_EVENT_createMat, 0, 0, 0, 0);
153
154 auto cache = boost::make_shared<std::vector<EntityCacheNumeredDofs>>(
155 entsFields.size());
156
157 size_t idx = 0;
158 for (auto it = entsFields.begin(); it != entsFields.end(); ++it, ++idx) {
159
160 const auto uid = (*it)->getLocalUniqueId();
161 auto r = entFEAdjacencies.get<Unique_mi_tag>().equal_range(uid);
162 for (auto lo = r.first; lo != r.second; ++lo) {
163
164 if ((lo->getBitFEId() & p_miit->getBitFEId()).any()) {
165
166 const BitRefLevel &prb_bit = p_miit->getBitRefLevel();
167 const BitRefLevel &prb_mask = p_miit->getBitRefLevelMask();
168 const BitRefLevel &fe_bit = lo->entFePtr->getBitRefLevel();
169
170 // if entity is not problem refinement level
171 if ((fe_bit & prb_mask) != fe_bit)
172 continue;
173 if ((fe_bit & prb_bit).none())
174 continue;
175
176 auto dit = p_miit->numeredColDofsPtr->lower_bound(uid);
177
178 decltype(dit) hi_dit;
179 if (dit != p_miit->numeredColDofsPtr->end())
180 hi_dit = p_miit->numeredColDofsPtr->upper_bound(
181 uid | static_cast<UId>(MAX_DOFS_ON_ENTITY - 1));
182 else
183 hi_dit = dit;
184
185 (*it)->entityCacheColDofs =
186 boost::shared_ptr<EntityCacheNumeredDofs>(cache, &((*cache)[idx]));
187 (*cache)[idx].loHi = {dit, hi_dit};
188
189 break;
190 }
191 }
192 }
193
194 using NumeredDofEntitysByIdx =
195 typename boost::multi_index::index<NumeredDofEntity_multiIndex,
196 TAG>::type;
197
198 // Get multi-indices for rows and columns
199 const NumeredDofEntitysByIdx &dofs_row_by_idx =
200 p_miit->numeredRowDofsPtr->get<TAG>();
201 int nb_dofs_row = p_miit->getNbDofsRow();
202 if (nb_dofs_row == 0) {
203 SETERRQ1(mofemComm, MOFEM_DATA_INCONSISTENCY, "problem <%s> has zero rows",
204 p_miit->getName().c_str());
205 }
206
207 // Get adjacencies form other processors
208 std::map<int, std::vector<int>> adjacent_dofs_on_other_parts;
209
210 // If not partitioned set petsc layout for matrix. If partitioned need to get
211 // adjacencies form other parts. Note if algebra is only partitioned no need
212 // to collect adjacencies form other entities. Those are already on mesh
213 // which is assumed that is on each processor the same.
214 typename boost::multi_index::index<NumeredDofEntity_multiIndex,
215 TAG>::type::iterator miit_row,
216 hi_miit_row;
217
218 if (TAG::IamNotPartitioned) {
219
220 // Get range of local indices
221 PetscLayout layout;
222 CHKERR PetscLayoutCreate(mofemComm, &layout);
223 CHKERR PetscLayoutSetBlockSize(layout, 1);
224 CHKERR PetscLayoutSetSize(layout, nb_dofs_row);
225 CHKERR PetscLayoutSetUp(layout);
226 PetscInt rstart, rend;
227 CHKERR PetscLayoutGetRange(layout, &rstart, &rend);
228 CHKERR PetscLayoutDestroy(&layout);
229
230 if (verb >= VERBOSE) {
231 MOFEM_LOG("SYNC", Sev::noisy)
232 << "row lower " << rstart << " row upper " << rend;
234 }
235
236 miit_row = dofs_row_by_idx.lower_bound(rstart);
237 hi_miit_row = dofs_row_by_idx.lower_bound(rend);
238 if (std::distance(miit_row, hi_miit_row) != rend - rstart) {
239 SETERRQ4(
240 mofemComm, PETSC_ERR_ARG_SIZ,
241 "data inconsistency, std::distance(miit_row,hi_miit_row) != rend - "
242 "rstart (%d != %d - %d = %d) ",
243 std::distance(miit_row, hi_miit_row), rend, rstart, rend - rstart);
244 }
245
246 } else {
247
248 MPI_Comm comm;
249 // // Make sure it is a PETSc mofemComm
250 CHKERR PetscCommDuplicate(get_comm(), &comm, NULL);
251
252 // get adjacent nodes on other partitions
253 std::vector<std::vector<int>> dofs_vec(sIze);
254
255 boost::shared_ptr<FieldEntity> mofem_ent_ptr;
256 std::vector<int> dofs_col_view;
257
258 typename boost::multi_index::index<NumeredDofEntity_multiIndex,
259 TAG>::type::iterator mit_row,
260 hi_mit_row;
261
262 mit_row = dofs_row_by_idx.begin();
263 hi_mit_row = dofs_row_by_idx.end();
264 for (; mit_row != hi_mit_row; mit_row++) {
265
266 // Shared or multishared row and not owned. Those data should be send to
267 // other side.
268
269 // Get entity adjacencies, no need to repeat that operation for dofs when
270 // are on the same entity. For simplicity is assumed that those sheered
271 // the same adjacencies.
272 unsigned char pstatus = (*mit_row)->getPStatus();
273 if ((pstatus & PSTATUS_NOT_OWNED) &&
274 (pstatus & (PSTATUS_SHARED | PSTATUS_MULTISHARED))) {
275
276 bool get_adj_col = true;
277 if (mofem_ent_ptr) {
278 if (mofem_ent_ptr->getLocalUniqueId() ==
279 (*mit_row)->getFieldEntityPtr()->getLocalUniqueId()) {
280 get_adj_col = false;
281 }
282 }
283
284 if (get_adj_col) {
285 // Get entity adjacencies
286 mofem_ent_ptr = (*mit_row)->getFieldEntityPtr();
287 CHKERR getEntityAdjacenies<TAG>(p_miit, mit_row, mofem_ent_ptr,
288 dofs_col_view, verb);
289 // Sort, unique and resize dofs_col_view
290 {
291 std::sort(dofs_col_view.begin(), dofs_col_view.end());
292 std::vector<int>::iterator new_end =
293 std::unique(dofs_col_view.begin(), dofs_col_view.end());
294 int new_size = std::distance(dofs_col_view.begin(), new_end);
295 dofs_col_view.resize(new_size);
296 }
297 // Add that row. Patterns is that first index is row index, second is
298 // size of adjacencies after that follows column adjacencies.
299 int owner = (*mit_row)->getOwnerProc();
300 dofs_vec[owner].emplace_back(TAG::get_index(mit_row)); // row index
301 dofs_vec[owner].emplace_back(
302 dofs_col_view.size()); // nb. of column adjacencies
303 // add adjacent cools
304 dofs_vec[owner].insert(dofs_vec[owner].end(), dofs_col_view.begin(),
305 dofs_col_view.end());
306 }
307 }
308 }
309
310 int nsends = 0; // number of messages to send
311 std::vector<int> dofs_vec_length(sIze); // length of the message to proc
312 for (int proc = 0; proc < sIze; proc++) {
313
314 if (!dofs_vec[proc].empty()) {
315
316 dofs_vec_length[proc] = dofs_vec[proc].size();
317 nsends++;
318
319 } else {
320
321 dofs_vec_length[proc] = 0;
322 }
323 }
324
325 std::vector<MPI_Status> status(sIze);
326
327 // Computes the number of messages a node expects to receive
328 int nrecvs; // number of messages received
329 CHKERR PetscGatherNumberOfMessages(comm, NULL, &dofs_vec_length[0],
330 &nrecvs);
331
332 // Computes info about messages that a MPI-node will receive, including
333 // (from-id,length) pairs for each message.
334 int *onodes; // list of node-ids from which messages are expected
335 int *olengths; // corresponding message lengths
336 CHKERR PetscGatherMessageLengths(comm, nsends, nrecvs, &dofs_vec_length[0],
337 &onodes, &olengths);
338
339 // Gets a unique new tag from a PETSc communicator.
340 int tag;
341 CHKERR PetscCommGetNewTag(comm, &tag);
342
343 // Allocate a buffer sufficient to hold messages of size specified in
344 // olengths. And post Irecvs on these buffers using node info from onodes
345 int **rbuf; // must bee freed by user
346 MPI_Request *r_waits; // must bee freed by user
347
348 // rbuf has a pointers to messages. It has size of of nrecvs (number of
349 // messages) +1. In the first index a block is allocated,
350 // such that rbuf[i] = rbuf[i-1]+olengths[i-1].
351 CHKERR PetscPostIrecvInt(comm, tag, nrecvs, onodes, olengths, &rbuf,
352 &r_waits);
353
354 MPI_Request *s_waits; // status of sens messages
355 CHKERR PetscMalloc1(nsends, &s_waits);
356
357 // Send messages
358 for (int proc = 0, kk = 0; proc < sIze; proc++) {
359 if (!dofs_vec_length[proc])
360 continue; // no message to send to this proc
361 CHKERR MPI_Isend(&(dofs_vec[proc])[0], // buffer to send
362 dofs_vec_length[proc], // message length
363 MPIU_INT, proc, // to proc
364 tag, comm, s_waits + kk);
365 kk++;
366 }
367
368 // Wait for received
369 if (nrecvs) {
370 CHKERR MPI_Waitall(nrecvs, r_waits, &status[0]);
371 }
372 // Wait for send messages
373 if (nsends) {
374 CHKERR MPI_Waitall(nsends, s_waits, &status[0]);
375 }
376
377 for (int kk = 0; kk < nrecvs; kk++) {
378
379 int len = olengths[kk];
380 int *data_from_proc = rbuf[kk];
381
382 for (int ii = 0; ii < len;) {
383
384 int row_idx = data_from_proc[ii++]; // get row number
385 int nb_adj_dofs = data_from_proc[ii++]; // get nb. of adjacent dofs
386
387 if (debug) {
388
389 DofByGlobalPetscIndex::iterator dit;
390 dit = p_miit->numeredRowDofsPtr->get<PetscGlobalIdx_mi_tag>().find(
391 row_idx);
392 if (dit ==
393 p_miit->numeredRowDofsPtr->get<PetscGlobalIdx_mi_tag>().end()) {
395 "dof %d can not be found in problem", row_idx);
396 }
397 }
398
399 for (int jj = 0; jj < nb_adj_dofs; jj++) {
400 adjacent_dofs_on_other_parts[row_idx].push_back(data_from_proc[ii++]);
401 }
402 }
403 }
404
405 // Cleaning
406 CHKERR PetscFree(s_waits);
407 CHKERR PetscFree(rbuf[0]);
408 CHKERR PetscFree(rbuf);
409 CHKERR PetscFree(r_waits);
410 CHKERR PetscFree(onodes);
411 CHKERR PetscFree(olengths);
412
413 miit_row = dofs_row_by_idx.begin();
414 hi_miit_row = dofs_row_by_idx.end();
415
416 CHKERR PetscCommDestroy(&comm);
417 }
418
419 boost::shared_ptr<FieldEntity> mofem_ent_ptr;
420 int row_last_evaluated_idx = -1;
421
422 std::vector<int> dofs_vec;
423 std::vector<int> dofs_col_view;
424
425 // loop local rows
426 int nb_loc_row_from_iterators = 0;
427 unsigned int rows_to_fill = p_miit->getNbLocalDofsRow();
428 i.reserve(rows_to_fill + 1);
429 for (; miit_row != hi_miit_row; miit_row++) {
430
431 if (!TAG::IamNotPartitioned) {
432 if (static_cast<int>((*miit_row)->getPart()) != rAnk)
433 continue;
434 }
435 // This is only for cross-check if everything is ok
436 nb_loc_row_from_iterators++;
437
438 // add next row to compressed matrix
439 i.push_back(j.size());
440
441 // Get entity adjacencies, no need to repeat that operation for dofs when
442 // are on the same entity. For simplicity is assumed that those share the
443 // same adjacencies.
444 if ((!mofem_ent_ptr)
445 ? 1
446 : (mofem_ent_ptr->getLocalUniqueId() !=
447 (*miit_row)->getFieldEntityPtr()->getLocalUniqueId())) {
448
449 // get entity adjacencies
450 mofem_ent_ptr = (*miit_row)->getFieldEntityPtr();
451 CHKERR getEntityAdjacenies<TAG>(p_miit, miit_row, mofem_ent_ptr,
452 dofs_col_view, verb);
453 row_last_evaluated_idx = TAG::get_index(miit_row);
454
455 dofs_vec.resize(0);
456 // insert dofs_col_view
457 dofs_vec.insert(dofs_vec.end(), dofs_col_view.begin(),
458 dofs_col_view.end());
459
460 unsigned char pstatus = (*miit_row)->getPStatus();
461 if (pstatus > 0) {
462 std::map<int, std::vector<int>>::iterator mit;
463 mit = adjacent_dofs_on_other_parts.find(row_last_evaluated_idx);
464 if (mit == adjacent_dofs_on_other_parts.end()) {
465 // NOTE: Dof can adjacent to other part but no elements are there
466 // which use that dof std::cerr << *miit_row << std::endl; SETERRQ1(
467 // get_comm(),MOFEM_DATA_INCONSISTENCY,
468 // "data inconsistency row_last_evaluated_idx = %d",
469 // row_last_evaluated_idx
470 // );
471 } else {
472 dofs_vec.insert(dofs_vec.end(), mit->second.begin(),
473 mit->second.end());
474 }
475 }
476
477 // sort and make unique
478 sort(dofs_vec.begin(), dofs_vec.end());
479 std::vector<int>::iterator new_end =
480 unique(dofs_vec.begin(), dofs_vec.end());
481 int new_size = std::distance(dofs_vec.begin(), new_end);
482 dofs_vec.resize(new_size);
483 }
484
485 // Try to be smart reserving memory
486 if (j.capacity() < j.size() + dofs_vec.size()) {
487
488 // TODO: [CORE-55] Improve algorithm estimating size of compressed matrix
489 unsigned int nb_nonzero = j.size() + dofs_vec.size();
490 unsigned int average_row_fill = nb_nonzero / i.size() + 1;
491 j.reserve(rows_to_fill * average_row_fill);
492 }
493
494 auto hi_diit = dofs_vec.end();
495 for (auto diit = dofs_vec.begin(); diit != hi_diit; diit++) {
496
497 if (no_diagonals) {
498 if (*diit == TAG::get_index(miit_row)) {
499 continue;
500 }
501 }
502 j.push_back(*diit);
503 }
504 }
505
506 // build adj matrix
507 i.push_back(j.size());
508
509 if (strcmp(type, MATMPIADJ) == 0) {
510
511 // Adjacency matrix used to partition problems, f.e. METIS
512 if (i.size() - 1 != (unsigned int)nb_loc_row_from_iterators) {
513 SETERRQ2(
514 get_comm(), PETSC_ERR_ARG_SIZ,
515 "Number of rows from iterator is different than size of rows in "
516 "compressed row "
517 "matrix (unsigned int)nb_local_dofs_row != i.size() - 1, i.e. %d != "
518 "%d",
519 (unsigned int)nb_loc_row_from_iterators, i.size() - 1);
520 }
521
522 } else if (strcmp(type, MATMPIAIJ) == 0) {
523
524 // Compressed MPIADJ matrix
525 if (i.size() - 1 != (unsigned int)nb_loc_row_from_iterators) {
526 SETERRQ2(
527 get_comm(), PETSC_ERR_ARG_SIZ,
528 "Number of rows from iterator is different than size of rows in "
529 "compressed row "
530 "matrix (unsigned int)nb_local_dofs_row != i.size() - 1, i.e. %d != "
531 "%d",
532 (unsigned int)nb_loc_row_from_iterators, i.size() - 1);
533 }
534 PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
535 if ((unsigned int)nb_local_dofs_row != i.size() - 1) {
536 SETERRQ2(
537 get_comm(), PETSC_ERR_ARG_SIZ,
538 "Number of rows is different than size of rows in compressed row "
539 "matrix (unsigned int)nb_local_dofs_row != i.size() - 1, i.e. %d != "
540 "%d",
541 (unsigned int)nb_local_dofs_row, i.size() - 1);
542 }
543
544 } else if (strcmp(type, MATAIJ) == 0) {
545
546 // Sequential compressed ADJ matrix
547 if (i.size() - 1 != (unsigned int)nb_loc_row_from_iterators) {
548 SETERRQ2(
549 get_comm(), PETSC_ERR_ARG_SIZ,
550 "Number of rows form iterator is different than size of rows in "
551 "compressed row "
552 "matrix (unsigned int)nb_local_dofs_row != i.size() - 1, i.e. %d != "
553 "%d",
554 (unsigned int)nb_loc_row_from_iterators, i.size() - 1);
555 }
556 PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
557 if ((unsigned int)nb_local_dofs_row != i.size() - 1) {
558 SETERRQ2(
559 get_comm(), PETSC_ERR_ARG_SIZ,
560 "Number of rows is different than size of rows in compressed row "
561 "matrix (unsigned int)nb_local_dofs_row != i.size() - 1, i.e. %d != "
562 "%d",
563 (unsigned int)nb_local_dofs_row, i.size() - 1);
564 }
565
566 } else if (strcmp(type, MATAIJCUSPARSE) == 0) {
567
568 if (i.size() - 1 != (unsigned int)nb_loc_row_from_iterators) {
569 SETERRQ(get_comm(), PETSC_ERR_ARG_SIZ, "data inconsistency");
570 }
571 PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
572 if ((unsigned int)nb_local_dofs_row != i.size() - 1) {
573 SETERRQ(get_comm(), PETSC_ERR_ARG_SIZ, "data inconsistency");
574 }
575
576 } else {
577
578 SETERRQ(get_comm(), PETSC_ERR_ARG_NULL, "not implemented");
579 }
580
581 PetscLogEventEnd(MOFEM_EVENT_createMat, 0, 0, 0, 0);
583}
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:345
#define MatrixManagerFunctionBegin
Create adjacent matrices using different indices.
@ VERBOSE
Definition: definitions.h:209
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
Definition: definitions.h:236
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
static const bool debug
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, UId, &NumeredDofEntity::getLocalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > >, ordered_non_unique< tag< Idx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::dofIdx > >, ordered_non_unique< tag< 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 > > > > NumeredDofEntity_multiIndex
MultiIndex container keeps NumeredDofEntity.
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
BlockParamData * cache
uint128_t UId
Unique Id.
Definition: Types.hpp:31
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
int r
Definition: sdf.py:5
MPI_Comm & get_comm() const
Definition: Core.hpp:975
PetscLogEvent MOFEM_EVENT_createMat
Definition: Core.hpp:958
FieldEntity_multiIndex entsFields
entities on fields
Definition: Core.hpp:304
int sIze
MoFEM communicator size.
Definition: Core.hpp:969
int rAnk
MOFEM communicator rank.
Definition: Core.hpp:970
MPI_Comm mofemComm
MoFEM communicator.
Definition: Core.hpp:966
FieldEntityEntFiniteElementAdjacencyMap_multiIndex entFEAdjacencies
adjacencies of elements to dofs
Definition: Core.hpp:311

◆ getEntityAdjacenies()

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

Get element adjacencies.

Definition at line 72 of file MatrixManager.cpp.

77 {
79
80 BitRefLevel prb_bit = p_miit->getBitRefLevel();
81 BitRefLevel prb_mask = p_miit->getBitRefLevelMask();
82
83 const EmptyFieldBlocks &empty_field_blocks = p_miit->getEmptyFieldBlocks();
84 const DofIdx nb_dofs_col = p_miit->getNbDofsCol();
85
86 dofs_col_view.clear();
87 for (auto r = entFEAdjacencies.get<Unique_mi_tag>().equal_range(
88 mofem_ent_ptr->getLocalUniqueId());
89 r.first != r.second; ++r.first) {
90
91 if (r.first->byWhat & BYROW) {
92
93 if ((r.first->entFePtr->getId() & p_miit->getBitFEId()).none()) {
94 // if element is not part of problem
95 continue;
96 }
97
98 const BitRefLevel &fe_bit = r.first->entFePtr->getBitRefLevel();
99 // if entity is not problem refinement level
100 if ((fe_bit & prb_bit).any() && (fe_bit & prb_mask) == fe_bit) {
101
102 const BitRefLevel &dof_bit = (*mit_row)->getBitRefLevel();
103 const bool empty_row_block =
104 (empty_field_blocks.first & (*mit_row)->getId()).none();
105
106 for (auto &it : r.first->entFePtr->getColFieldEnts()) {
107 if (auto e = it.lock()) {
108 if (empty_row_block ||
109 (empty_field_blocks.second & e->getId()).none()) {
110
111 if (auto cache = e->entityCacheColDofs.lock()) {
112 const auto lo = cache->loHi[0];
113 const auto hi = cache->loHi[1];
114 for (auto vit = lo; vit != hi; ++vit) {
115
116 const int idx = TAG::get_index(vit);
117 if (PetscLikely(idx >= 0))
118 dofs_col_view.push_back(idx);
119
120#ifndef NDEBUG
121 if (PetscUnlikely(idx >= nb_dofs_col)) {
122 MOFEM_LOG("SELF", Sev::error)
123 << "Problem with dof: " << std::endl
124 << "Rank " << rAnk << " : " << *(*vit);
125 SETERRQ(
126 mofemComm, PETSC_ERR_ARG_SIZ,
127 "Index of dof larger than number of DOFs in column");
128 }
129#endif
130 }
131
132 } else {
133 SETERRQ(mofemComm, MOFEM_DATA_INCONSISTENCY, "Cache not set");
134 }
135 }
136 }
137 }
138 }
139 }
140 }
141
143}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ BYROW
Definition: definitions.h:131
int DofIdx
Index of DOF.
Definition: Types.hpp:18
Problem::EmptyFieldBlocks EmptyFieldBlocks

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