Advanced Multi-Physics (AMP)
On-Line Documentation
ManagedVectorData.h
Go to the documentation of this file.
1#ifndef included_AMP_ManagedVectorData
2#define included_AMP_ManagedVectorData
3
4#include "AMP/vectors/Vector.h"
5#include "AMP/vectors/data/DataChangeListener.h"
6#include "AMP/vectors/data/GhostDataHelper.hpp"
7#include "AMP/vectors/data/VectorData.h"
8
9#include <stdexcept>
10#include <vector>
11
12
13namespace AMP::LinearAlgebra {
14
15
25{
26
27public:
31 explicit ManagedVectorData( std::shared_ptr<Vector> vec );
32
36 explicit ManagedVectorData( std::shared_ptr<VectorData> alias );
37
40
44 std::shared_ptr<Vector> getVectorEngine();
45 std::shared_ptr<const Vector> getVectorEngine() const;
46
47 bool isAnAliasOf( const VectorData &rhs ) const override;
48
49 void receiveDataChanged() override { fireDataChange(); }
50
51protected:
53 std::shared_ptr<Vector> d_Engine;
54
55
56public: // Derived from VectorData
57 size_t numberOfDataBlocks() const override;
58 size_t sizeOfDataBlock( size_t ) const override;
59 void setValuesByLocalID( size_t, const size_t *, const void *, const typeID & ) override;
60 void addValuesByLocalID( size_t, const size_t *, const void *, const typeID & ) override;
61 void getValuesByLocalID( size_t, const size_t *, void *, const typeID & ) const override;
62 void setGhostValuesByGlobalID( size_t, const size_t *, const void *, const typeID & ) override;
63 void addGhostValuesByGlobalID( size_t, const size_t *, const void *, const typeID & ) override;
64 void getGhostValuesByGlobalID( size_t, const size_t *, void *, const typeID & ) const override;
65 size_t getAllGhostValues( void *, const typeID & ) const override;
66 void putRawData( const void *, const typeID & ) override;
67 void getRawData( void *, const typeID & ) const override;
69 void setUpdateStatus( UpdateState state ) override;
70 typeID getType( size_t ) const override;
71 uint64_t getDataID() const override
72 {
73 return reinterpret_cast<uint64_t>( getRawDataBlockAsVoid( 0 ) );
74 }
75 size_t sizeofDataBlockType( size_t ) const override { return sizeof( double ); }
76 std::string VectorDataName() const override;
77 void swapData( VectorData & ) override;
78 void assemble() override;
79 void dataChanged() override;
80
81 std::shared_ptr<VectorData> cloneData( const std::string &name = "" ) const override;
82 bool hasContiguousData() const override;
83 void makeConsistent( ScatterType t ) override;
85
86protected: // Derived from VectorData
87 void *getRawDataBlockAsVoid( size_t i ) override;
88 const void *getRawDataBlockAsVoid( size_t i ) const override;
89
90private:
92};
93
94
95} // namespace AMP::LinearAlgebra
96
97
98#endif
virtual void fireDataChange()
Notify all listeners of a data change event.
Interface for managing classes that need to know when managed data has changed.
Class used to control data and kernels of various vector libraries.
void addGhostValuesByGlobalID(size_t, const size_t *, const void *, const typeID &) override
Add shared values using global identifier.
virtual ~ManagedVectorData()
Destructor.
std::shared_ptr< const Vector > getVectorEngine() const
void * getRawDataBlockAsVoid(size_t i) override
Return a pointer to a particular block of memory in the vector.
void setValuesByLocalID(size_t, const size_t *, const void *, const typeID &) override
Set values in the vector by their local offset.
size_t getAllGhostValues(void *, const typeID &) const override
Get all ghost values in the vector.
const void * getRawDataBlockAsVoid(size_t i) const override
Return a pointer to a particular block of memory in the vector.
void addValuesByLocalID(size_t, const size_t *, const void *, const typeID &) override
Add values to vector entities by their local offset.
std::shared_ptr< Vector > d_Engine
The underlying vector.
void getRawData(void *, const typeID &) const override
Copy data out of this vector.
void setGhostValuesByGlobalID(size_t, const size_t *, const void *, const typeID &) override
Set ghost values using global identifier.
uint64_t getDataID() const override
A unique id for the underlying data allocation.
void assemble() override
This method is used to implement the assemble interface of PETSc.
typeID getType(size_t) const override
Return the typeid of the given block.
bool hasContiguousData() const override
returns whether all data for the vector on a single process is contiguous
size_t sizeofDataBlockType(size_t) const override
Return the result of sizeof(TYPE) for the given data block.
void setUpdateStatus(UpdateState state) override
Sets the current update state of the Vector.
size_t sizeOfDataBlock(size_t) const override
Number of elements in a data block.
UpdateState getLocalUpdateStatus() const override
Return the current update state of the Vector.
void putRawData(const void *, const typeID &) override
Copy data into this vector.
ManagedVectorData(std::shared_ptr< Vector > vec)
Construct a ManagedVector from a set of parameters.
void makeConsistent(ScatterType t) override
Update shared values on entire communicator.
std::string VectorDataName() const override
Get the type name.
void swapData(VectorData &) override
Swap the data with another VectorData object.
ManagedVectorData(std::shared_ptr< VectorData > alias)
Construct a view of an AMP vector.
size_t numberOfDataBlocks() const override
Number of blocks of contiguous data in the Vector.
std::shared_ptr< Vector > getVectorEngine()
Return the engine associated with this ManagedVector.
void getGhostValuesByGlobalID(size_t, const size_t *, void *, const typeID &) const override
Get ghost values in the vector by their global offset.
std::shared_ptr< VectorData > cloneData(const std::string &name="") const override
Clone the data.
bool isAnAliasOf(const VectorData &rhs) const override
Check if the two VectorData objects are alias of each other.
void getValuesByLocalID(size_t, const size_t *, void *, const typeID &) const override
Get local values in the vector by their global offset.
void dataChanged() override
Notify listeners that data has changed in this vector.
void receiveDataChanged() override
The method called when a data change event occurs.
A class used to hold vector data.
Definition VectorData.h:38
virtual void makeConsistent()
Update shared values on entire communicator.
UpdateState
The four states a Vector can be in.
Definition Variable.h:26
ScatterType
Flag to choose algorithm for makeConsistent.
Definition Variable.h:21
Class to store type info.
Definition typeid.h:210



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:41.
Comments on this page