69
69
//--- Implementation of the GenericTensor interface ---
71
71
/// Return copy of vector
72
virtual boost::shared_ptr<GenericVector> copy() const
72
virtual std::shared_ptr<GenericVector> copy() const
74
boost::shared_ptr<Vector> x(new Vector(*this));
74
std::shared_ptr<Vector> x(new Vector(*this));
83
83
virtual void apply(std::string mode)
84
84
{ vector->apply(mode); }
86
/// Return MPI communicator
87
virtual MPI_Comm mpi_comm() const
88
{ return vector->mpi_comm(); }
86
90
/// Return informal string representation (pretty-print)
87
91
virtual std::string str(bool verbose) const
88
92
{ return "<Vector wrapper of " + vector->str(verbose) + ">"; }
90
94
//--- Implementation of the GenericVector interface ---
92
/// Resize vector to size N
93
virtual void resize(std::size_t N)
94
{ vector->resize(N); }
96
/// Resize vector with given ownership range
97
virtual void resize(std::pair<std::size_t, std::size_t> range)
98
{ vector->resize(range); }
100
/// Resize vector with given ownership range and with ghost values
101
virtual void resize(std::pair<std::size_t, std::size_t> range,
102
const std::vector<la_index>& ghost_indices)
103
{ vector->resize(range, ghost_indices); }
96
/// Initialize vector to size N
97
virtual void init(MPI_Comm comm, std::size_t N)
98
{ vector->init(comm, N); }
100
/// Initlialize vector with given ownership range
101
virtual void init(MPI_Comm comm, std::pair<std::size_t, std::size_t> range)
102
{ vector->init(comm, range); }
104
/// Initialize vector with given ownership range and with ghost
106
virtual void init(MPI_Comm comm,
107
std::pair<std::size_t, std::size_t> range,
108
const std::vector<la_index>& ghost_indices)
109
{ vector->init(comm, range, ghost_indices); }
111
// Bring init function from GenericVector into scope
112
using GenericVector::init;
105
114
/// Return true if vector is empty
106
115
virtual bool empty() const
238
247
virtual double* data()
239
248
{ return vector->data(); }
241
/// Update ghost values
242
virtual void update_ghost_values()
244
vector->update_ghost_values();
246
250
//--- Special functions ---
248
252
/// Return linear algebra backend factory
259
263
virtual GenericVector* instance()
260
264
{ return vector.get(); }
262
virtual boost::shared_ptr<const LinearAlgebraObject> shared_instance() const
266
virtual std::shared_ptr<const LinearAlgebraObject> shared_instance() const
263
267
{ return vector; }
265
virtual boost::shared_ptr<LinearAlgebraObject> shared_instance()
269
virtual std::shared_ptr<LinearAlgebraObject> shared_instance()
266
270
{ return vector; }
268
272
//--- Special Vector functions ---