===================================================================== An extension of DoubleVector that allows access to certain global entries that are not stored locally. Synchronisation of these values must be performed manually by calling the synchronise() function. Synchronisation can only be from the haloed to the halo, but the local halo entries can all be summed and stored in the More...
#include <double_vector_with_halo.h>
Public Member Functions | |
DoubleVectorWithHaloEntries () | |
Constructor for an uninitialized DoubleVectorWithHaloEntries. More... | |
DoubleVectorWithHaloEntries (const LinearAlgebraDistribution *const &dist_pt, DoubleVectorHaloScheme *const &halo_scheme_pt=0, const double &v=0.0) | |
Constructor. Assembles a DoubleVectorWithHaloEntries with a prescribed distribution. Additionally every entry can be set (with argument v - defaults to 0). More... | |
DoubleVectorWithHaloEntries (const LinearAlgebraDistribution &dist, DoubleVectorHaloScheme *const &halo_scheme_pt=0, const double &v=0.0) | |
Constructor. Assembles a DoubleVectorWithHaloEntries with a prescribed distribution. Additionally every entry can be set (with argument v - defaults to 0). More... | |
~DoubleVectorWithHaloEntries () | |
Destructor. More... | |
DoubleVectorWithHaloEntries (const DoubleVectorWithHaloEntries &new_vector) | |
Copy constructor from any DoubleVector. More... | |
DoubleVectorWithHaloEntries (const DoubleVector &new_vector, DoubleVectorHaloScheme *const &halo_scheme_pt=0) | |
Copy constructor from any DoubleVector. More... | |
void | operator= (const DoubleVectorWithHaloEntries &old_vector) |
assignment operator More... | |
double & | global_value (const unsigned &i) |
Direct access to global entry. More... | |
const double & | global_value (const unsigned &i) const |
Direct access to the global entry (const version) More... | |
void | synchronise () |
Synchronise the halo data. More... | |
void | sum_all_halo_and_haloed_values () |
Sum all the data, store in the master (haloed) data and then synchronise. More... | |
DoubleVectorHaloScheme *& | halo_scheme_pt () |
Access function for halo scheme. More... | |
DoubleVectorHaloScheme *const & | halo_scheme_pt () const |
Access function for halo scheme (const version) More... | |
void | build_halo_scheme (DoubleVectorHaloScheme *const &halo_scheme_pt) |
Construct the halo scheme and storage for the halo data. More... | |
Public Member Functions inherited from oomph::DoubleVector | |
DoubleVector () | |
Constructor for an uninitialized DoubleVector. More... | |
DoubleVector (const LinearAlgebraDistribution *const &dist_pt, const double &v=0.0) | |
Constructor. Assembles a DoubleVector with a prescribed distribution. Additionally every entry can be set (with argument v - defaults to 0). More... | |
DoubleVector (const LinearAlgebraDistribution &dist, const double &v=0.0) | |
Constructor. Assembles a DoubleVector with a prescribed distribution. Additionally every entry can be set (with argument v - defaults to 0). More... | |
~DoubleVector () | |
Destructor - just calls this->clear() to delete the distribution and data. More... | |
DoubleVector (const DoubleVector &new_vector) | |
Copy constructor. More... | |
void | operator= (const DoubleVector &old_vector) |
assignment operator More... | |
void | build (const DoubleVector &old_vector) |
Just copys the argument DoubleVector. More... | |
void | build (const LinearAlgebraDistribution &dist, const double &v) |
Assembles a DoubleVector with distribution dist, if v is specified each element is set to v, otherwise each element is set to 0.0. More... | |
void | build (const LinearAlgebraDistribution *const &dist_pt, const double &v) |
Assembles a DoubleVector with distribution dist, if v is specified each element is set to v, otherwise each element is set to 0.0. More... | |
void | build (const LinearAlgebraDistribution &dist, const Vector< double > &v) |
Assembles a DoubleVector with a distribution dist and coefficients taken from the vector v. Note. The vector v MUST be of length nrow() More... | |
void | build (const LinearAlgebraDistribution *const &dist_pt, const Vector< double > &v) |
Assembles a DoubleVector with a distribution dist and coefficients taken from the vector v. Note. The vector v MUST be of length nrow() More... | |
void | initialise (const double &v) |
initialise the whole vector with value v More... | |
void | initialise (const Vector< double > v) |
initialise the vector with coefficient from the vector v. Note: The vector v must be of length More... | |
void | clear () |
wipes the DoubleVector More... | |
bool | built () const |
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 correspond to the LinearAlgebraDistribution dist_pt argument. More... | |
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 correspond to the distribution of this vector. More... | |
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 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. More... | |
double & | operator[] (int i) |
[] access function to the (local) values of this vector More... | |
bool | operator== (const DoubleVector &v) |
== operator More... | |
void | operator+= (const DoubleVector &v) |
+= operator with another vector More... | |
void | operator-= (const DoubleVector &v) |
-= operator with another vector More... | |
void | operator*= (const double &d) |
multiply by a double More... | |
void | operator/= (const double &d) |
divide by a double More... | |
const double & | operator[] (int i) const |
[] access function to the (local) values of this vector More... | |
double | max () const |
returns the maximum coefficient More... | |
double * | values_pt () |
access function to the underlying values More... | |
double * | values_pt () const |
access function to the underlying values (const version) More... | |
void | output (std::ostream &outfile, const int &output_precision=-1) const |
output the global contents of the vector More... | |
void | output (std::string filename, const int &output_precision=-1) const |
output the global contents of the vector More... | |
void | output_local_values (std::ostream &outfile, const int &output_precision=-1) const |
output the local contents of the vector More... | |
void | output_local_values (std::string filename, const int &output_precision=-1) const |
output the local contents of the vector More... | |
void | output_local_values_with_offset (std::ostream &outfile, const int &output_precision=-1) const |
output the local contents of the vector More... | |
void | output_local_values_with_offset (std::string filename, const int &output_precision=-1) const |
output the local contents of the vector More... | |
double | dot (const DoubleVector &vec) const |
compute the dot product of this vector with the vector vec. More... | |
double | norm () const |
compute the 2 norm of this vector More... | |
double | norm (const CRDoubleMatrix *matrix_pt) const |
compute the A-norm using the matrix at matrix_pt More... | |
Public Member Functions inherited from oomph::DistributableLinearAlgebraObject | |
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 |
if the communicator_pt is null then the distribution is not setup then false is returned, otherwise return true More... | |
void | build_distribution (const LinearAlgebraDistribution *const dist_pt) |
setup the distribution of this distributable linear algebra object More... | |
void | build_distribution (const LinearAlgebraDistribution &dist) |
setup the distribution of this distributable linear algebra object More... | |
Private Attributes | |
DoubleVectorHaloScheme * | Halo_scheme_pt |
Pointer to the lookup scheme that stores information about on which processor the required information is haloed. More... | |
Vector< double > | Halo_value |
Vector of the halo values. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject | |
void | clear_distribution () |
clear the distribution of this distributable linear algebra object More... | |
===================================================================== An extension of DoubleVector that allows access to certain global entries that are not stored locally. Synchronisation of these values must be performed manually by calling the synchronise() function. Synchronisation can only be from the haloed to the halo, but the local halo entries can all be summed and stored in the
Definition at line 149 of file double_vector_with_halo.h.
|
inline |
Constructor for an uninitialized DoubleVectorWithHaloEntries.
Definition at line 160 of file double_vector_with_halo.h.
|
inline |
Constructor. Assembles a DoubleVectorWithHaloEntries with a prescribed distribution. Additionally every entry can be set (with argument v - defaults to 0).
Definition at line 166 of file double_vector_with_halo.h.
References build_halo_scheme(), and halo_scheme_pt().
|
inline |
Constructor. Assembles a DoubleVectorWithHaloEntries with a prescribed distribution. Additionally every entry can be set (with argument v - defaults to 0).
Definition at line 180 of file double_vector_with_halo.h.
References build_halo_scheme(), and halo_scheme_pt().
|
inline |
Destructor.
Definition at line 191 of file double_vector_with_halo.h.
|
inline |
Copy constructor from any DoubleVector.
Definition at line 195 of file double_vector_with_halo.h.
References build_halo_scheme(), and halo_scheme_pt().
|
inline |
Copy constructor from any DoubleVector.
Definition at line 203 of file double_vector_with_halo.h.
References build_halo_scheme(), and halo_scheme_pt().
void oomph::DoubleVectorWithHaloEntries::build_halo_scheme | ( | DoubleVectorHaloScheme *const & | halo_scheme_pt | ) |
Construct the halo scheme and storage for the halo data.
Definition at line 379 of file double_vector_with_halo.cc.
References Halo_scheme_pt, halo_scheme_pt(), Halo_value, oomph::DoubleVectorHaloScheme::Local_index, and synchronise().
Referenced by DoubleVectorWithHaloEntries(), operator=(), oomph::PitchForkHandler::PitchForkHandler(), and oomph::Problem::setup_element_count_per_dof().
|
inline |
Direct access to global entry.
Definition at line 221 of file double_vector_with_halo.h.
References oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::first_row(), Halo_scheme_pt, Halo_value, i, oomph::DoubleVectorHaloScheme::local_index(), and oomph::DistributableLinearAlgebraObject::nrow_local().
Referenced by oomph::PitchForkHandler::get_dresiduals_dparameter(), oomph::Problem::get_hessian_vector_products(), oomph::PitchForkHandler::get_jacobian(), oomph::PitchForkHandler::get_residuals(), oomph::PitchForkHandler::PitchForkHandler(), and oomph::Problem::setup_element_count_per_dof().
|
inline |
Direct access to the global entry (const version)
Definition at line 268 of file double_vector_with_halo.h.
References oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::first_row(), Halo_scheme_pt, Halo_value, i, oomph::DoubleVectorHaloScheme::local_index(), and oomph::DistributableLinearAlgebraObject::nrow_local().
|
inline |
Access function for halo scheme.
Definition at line 323 of file double_vector_with_halo.h.
References Halo_scheme_pt.
Referenced by build_halo_scheme(), DoubleVectorWithHaloEntries(), and operator=().
|
inline |
Access function for halo scheme (const version)
Definition at line 329 of file double_vector_with_halo.h.
References Halo_scheme_pt.
|
inline |
assignment operator
Definition at line 213 of file double_vector_with_halo.h.
References oomph::DoubleVector::build(), build_halo_scheme(), and halo_scheme_pt().
void oomph::DoubleVectorWithHaloEntries::sum_all_halo_and_haloed_values | ( | ) |
Sum all the data, store in the master (haloed) data and then synchronise.
Gather all ther data from multiple processors and sum the result which will be stored in the master copy and then synchronised to all copies. This requires two "all to all" communications.
Definition at line 323 of file double_vector_with_halo.cc.
References oomph::DistributableLinearAlgebraObject::distributed(), oomph::DoubleVectorHaloScheme::Halo_displacement, oomph::DoubleVectorHaloScheme::Halo_eqns, oomph::DoubleVectorHaloScheme::Halo_n, Halo_scheme_pt, Halo_value, oomph::DoubleVectorHaloScheme::Haloed_displacement, oomph::DoubleVectorHaloScheme::Haloed_eqns, oomph::DoubleVectorHaloScheme::Haloed_n, i, and synchronise().
Referenced by oomph::PitchForkHandler::PitchForkHandler(), and oomph::Problem::setup_element_count_per_dof().
void oomph::DoubleVectorWithHaloEntries::synchronise | ( | ) |
Synchronise the halo data.
Synchronise the halo data within the vector. This requires one "all to all" communnication.
Definition at line 269 of file double_vector_with_halo.cc.
References oomph::DistributableLinearAlgebraObject::distributed(), oomph::DoubleVectorHaloScheme::Halo_displacement, oomph::DoubleVectorHaloScheme::Halo_eqns, oomph::DoubleVectorHaloScheme::Halo_n, Halo_scheme_pt, Halo_value, oomph::DoubleVectorHaloScheme::Haloed_displacement, oomph::DoubleVectorHaloScheme::Haloed_eqns, oomph::DoubleVectorHaloScheme::Haloed_n, and i.
Referenced by build_halo_scheme(), sum_all_halo_and_haloed_values(), and oomph::PitchForkHandler::synchronise().
|
private |
Pointer to the lookup scheme that stores information about on which processor the required information is haloed.
Definition at line 153 of file double_vector_with_halo.h.
Referenced by build_halo_scheme(), global_value(), halo_scheme_pt(), sum_all_halo_and_haloed_values(), and synchronise().
|
private |
Vector of the halo values.
Definition at line 156 of file double_vector_with_halo.h.
Referenced by build_halo_scheme(), global_value(), sum_all_halo_and_haloed_values(), and synchronise().