Flow123d
release_2.2.0-22-g936454a
|
class to manage local indices on sub-domain to global indices on domain More...
#include <local_to_global_map.hh>
Public Member Functions | |
LocalToGlobalMap (const Distribution &distr) | |
LocalToGlobalMap (std::shared_ptr< Distribution > distr) | |
void | insert (const unsigned int idx) |
void | insert (const std::vector< unsigned int > &indices) |
void | finalize () |
unsigned int | operator[] (const unsigned int local_idx) const |
unsigned int | size () const |
std::shared_ptr< Distribution > | get_distr () |
const std::vector< unsigned int > & | get_map_vector () const |
Private Attributes | |
std::set< unsigned int > * | nonlocal_indices_ |
auxiliary set of non-local part of the map More... | |
std::shared_ptr< Distribution > | distr_ |
distribution of the global indices More... | |
std::vector< unsigned int > | global_indices_ |
mapping for all local indices More... | |
class to manage local indices on sub-domain to global indices on domain
Currently (March 2012) the local to global maps are managed by individual equations (e.g. DarcyFlow has el_4_loc .. there it is complicated by different local indexing of elements, sides and edges). In fact el_4_loc etc. are new_local to old_global maps. This map is created as follows:
PETSC solver: 1) create graph 2) make partitioning 2.5) create id_4_old (just used to create new_4_id, id was non continuous index not used anymore) 3) call id_maps which: 4) call ISPartitioninToNumbering : assign partitions to processors (identity, no optimization); make "distribution"; make mapping (array of ints): old_local to new_global 5) from this we crate AO (application ordering from PETSc) 6) use AO to map identity array to old numbering -> creates map: new_global to old_global
So this produce new_local to old_global mapping and only for continuous part of local indices (not for ghost indices) See that this works without any information about connectivity.
METIS/BDDC solver: 1) graph, partition of elements, maps for elements (no overlap, no ghost values) using id_maps function 2) same for edges -> produce non overlapping local to global maps. 3) use std::set to collect all dofs on local elements (pass through mesh) complexity: n*log(n) n-local number of dofs 4) copy set to vector - makes local ordering arbitrary
Future usage is:
In both cases the mapping is created by adding all global numbers on local subdomain. In order to keep local part of the map continuous, we need Distribution that describes splitting of global indices into continuous blocks. This Distribution is known as soon as we assign partitions to processors. So we assume that it is known at construction time.
Definition at line 70 of file local_to_global_map.hh.
LocalToGlobalMap::LocalToGlobalMap | ( | const Distribution & | distr | ) |
Constructor. Starts filling of the map.
distr | Non overlapping distribution of global indices to processors in continuous blocks. Local block of indices forms first part of the mapping and then nonlocal indices follows. This constructor makes a deep copy of the distribution. |
Definition at line 24 of file local_to_global_map.cc.
LocalToGlobalMap::LocalToGlobalMap | ( | std::shared_ptr< Distribution > | distr | ) |
Same as the previous constructor, but just takes copy of shared pointer. This assumes that Distribution is allocated on the heap by: std::make_shared<Distribution>
Definition at line 30 of file local_to_global_map.cc.
void LocalToGlobalMap::finalize | ( | ) |
Finish filling stage. Creates mapping array, then you can use () operator to map indices.
Definition at line 47 of file local_to_global_map.cc.
|
inline |
Returns smart_ptr to the Distribution of the global indices. Allow share this among many objects.
Definition at line 118 of file local_to_global_map.hh.
|
inline |
Returns inner vector.
Definition at line 124 of file local_to_global_map.hh.
void LocalToGlobalMap::insert | ( | const unsigned int | idx | ) |
Insert a global index to the mapping.
Definition at line 36 of file local_to_global_map.cc.
void LocalToGlobalMap::insert | ( | const std::vector< unsigned int > & | indices | ) |
Insert more indices at once.
Definition at line 41 of file local_to_global_map.cc.
|
inline |
Maps local index to the global one. For DEBUG, performs check for dimension.
Definition at line 103 of file local_to_global_map.hh.
|
inline |
Returns size of local map.
Definition at line 112 of file local_to_global_map.hh.
|
private |
distribution of the global indices
Definition at line 133 of file local_to_global_map.hh.
|
private |
mapping for all local indices
Definition at line 135 of file local_to_global_map.hh.
|
private |
auxiliary set of non-local part of the map
Definition at line 131 of file local_to_global_map.hh.