30 #ifndef OOMPH_DOUBLE_VECTOR_CLASS_HEADER 31 #define OOMPH_DOUBLE_VECTOR_CLASS_HEADER 35 #include <oomph-lib-config.h> 78 this->
build(dist_pt,v);
102 this->
build(new_vector);
108 this->
build(old_vector);
119 this->
build(&dist,v);
133 this->
build(&dist,v);
173 double* external_values,
174 bool delete_external_values)
197 bool delete_external_values)
207 std::ostringstream error_message;
208 error_message <<
"The distribution of the vector must be setup before " 209 <<
"external values can be set";
211 OOMPH_CURRENT_FUNCTION,
212 OOMPH_EXCEPTION_LOCATION);
265 void output(std::ostream &outfile,
const int& output_precision = -1)
const;
271 std::ofstream some_file;
272 some_file.open(filename.c_str());
273 output(some_file,output_precision);
279 const int& output_precision = -1)
const;
283 const int& output_precision = -1)
const 286 std::ofstream some_file;
287 some_file.open(filename.c_str());
294 const int& output_precision = -1)
const;
298 const int& output_precision = -1)
const 301 std::ofstream some_file;
302 some_file.open(filename.c_str());
333 namespace DoubleVectorHelpers
double * values_pt() const
access function to the underlying values (const version)
void clear()
wipes the 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...
DoubleVector()
Constructor for an uninitialized DoubleVector.
bool operator==(const DoubleVector &v)
== operator
double * values_pt()
access function to the underlying values
DoubleVector(const DoubleVector &new_vector)
Copy constructor.
void output_local_values(std::ostream &outfile, 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...
double & operator[](int i)
[] access function to the (local) values of this vector
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, no data is sent between processors. This results in our vectors which are a permutation of the in vector.
~DoubleVector()
Destructor - just calls this->clear() to delete the distribution and data.
void operator=(const DoubleVector &old_vector)
assignment operator
void build(const LinearAlgebraDistribution &dist, const double &v)
Assembles a DoubleVector with distribution dist, if v is specified each element is set to v...
DoubleVector(const LinearAlgebraDistribution &dist, const double &v=0.0)
Constructor. Assembles a DoubleVector with a prescribed distribution. Additionally every entry can be...
friend std::ostream & operator<<(std::ostream &out, const DoubleVector &v)
Ouput operator for DoubleVector.
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 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, we will not build a new distribution. Otherwise a new distribution will be built using LinearAlgebraDistribution::concatenate(...).
bool Internal_values
Boolean flag to indicate whether the vector's data (values_pt) is owned by this vector.
void operator-=(const DoubleVector &v)
-= operator with another vector
bool distribution_built() const
void operator/=(const double &d)
divide by a double
void operator+=(const DoubleVector &v)
+= operator with another vector
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
Base class for any linear algebra object that is distributable. Just contains storage for the LinearA...
double * Values_pt
the local vector
void initialise(const double &v)
initialise the whole vector with value v
void build(const LinearAlgebraDistribution &dist, const Vector< double > &v)
Assembles a DoubleVector with a distribution dist and coefficients taken from the vector v...
void clear_distribution()
clear the distribution of this distributable linear algebra object
bool Built
indicates that the vector has been built and is usable
void output_local_values_with_offset(std::string filename, 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 dot(const DoubleVector &vec) const
compute the dot product of this vector with the vector vec.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
void output(std::string filename, const int &output_precision=-1) const
output the global contents of the vector
void output_local_values_with_offset(std::ostream &outfile, const int &output_precision=-1) const
output the local contents of the vector
void build_distribution(const LinearAlgebraDistribution *const dist_pt)
setup the distribution of this distributable linear algebra object
void operator*=(const double &d)
multiply by a double
void concatenate(const Vector< DoubleVector *> &in_vector_pt, DoubleVector &out_vector)
Concatenate DoubleVectors. Takes a Vector of DoubleVectors. If the out vector is built, we will not build a new distribution. Otherwise we build a uniform distribution.
A vector in the mathematical sense, initially developed for linear algebra type applications. If MPI then this vector can be distributed - its distribution is described by the LinearAlgebraDistribution object at Distribution_pt. Data is stored in a C-style pointer vector (double*)
double norm() const
compute the 2 norm of this vector
A class for compressed row matrices. This is a distributable object.
void output(std::ostream &outfile, const int &output_precision=-1) const
output the global contents of the vector
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 output_local_values(std::string filename, const int &output_precision=-1) const
output the local contents of the vector
double max() const
returns the maximum coefficient