26 #ifndef OOMPH_DOUBLE_VECTOR_WITH_HALO_CLASS_HEADER
27 #define OOMPH_DOUBLE_VECTOR_WITH_HALO_CLASS_HEADER
31 #include <oomph-lib-config.h>
39 class DoubleVectorWithHaloEntries;
121 std::map<unsigned, unsigned>::iterator it =
Local_index.find(global_eqn);
130 std::ostringstream error_stream;
131 error_stream <<
"Global equation " << global_eqn <<
" "
132 <<
"has not been set as halo\n";
134 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
169 const double& v = 0.0)
183 const double& v = 0.0)
215 this->
build(old_vector);
228 const unsigned first_row_local = this->
first_row();
229 const unsigned n_row_local = this->
nrow_local();
232 if ((i >= first_row_local) && (
i < first_row_local + n_row_local))
234 return (*
this)[
i - first_row_local];
243 std::ostringstream error_stream;
245 <<
"Halo data requested, but no halo scheme has been setup\n"
246 <<
"You should call this->build_halo_scheme(halo_scheme_pt).\n"
247 <<
"You may wish to setup the scheme for the Problem using \n"
248 <<
"Problem::setup_dof_halo_scheme()\n";
251 OOMPH_CURRENT_FUNCTION,
252 OOMPH_EXCEPTION_LOCATION);
275 const unsigned first_row_local = this->
first_row();
276 const unsigned n_row_local = this->
nrow_local();
279 if ((i >= first_row_local) && (
i < first_row_local + n_row_local))
281 return (*
this)[
i - first_row_local];
290 std::ostringstream error_stream;
292 <<
"Halo data requested, but no halo scheme has been setup\n"
293 <<
"You should call this->build_halo_scheme(halo_scheme_pt).\n"
294 <<
"You may wish to setup the scheme for the Problem using \n"
295 <<
"Problem::setup_dof_halo_scheme()\n";
298 OOMPH_CURRENT_FUNCTION,
299 OOMPH_EXCEPTION_LOCATION);
bool distributed() const
distribution is serial or distributed
unsigned nrow_local() const
access function for the num of local rows on this processor.
unsigned first_row() const
access function for the first row on this processor
A class that stores the halo/haloed entries required when using a DoubleVectorWithHaloEntries....
Vector< int > Haloed_n
Storage for the number of haloed entries to be sent to each processor.
LinearAlgebraDistribution *& distribution_pt()
Return the pointer to the distirbution used to setup the halo information.
Vector< int > Halo_displacement
Storage for the offsets of the processor data in the receive buffer.
Vector< int > Halo_n
Storage for the number of entries to be received from each other processor.
unsigned n_halo_values() const
Return the number of halo values.
LinearAlgebraDistribution * Distribution_pt
Store the distribution that was used to setup the halo scheme.
std::map< unsigned, unsigned > Local_index
Storage for the translation scheme from global unknown to local index in the additional storage vecto...
Vector< int > Haloed_displacement
Storage for the offsets of the haloed entries for each processor in the packed Haloed_eqns array.
void setup_halo_dofs(const std::map< unsigned, double * > &halo_data_pt, Vector< double * > &halo_dof_pt)
Function that sets up a vector of pointers to halo data, index using the scheme in Local_index.
Vector< unsigned > Haloed_eqns
The haloed entries that will be sent in a format compatible with MPI_Alltoallv i.e....
DoubleVectorHaloScheme(LinearAlgebraDistribution *const &dist_pt, const Vector< unsigned > &required_global_eqn)
Constructor that sets up the required information communicating between all processors....
unsigned local_index(const unsigned &global_eqn)
Return the local index associated with the global equation.
Vector< unsigned > Halo_eqns
Storage for all the entries that are to be received from other processors (received_from_proc0,...
===================================================================== An extension of DoubleVector th...
DoubleVectorWithHaloEntries()
Constructor for an uninitialized DoubleVectorWithHaloEntries.
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....
void build_halo_scheme(DoubleVectorHaloScheme *const &halo_scheme_pt)
Construct the halo scheme and storage for the halo data.
DoubleVectorWithHaloEntries(const LinearAlgebraDistribution &dist, DoubleVectorHaloScheme *const &halo_scheme_pt=0, const double &v=0.0)
Constructor. Assembles a DoubleVectorWithHaloEntries with a prescribed distribution....
DoubleVectorWithHaloEntries(const DoubleVector &new_vector, DoubleVectorHaloScheme *const &halo_scheme_pt=0)
Copy constructor from any DoubleVector.
DoubleVectorHaloScheme *const & halo_scheme_pt() const
Access function for halo scheme (const version)
DoubleVectorHaloScheme * Halo_scheme_pt
Pointer to the lookup scheme that stores information about on which processor the required informatio...
const double & global_value(const unsigned &i) const
Direct access to the global entry (const version)
void synchronise()
Synchronise the halo data.
void sum_all_halo_and_haloed_values()
Sum all the data, store in the master (haloed) data and then synchronise.
DoubleVectorHaloScheme *& halo_scheme_pt()
Access function for halo scheme.
double & global_value(const unsigned &i)
Direct access to global entry.
DoubleVectorWithHaloEntries(const DoubleVectorWithHaloEntries &new_vector)
Copy constructor from any DoubleVector.
void operator=(const DoubleVectorWithHaloEntries &old_vector)
assignment operator
Vector< double > Halo_value
Vector of the halo values.
~DoubleVectorWithHaloEntries()
Destructor.
A vector in the mathematical sense, initially developed for linear algebra type applications....
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
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....
//////////////////////////////////////////////////////////////////// ////////////////////////////////...