Flow123d  release_2.2.0-914-gf1a3a4f
Public Types | Public Member Functions | Private Attributes | List of all members
Distribution Class Reference

#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...
 

Detailed Description

Continuous distribution of an 1D array of indexes. TODO: after inclusion of LibMesh sources:

Definition at line 50 of file distribution.hh.

Member Enumeration Documentation

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.

Constructor & Destructor Documentation

Distribution::Distribution ( const unsigned int  size,
MPI_Comm  comm 
)

Constructor. It makes distribution from given local number of indices on every processor.

COLLECTIVE

Parameters
sizeLocal 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.

Parameters
sizesInt 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.

Parameters
petsc_vectorconstructor 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.

Parameters
typeEither Block or Localized distribution of indices.
global_sizeTotal 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)

Copy Constructor.

copy constructor

Definition at line 127 of file distribution.cc.

Distribution::~Distribution ( )

Destructor.

Definition at line 183 of file distribution.cc.

Member Function Documentation

unsigned int Distribution::begin ( int  proc) const
inline

get starting local index

Definition at line 109 of file distribution.hh.

Here is the caller graph for this function:

unsigned int Distribution::begin ( ) const
inline

Definition at line 110 of file distribution.hh.

Here is the caller graph for this function:

unsigned int Distribution::end ( int  proc) const
inline

get last local index +1

Definition at line 112 of file distribution.hh.

Here is the caller graph for this function:

unsigned int Distribution::end ( ) const
inline

Definition at line 113 of file distribution.hh.

Here is the caller graph for this function:

MPI_Comm Distribution::get_comm ( ) const
inline

Returns communicator.

Definition at line 129 of file distribution.hh.

Here is the caller graph for this function:

const unsigned int * Distribution::get_lsizes_array ( )

get local sizes array

Definition at line 155 of file distribution.cc.

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

const unsigned int * Distribution::get_starts_array ( ) const

get local starts array

Definition at line 167 of file distribution.cc.

Here is the caller graph for this function:

bool Distribution::is_local ( unsigned int  idx) const
inline

identify local index

Definition at line 120 of file distribution.hh.

Here is the caller graph for this function:

bool Distribution::is_on_proc ( unsigned int  idx,
unsigned int  proc 
) const
inline

Definition at line 121 of file distribution.hh.

Here is the caller graph for this function:

unsigned int Distribution::lsize ( int  proc) const
inline

get local size

Definition at line 115 of file distribution.hh.

unsigned int Distribution::lsize ( ) const
inline

Definition at line 116 of file distribution.hh.

Here is the caller graph for this function:

unsigned int Distribution::myp ( ) const
inline

get my processor

Definition at line 107 of file distribution.hh.

Here is the caller graph for this function:

unsigned int Distribution::np ( ) const
inline

get num of processors

Definition at line 105 of file distribution.hh.

Here is the caller graph for this function:

unsigned int Distribution::size ( ) const
inline

get global size

Definition at line 118 of file distribution.hh.

Here is the caller graph for this function:

void Distribution::view ( std::ostream &  stream) const

distribution view

Definition at line 173 of file distribution.cc.

Here is the caller graph for this function:

Member Data Documentation

const MPI_Comm Distribution::communicator
private

communicator

Definition at line 135 of file distribution.hh.

unsigned int* Distribution::lsizes
private

local sizes

Definition at line 143 of file distribution.hh.

int Distribution::my_proc
private

my proc number

Definition at line 139 of file distribution.hh.

int Distribution::num_of_procs
private

number of procs

Definition at line 137 of file distribution.hh.

unsigned int* Distribution::starts
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.


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