Flow123d
release_3.0.0-966-gb002c76
|
#include <distribution.hh>
Public Types | |
enum | SpecialDistribution { Block =-1, Localized =-2 } |
Public Member Functions | |
Distribution (const unsigned int size, MPI_Comm comm) | |
Distribution (const unsigned int *const sizes, MPI_Comm comm) | |
Distribution (const Vec &petsc_vector) | |
Distribution (const DistributionType &type, unsigned int global_size, MPI_Comm comm) | |
Distribution (const Distribution &distr) | |
unsigned int | np () const |
get num of processors More... | |
unsigned int | myp () const |
get my processor More... | |
unsigned int | begin (int proc) const |
get starting local index More... | |
unsigned int | begin () const |
unsigned int | end (int proc) const |
get last local index +1 More... | |
unsigned int | end () const |
unsigned int | lsize (int proc) const |
get local size More... | |
unsigned int | lsize () const |
unsigned int | size () const |
get global size More... | |
bool | is_local (unsigned int idx) const |
identify local index More... | |
bool | is_on_proc (unsigned int idx, unsigned int proc) const |
unsigned int | get_proc (unsigned int idx) const |
get processor of the given index More... | |
const unsigned int * | get_lsizes_array () |
get local sizes array More... | |
const unsigned int * | get_starts_array () const |
get local starts array More... | |
MPI_Comm | get_comm () const |
Returns communicator. More... | |
void | view (std::ostream &stream) const |
distribution view More... | |
~Distribution () | |
Private Attributes | |
const MPI_Comm | communicator |
communicator More... | |
int | num_of_procs |
number of procs More... | |
int | my_proc |
my proc number More... | |
unsigned int * | starts |
starts[i] index of the first index on the proc i; starts[n_procs]=size of whole array More... | |
unsigned int * | lsizes |
local sizes More... | |
Continuous distribution of an 1D array of indexes. TODO: after inclusion of LibMesh sources:
Definition at line 50 of file distribution.hh.
Type of distribution automatically created only from global number of indices.
Enumerator | |
---|---|
Block |
Distribute indices evenly. |
Localized |
Put all on the first processor. |
Definition at line 55 of file distribution.hh.
Distribution::Distribution | ( | const unsigned int | size, |
MPI_Comm | comm | ||
) |
Constructor. It makes distribution from given local number of indices on every processor.
COLLECTIVE
size | Local size on calling processor. |
create a Distribution from local sizes (dim = np ) (collective context)
Definition at line 27 of file distribution.cc.
Distribution::Distribution | ( | const unsigned int *const | sizes, |
MPI_Comm | comm | ||
) |
Constructor. It makes distribution from given array of sizes of processors.
NOT COLLECTIVE, but still use MPI to provide information about processors.
sizes | Int array with sizes. |
create a Distribution from local sizes (dim = np ) (local context)
Definition at line 51 of file distribution.cc.
Distribution::Distribution | ( | const Vec & | petsc_vector | ) |
Constructor. It makes distribution from distribution of a PETSC vector.
NOT COLLECTIVE, but still use MPI to provide information about processors.
petsc_vector | constructor from existing PETSC vector (collective context) |
Definition at line 70 of file distribution.cc.
Distribution::Distribution | ( | const DistributionType & | type, |
unsigned int | global_size, | ||
MPI_Comm | comm | ||
) |
Constructor. It makes distribution from global number of indices according to given scheme.
NOT COLLECTIVE, but still use MPI to provide information about processors.
type | Either Block or Localized distribution of indices. |
global_size | Total number of indices to distribute. |
construct from given global size (collective context)
Definition at line 92 of file distribution.cc.
Distribution::Distribution | ( | const Distribution & | distr | ) |
Distribution::~Distribution | ( | ) |
Destructor.
Definition at line 183 of file distribution.cc.
|
inline |
get starting local index
Definition at line 109 of file distribution.hh.
|
inline |
|
inline |
get last local index +1
Definition at line 112 of file distribution.hh.
|
inline |
|
inline |
Returns communicator.
Definition at line 129 of file distribution.hh.
const unsigned int * Distribution::get_lsizes_array | ( | ) |
get local sizes array
Definition at line 155 of file distribution.cc.
unsigned int Distribution::get_proc | ( | unsigned int | idx | ) | const |
get processor of the given index
find the proc to which belongs index "idx" in the distribution use simple linear search, better binary search could be implemented (local context)
Definition at line 143 of file distribution.cc.
const unsigned int * Distribution::get_starts_array | ( | ) | const |
get local starts array
Definition at line 167 of file distribution.cc.
|
inline |
identify local index
Definition at line 120 of file distribution.hh.
|
inline |
|
inline |
get local size
Definition at line 115 of file distribution.hh.
|
inline |
|
inline |
get my processor
Definition at line 107 of file distribution.hh.
|
inline |
get num of processors
Definition at line 105 of file distribution.hh.
|
inline |
get global size
Definition at line 118 of file distribution.hh.
void Distribution::view | ( | std::ostream & | stream | ) | const |
distribution view
Definition at line 173 of file distribution.cc.
|
private |
communicator
Definition at line 135 of file distribution.hh.
|
private |
local sizes
Definition at line 143 of file distribution.hh.
|
private |
my proc number
Definition at line 139 of file distribution.hh.
|
private |
number of procs
Definition at line 137 of file distribution.hh.
|
private |
starts[i] index of the first index on the proc i; starts[n_procs]=size of whole array
Definition at line 141 of file distribution.hh.