Advanced Multi-Physics (AMP)
On-Line Documentation
SubsetCommSelfVectorData.h
Go to the documentation of this file.
1#ifndef included_AMP_SubsetCommSelfVectorData
2#define included_AMP_SubsetCommSelfVectorData
3
4#include "AMP/discretization/DOF_Manager.h"
5#include "AMP/discretization/subsetCommSelfDOFManager.h"
6#include "AMP/vectors/Vector.h"
7#include "AMP/vectors/data/SubsetVectorData.h"
8#include "AMP/vectors/data/VectorData.h"
9
10#include <vector>
11
12namespace AMP::LinearAlgebra {
13
14
21{
22
23public:
24 std::string VectorDataName() const override
25 {
26 return "SubsetCommSelfVectorData of " + d_parentData->VectorDataName();
27 }
28 const AMP_MPI &getComm() const override;
29 size_t numberOfDataBlocks() const override;
30 size_t sizeOfDataBlock( size_t i ) const override;
31 void addValuesByLocalID( size_t, const size_t *, const void *, const typeID & ) override;
32 void setValuesByLocalID( size_t, const size_t *, const void *, const typeID & ) override;
33 void getValuesByLocalID( size_t, const size_t *, void *, const typeID & ) const override;
34 void putRawData( const void *in, const typeID &id ) override;
35 void getRawData( void *out, const typeID &id ) const override;
36 typeID getType( size_t block ) const override { return d_parentData->getType( block ); }
37 uint64_t getDataID() const override { return d_parentData->getDataID(); }
38 size_t sizeofDataBlockType( size_t ) const override { return sizeof( double ); }
39 void swapData( VectorData & ) override;
40 std::shared_ptr<VectorData> cloneData( const std::string &name = "" ) const override;
41 bool hasContiguousData() const override { return numberOfDataBlocks() > 1 ? false : true; }
43 explicit SubsetCommSelfVectorData( std::shared_ptr<VectorData> data );
45 void setUpdateStatus( UpdateState state ) override;
46 void setUpdateStatusPtr( std::shared_ptr<UpdateState> rhs ) override;
47 std::shared_ptr<UpdateState> getUpdateStatusPtr() const override;
48
49public: // Ghost data functions
50 bool hasGhosts() const override { return false; }
51 void fillGhosts( const Scalar & ) override {}
52 std::shared_ptr<CommunicationList> getCommunicationList() const override { return nullptr; }
53 void setCommunicationList( std::shared_ptr<CommunicationList> ) override {}
54 size_t getGhostSize() const override { return 0; }
55 bool containsGlobalElement( size_t ) const override;
56 void setGhostValuesByGlobalID( size_t, const size_t *, const void *, const typeID & ) override;
57 void addGhostValuesByGlobalID( size_t, const size_t *, const void *, const typeID & ) override;
58 void getGhostValuesByGlobalID( size_t, const size_t *, void *, const typeID & ) const override;
59 void
60 getGhostAddValuesByGlobalID( size_t, const size_t *, void *, const typeID & ) const override;
61 size_t getAllGhostValues( void *, const typeID & ) const override;
62 void makeConsistent( ScatterType ) override;
63 void makeConsistent() override;
64 void dataChanged() override;
65 void dumpGhostedData( std::ostream &, size_t ) const override {}
66 void copyGhostValues( const VectorData & ) override {}
67
72
73private:
74 void *getRawDataBlockAsVoid( size_t i ) override;
75 const void *getRawDataBlockAsVoid( size_t i ) const override;
76
77 // Internal data
78 std::shared_ptr<VectorData> d_parentData; // VectorData for the subset
79 std::vector<size_t> d_SubsetLocalIDToViewGlobalID; // The list of global ID in the parent vector
80 std::shared_ptr<UpdateState> d_UpdateState;
81};
82
83
84} // namespace AMP::LinearAlgebra
85
86
87#endif
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
This vector is a subset of an AMP Vector.
void setGhostValuesByGlobalID(size_t, const size_t *, const void *, const typeID &) override
Set ghost values using global identifier.
void dataChanged() override
Notify listeners that data has changed in this vector.
size_t numberOfDataBlocks() const override
Number of blocks of contiguous data in the Vector.
void addGhostValuesByGlobalID(size_t, const size_t *, const void *, const typeID &) override
Add shared values using global identifier.
bool containsGlobalElement(size_t) const override
void getRawData(void *out, const typeID &id) const override
Copy data out of this vector.
size_t sizeOfDataBlock(size_t i) const override
Number of elements in a data block.
void swapData(VectorData &) override
Swap the data with another VectorData object.
size_t sizeofDataBlockType(size_t) const override
Return the result of sizeof(TYPE) for the given data block.
const void * getRawDataBlockAsVoid(size_t i) const override
Return a pointer to a particular block of memory in the vector.
size_t getGhostSize() const override
Number of entries "owned" by other cores stored on this core.
void getGhostAddValuesByGlobalID(size_t, const size_t *, void *, const typeID &) const override
get ghosted values to add to off-proc elements
void makeConsistent() override
Update shared values on entire communicator.
void putRawData(const void *in, const typeID &id) override
Copy data into this vector.
bool hasContiguousData() const override
returns whether all data for the vector on a single process is contiguous
void setCommunicationList(std::shared_ptr< CommunicationList >) override
Set the CommunicationList for this Vector.
const AMP_MPI & getComm() const override
Get the communicator.
bool hasGhosts() const override
Check if any entries "owned" by other cores are stored on this core.
void fillGhosts(const Scalar &) override
Zero all ghost data (does not modify consistent status)
void makeConsistent(ScatterType) override
Update shared values on entire communicator.
uint64_t getDataID() const override
A unique id for the underlying data allocation.
typeID getType(size_t block) const override
Return the typeid of the given block.
void dumpGhostedData(std::ostream &, size_t) const override
Write data owned by other processors to an std::ostream.
void copyGhostValues(const VectorData &) override
Copy ghosted vlues to a vector.
std::string VectorDataName() const override
Get the type name.
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< UpdateState > getUpdateStatusPtr() const override
Return the current update state of this Vector.
void addValuesByLocalID(size_t, const size_t *, const void *, const typeID &) override
Add values to vector entities by their local offset.
void setUpdateStatus(UpdateState state) override
Sets the current update state of the Vector.
std::shared_ptr< CommunicationList > getCommunicationList() const override
Get the CommunicationList for this Vector.
UpdateState getLocalUpdateStatus() const override
Return the current update state of the Vector.
void setUpdateStatusPtr(std::shared_ptr< UpdateState > rhs) override
Tie the current update state to another.
std::shared_ptr< VectorData > cloneData(const std::string &name="") const override
Clone the data.
SubsetCommSelfVectorData(std::shared_ptr< VectorData > data)
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.
void getValuesByLocalID(size_t, const size_t *, void *, const typeID &) const override
Get local values in the vector by their global offset.
A class used to hold vector data.
Definition VectorData.h:38
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
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