1#ifndef included_AMP_MultiVector
2#define included_AMP_MultiVector
5#include "AMP/vectors/Vector.h"
23 static std::shared_ptr<MultiVector>
create( std::shared_ptr<Variable> name,
30 static std::shared_ptr<MultiVector>
create(
const std::string &name,
const AMP_MPI &comm );
37 static std::shared_ptr<MultiVector>
create( std::shared_ptr<Variable> name,
39 const std::vector<Vector::shared_ptr> &
vecs );
46 static std::shared_ptr<MultiVector>
create(
const std::string &name,
48 const std::vector<Vector::shared_ptr> &
vecs );
55 static std::shared_ptr<const MultiVector>
58 const std::vector<Vector::const_shared_ptr> &
vecs );
65 static std::shared_ptr<const MultiVector>
68 const std::vector<Vector::const_shared_ptr> &
vecs );
108 std::vector<std::shared_ptr<const Vector>>
getVecs()
const;
138 virtual void addVector( std::vector<Vector::shared_ptr> vec );
162 std::string
type()
const override;
208 const std::vector<Vector::shared_ptr> &
vecs );
Provides C++ wrapper around MPI routines.
Class to manage reading/writing restart data.
A collection of AMP Vectors that appear as one vector.
void swapVectors(Vector &other) override
Swap the data in this Vector for another.
virtual Vector::shared_ptr getVector(size_t i)
Return the i-th Vector in this MultiVector.
const std::vector< std::shared_ptr< Vector > > & getVecs()
Return one past the last vector in the MultiVector.
MultiVector(const std::string &name, const AMP_MPI &comm, const std::vector< Vector::shared_ptr > &vecs)
virtual void addVector(Vector::shared_ptr vec)
Add a vector to a MultiVector. Note: this is a collective operation, vec may be NULL on some processo...
void resetVectorOperations()
const Vector::shared_ptr & getVector(const Vector &vec, size_t which) const
A convenience method for extracting vectors from a base class.
static std::shared_ptr< const MultiVector > const_create(const std::string &name, const AMP_MPI &comm, const std::vector< Vector::const_shared_ptr > &vecs)
Create a new multivector in parallel.
std::unique_ptr< Vector > rawClone() const override
Allocate space in the same fashion as this
std::vector< Vector::shared_ptr > d_vVectors
The list of AMP Vectors that comprise this Vector.
Vector::shared_ptr selectInto(const VectorSelector &) override
Selects a portion of this vector and puts a view into a vector.
void addVectorHelper(Vector::shared_ptr vec)
auto begin()
Return the first vector in the MultiVector.
MultiVector(const std::string &name, const AMP_MPI &comm)
MultiVector & operator=(MultiVector &&)=delete
bool containsPointer(const Vector::shared_ptr p) const
Determine if a Vector is a constituent.
static std::shared_ptr< MultiVector > create(std::shared_ptr< Variable > name, const AMP_MPI &comm, const std::vector< Vector::shared_ptr > &vecs)
Create a new multivector in parallel.
std::vector< std::shared_ptr< const Vector > > getVecs() const
Return one past the last vector in the MultiVector.
static std::shared_ptr< const MultiVector > constView(Vector::const_shared_ptr vec, const AMP_MPI &comm=AMP_COMM_NULL)
Create a multivector view of a vector.
void writeRestart(int64_t fid) const override
Write restart data to file.
size_t getNumberOfSubvectors() const
Obtain the number of Vector objects in this MultiVector.
MultiVector(const MultiVector &)=delete
static std::shared_ptr< MultiVector > create(const std::string &name, const AMP_MPI &comm)
Create a new (empty) multivector.
MultiVector(int64_t fid, AMP::IO::RestartManager *manager)
Read restart data to file.
static std::shared_ptr< MultiVector > view(Vector::shared_ptr vec, const AMP_MPI &comm=AMP_COMM_NULL)
Create a multivector view of a vector.
MultiVector & operator=(const MultiVector &)=delete
Vector::shared_ptr & getVector(Vector &vec, size_t which) const
A convenience method for extracting vectors from a base class.
virtual void replaceSubVector(Vector::shared_ptr oldVec, Vector::shared_ptr newVec)
Replace a vector in a MultiVector.
auto end() const
Return one past the last vector in the MultiVector.
static std::shared_ptr< const MultiVector > const_create(std::shared_ptr< Variable > name, const AMP_MPI &comm, const std::vector< Vector::const_shared_ptr > &vecs)
Create a new multivector in parallel.
MultiVector(MultiVector &&)=delete
virtual Vector::const_shared_ptr getVector(size_t i) const
Return the i-th Vector in this MultiVector.
static std::shared_ptr< MultiVector > create(const std::string &name, const AMP_MPI &comm, const std::vector< Vector::shared_ptr > &vecs)
Create a new multivector in parallel.
auto begin() const
Return the first vector in the MultiVector.
Vector::const_shared_ptr selectInto(const VectorSelector &criterion) const override
MultiVector(std::shared_ptr< Vector > vec)
auto end()
Return one past the last vector in the MultiVector.
void registerChildObjects(AMP::IO::RestartManager *manager) const override
Register any child objects.
virtual void addVector(std::vector< Vector::shared_ptr > vec)
Add vector(s) to a MultiVector. Note: This is a collective operation, vec may be different sizes on d...
virtual void eraseVector(Vector::shared_ptr vec)
Remove a vector from a MultiVector.
static std::shared_ptr< MultiVector > create(std::shared_ptr< Variable > name, const AMP_MPI &comm)
Create a new (empty) multivector.
void reset() override
Reset.
std::string type() const override
Return the name of the vector.
A class used by Vector::select and Vector::selectInto to create vectors with particular data.
Abstraction of a discrete Vector in a linear simulation.
std::shared_ptr< Vector > shared_ptr
Shorthand for shared pointer to Vector.
std::shared_ptr< const Vector > const_shared_ptr