26 #ifndef OOMPH_DOUBLE_VECTOR_CLASS_HEADER
27 #define OOMPH_DOUBLE_VECTOR_CLASS_HEADER
31 #include <oomph-lib-config.h>
67 const double& v = 0.0)
70 this->
build(dist_pt, v);
96 this->
build(new_vector);
102 this->
build(old_vector);
112 this->
build(&dist, v);
125 this->
build(&dist, v);
168 double* external_values,
169 bool delete_external_values)
192 bool delete_external_values)
202 std::ostringstream error_message;
203 error_message <<
"The distribution of the vector must be setup before "
204 <<
"external values can be set";
206 OOMPH_CURRENT_FUNCTION,
207 OOMPH_EXCEPTION_LOCATION);
266 void output(std::ostream& outfile,
const int& output_precision = -1)
const;
272 std::ofstream some_file;
273 some_file.open(filename.c_str());
274 output(some_file, output_precision);
280 const int& output_precision = -1)
const;
284 const int& output_precision = -1)
const
287 std::ofstream some_file;
288 some_file.open(filename.c_str());
295 std::ostream& outfile,
const int& output_precision = -1)
const;
299 const int& output_precision = -1)
const
302 std::ofstream some_file;
303 some_file.open(filename.c_str());
333 namespace DoubleVectorHelpers
A class for compressed row matrices. This is a distributable object.
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 distribution_built() const
if the communicator_pt is null then the distribution is not setup then false is returned,...
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 set_external_values(double *external_values, bool delete_external_values)
Allows are external data to be used by this vector. WARNING: The size of the external data must corre...
void initialise(const double &v)
initialise the whole vector with value v
void output_local_values(std::string filename, const int &output_precision=-1) const
output the local contents of the vector
DoubleVector(const LinearAlgebraDistribution *const &dist_pt, const double &v=0.0)
Constructor. Assembles a DoubleVector with a prescribed distribution. Additionally every entry can be...
void operator+=(const DoubleVector &v)
+= operator with another vector
DoubleVector(const LinearAlgebraDistribution &dist, const double &v=0.0)
Constructor. Assembles a DoubleVector with a prescribed distribution. Additionally every entry can be...
void output_local_values(std::ostream &outfile, const int &output_precision=-1) const
output the local contents of the vector
void set_external_values(const LinearAlgebraDistribution *const &dist_pt, double *external_values, bool delete_external_values)
Allows are external data to be used by this vector. WARNING: The size of the external data must corre...
double max() const
returns the maximum coefficient
bool operator==(const DoubleVector &v)
== operator
~DoubleVector()
Destructor - just calls this->clear() to delete the distribution and data.
void operator*=(const double &d)
multiply by a double
void build(const LinearAlgebraDistribution &dist, const Vector< double > &v)
Assembles a DoubleVector with a distribution dist and coefficients taken from the vector v....
friend std::ostream & operator<<(std::ostream &out, const DoubleVector &v)
Ouput operator for DoubleVector.
DoubleVector()
Constructor for an uninitialized DoubleVector.
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
double * values_pt()
access function to the underlying values
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 output_local_values_with_offset(std::string filename, const int &output_precision=-1) const
output the local contents of the vector
void operator-=(const DoubleVector &v)
-= operator with another vector
void output(std::string filename, const int &output_precision=-1) const
output the global contents of the vector
void operator/=(const double &d)
divide by a double
void operator=(const DoubleVector &old_vector)
assignment operator
bool Built
indicates that the vector has been built and is usable
double * values_pt() const
access function to the underlying values (const version)
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 build(const LinearAlgebraDistribution &dist, const double &v)
Assembles a DoubleVector with distribution dist, if v is specified each element is set to v,...
void clear()
wipes the DoubleVector
DoubleVector(const DoubleVector &new_vector)
Copy constructor.
void output_local_values_with_offset(std::ostream &outfile, const int &output_precision=-1) const
output the local contents of the vector
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
An OomphLibError object which should be thrown when an run-time error is encountered....
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,...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...