Advanced Multi-Physics (AMP)
On-Line Documentation
EpetraVectorData.h
Go to the documentation of this file.
1#ifndef included_AMP_EpetraVectorData
2#define included_AMP_EpetraVectorData
3
4#include "AMP/vectors/data/GhostDataHelper.hpp"
5#include "AMP/vectors/data/VectorData.h"
6
8#include <Epetra_Map.h>
9#include <Epetra_Vector.h>
11
12
13namespace AMP::LinearAlgebra {
14
19{
20public:
27 const AMP_MPI &comm,
28 std::shared_ptr<CommunicationList> commList );
29
32
36 Epetra_Map &getEpetraMap();
37
39 inline size_t getLocalSize() const { return d_end - d_begin; }
40
42 inline size_t getGlobalSize() const { return d_global; }
43
45 inline size_t beginDOF() const { return d_begin; }
46
50 inline AMP_MPI getComm() const { return d_comm; }
51
53 std::shared_ptr<CommunicationList> d_CommList = nullptr;
54
55private:
56 size_t d_begin = 0; // Starting DOF
57 size_t d_end = 0; // Ending DOF
58 size_t d_global = 0; // Number of global DOFs
59 AMP_MPI d_comm; // Comm
60 std::shared_ptr<Epetra_Map> d_emap = nullptr; // Epetra map
61};
62
69class EpetraVectorData : public GhostDataHelper<double>
70{
71
72public: // Virtual functions
74 virtual ~EpetraVectorData() {}
75 static std::shared_ptr<EpetraVectorData>
76 create( std::shared_ptr<EpetraVectorEngineParameters> alias, std::shared_ptr<VectorData> buf );
77
78 std::string VectorDataName() const override { return "EpetraVectorData"; }
79 size_t numberOfDataBlocks() const override { return 1; }
80 size_t sizeOfDataBlock( size_t i ) const override { return i == 0 ? d_localSize : 0; }
81 void setValuesByLocalID( size_t, const size_t *, const void *, const typeID & ) override;
82 void addValuesByLocalID( size_t, const size_t *, const void *, const typeID & ) override;
83 void getValuesByLocalID( size_t, const size_t *, void *, const typeID & ) const override;
84 void putRawData( const void *in, const typeID &id ) override;
85 void getRawData( void *out, const typeID &id ) const override;
86 uint64_t getDataID() const override
87 {
88 return reinterpret_cast<uint64_t>( getRawDataBlockAsVoid( 0 ) );
89 }
90 void *getRawDataBlockAsVoid( size_t i ) override;
91 const void *getRawDataBlockAsVoid( size_t i ) const override;
92 size_t sizeofDataBlockType( size_t ) const override { return sizeof( double ); }
93 typeID getType( size_t ) const override { return getTypeID<double>(); }
94 void swapData( VectorData & ) override;
95 std::shared_ptr<VectorData> cloneData( const std::string &name = "" ) const override;
96
100 inline Epetra_Vector &getEpetra_Vector() { return d_epetraVector; }
101
105 inline const Epetra_Vector &getEpetra_Vector() const { return d_epetraVector; }
106
107 EpetraVectorData( std::shared_ptr<EpetraVectorEngineParameters> alias,
108 Epetra_DataAccess,
109 const Epetra_BlockMap &,
110 std::shared_ptr<VectorData>,
111 int,
112 int,
113 int );
114
115protected:
117 Epetra_Vector d_epetraVector;
118
120 std::shared_ptr<VectorData> d_buf_scope;
121};
122
123
124} // namespace AMP::LinearAlgebra
125
126
127#endif
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
A linear algebra engine that uses Epetra.
virtual ~EpetraVectorData()
Virtual destructor.
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 numberOfDataBlocks() const override
Number of blocks of contiguous data in the Vector.
Epetra_Vector d_epetraVector
The Epetra_Vector to perform work on.
std::string VectorDataName() const override
Get the type name.
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.
void getValuesByLocalID(size_t, const size_t *, void *, const typeID &) const override
Get local values in the vector by their global offset.
std::shared_ptr< VectorData > d_buf_scope
A shared ptr to the buffer (to prevent it from leaving scope)
typeID getType(size_t) const override
Return the typeid of the given block.
Epetra_Vector & getEpetra_Vector()
Get the raw Epetra_Vector.
static std::shared_ptr< EpetraVectorData > create(std::shared_ptr< EpetraVectorEngineParameters > alias, std::shared_ptr< VectorData > buf)
EpetraVectorData(std::shared_ptr< EpetraVectorEngineParameters > alias, Epetra_DataAccess, const Epetra_BlockMap &, std::shared_ptr< VectorData >, int, int, int)
void putRawData(const void *in, const typeID &id) override
Copy data into 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.
void getRawData(void *out, const typeID &id) const override
Copy data out of this vector.
const Epetra_Vector & getEpetra_Vector() const
Get the raw Epetra_Vector.
void addValuesByLocalID(size_t, const size_t *, const void *, const typeID &) override
Add values to vector entities by their local offset.
uint64_t getDataID() const override
A unique id for the underlying data allocation.
std::shared_ptr< VectorData > cloneData(const std::string &name="") const override
Clone the data.
Class that details how to construct an EpetraVectorEngine.
std::shared_ptr< CommunicationList > d_CommList
The CommunicationList for a vector.
EpetraVectorEngineParameters(size_t N_local, const AMP_MPI &comm, std::shared_ptr< CommunicationList > commList)
Constructor.
size_t getLocalSize() const
Return the local size.
size_t beginDOF() const
Return the first DOF on this core.
Epetra_Map & getEpetraMap()
Return the Epetra_Map for this engine.
AMP_MPI getComm() const
Return the Epetra_MpiComm for this engine.
size_t getGlobalSize() const
Return the local size.
A class used to hold vector data.
Definition VectorData.h:38
#define DISABLE_WARNINGS
Re-enable warnings.
#define ENABLE_WARNINGS
Suppress all warnings.
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