Flow123d
master-1edfbef2b
|
Go to the documentation of this file.
57 for(
unsigned int i=0 ; i<
np(); i++)
starts[i+1]=
starts[i]+sizes[i];
65 :communicator(PETSC_COMM_WORLD),
71 const PetscInt *petsc_starts;
72 chkerr(VecGetOwnershipRanges(petsc_vector,&petsc_starts));
75 for(
unsigned int i=0 ; i<=
np(); i++)
starts[i]=petsc_starts[i];
91 unsigned int reminder, per_proc;
93 reminder=global_size %
np(); per_proc=global_size /
np();
97 for(
unsigned int i=0; i<
np(); i++)
104 for(
unsigned int i=1; i<=
np(); i++)
starts[i]=global_size;
115 : communicator(distr.communicator)
133 ASSERT_LT(idx,
size()).error(
"Index is greater than distribution size.\n");
135 for(
unsigned int i=0; i<
np(); i++) {
162 stream <<
"[" <<
myp() <<
"]" <<
"Distribution size: " <<
size() <<
" lsize: " <<
lsize() <<
" offset: " <<
begin() <<
" mpi_size: " <<
np() << endl;
163 for(
unsigned int i=0; i<
np();++i)
164 stream <<
"[" <<
myp() <<
"]" <<
"proc: " << i <<
" offset: " <<
begin(i) <<
" lsize: " <<
lsize(i) << endl;
unsigned int np() const
get num of processors
unsigned int lsize() const
unsigned int myp() const
get my processor
int my_proc
my proc number
Support classes for parallel programing.
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
unsigned int size() const
get global size
Distribution(const unsigned int size, MPI_Comm comm)
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
unsigned int * starts
starts[i] index of the first index on the proc i; starts[n_procs]=size of whole array
unsigned int get_proc(unsigned int idx) const
get processor of the given index
#define ASSERT_PERMANENT_GT(a, b)
Definition of comparative assert macro (Greater Than)
int num_of_procs
number of procs
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
const unsigned int * get_lsizes_array()
get local sizes array
unsigned int * lsizes
local sizes
const unsigned int * get_starts_array() const
get local starts array
Global macros to enhance readability and debugging, general constants.
const MPI_Comm communicator
communicator
unsigned int begin() const
#define MPI_Allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm)
bool is_on_proc(unsigned int idx, unsigned int proc) const
void view(std::ostream &stream) const
distribution view
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.