![]() |
|
#include <double_multi_vector.h>
Public Member Functions | |
DoubleMultiVector () | |
Constructor for an uninitialized DoubleMultiVector. More... | |
DoubleMultiVector (const unsigned &n_vector, const LinearAlgebraDistribution *const &dist_pt, const double &v=0.0) | |
DoubleMultiVector (const unsigned &n_vector, const LinearAlgebraDistribution &dist, const double &v=0.0) | |
DoubleMultiVector (const unsigned &n_vector, const DoubleMultiVector &old_vector, const double &initial_value=0.0) | |
DoubleMultiVector (const DoubleMultiVector &old_vector, const std::vector< int > &index, const bool &deep_copy=true) | |
DoubleMultiVector (const DoubleMultiVector &new_vector) | |
Copy constructor. More... | |
~DoubleMultiVector () | |
void | operator= (const DoubleMultiVector &old_vector) |
assignment operator (deep copy) More... | |
unsigned | nvector () const |
Return the number of vectors. More... | |
void | shallow_build (const DoubleMultiVector &old_vector) |
Provide a (shallow) copy of the old vector. More... | |
void | shallow_build (const unsigned &n_vector, const LinearAlgebraDistribution &dist) |
void | shallow_build (const unsigned &n_vector, const LinearAlgebraDistribution *const &dist_pt) |
void | build (const DoubleMultiVector &old_vector) |
Provides a (deep) copy of the old_vector. More... | |
void | build (const unsigned &n_vector, const LinearAlgebraDistribution &dist, const double &initial_value=0.0) |
void | build (const unsigned &n_vector, const LinearAlgebraDistribution *const &dist_pt, const double &initial_value=0.0) |
void | initialise (const double &initial_value) |
initialise the whole vector with value v More... | |
void | clear () |
wipes the DoubleVector More... | |
bool | built () const |
void | redistribute (const LinearAlgebraDistribution *const &dist_pt) |
double & | operator() (int v, int i) const |
[] access function to the (local) values of the v-th vector More... | |
bool | operator== (const DoubleMultiVector &vec) |
== operator More... | |
void | operator+= (DoubleMultiVector vec) |
+= operator More... | |
void | operator-= (DoubleMultiVector vec) |
-= operator More... | |
void | operator*= (const double &scalar_value) |
Multiply by a scalar. More... | |
double ** | values () |
access function to the underlying values More... | |
double ** | values () const |
access function to the underlying values (const version) More... | |
double * | values (const unsigned &i) |
access function to the i-th vector's data More... | |
double * | values (const unsigned &i) const |
access function to the i-th vector's data (const version) More... | |
DoubleVector & | doublevector (const unsigned &i) |
access to the DoubleVector representatoin More... | |
const DoubleVector & | doublevector (const unsigned &i) const |
access to the DoubleVector representation (const version) More... | |
void | output (std::ostream &outfile) const |
output the contents of the vector More... | |
void | output (std::string filename) |
output the contents of the vector More... | |
void | dot (const DoubleMultiVector &vec, std::vector< double > &result) const |
compute the 2 norm of this vector More... | |
void | norm (std::vector< double > &result) const |
compute the 2 norm of this vector More... | |
![]() | |
DistributableLinearAlgebraObject () | |
Default constructor - create a distribution. More... | |
DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const DistributableLinearAlgebraObject &)=delete |
Broken assignment operator. More... | |
virtual | ~DistributableLinearAlgebraObject () |
Destructor. More... | |
LinearAlgebraDistribution * | distribution_pt () const |
access to the LinearAlgebraDistribution More... | |
unsigned | nrow () const |
access function to the number of global rows. More... | |
unsigned | nrow_local () const |
access function for the num of local rows on this processor. More... | |
unsigned | nrow_local (const unsigned &p) const |
access function for the num of local rows on this processor. More... | |
unsigned | first_row () const |
access function for the first row on this processor More... | |
unsigned | first_row (const unsigned &p) const |
access function for the first row on this processor More... | |
bool | distributed () const |
distribution is serial or distributed More... | |
bool | distribution_built () const |
void | build_distribution (const LinearAlgebraDistribution *const dist_pt) |
void | build_distribution (const LinearAlgebraDistribution &dist) |
Private Member Functions | |
void | setup_doublevector_representation () |
compute the A-norm using the matrix at matrix_pt More... | |
Private Attributes | |
double ** | Values |
unsigned | Nvector |
The number of vectors. More... | |
bool | Internal_values |
bool | Built |
indicates that the vector has been built and is usable More... | |
Vector< DoubleVector > | Internal_doublevector |
Need a vector of DoubleVectors to interface with our linear solvers. More... | |
Additional Inherited Members | |
![]() | |
void | clear_distribution () |
A multi vector in the mathematical sense, initially developed for linear algebra type applications. If MPI then this multi 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*)
|
inline |
Constructor for an uninitialized DoubleMultiVector.
|
inline |
Constructor. Assembles a DoubleMultiVector consisting of n_vector vectors, each with a prescribed distribution. Additionally every entry can be set (with argument v - defaults to 0).
References build(), setup_doublevector_representation(), and v.
|
inline |
Constructor. Assembles a DoubleMultiVector consisting of n_vector vectors, each with a prescribed distribution. Additionally every entry can be set (with argument v - defaults to 0).
References build(), setup_doublevector_representation(), and v.
|
inline |
Constructor. Build a multivector using the same distribution of the input vector with n_vector columns and initialised to the value v
References build(), oomph::DistributableLinearAlgebraObject::distribution_pt(), and setup_doublevector_representation().
|
inline |
Constructor that builds a multivector from selected columns of the input multivector. The boolean controls whether it is a shallow or deep copy (default deep)
References build(), oomph::CRDoubleMatrixHelpers::deep_copy(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, oomph::DistributableLinearAlgebraObject::nrow_local(), setup_doublevector_representation(), shallow_build(), v, and values().
|
inline |
Copy constructor.
References build(), and setup_doublevector_representation().
|
inline |
Destructor - just calls this->clear() to delete the distribution and data
References clear().
|
inline |
Provides a (deep) copy of the old_vector.
References oomph::DistributableLinearAlgebraObject::distribution_built(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, Internal_values, oomph::DistributableLinearAlgebraObject::nrow_local(), nvector(), Nvector, v, and values().
Referenced by build(), DoubleMultiVector(), and operator=().
|
inline |
|
inline |
Assembles a DoubleMultiVector with n_vector vectors, each with a distribution dist, if v is specified each element is set to v, otherwise each element is set to 0.0
References oomph::DistributableLinearAlgebraObject::build_distribution(), Built, oomph::LinearAlgebraDistribution::built(), clear(), i, Internal_values, oomph::DistributableLinearAlgebraObject::nrow_local(), Nvector, v, and values().
|
inline |
References Built.
Referenced by dot(), norm(), operator+=(), operator-=(), and operator==().
|
inline |
wipes the DoubleVector
initialise the vector with coefficient from the vector v. Note: The vector v must be of length
References Built, oomph::DistributableLinearAlgebraObject::clear_distribution(), Internal_values, and Values.
Referenced by build(), shallow_build(), and ~DoubleMultiVector().
|
inline |
compute the 2 norm of this vector
References built(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, n, oomph::DistributableLinearAlgebraObject::nrow_local(), nvector(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, v, and values().
Referenced by Anasazi::MultiVecTraits< double, oomph::DoubleMultiVector >::MvDot().
|
inline |
access to the DoubleVector representatoin
References i, and Internal_doublevector.
|
inline |
access to the DoubleVector representation (const version)
References i, and Internal_doublevector.
|
inline |
initialise the whole vector with value v
References Built, i, oomph::DistributableLinearAlgebraObject::nrow_local(), Nvector, and v.
Referenced by Anasazi::MultiVecTraits< double, oomph::DoubleMultiVector >::MvInit().
|
inline |
compute the 2 norm of this vector
References built(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, n, oomph::DistributableLinearAlgebraObject::nrow_local(), nvector(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, sqrt(), and v.
Referenced by Anasazi::MultiVecTraits< double, oomph::DoubleMultiVector >::MvNorm().
|
inline |
Return the number of vectors.
References Nvector.
Referenced by build(), dot(), Anasazi::MultiVecTraits< double, oomph::DoubleMultiVector >::GetNumberVecs(), Anasazi::MultiVecTraits< double, oomph::DoubleMultiVector >::MvRandom(), Anasazi::MultiVecTraits< double, oomph::DoubleMultiVector >::MvScale(), Anasazi::MultiVecTraits< double, oomph::DoubleMultiVector >::MvTimesMatAddMv(), Anasazi::MultiVecTraits< double, oomph::DoubleMultiVector >::MvTransMv(), norm(), operator*=(), operator+=(), operator-=(), operator==(), output(), setup_doublevector_representation(), and shallow_build().
[] access function to the (local) values of the v-th vector
References calibrate::error, i, oomph::DistributableLinearAlgebraObject::nrow_local(), Nvector, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and v.
|
inline |
Multiply by a scalar.
References oomph::DistributableLinearAlgebraObject::distribution_built(), i, oomph::DistributableLinearAlgebraObject::nrow_local(), nvector(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and v.
|
inline |
|
inline |
|
inline |
assignment operator (deep copy)
References build(), and setup_doublevector_representation().
|
inline |
|
inline |
output the contents of the vector
References oomph::LinearAlgebraDistribution::communicator_pt(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::DistributableLinearAlgebraObject::first_row(), i, oomph::OomphCommunicator::nproc(), oomph::DistributableLinearAlgebraObject::nrow(), oomph::DistributableLinearAlgebraObject::nrow_local(), nvector(), p, v, and Values.
Referenced by Anasazi::MultiVecTraits< double, oomph::DoubleMultiVector >::MvPrint(), and output().
|
inline |
output the contents of the vector
References MergeRestartFiles::filename, and output().
void oomph::DoubleMultiVector::redistribute | ( | const LinearAlgebraDistribution *const & | dist_pt | ) |
Allows are external data to be used by this vector. WARNING: The size of the external data must correspond to the LinearAlgebraDistribution dist_pt argument.
The contents of the vector are redistributed to match the new distribution. In a non-MPI rebuild this method works, but does nothing. NOTE 1: The current distribution and the new distribution must have the same number of global rows. NOTE 2: The current distribution and the new distribution must have the same Communicator.
References oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::LinearAlgebraDistribution::communicator_pt(), oomph::LinearAlgebraDistribution::distributed(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearAlgebraDistribution::first_row(), oomph::DistributableLinearAlgebraObject::first_row(), i, Internal_values, j, k, max, min, oomph::OomphCommunicator::my_rank(), oomph::OomphCommunicator::nproc(), oomph::LinearAlgebraDistribution::nrow(), oomph::DistributableLinearAlgebraObject::nrow(), oomph::LinearAlgebraDistribution::nrow_local(), oomph::DistributableLinearAlgebraObject::nrow_local(), Nvector, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, p, setup_doublevector_representation(), v, values(), and Values.
|
inlineprivate |
compute the A-norm using the matrix at matrix_pt
Setup the doublevector representation
References oomph::DistributableLinearAlgebraObject::distribution_pt(), Internal_doublevector, nvector(), v, and values().
Referenced by DoubleMultiVector(), operator=(), and redistribute().
|
inline |
Provide a (shallow) copy of the old vector.
References oomph::DistributableLinearAlgebraObject::distribution_built(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Internal_values, nvector(), Nvector, v, and values().
Referenced by DoubleMultiVector(), and shallow_build().
|
inline |
Build the storage for pointers to vectors with a given distribution, but do not populate the pointers
References shallow_build().
|
inline |
Build the storage for pointers to vectors with a given distribution, but do not populate the pointers
References oomph::DistributableLinearAlgebraObject::build_distribution(), Built, oomph::LinearAlgebraDistribution::built(), clear(), Internal_values, and Nvector.
|
inline |
access function to the underlying values
References Values.
Referenced by build(), dot(), DoubleMultiVector(), operator+=(), operator-=(), operator==(), redistribute(), setup_doublevector_representation(), and shallow_build().
|
inline |
|
private |
indicates that the vector has been built and is usable
Referenced by build(), built(), clear(), initialise(), and shallow_build().
|
private |
Need a vector of DoubleVectors to interface with our linear solvers.
Referenced by doublevector(), and setup_doublevector_representation().
|
private |
Boolean flag to indicate whether the vector's data (values_pt) is owned by this vector.
Referenced by build(), clear(), redistribute(), and shallow_build().
|
private |
The number of vectors.
Referenced by build(), initialise(), nvector(), operator()(), redistribute(), and shallow_build().
|
private |
the local data, need a pointer to a pointer so that the individual vectors can be extracted
Referenced by clear(), output(), redistribute(), and values().