Advanced Multi-Physics (AMP)
On-Line Documentation
VectorDataDevice.h
Go to the documentation of this file.
1#ifndef included_AMP_VectorDataDevice
2#define included_AMP_VectorDataDevice
3
4#include "AMP/vectors/data/VectorDataDefault.h"
5
6
7namespace AMP::LinearAlgebra {
8
9
15template<typename TYPE = double, class Allocator = AMP::HostAllocator<void>>
16class VectorDataDevice final : public VectorDataDefault<TYPE, Allocator>
17{
18public: // Member types
19 using value_type = TYPE;
21 typename std::allocator_traits<Allocator>::template rebind_alloc<TYPE>;
22 using idxAllocator_t = typename std::allocator_traits<Allocator>::template rebind_alloc<size_t>;
23
24public: // Constructors
25 VectorDataDevice( size_t start, size_t localSize, size_t globalSize );
26
28
29public: // Virtual functions
32
34 std::string VectorDataName() const override;
35
40 void putRawData( const void *buf, const typeID &id ) override;
41
47 void getRawData( void *buf, const typeID &id ) const override;
48
59 void setValuesByLocalID( size_t num,
60 const size_t *indices,
61 const void *vals,
62 const typeID &id ) override;
63
75 void addValuesByLocalID( size_t num,
76 const size_t *indices,
77 const void *vals,
78 const typeID &id ) override;
79
91 void getValuesByLocalID( size_t num,
92 const size_t *indices,
93 void *vals,
94 const typeID &id ) const override;
95
98 std::shared_ptr<VectorData> cloneData( const std::string &name = "" ) const override;
99
100public: // Functions overloaded from GhostDataHelpers and in turn VectorData
101 void fillGhosts( const Scalar & ) override;
102 bool allGhostIndices( size_t N, const size_t *ndx ) const override;
103 bool containsGlobalElement( size_t ) const override;
104 void setGhostValuesByGlobalID( size_t, const size_t *, const void *, const typeID & ) override;
105 void addGhostValuesByGlobalID( size_t, const size_t *, const void *, const typeID & ) override;
106 void getGhostValuesByGlobalID( size_t, const size_t *, void *, const typeID & ) const override;
107 void
108 getGhostAddValuesByGlobalID( size_t, const size_t *, void *, const typeID & ) const override;
109
114
115public: // Write/read restart data
116 void registerChildObjects( AMP::IO::RestartManager *manager ) const override;
117 void writeRestart( int64_t ) const override;
119
120private:
121 void setScratchSpace( size_t N ) const;
122 void setMapScratchSpace( size_t N ) const;
123 std::tuple<bool, size_t *, void *> copyToScratchSpace( size_t num,
124 const size_t *indices_,
125 const void *vals_,
126 const typeID &id ) const;
127
130
131 mutable size_t d_scratchSize = 0;
132 mutable size_t *d_idx_req_scratch = nullptr;
133 mutable size_t *d_idx_map_scratch = nullptr;
134 mutable TYPE *d_scalar_scratch = nullptr;
135};
136
137
138} // namespace AMP::LinearAlgebra
139
140
141#endif
Class to manage reading/writing restart data.
A class used to hold vector data.
A class used to hold vector data.
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.
void fillGhosts(const Scalar &) override
Zero all ghost data (does not modify consistent status)
void setScratchSpace(size_t N) const
bool allGhostIndices(size_t N, const size_t *ndx) const override
void registerChildObjects(AMP::IO::RestartManager *manager) const override
Register any child objects.
void putRawData(const void *buf, const typeID &id) override
Copy data into this vector.
VectorDataDevice(size_t start, size_t localSize, size_t globalSize)
void writeRestart(int64_t) const override
Write restart data to file.
void setMapScratchSpace(size_t N) const
typename std::allocator_traits< Allocator >::template rebind_alloc< TYPE > scalarAllocator_t
void addGhostValuesByGlobalID(size_t, const size_t *, const void *, const typeID &) override
Add shared values using global identifier.
std::string VectorDataName() const override
Get the type name.
std::tuple< bool, size_t *, void * > copyToScratchSpace(size_t num, const size_t *indices_, const void *vals_, const typeID &id) const
void getGhostAddValuesByGlobalID(size_t, const size_t *, void *, const typeID &) const override
get ghosted values to add to off-proc elements
bool containsGlobalElement(size_t) const override
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.
VectorDataDevice(const VectorDataDevice &)=delete
void getGhostValuesByGlobalID(size_t, const size_t *, void *, const typeID &) const override
Get ghost values in the vector by their global offset.
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.
void getRawData(void *buf, const typeID &id) const override
Copy data out of this vector.
typename std::allocator_traits< Allocator >::template rebind_alloc< size_t > idxAllocator_t
virtual ~VectorDataDevice()
Virtual destructor.
VectorDataDevice(int64_t, AMP::IO::RestartManager *)
void setGhostValuesByGlobalID(size_t, const size_t *, const void *, const typeID &) override
Set ghost values using global identifier.
std::shared_ptr< VectorData > cloneData(const std::string &name="") const override
Clone the data.
void getGhostAddValuesByGlobalID(size_t num, const size_t *indices, TYPE *vals) const
get ghosted values to add to off-proc elements
void addGhostValuesByGlobalID(size_t num, const size_t *indices, const TYPE *vals)
Add shared values using global identifier.
void setGhostValuesByGlobalID(size_t num, const size_t *indices, const TYPE *vals)
Set ghost values using global identifier.
void getGhostValuesByGlobalID(size_t num, const size_t *indices, TYPE *vals) const
Get ghost values in the vector by their global offset.
Scalar is a class used to store a scalar variable that may be different types/precision.
Definition Scalar.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