Advanced Multi-Physics (AMP)
On-Line Documentation
MultiDOF_Manager.h
Go to the documentation of this file.
1#ifndef included_AMP_MultiDOF_Manager
2#define included_AMP_MultiDOF_Manager
3
4#include "AMP/discretization/DOF_Manager.h"
5#include "AMP/discretization/MultiDOFHelper.h"
6#include "AMP/mesh/Mesh.h"
7#include "AMP/mesh/MeshElement.h"
8#include <memory>
9
10
11namespace AMP::Discretization {
12
13
24{
25public:
27
36 std::vector<std::shared_ptr<DOFManager>> managers,
37 std::shared_ptr<const AMP::Mesh::Mesh> mesh = {} );
38
44 multiDOFManager( std::shared_ptr<DOFManager> manager );
45
47 virtual ~multiDOFManager() override;
48
49
55 AMP::Mesh::MeshElementID getElementID( size_t dof ) const override;
56
57
63 std::unique_ptr<AMP::Mesh::MeshElement> getElement( size_t dof ) const override;
64
65
69 std::shared_ptr<const AMP::Mesh::Mesh> getMesh() const override;
70
71
77
78
80 std::vector<size_t> getRemoteDOFs() const override;
81
82
87 std::shared_ptr<DOFManager> subset( const AMP_MPI &comm ) override;
88
89
98 std::shared_ptr<DOFManager> subset( const std::shared_ptr<const AMP::Mesh::Mesh> mesh,
99 bool useMeshComm = true ) override;
100
101
108 std::shared_ptr<DOFManager> subset( const AMP::Mesh::MeshIterator &iterator,
109 const AMP_MPI &comm ) override;
110
115 void reset( std::vector<std::shared_ptr<DOFManager>> managers,
116 std::shared_ptr<const AMP::Mesh::Mesh> mesh = {} );
117
123 int getDOFsPerPoint() const override;
124
125public:
127 inline const auto &getDOFManagers() const { return d_managers; }
128
130 inline const auto &getDOFManager( const size_t i ) const { return d_managers[i]; }
131
132
142 std::vector<size_t> getGlobalDOF( const int DOFManager,
143 const std::vector<size_t> &localDOF ) const;
144
145
161 std::vector<size_t> getSubDOF( const int DOFManager,
162 const std::vector<size_t> &globalDOF ) const;
163
164
165public: // Advanced interfaces
168 size_t *dofs,
169 size_t N_alloc,
170 bool sort = true ) const override;
172
173 // Append DOFs to the list
175 size_t *dofs,
176 size_t index,
177 size_t capacity ) const override;
178
180 std::vector<size_t> getLocalSizes() const override;
181
182 // Get the map
183 inline const multiDOFHelper &getMap() const { return d_dofMap; }
184
185private:
186 // Convert the local to global dof
187 inline size_t subToGlobal( int manager, size_t dof ) const
188 {
189 return d_dofMap.subToGlobal( manager, dof );
190 }
191
192 // Convert the global to local dof
193 inline std::pair<size_t, int> globalToSub( size_t dof ) const
194 {
195 return d_dofMap.globalToSub( dof );
196 }
197
198
199private:
200 multiDOFManager() = delete;
201
202 std::shared_ptr<const AMP::Mesh::Mesh> d_mesh;
203 std::vector<std::shared_ptr<DOFManager>> d_managers;
204 std::vector<size_t> d_globalSize;
206};
207} // namespace AMP::Discretization
208
209#endif
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
std::vector< size_t > getRowDOFs(const AMP::Mesh::MeshElementID &id) const
Get the row DOFs given a mesh element.
virtual std::shared_ptr< DOFManager > subset(const AMP_MPI &comm)
Subset the DOF Manager for a AMP_MPI communicator.
A class to manage mapping multiple DOFs to global indicies.
std::pair< size_t, int > globalToSub(size_t dof) const
Convert the global to local dof.
size_t subToGlobal(int manager, size_t dof) const
Convert the local to global dof.
A derived class to combine multiple DOFManagers.
std::vector< size_t > getRemoteDOFs() const override
Get the remote DOFs for a vector.
multiDOFManager(std::shared_ptr< DOFManager > manager)
Create a new DOF manager object.
void reset(std::vector< std::shared_ptr< DOFManager > > managers, std::shared_ptr< const AMP::Mesh::Mesh > mesh={})
std::pair< size_t, int > globalToSub(size_t dof) const
std::vector< size_t > getSubDOF(const int DOFManager, const std::vector< size_t > &globalDOF) const
Function to convert DOFs from the global DOF to a sub-manager DOF.
virtual ~multiDOFManager() override
Deconstructor.
std::vector< size_t > getGlobalDOF(const int DOFManager, const std::vector< size_t > &localDOF) const
Function to convert DOFs from a sub-manager DOF to the global DOF.
const auto & getDOFManagers() const
Get the DOFManagers that compose the multiDOFManager.
multiDOFManager(const AMP_MPI &comm, std::vector< std::shared_ptr< DOFManager > > managers, std::shared_ptr< const AMP::Mesh::Mesh > mesh={})
Create a new DOF manager object.
std::vector< size_t > getLocalSizes() const override
Get the local sizes on each rank.
size_t appendDOFs(const AMP::Mesh::MeshElementID &id, size_t *dofs, size_t index, size_t capacity) const override
std::shared_ptr< const AMP::Mesh::Mesh > getMesh() const override
Get the underlying mesh.
AMP::Mesh::MeshIterator getIterator() const override
Get an entry over the mesh elements associated with the DOFs.
int getDOFsPerPoint() const override
Get the number of DOFs per element.
AMP::Mesh::MeshElementID getElementID(size_t dof) const override
Get the mesh element ID for a DOF.
const multiDOFHelper & getMap() const
std::shared_ptr< DOFManager > subset(const AMP_MPI &comm) override
Subset the DOF Manager for a AMP_MPI communicator.
std::vector< std::shared_ptr< DOFManager > > d_managers
std::shared_ptr< DOFManager > subset(const AMP::Mesh::MeshIterator &iterator, const AMP_MPI &comm) override
Subset the DOF Manager for a mesh element iterator.
size_t getRowDOFs(const AMP::Mesh::MeshElementID &id, size_t *dofs, size_t N_alloc, bool sort=true) const override
Get the row DOFs given a mesh element.
size_t subToGlobal(int manager, size_t dof) const
std::shared_ptr< const AMP::Mesh::Mesh > d_mesh
const auto & getDOFManager(const size_t i) const
get the i-th dof manager
std::shared_ptr< DOFManager > subset(const std::shared_ptr< const AMP::Mesh::Mesh > mesh, bool useMeshComm=true) override
Subset the DOF Manager for a mesh.
std::unique_ptr< AMP::Mesh::MeshElement > getElement(size_t dof) const override
Get the mesh element for a DOF.
A class used to iterate over elements in a Mesh.
A structure used to identify the mesh element.
Definition MeshID.h:156



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