Advanced Multi-Physics (AMP)
On-Line Documentation
SubsetVectorData.h
Go to the documentation of this file.
1#ifndef included_AMP_SubsetVectorData
2#define included_AMP_SubsetVectorData
3
4#include "AMP/discretization/DOF_Manager.h"
5#include "AMP/vectors/Vector.h"
6#include "AMP/vectors/data/GhostDataHelper.hpp"
7#include "AMP/vectors/data/VectorData.h"
8
9#include <vector>
10
11namespace AMP::LinearAlgebra {
12
13
16{
17public:
19 std::shared_ptr<CommunicationList> d_CommList = nullptr;
20
22 std::shared_ptr<AMP::Discretization::DOFManager> d_DOFManager = nullptr;
23
24 Vector::shared_ptr d_ViewVector; // Vector we subsetted for the view
25};
26
64class SubsetVectorData : public GhostDataHelper<double>
65{
66
67public:
68 std::string VectorDataName() const override
69 {
70 return "SubsetVectorData of " + d_ViewVector->type();
71 }
72 size_t numberOfDataBlocks() const override;
73 size_t sizeOfDataBlock( size_t i ) const override;
74
75 void addValuesByLocalID( size_t, const size_t *, const void *, const typeID & ) override;
76 void setValuesByLocalID( size_t, const size_t *, const void *, const typeID & ) override;
77 void getValuesByLocalID( size_t, const size_t *, void *, const typeID & ) const override;
78 void putRawData( const void *in, const typeID &id ) override;
79 void getRawData( void *out, const typeID &id ) const override;
80 typeID getType( size_t ) const override { return d_typeID; }
81 uint64_t getDataID() const override { return d_ViewVector->getDataID(); }
82 size_t sizeofDataBlockType( size_t ) const override { return sizeof( double ); }
83 void swapData( VectorData & ) override;
84 std::shared_ptr<VectorData> cloneData( const std::string &name = "" ) const override;
85 bool hasContiguousData() const override { return numberOfDataBlocks() > 1 ? false : true; }
87 const AMP_MPI &getComm() const override;
88 explicit SubsetVectorData( std::shared_ptr<SubsetVectorParameters> params );
89
90private:
91 void *getRawDataBlockAsVoid( size_t i ) override;
92 const void *getRawDataBlockAsVoid( size_t i ) const override;
93
94 // Internal data
95 Vector::shared_ptr d_ViewVector; // Vector we subsetted for the view
96 size_t d_parentLocalStartID; // Offset for the parent
97 std::vector<size_t> d_SubsetLocalIDToViewGlobalID; // The list of global ID in the parent vector
99 std::vector<size_t> d_dataBlockSize; // The size of the data blocks
100 std::vector<void *> d_dataBlockPtr; // The pointers to the data blocks
101 std::shared_ptr<AMP::Discretization::DOFManager>
102 d_DOFManager; // this will contain the subset DOF
103};
104
105
106} // namespace AMP::LinearAlgebra
107
108
109#endif
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
void setValuesByLocalID(size_t, const size_t *, const void *, const typeID &) override
Set values in the vector by their local offset.
std::shared_ptr< VectorData > cloneData(const std::string &name="") const override
Clone the data.
void swapData(VectorData &) override
Swap the data with another VectorData object.
std::string VectorDataName() const override
Get the type name.
bool hasContiguousData() const override
returns whether all data for the vector on a single process is contiguous
void getValuesByLocalID(size_t, const size_t *, void *, const typeID &) const override
Get local values in the vector by their global offset.
std::vector< size_t > d_SubsetLocalIDToViewGlobalID
SubsetVectorData(std::shared_ptr< SubsetVectorParameters > params)
size_t sizeOfDataBlock(size_t i) const override
Number of elements in a data block.
void putRawData(const void *in, const typeID &id) override
Copy data into this vector.
std::shared_ptr< AMP::Discretization::DOFManager > d_DOFManager
void * getRawDataBlockAsVoid(size_t i) override
Return a pointer to a particular block of memory in the vector.
const void * getRawDataBlockAsVoid(size_t i) const override
Return a pointer to a particular block of memory in the vector.
void getRawData(void *out, 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.
size_t sizeofDataBlockType(size_t) const override
Return the result of sizeof(TYPE) for the given data block.
void addValuesByLocalID(size_t, const size_t *, const void *, const typeID &) override
Add values to vector entities by their local offset.
const AMP_MPI & getComm() const override
Get the communicator.
uint64_t getDataID() const override
A unique id for the underlying data allocation.
typeID getType(size_t) const override
Return the typeid of the given block.
Parameters used to instantiate a Vector.
std::shared_ptr< AMP::Discretization::DOFManager > d_DOFManager
The DOF_Manager for a vector.
std::shared_ptr< CommunicationList > d_CommList
The CommunicationList for a vector.
A class used to hold vector data.
Definition VectorData.h:38
std::shared_ptr< Vector > shared_ptr
Shorthand for shared pointer to Vector.
Definition Vector.h:60
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