26#ifndef OOMPH_LINEAR_ALGEBRA_DISTRIBUTION_CLASS_HEADER
27#define OOMPH_LINEAR_ALGEBRA_DISTRIBUTION_CLASS_HEADER
31#include <oomph-lib-config.h>
76 const unsigned&
n_row = 0)
86 const unsigned&
n_row,
99 const unsigned&
n_row = 0)
109 const unsigned&
n_row,
120 this->
build(old_dist);
127 this->
build(old_dist_pt);
139 this->
build(old_dist);
148 const unsigned&
nrow = 0);
156 const unsigned&
nrow,
167 this->
build(*new_dist_pt);
203 "LinearAlgebraDistribution has not been built : Comm_pt == 0.",
204 "LinearAlgebraDistribution::nrow_local()",
228 "LinearAlgebraDistribution has not been built : Comm_pt == 0.",
232 if (
p >=
unsigned(
Comm_pt->nproc()))
234 std::ostringstream error_message;
235 error_message <<
"Requested nrow_local(" <<
p
236 <<
"), but this distribution is defined "
237 <<
"on " <<
Comm_pt->nproc() <<
"processors.";
271 "LinearAlgebraDistribution has not been built : Comm_pt == 0.",
295 "LinearAlgebraDistribution has not been built : Comm_pt == 0.",
299 if (
p >=
unsigned(
Comm_pt->nproc()))
301 std::ostringstream error_message;
302 error_message <<
"Requested first_row(" <<
p
303 <<
"), but this distribution is defined "
304 <<
"on " <<
Comm_pt->nproc() <<
"processors.";
371 "Requested global row outside the number of global rows",
535 namespace LinearAlgebraDistributionHelpers
Base class for any linear algebra object that is distributable. Just contains storage for the LinearA...
unsigned nrow_local(const unsigned &p) const
access function for the num of local rows on this processor.
void clear_distribution()
clear the distribution of this distributable linear algebra object
virtual ~DistributableLinearAlgebraObject()
Destructor.
unsigned first_row(const unsigned &p) const
access function for the first row on this processor
bool distributed() const
distribution is serial or distributed
DistributableLinearAlgebraObject(const DistributableLinearAlgebraObject &matrix)=delete
Broken copy constructor.
unsigned nrow() const
access function to the number of global rows.
bool distribution_built() const
if the communicator_pt is null then the distribution is not setup then false is returned,...
LinearAlgebraDistribution * Distribution_pt
the LinearAlgebraDistribution object
unsigned nrow_local() const
access function for the num of local rows on this processor.
unsigned first_row() const
access function for the first row on this processor
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
void build_distribution(const LinearAlgebraDistribution *const dist_pt)
setup the distribution of this distributable linear algebra object
DistributableLinearAlgebraObject()
Default constructor - create a distribution.
void operator=(const DistributableLinearAlgebraObject &)=delete
Broken assignment operator.
void build_distribution(const LinearAlgebraDistribution &dist)
setup the distribution of this distributable linear algebra object
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
void operator=(const LinearAlgebraDistribution &old_dist)
Assignment Operator.
bool distributed() const
access function to the distributed - indicates whether the distribution is serial or distributed
unsigned first_row(const unsigned &p) const
access function for the first row on the p-th processor
LinearAlgebraDistribution(const OomphCommunicator *const comm_pt, const unsigned &first_row_, const unsigned &n_row_local, const unsigned &n_row=0)
Constructor. Takes the first_row, nrow_local (both for this processor) and nrow as arguments....
unsigned first_row() const
access function for the first row on this processor. If not distributed then this is just zero.
OomphCommunicator * communicator_pt() const
const access to the communicator pointer
bool operator==(const LinearAlgebraDistribution &other_dist) const
== Operator
Vector< unsigned > Nrow_local
the number of local rows on the processor
void build(const OomphCommunicator *const comm_pt, const unsigned &first_row, const unsigned &nrow_local, const unsigned &nrow=0)
Sets the distribution. Takes first_row, nrow_local and nrow as arguments. If nrow is not provided or ...
~LinearAlgebraDistribution()
Destructor.
bool operator!=(const LinearAlgebraDistribution &other_dist) const
!= operator
OomphCommunicator * Comm_pt
the pointer to the MPI communicator object in this distribution
unsigned Nrow
the number of global rows
LinearAlgebraDistribution(const OomphCommunicator *const comm_pt, const unsigned &n_row, const bool &distributed_=true)
Constructor. Takes the number of global rows and uniformly distributes them over the processors if di...
LinearAlgebraDistribution(const OomphCommunicator &comm, const unsigned &n_row, const bool &distributed_=true)
Constructor. Takes the number of global rows and uniformly distributes them over the processors if di...
friend std::ostream & operator<<(std::ostream &stream, LinearAlgebraDistribution &dist)
<< operator
Vector< unsigned > First_row
the first row on this processor
unsigned global_to_local_row_map(const unsigned &global_i) const
return the local index corresponding to the global index
bool built() const
if the communicator_pt is null then the distribution is not setup then false is returned,...
bool Distributed
flag to indicate whether this distribution describes an object that is distributed over the processor...
Vector< unsigned > first_row_vector() const
return the first_row Vector
unsigned nrow_local(const unsigned &p) const
access function for the num of local rows on this processor. If no MPI the nrow is returned
unsigned nrow() const
access function to the number of global rows.
void clear()
clears the distribution
unsigned nrow_local() const
access function for the num of local rows on this processor. If no MPI then Nrow is returned.
unsigned rank_of_global_row(const unsigned i) const
return the processor rank of the global row number i
LinearAlgebraDistribution(const LinearAlgebraDistribution &old_dist)
Copy Constructor.
LinearAlgebraDistribution()
Default Constructor - creates a Distribution that has not been setup.
LinearAlgebraDistribution(const LinearAlgebraDistribution *old_dist_pt)
pointer based copy constructor
Vector< unsigned > nrow_local_vector() const
return the nrow_local Vector
void build(const LinearAlgebraDistribution *new_dist_pt)
Copy the argument distribution. Also a helper method for the =assignment operator and copy constructo...
LinearAlgebraDistribution(const OomphCommunicator &comm, const unsigned &first_row_, const unsigned &n_row_local, const unsigned &n_row=0)
Constructor. Takes the first_row, nrow_local (both for this processor) and nrow as arguments....
An oomph-lib wrapper to the MPI_Comm communicator object. Just contains an MPI_Comm object (which is ...
An OomphLibError object which should be thrown when an run-time error is encountered....
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
void concatenate(const Vector< LinearAlgebraDistribution * > &in_distribution_pt, LinearAlgebraDistribution &out_distribution)
Takes a vector of LinearAlgebraDistribution objects and concatenates them such that the nrow_local of...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).