Advanced Multi-Physics (AMP)
On-Line Documentation
TpetraVectorFactory.h
Go to the documentation of this file.
1#ifndef included_AMP_TpetraVectorFactor
2#define included_AMP_TpetraVectorFactor
3
4
5#include "AMP/utils/UnitTest.h"
6#include "AMP/vectors/Vector.h"
7#include "AMP/vectors/testHelpers/VectorTests.h"
8
9#include "Tpetra_Vector_decl.hpp"
11
12
13namespace AMP::LinearAlgebra {
14
15
16template<typename ST = double,
17 typename LO = int32_t,
18 typename GO = long long,
19 typename NT = Tpetra::Vector<>::node_type>
20class NativeTpetraFactory : public VectorFactory
21{
22public:
23 NativeTpetraFactory() {}
24 AMP::LinearAlgebra::Vector::shared_ptr getVector() const override
25 {
26 const int nLocal = 210;
27 AMP::AMP_MPI globalComm( AMP_COMM_WORLD );
28 const int start = nLocal * globalComm.getRank();
29 const int nGlobal = nLocal * globalComm.getSize();
30 auto commList = std::make_shared<CommunicationList>( nLocal, globalComm );
31 auto dofManager = std::make_shared<AMP::Discretization::DOFManager>( nLocal, globalComm );
32 auto buffer =
33 std::make_shared<AMP::LinearAlgebra::VectorDataDefault<ST>>( start, nLocal, nGlobal );
34 auto vec = createTpetraVector( commList, dofManager, buffer );
35 return vec;
36 }
37 std::string name() const override { return "NativeTpetraFactory"; }
38};
39
40
41} // namespace AMP::LinearAlgebra
42
44
45#endif
#define AMP_COMM_WORLD
Definition AMP_MPI.h:32
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
std::shared_ptr< Vector > shared_ptr
Shorthand for shared pointer to Vector.
Definition Vector.h:60
std::shared_ptr< Vector > createTpetraVector(std::shared_ptr< CommunicationList > commList, std::shared_ptr< AMP::Discretization::DOFManager > DOFs, std::shared_ptr< VectorData > p=nullptr)
Create a Tpetra vector.
MueLu::GlobalOrdinal GO
MueLu::LocalOrdinal LO



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