Flow123d  3.9.0-127d9ed9b
Public Member Functions | Private Attributes | List of all members
LocalToGlobalMap Class Reference

class to manage local indices on sub-domain to global indices on domain More...

#include <local_to_global_map.hh>

Collaboration diagram for LocalToGlobalMap:
Collaboration graph
[legend]

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< Distributionget_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< Distributiondistr_
 distribution of the global indices More...
 
std::vector< unsigned int > global_indices_
 mapping for all local indices More...
 

Detailed Description

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

7) go through new_local continuous part and map it to old_global index

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 75 of file local_to_global_map.hh.

Constructor & Destructor Documentation

◆ LocalToGlobalMap() [1/2]

LocalToGlobalMap::LocalToGlobalMap ( const Distribution distr)

Constructor. Starts filling of the map.

Parameters
distrNon 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() [2/2]

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.

Member Function Documentation

◆ finalize()

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.

◆ get_distr()

std::shared_ptr<Distribution> LocalToGlobalMap::get_distr ( )
inline

Returns smart_ptr to the Distribution of the global indices. Allow share this among many objects.

Definition at line 123 of file local_to_global_map.hh.

◆ get_map_vector()

const std::vector<unsigned int>& LocalToGlobalMap::get_map_vector ( ) const
inline

Returns inner vector.

Definition at line 129 of file local_to_global_map.hh.

◆ insert() [1/2]

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.

◆ insert() [2/2]

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.

◆ operator[]()

unsigned int LocalToGlobalMap::operator[] ( const unsigned int  local_idx) const
inline

Maps local index to the global one. For DEBUG, performs check for dimension.

Definition at line 108 of file local_to_global_map.hh.

◆ size()

unsigned int LocalToGlobalMap::size ( ) const
inline

Returns size of local map.

Definition at line 117 of file local_to_global_map.hh.

Member Data Documentation

◆ distr_

std::shared_ptr<Distribution> LocalToGlobalMap::distr_
private

distribution of the global indices

Definition at line 138 of file local_to_global_map.hh.

◆ global_indices_

std::vector<unsigned int> LocalToGlobalMap::global_indices_
private

mapping for all local indices

Definition at line 140 of file local_to_global_map.hh.

◆ nonlocal_indices_

std::set<unsigned int>* LocalToGlobalMap::nonlocal_indices_
private

auxiliary set of non-local part of the map

Definition at line 136 of file local_to_global_map.hh.


The documentation for this class was generated from the following files: