Advanced Multi-Physics (AMP)
On-Line Documentation
VectorDataDefault.h
Go to the documentation of this file.
1#ifndef included_AMP_VectorDataDefault
2#define included_AMP_VectorDataDefault
3
4#include "AMP/utils/Memory.h"
5#include "AMP/utils/UtilityMacros.h"
6#include "AMP/vectors/data/GhostDataHelper.hpp"
7#include "AMP/vectors/data/VectorData.h"
8
9
10namespace AMP::LinearAlgebra {
11
12
13template<typename TYPE>
14class VectorDataIterator;
15
16
22template<typename TYPE = double, class Allocator = AMP::HostAllocator<void>>
23class VectorDataDefault : public GhostDataHelper<TYPE, Allocator>
24{
25public: // Member types
26 using value_type = TYPE;
28 typename std::allocator_traits<Allocator>::template rebind_alloc<TYPE>;
29
30public: // Constructors
31 VectorDataDefault( size_t start, size_t localSize, size_t globalSize );
32
34
35public: // Virtual functions
38
40 std::string VectorDataName() const override;
41
47 size_t numberOfDataBlocks() const override;
48
53 size_t sizeOfDataBlock( size_t i = 0 ) const override;
54
55
60 void putRawData( const void *buf, const typeID &id ) override;
61
67 void getRawData( void *buf, const typeID &id ) const override;
68
79 void setValuesByLocalID( size_t num,
80 const size_t *indices,
81 const void *vals,
82 const typeID &id ) override;
83
95 void addValuesByLocalID( size_t num,
96 const size_t *indices,
97 const void *vals,
98 const typeID &id ) override;
99
111 void getValuesByLocalID( size_t num,
112 const size_t *indices,
113 void *vals,
114 const typeID &id ) const override;
115
116
117public: // Advanced virtual functions
125 uint64_t getDataID() const override;
126
130 void *getRawDataBlockAsVoid( size_t i ) override;
131
136 const void *getRawDataBlockAsVoid( size_t i ) const override;
137
141 size_t sizeofDataBlockType( size_t i ) const override;
142
146 typeID getType( size_t block ) const override;
147
151 void swapData( VectorData &rhs ) override;
152
155 std::shared_ptr<VectorData> cloneData( const std::string &name = "" ) const override;
156
160
161public: // Non-virtual functions
165 TYPE &operator[]( size_t i );
166
170 const TYPE &operator[]( size_t i ) const;
171
172
173public: // Write/read restart data
174 void registerChildObjects( AMP::IO::RestartManager *manager ) const override;
175 void writeRestart( int64_t ) const override;
177
178protected:
179 TYPE *d_data = nullptr;
180};
181
182
183} // namespace AMP::LinearAlgebra
184
185
186#endif
Class to manage reading/writing restart data.
A class used to hold vector data.
virtual ~VectorDataDefault()
Virtual destructor.
size_t sizeofDataBlockType(size_t i) const override
Return the result of sizeof(TYPE) for the given data block.
void swapData(VectorData &rhs) override
Swap the data with another VectorData object.
void putRawData(const void *buf, const typeID &id) override
Copy data into this vector.
const TYPE & operator[](size_t i) const
Access the raw element.
VectorDataDefault(int64_t, AMP::IO::RestartManager *)
AMP::Utilities::MemoryType getMemoryLocation() const override
returns the memory location for data
typeID getType(size_t block) const override
Return the typeid of the given block.
void writeRestart(int64_t) const override
Write restart data to file.
std::string VectorDataName() const override
Get the type name.
void setValuesByLocalID(size_t num, const size_t *indices, const void *vals, const typeID &id) override
Set values in the vector by their local offset.
uint64_t getDataID() const override
A unique id for the underlying data allocation.
void registerChildObjects(AMP::IO::RestartManager *manager) const override
Register any child objects.
std::shared_ptr< VectorData > cloneData(const std::string &name="") const override
Clone the data.
const void * getRawDataBlockAsVoid(size_t i) const override
Return a pointer to a particular block of memory in the vector.
TYPE & operator[](size_t i)
Access the raw element.
void * getRawDataBlockAsVoid(size_t i) override
Return a pointer to a particular block of memory in the vector.
VectorDataDefault(size_t start, size_t localSize, size_t globalSize)
VectorDataDefault(const VectorDataDefault &)=delete
typename std::allocator_traits< Allocator >::template rebind_alloc< TYPE > scalarAllocator_t
void getRawData(void *buf, const typeID &id) const override
Copy data out of this vector.
size_t numberOfDataBlocks() const override
Number of blocks of contiguous data in the Vector.
void getValuesByLocalID(size_t num, const size_t *indices, void *vals, const typeID &id) const override
Get values to vector entities by their local offset.
void addValuesByLocalID(size_t num, const size_t *indices, const void *vals, const typeID &id) override
Add values to vector entities by their local offset.
size_t sizeOfDataBlock(size_t i=0) const override
Number of elements in a data block.
A class used to hold vector data.
Definition VectorData.h:38
MemoryType
Enum to store pointer type.
Definition Memory.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