Advanced Multi-Physics (AMP)
On-Line Documentation
MultiDOFHelper.h
Go to the documentation of this file.
1#ifndef included_AMP_MultiDOFHelper
2#define included_AMP_MultiDOFHelper
3
4#include "AMP/discretization/DOF_Manager.h"
5#include "AMP/utils/Array.h"
6
7#include <vector>
8
10class VectorData;
11}
12
13
14namespace AMP::Discretization {
15
21class multiDOFHelper final
22{
23public:
24 // Constructor
25 multiDOFHelper( const DOFManager &manager );
26
27 // Constructor
29
30 // Constructor
31 multiDOFHelper( const std::vector<std::shared_ptr<DOFManager>> &managers,
32 const AMP::AMP_MPI &comm );
33
34 // Constructor
35 multiDOFHelper( const std::vector<AMP::LinearAlgebra::VectorData *> &data,
36 const AMP::AMP_MPI &comm );
37
39 size_t subToGlobal( int manager, size_t dof ) const;
40
42 std::vector<size_t> getSubDOF( const int manager, const std::vector<size_t> &globalDOFs ) const;
43
45 std::pair<size_t, int> globalToSub( size_t dof ) const;
46
48 std::vector<size_t> getGlobalDOF( const int manager, const std::vector<size_t> &subDOFs ) const;
49
50 // Get the number of local DOFs
51 inline size_t numLocal() const { return d_local[d_rank]; }
52
53 // Get the number of global DOFs
54 inline size_t numGlobal() const { return d_begin.back() + d_local.back(); }
55
56 // Get the first local dof
57 inline size_t begin() const { return d_begin[d_rank]; }
58
59 // Get one past the last local dof
60 inline size_t end() const { return d_begin[d_rank] + d_local[d_rank]; }
61
62 // Get the local size for each rank
63 const std::vector<size_t> &getLocalSize() const { return d_local; }
64
65public: // Default constructors
66 multiDOFHelper() = default;
69
72
73public: // HDF5 interfaces
74 void writeHDF5( size_t ) const;
75 multiDOFHelper( size_t );
76
77private:
78 void initialize( int rank, std::vector<size_t> &&data );
79 void initialize( const AMP::AMP_MPI &comm, const AMP::Array<size_t> &data );
80
81private:
82 int d_rank = 0;
83 std::vector<size_t> d_index;
84 std::vector<size_t> d_local;
85 std::vector<size_t> d_begin;
86 std::vector<size_t> d_globalSize;
90};
91
92
93} // namespace AMP::Discretization
94
95#endif
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
A class to manage mapping multiple DOFs to global indicies.
const std::vector< size_t > & getLocalSize() const
multiDOFHelper(const std::vector< AMP::LinearAlgebra::VectorData * > &data, const AMP::AMP_MPI &comm)
void initialize(const AMP::AMP_MPI &comm, const AMP::Array< size_t > &data)
std::vector< size_t > getSubDOF(const int manager, const std::vector< size_t > &globalDOFs) const
Convert the local to global dof.
std::vector< size_t > getGlobalDOF(const int manager, const std::vector< size_t > &subDOFs) const
Convert the global to local dof.
multiDOFHelper & operator=(multiDOFHelper &&)=default
multiDOFHelper(multiDOFHelper &&)=default
std::pair< size_t, int > globalToSub(size_t dof) const
Convert the global to local dof.
void initialize(int rank, std::vector< size_t > &&data)
size_t subToGlobal(int manager, size_t dof) const
Convert the local to global dof.
multiDOFHelper(const multiDOFHelper &)
multiDOFHelper(const DOFManager &manager)
multiDOFHelper(const std::vector< std::shared_ptr< DOFManager > > &managers, const AMP::AMP_MPI &comm)
multiDOFHelper(const AMP::LinearAlgebra::VectorData &data)
A class used to hold vector data.
Definition VectorData.h:38



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:40.
Comments on this page