30 #ifndef OOMPH_DOUBLE_VECTOR_WITH_HALO_CLASS_HEADER 31 #define OOMPH_DOUBLE_VECTOR_WITH_HALO_CLASS_HEADER 35 #include <oomph-lib-config.h> 43 class DoubleVectorWithHaloEntries;
120 std::map<unsigned,unsigned>::iterator it = Local_index.find(global_eqn);
122 if(it!=Local_index.end()) {
return it->second;}
126 std::ostringstream error_stream;
127 error_stream <<
"Global equation " << global_eqn <<
" " 128 <<
"has not been set as halo\n";
130 OOMPH_CURRENT_FUNCTION,
131 OOMPH_EXCEPTION_LOCATION);
168 const double& v=0.0) :
172 this->build_halo_scheme(halo_scheme_pt);
186 this->build_halo_scheme(halo_scheme_pt);
207 this->build_halo_scheme(halo_scheme_pt);
213 this->build(old_vector);
224 if(this->distributed())
226 const unsigned first_row_local = this->first_row();
227 const unsigned n_row_local = this->nrow_local();
230 if((i >= first_row_local) && (i < first_row_local + n_row_local))
232 return (*
this)[i-first_row_local];
239 if(Halo_scheme_pt==0)
241 std::ostringstream error_stream;
243 "Halo data requested, but no halo scheme has been setup\n" <<
244 "You should call this->build_halo_scheme(halo_scheme_pt).\n" <<
245 "You may wish to setup the scheme for the Problem using \n" <<
246 "Problem::setup_dof_halo_scheme()\n";
249 OOMPH_CURRENT_FUNCTION,
250 OOMPH_EXCEPTION_LOCATION);
271 if(this->distributed())
273 const unsigned first_row_local = this->first_row();
274 const unsigned n_row_local = this->nrow_local();
277 if((i >= first_row_local) && (i < first_row_local + n_row_local))
279 return (*
this)[i-first_row_local];
286 if(Halo_scheme_pt==0)
288 std::ostringstream error_stream;
290 "Halo data requested, but no halo scheme has been setup\n" <<
291 "You should call this->build_halo_scheme(halo_scheme_pt).\n" <<
292 "You may wish to setup the scheme for the Problem using \n" <<
293 "Problem::setup_dof_halo_scheme()\n";
296 OOMPH_CURRENT_FUNCTION,
297 OOMPH_EXCEPTION_LOCATION);
318 void sum_all_halo_and_haloed_values();
DoubleVectorWithHaloEntries(const DoubleVectorWithHaloEntries &new_vector)
Copy constructor from any DoubleVector.
~DoubleVectorWithHaloEntries()
Destructor.
Vector< int > Halo_n
Storage for the number of entries to be received from each other processor.
double & global_value(const unsigned &i)
Direct access to global entry.
DoubleVectorHaloScheme * Halo_scheme_pt
Pointer to the lookup scheme that stores information about on which processor the required informatio...
void operator=(const DoubleVectorWithHaloEntries &old_vector)
assignment operator
DoubleVectorHaloScheme *const & halo_scheme_pt() const
Access function for halo scheme (const version)
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).
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).
LinearAlgebraDistribution * Distribution_pt
Store the distribution that was used to setup the halo scheme.
Vector< int > Halo_displacement
Storage for the offsets of the processor data in the receive buffer.
DoubleVectorWithHaloEntries(const DoubleVector &new_vector, DoubleVectorHaloScheme *const &halo_scheme_pt=0)
Copy constructor from any DoubleVector.
Vector< unsigned > Halo_eqns
Storage for all the entries that are to be received from other processors (received_from_proc0,received_from_proc1,...received_from_procn)
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
DoubleVectorHaloScheme *& halo_scheme_pt()
Access function for halo scheme.
Vector< double > Halo_value
Vector of the halo values.
const double & global_value(const unsigned &i) const
Direct access to the global entry (const version)
Vector< int > Haloed_displacement
Storage for the offsets of the haloed entries for each processor in the packed Haloed_eqns array...
unsigned local_index(const unsigned &global_eqn)
Return the local index associated with the global equation.
unsigned n_halo_values() const
Return the number of halo values.
Vector< unsigned > Haloed_eqns
The haloed entries that will be sent in a format compatible with MPI_Alltoallv i.e. (send_to_proc0,send_to_proc1 ... send_to_procn)
Vector< int > Haloed_n
Storage for the number of haloed entries to be sent to each processor.
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...
std::map< unsigned, unsigned > Local_index
Storage for the translation scheme from global unknown to local index in the additional storage vecto...
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*)
DoubleVectorWithHaloEntries()
Constructor for an uninitialized DoubleVectorWithHaloEntries.
LinearAlgebraDistribution *& distribution_pt()
Return the pointer to the distirbution used to setup the halo information.
DoubleVectorHaloScheme(LinearAlgebraDistribution *const &dist_pt, const Vector< unsigned > &required_global_eqn)
Constructor that sets up the required information communicating between all processors. Requires two "all to all" communications. Arguments are the distribution of the DoubleVector and a Vector of global unknowns required on this processor.