143 std::ostringstream error_message;
144 error_message <<
"The vector passed to initialise(...) must be of length "
175 std::ostringstream error_message;
176 error_message <<
"This vector does not own its data (i.e. it has been "
177 <<
"passed in via set_external_values() and therefore "
178 <<
"cannot be redistributed";
186 std::ostringstream error_message;
187 error_message <<
"The number of global rows in the new distribution ("
188 <<
dist_pt->nrow() <<
") is not equal to the number"
189 <<
" of global rows in the current distribution ("
190 << this->
nrow() <<
").\n";
199 std::ostringstream error_message;
200 error_message <<
"The new distribution and the current distribution must "
201 <<
"have the same communicator.";
413 std::ostringstream error_message;
414 error_message <<
"Range Error: " <<
i <<
" is not in the range (0,"
429 if (
v.built() && !
this->built())
433 else if (!
v.built() &&
this->built())
437 else if (!
v.built() && !
this->built())
465 std::ostringstream error_message;
466 error_message <<
"This vector must be setup.";
473 std::ostringstream error_message;
474 error_message <<
"The vector v must be setup.";
479 if (!(*
v.distribution_pt() == *
this->distribution_pt()))
481 std::ostringstream error_message;
482 error_message <<
"The vector v and this vector must have the same "
510 std::ostringstream error_message;
511 error_message <<
"This vector must be setup.";
518 std::ostringstream error_message;
519 error_message <<
"The vector v must be setup.";
524 if (!(*
v.distribution_pt() == *
this->distribution_pt()))
526 std::ostringstream error_message;
527 error_message <<
"The vector v and this vector must have the same "
556 error_msg <<
"DoubleVector must be set up.";
591 std::ostringstream error_message;
592 error_message <<
"Range Error: " <<
i <<
" is not in the range (0,"
611 for (
unsigned i = 0;
i <
nrow;
i++)
675 unsigned nrow = this->
nrow();
718 for (
unsigned i = 0;
i <
nrow;
i++)
811 std::ostringstream error_message;
812 error_message <<
"This vector must be setup.";
818 std::ostringstream error_message;
819 error_message <<
"The input vector be setup.";
825 std::ostringstream error_message;
826 error_message <<
"The distribution of this vector and the vector vec "
827 <<
"must be the same."
873 std::ostringstream error_message;
874 error_message <<
"This vector must be setup.";
920 std::ostringstream error_message;
921 error_message <<
"This vector must be setup.";
925 if (!matrix_pt->
built())
927 std::ostringstream error_message;
928 error_message <<
"The input matrix be built.";
934 std::ostringstream error_message;
935 error_message <<
"The distribution of this vector and the matrix at "
936 <<
"matrix_pt must be the same";
954 for (
unsigned i = 1,
ni =
v.nrow_local();
i <
ni;
i++)
966 namespace DoubleVectorHelpers
1004 std::ostringstream error_message;
1005 error_message <<
"There is no vector to concatenate...\n"
1006 <<
"Perhaps you forgot to fill in_vector_pt?\n";
1017 <<
"This does not require concatenating...\n";
1028 std::ostringstream error_message;
1029 error_message <<
"The vector in position " <<
vec_i
1030 <<
" is not built.\n"
1031 <<
"I cannot concatenate an unbuilt vector.\n";
1073 std::ostringstream error_message;
1074 error_message <<
"The sum of nrow of the in vectors does not match\n"
1075 <<
"the nrow of the out vector.\n";
1087 *(
out_vector.distribution_pt()->communicator_pt());
1097 std::ostringstream error_message;
1098 error_message <<
"The vector in position " <<
vec_i <<
" has a\n"
1099 <<
"different communicator from the out vector.\n";
1114 std::ostringstream error_message;
1115 error_message <<
"The vector in position " <<
vec_i <<
" has a\n"
1116 <<
"different distributed boolean from "
1117 <<
"the out vector.\n";
1128 if ((comm_pt->nproc() == 1) || !distributed)
1161 unsigned nproc = comm_pt->nproc();
1164 unsigned my_rank = comm_pt->my_rank();
1275 comm_pt->mpi_comm());
1311 comm_pt->mpi_comm());
1356 std::ostringstream error_message;
1357 error_message <<
"I don't know what to do with distributed vectors\n"
1358 <<
"without MPI... :(";
1423 std::ostringstream error_message;
1424 error_message <<
"The in_vector is not built.\n"
1425 <<
"Please build it!.\n";
1436 std::ostringstream error_message;
1437 error_message <<
"The vector at position " <<
vec_i
1438 <<
" is not built.\n"
1439 <<
"Please build it!.\n";
1456 std::ostringstream error_message;
1457 error_message <<
"The global number of rows in the in_vector\n"
1458 <<
"is not equal to the sum of the global nrows\n"
1459 <<
"of the in vectors.\n";
1469 *(
in_vector.distribution_pt()->communicator_pt());
1477 std::ostringstream error_message;
1478 error_message <<
"The communicator for the distribution in the \n"
1479 <<
"position " <<
vec_i
1480 <<
" is not the same as the in_vector\n";
1494 std::ostringstream error_message;
1496 <<
"The vector in position " <<
vec_i <<
" does not \n"
1497 <<
" have the same distributed boolean as the in_vector\n";
1508 in_vector.distribution_pt()->communicator_pt();
1511 bool distributed =
in_vector.distributed();
1514 if ((comm_pt->nproc() == 1) || !distributed)
1557 unsigned nproc = comm_pt->nproc();
1560 unsigned my_rank = comm_pt->my_rank();
1675 comm_pt->mpi_comm());
1711 comm_pt->mpi_comm());
1781 std::ostringstream error_message;
1782 error_message <<
"You have a distributed vector but with no mpi...\n"
1783 <<
"I don't know what to do :( \n";
1867 std::ostringstream error_message;
1868 error_message <<
"There is no vector to concatenate...\n"
1869 <<
"Perhaps you forgot to fill in_vector_pt?\n";
1880 <<
"This does not require concatenating...\n";
1891 std::ostringstream error_message;
1892 error_message <<
"The vector in position " <<
vec_i
1893 <<
" is not built.\n"
1894 <<
"I cannot concatenate an unbuilt vector.\n";
1923 *(
out_vector.distribution_pt()->communicator_pt());
1933 std::ostringstream error_message;
1934 error_message <<
"The vector in position " <<
vec_i <<
" has a\n"
1935 <<
"different communicator from the out vector.\n";
1950 std::ostringstream error_message;
1951 error_message <<
"The vector in position " <<
vec_i <<
" has a\n"
1952 <<
"different distributed boolean from the "
1984 std::ostringstream error_message;
1985 error_message <<
"The distribution of the out vector is not correct.\n"
1986 <<
"Please call the function with a cleared out vector,\n"
1987 <<
"or compare the distribution of the out vector with\n"
1988 <<
"the distribution created by\n"
1989 <<
"LinearAlgebraDistributionHelpers::concatenate(...)\n";
2085 std::ostringstream error_message;
2086 error_message <<
"The in_vector is not built.\n"
2087 <<
"Please build it!.\n";
2098 std::ostringstream error_message;
2099 error_message <<
"The vector at position " <<
vec_i
2100 <<
" is not built.\n"
2101 <<
"Please build it!.\n";
2125 std::ostringstream error_message;
2126 error_message <<
"The distribution from the in vector is incorrect.\n"
2127 <<
"It must be a concatenation of all the distributions\n"
2128 <<
"from the out vectors.\n";
2141 *(
in_vector.distribution_pt()->communicator_pt());
2149 std::ostringstream error_message;
2150 error_message <<
"The communicator for the vector in position\n"
2151 <<
vec_i <<
" is not the same as the in_vector\n"
2168 std::ostringstream error_message;
2169 error_message <<
"The vector in position " <<
vec_i
2170 <<
" does not have\n"
2171 <<
"the same distributed boolean as the in vector";
A class for compressed row matrices. This is a distributable object.
void multiply(const DoubleVector &x, DoubleVector &soln) const
Multiply the matrix by the vector x: soln=Ax.
bool built() const
access function to the Built flag - indicates whether the matrix has been build - i....
bool distributed() const
distribution is serial or distributed
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,...
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
A vector in the mathematical sense, initially developed for linear algebra type applications....
void initialise(const double &v)
initialise the whole vector with value v
void operator+=(const DoubleVector &v)
+= operator with another vector
void output_local_values(std::ostream &outfile, const int &output_precision=-1) const
output the local contents of the vector
double max() const
returns the maximum coefficient
bool operator==(const DoubleVector &v)
== operator
void operator*=(const double &d)
multiply by a double
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
void redistribute(const LinearAlgebraDistribution *const &dist_pt)
The contents of the vector are redistributed to match the new distribution. In a non-MPI rebuild this...
double norm() const
compute the 2 norm of this vector
bool Internal_values
Boolean flag to indicate whether the vector's data (values_pt) is owned by this vector.
void output(std::ostream &outfile, const int &output_precision=-1) const
output the global contents of the vector
void operator-=(const DoubleVector &v)
-= operator with another vector
void operator/=(const double &d)
divide by a double
bool Built
indicates that the vector has been built and is usable
double * Values_pt
the local vector
double dot(const DoubleVector &vec) const
compute the dot product of this vector with the vector vec.
double & operator[](int i)
[] access function to the (local) values of this vector
void clear()
wipes the DoubleVector
void output_local_values_with_offset(std::ostream &outfile, const int &output_precision=-1) const
output the local contents of the vector
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
bool distributed() const
access function to the distributed - indicates whether the distribution is serial or distributed
OomphCommunicator * communicator_pt() const
const access to the communicator pointer
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....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
void split(const DoubleVector &in_vector, Vector< DoubleVector * > &out_vector_pt)
Split a DoubleVector into the out DoubleVectors. Let vec_A be the in Vector, and let vec_B and vec_C ...
void concatenate_without_communication(const Vector< DoubleVector * > &in_vector_pt, DoubleVector &out_vector)
Concatenate DoubleVectors. Takes a Vector of DoubleVectors. If the out vector is built,...
void split_without_communication(const DoubleVector &in_vector, Vector< DoubleVector * > &out_vector_pt)
Split a DoubleVector into the out DoubleVectors. Data stays on its current processor,...
void concatenate(const Vector< DoubleVector * > &in_vector_pt, DoubleVector &out_vector)
Concatenate DoubleVectors. Takes a Vector of DoubleVectors. If the out vector is built,...
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).
std::ostream & operator<<(std::ostream &out, const DoubleVector &v)
output operator