Public Member Functions | Private Attributes | List of all members
oomph::DoubleVectorWithHaloEntries Class Reference

#include <double_vector_with_halo.h>

+ Inheritance diagram for oomph::DoubleVectorWithHaloEntries:

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 ()
 
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)
 Broken copy constructor. More...
 
void operator= (const DistributableLinearAlgebraObject &)
 Broken assignment operator. More...
 
virtual ~DistributableLinearAlgebraObject ()
 Destructor. More...
 
LinearAlgebraDistributiondistribution_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)
 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

DoubleVectorHaloSchemeHalo_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...
 

Detailed Description

===================================================================== 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

haloed value.

Definition at line 147 of file double_vector_with_halo.h.

Constructor & Destructor Documentation

oomph::DoubleVectorWithHaloEntries::DoubleVectorWithHaloEntries ( )
inline

Constructor for an uninitialized DoubleVectorWithHaloEntries.

Definition at line 159 of file double_vector_with_halo.h.

oomph::DoubleVectorWithHaloEntries::DoubleVectorWithHaloEntries ( const LinearAlgebraDistribution *const &  dist_pt,
DoubleVectorHaloScheme *const &  halo_scheme_pt = 0,
const double &  v = 0.0 
)
inline

Constructor. Assembles a DoubleVectorWithHaloEntries with a prescribed distribution. Additionally every entry can be set (with argument v - defaults to 0).

Definition at line 165 of file double_vector_with_halo.h.

References build_halo_scheme(), and halo_scheme_pt().

oomph::DoubleVectorWithHaloEntries::DoubleVectorWithHaloEntries ( const LinearAlgebraDistribution dist,
DoubleVectorHaloScheme *const &  halo_scheme_pt = 0,
const double &  v = 0.0 
)
inline

Constructor. Assembles a DoubleVectorWithHaloEntries with a prescribed distribution. Additionally every entry can be set (with argument v - defaults to 0).

Definition at line 179 of file double_vector_with_halo.h.

References build_halo_scheme(), and halo_scheme_pt().

oomph::DoubleVectorWithHaloEntries::~DoubleVectorWithHaloEntries ( )
inline

Destructor.

Definition at line 190 of file double_vector_with_halo.h.

oomph::DoubleVectorWithHaloEntries::DoubleVectorWithHaloEntries ( const DoubleVectorWithHaloEntries new_vector)
inline

Copy constructor from any DoubleVector.

Definition at line 194 of file double_vector_with_halo.h.

References build_halo_scheme(), and halo_scheme_pt().

oomph::DoubleVectorWithHaloEntries::DoubleVectorWithHaloEntries ( const DoubleVector new_vector,
DoubleVectorHaloScheme *const &  halo_scheme_pt = 0 
)
inline

Copy constructor from any DoubleVector.

Definition at line 202 of file double_vector_with_halo.h.

References build_halo_scheme(), and halo_scheme_pt().

Member Function Documentation

void oomph::DoubleVectorWithHaloEntries::build_halo_scheme ( DoubleVectorHaloScheme *const &  halo_scheme_pt)
double& oomph::DoubleVectorWithHaloEntries::global_value ( const unsigned &  i)
inline
const double& oomph::DoubleVectorWithHaloEntries::global_value ( const unsigned &  i) const
inline
DoubleVectorHaloScheme* & oomph::DoubleVectorWithHaloEntries::halo_scheme_pt ( )
inline

Access function for halo scheme.

Definition at line 321 of file double_vector_with_halo.h.

References Halo_scheme_pt.

Referenced by build_halo_scheme(), DoubleVectorWithHaloEntries(), and operator=().

DoubleVectorHaloScheme* const& oomph::DoubleVectorWithHaloEntries::halo_scheme_pt ( ) const
inline

Access function for halo scheme (const version)

Definition at line 324 of file double_vector_with_halo.h.

References Halo_scheme_pt.

void oomph::DoubleVectorWithHaloEntries::operator= ( const DoubleVectorWithHaloEntries old_vector)
inline

assignment operator

Definition at line 211 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 297 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 ( )

Member Data Documentation

DoubleVectorHaloScheme* oomph::DoubleVectorWithHaloEntries::Halo_scheme_pt
private

Pointer to the lookup scheme that stores information about on which processor the required information is haloed.

Definition at line 151 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().

Vector<double> oomph::DoubleVectorWithHaloEntries::Halo_value
private

Vector of the halo values.

Definition at line 154 of file double_vector_with_halo.h.

Referenced by build_halo_scheme(), global_value(), sum_all_halo_and_haloed_values(), and synchronise().


The documentation for this class was generated from the following files: