26#ifndef OOMPH_DOUBLE_MULTI_VECTOR_CLASS_HEADER
27#define OOMPH_DOUBLE_MULTI_VECTOR_CLASS_HEADER
31#include <oomph-lib-config.h>
42#ifdef OOMPH_HAS_TRILINOS
43#include "Teuchos_Range1D.hpp"
70 const double&
v = 0.0)
83 const double&
v = 0.0)
106 const std::vector<int>& index,
107 const bool& deep_copy =
true)
139#ifdef OOMPH_HAS_TRILINOS
145 const Teuchos::Range1D& index,
146 const bool& deep_copy =
true)
191 this->
build(new_vector);
206 this->
build(old_vector);
487 std::ostringstream error_message;
491 error_message <<
"Range Error: Vector " <<
v
492 <<
"is not in the range (0," <<
Nvector - 1 <<
")";
498 error_message <<
"Range Error: " <<
i <<
" is not in the range (0,"
517 if (
vec.built() && !
this->built())
521 else if (!
vec.built() &&
this->built())
525 else if (!
vec.built() && !
this->built())
555 std::ostringstream error_message;
556 error_message <<
"This vector must be setup.";
564 std::ostringstream error_message;
565 error_message <<
"The vector v must be setup.";
571 if (!(*
vec.distribution_pt() == *
this->distribution_pt()))
573 std::ostringstream error_message;
574 error_message <<
"The vector v and this vector must have the same "
602 std::ostringstream error_message;
603 error_message <<
"This vector must be setup.";
611 std::ostringstream error_message;
612 error_message <<
"The vector v must be setup.";
618 if (!(*
vec.distribution_pt() == *
this->distribution_pt()))
620 std::ostringstream error_message;
621 error_message <<
"The vector v and this vector must have the same "
648 std::ostringstream error_message;
649 error_message <<
"This vector must be setup.";
728 unsigned nrow = this->
nrow();
776 for (
unsigned i = 0;
i <
nrow;
i++)
815 std::ostringstream error_message;
816 error_message <<
"This vector must be setup.";
823 std::ostringstream error_message;
824 error_message <<
"The input vector be setup.";
831 std::ostringstream error_message;
832 error_message <<
"The distribution of this vector and the vector vec "
833 <<
"must be the same."
895 std::ostringstream error_message;
896 error_message <<
"This vector must be setup.";
Base class for any linear algebra object that is distributable. Just contains storage for the LinearA...
void clear_distribution()
clear the distribution of this distributable linear algebra object
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 multi vector in the mathematical sense, initially developed for linear algebra type applications....
DoubleMultiVector(const unsigned &n_vector, const LinearAlgebraDistribution &dist, const double &v=0.0)
Constructor. Assembles a DoubleMultiVector consisting of n_vector vectors, each with a prescribed dis...
void setup_doublevector_representation()
compute the A-norm using the matrix at matrix_pt
const DoubleVector & doublevector(const unsigned &i) const
access to the DoubleVector representation (const version)
void output(std::ostream &outfile) const
output the contents of the vector
double * values(const unsigned &i) const
access function to the i-th vector's data (const version)
DoubleMultiVector(const unsigned &n_vector, const LinearAlgebraDistribution *const &dist_pt, const double &v=0.0)
Constructor. Assembles a DoubleMultiVector consisting of n_vector vectors, each with a prescribed dis...
void redistribute(const LinearAlgebraDistribution *const &dist_pt)
Allows are external data to be used by this vector. WARNING: The size of the external data must corre...
unsigned Nvector
The number of vectors.
void shallow_build(const unsigned &n_vector, const LinearAlgebraDistribution &dist)
Build the storage for pointers to vectors with a given distribution, but do not populate the pointers...
DoubleMultiVector(const unsigned &n_vector, const DoubleMultiVector &old_vector, const double &initial_value=0.0)
Constructor. Build a multivector using the same distribution of the input vector with n_vector column...
void build(const unsigned &n_vector, const LinearAlgebraDistribution *const &dist_pt, const double &initial_value=0.0)
Assembles a DoubleMultiVector with n_vector vectors, each with a distribution dist,...
DoubleMultiVector(const DoubleMultiVector &old_vector, const std::vector< int > &index, const bool &deep_copy=true)
Constructor that builds a multivector from selected columns of the input multivector....
DoubleMultiVector()
Constructor for an uninitialized DoubleMultiVector.
void operator*=(const double &scalar_value)
Multiply by a scalar.
double ** values()
access function to the underlying values
~DoubleMultiVector()
Destructor - just calls this->clear() to delete the distribution and data.
double ** Values
the local data, need a pointer to a pointer so that the individual vectors can be extracted
Vector< DoubleVector > Internal_doublevector
Need a vector of DoubleVectors to interface with our linear solvers.
void initialise(const double &initial_value)
initialise the whole vector with value v
void clear()
initialise the vector with coefficient from the vector v. Note: The vector v must be of length
void build(const unsigned &n_vector, const LinearAlgebraDistribution &dist, const double &initial_value=0.0)
Assembles a DoubleMultiVector with n_vector vectors, a distribution dist, if v is specified each elem...
DoubleMultiVector(const DoubleMultiVector &old_vector, const Teuchos::Range1D &index, const bool &deep_copy=true)
Constructor that builds a multivector from selected columns of the input multivector and the provided...
void operator=(const DoubleMultiVector &old_vector)
assignment operator (deep copy)
bool Built
indicates that the vector has been built and is usable
void dot(const DoubleMultiVector &vec, std::vector< double > &result) const
compute the 2 norm of this vector
void norm(std::vector< double > &result) const
compute the 2 norm of this vector
double & operator()(int v, int i) const
[] access function to the (local) values of the v-th vector
void shallow_build(const DoubleMultiVector &old_vector)
Provide a (shallow) copy of the old vector.
bool operator==(const DoubleMultiVector &vec)
== operator
double ** values() const
access function to the underlying values (const version)
void operator-=(DoubleMultiVector vec)
-= operator
void operator+=(DoubleMultiVector vec)
+= operator
void shallow_build(const unsigned &n_vector, const LinearAlgebraDistribution *const &dist_pt)
Build the storage for pointers to vectors with a given distribution, but do not populate the pointers...
bool Internal_values
Boolean flag to indicate whether the vector's data (values_pt) is owned by this vector.
void output(std::string filename)
output the contents of the vector
unsigned nvector() const
Return the number of vectors.
double * values(const unsigned &i)
access function to the i-th vector's data
DoubleMultiVector(const DoubleMultiVector &new_vector)
Copy constructor.
DoubleVector & doublevector(const unsigned &i)
access to the DoubleVector representatoin
void build(const DoubleMultiVector &old_vector)
Provides a (deep) copy of the old_vector.
A vector in the mathematical sense, initially developed for linear algebra type applications....
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...
OomphCommunicator * communicator_pt() const
const access to the communicator pointer
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...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).