Advanced Multi-Physics (AMP)
On-Line Documentation
DOF_Manager.h
Go to the documentation of this file.
1#ifndef included_AMP_DOF_Manager
2#define included_AMP_DOF_Manager
3
4#include "AMP/discretization/DOF_ManagerParameters.h"
5#include "AMP/mesh/Mesh.h"
6#include "AMP/mesh/MeshElement.h"
7#include "AMP/mesh/MeshID.h"
8#include "AMP/utils/AMP_MPI.h"
9
10
11namespace AMP::IO {
12class RestartManager;
13}
14
15
16namespace AMP::Discretization {
17
18
27class DOFManager : public AMP::enable_shared_from_this<AMP::Discretization::DOFManager>
28{
29public:
39 DOFManager( size_t N_local, const AMP_MPI &comm, std::vector<size_t> remoteDOFs = {} );
40
41
43 virtual ~DOFManager();
44
45
47 virtual std::string className() const;
48
49
54 virtual bool operator==( const DOFManager &rhs ) const;
55
56
61 bool operator!=( const DOFManager &rhs ) const;
62
63
69 virtual AMP::Mesh::MeshElementID getElementID( size_t dof ) const;
70
71
77 virtual std::unique_ptr<AMP::Mesh::MeshElement> getElement( size_t dof ) const;
78
79
85 virtual int getDOFsPerPoint() const;
86
87
94 void getDOFs( const AMP::Mesh::MeshElementID &id, std::vector<size_t> &dofs ) const;
95
96
103 void getDOFs( const std::vector<AMP::Mesh::MeshElementID> &ids,
104 std::vector<size_t> &dofs ) const;
105
106
114 void getDOFs( int N_ids, const AMP::Mesh::MeshElementID *ids, std::vector<size_t> &dofs ) const;
115
116
120 virtual std::shared_ptr<const AMP::Mesh::Mesh> getMesh() const;
121
122
135
136
140 virtual size_t beginDOF() const;
141
142
146 virtual size_t endDOF() const;
147
148
152 virtual size_t numLocalDOF() const;
153
154
158 virtual size_t numGlobalDOF() const;
159
160
164 virtual std::vector<size_t> getLocalSizes() const;
165
166
168 inline const AMP_MPI &getComm() const { return d_comm; }
169
170
172 virtual std::vector<size_t> getRemoteDOFs() const;
173
174 virtual void replaceRemoteDOFs( std::vector<size_t> &newRemote ) { d_remoteDOFs = newRemote; }
175
176
178 std::vector<size_t> getRowDOFs( const AMP::Mesh::MeshElementID &id ) const;
179
180
185 virtual std::shared_ptr<DOFManager> subset( const AMP_MPI &comm );
186
187
196 virtual std::shared_ptr<DOFManager> subset( const std::shared_ptr<const AMP::Mesh::Mesh> mesh,
197 bool useMeshComm = true );
198
199
206 virtual std::shared_ptr<DOFManager> subset( const AMP::Mesh::MeshIterator &iterator,
207 const AMP_MPI &comm );
208
209
211 uint64_t getID() const;
212
213
214public: // Advanced interfaces
216 virtual size_t getRowDOFs( const AMP::Mesh::MeshElementID &id,
217 size_t *dofs,
218 size_t N_alloc,
219 bool sort = true ) const;
220
221 // Append DOFs to the list
222 virtual size_t appendDOFs( const AMP::Mesh::MeshElementID &id,
223 size_t *dofs,
224 size_t index,
225 size_t capacity ) const;
226
227
228public: // Write/read restart data
234 virtual void registerChildObjects( AMP::IO::RestartManager *manager ) const;
235
241 virtual void writeRestart( int64_t fid ) const;
242
249 DOFManager( int64_t fid, AMP::IO::RestartManager *manager );
250
251
252protected:
255
257 std::shared_ptr<DOFManagerParameters> params;
258
260 size_t d_begin = 0, d_end = 0, d_global = 0;
261 mutable std::vector<size_t> d_localSize;
262
264 std::vector<size_t> d_remoteDOFs;
265
268};
269
270
271} // namespace AMP::Discretization
272
273#endif
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
void getDOFs(const std::vector< AMP::Mesh::MeshElementID > &ids, std::vector< size_t > &dofs) const
Get the entry indices of DOFs given a mesh element ID.
const AMP_MPI & getComm() const
Get the comm for the DOFManger.
std::shared_ptr< DOFManagerParameters > params
The DOF manager parameters.
virtual std::vector< size_t > getRemoteDOFs() const
Get the remote DOFs for a vector.
virtual size_t beginDOF() const
The first D.O.F. on this core.
virtual void writeRestart(int64_t fid) const
Write restart data to file.
virtual std::shared_ptr< const AMP::Mesh::Mesh > getMesh() const
Get the underlying mesh.
virtual ~DOFManager()
Deconstructor.
virtual bool operator==(const DOFManager &rhs) const
Compares two DOFManager for equality.
virtual size_t endDOF() const
One past the last D.O.F. on this core.
std::vector< size_t > d_remoteDOFs
The remote dofs (if cached)
DOFManager(int64_t fid, AMP::IO::RestartManager *manager)
Write restart data to file.
virtual int getDOFsPerPoint() const
Get the number of DOFs per element.
virtual size_t appendDOFs(const AMP::Mesh::MeshElementID &id, size_t *dofs, size_t index, size_t capacity) const
size_t d_begin
The begining DOF, ending DOF and number of local DOFs for this processor.
DOFManager()
Empty constructor for a DOF manager object.
virtual size_t getRowDOFs(const AMP::Mesh::MeshElementID &id, size_t *dofs, size_t N_alloc, bool sort=true) const
Get the row DOFs given a mesh element.
virtual size_t numLocalDOF() const
The local number of D.O.F.
void getDOFs(const AMP::Mesh::MeshElementID &id, std::vector< size_t > &dofs) const
Get the entry indices of DOFs given a mesh element ID.
virtual std::unique_ptr< AMP::Mesh::MeshElement > getElement(size_t dof) const
Get the mesh element for a DOF.
virtual AMP::Mesh::MeshIterator getIterator() const
Get an entry over the mesh elements associated with the DOFs.
DOFManager(size_t N_local, const AMP_MPI &comm, std::vector< size_t > remoteDOFs={})
Basic constructor for DOFManager.
void getDOFs(int N_ids, const AMP::Mesh::MeshElementID *ids, std::vector< size_t > &dofs) const
Get the entry indices of DOFs given a mesh element ID.
virtual std::vector< size_t > getLocalSizes() const
The local number of D.O.F on each rank.
virtual void replaceRemoteDOFs(std::vector< size_t > &newRemote)
virtual std::string className() const
Return a string with the mesh class name.
virtual void registerChildObjects(AMP::IO::RestartManager *manager) const
Register any child objects.
virtual std::shared_ptr< DOFManager > subset(const std::shared_ptr< const AMP::Mesh::Mesh > mesh, bool useMeshComm=true)
Subset the DOF Manager for a mesh.
AMP_MPI d_comm
The comm for this DOFManager.
virtual std::shared_ptr< DOFManager > subset(const AMP::Mesh::MeshIterator &iterator, const AMP_MPI &comm)
Subset the DOF Manager for a mesh element iterator.
virtual size_t numGlobalDOF() const
The global number of D.O.F.
bool operator!=(const DOFManager &rhs) const
Inverse of ==.
std::vector< size_t > getRowDOFs(const AMP::Mesh::MeshElementID &id) const
Get the row DOFs given a mesh element.
virtual AMP::Mesh::MeshElementID getElementID(size_t dof) const
Get the mesh element for a DOF.
virtual std::shared_ptr< DOFManager > subset(const AMP_MPI &comm)
Subset the DOF Manager for a AMP_MPI communicator.
std::vector< size_t > d_localSize
uint64_t getID() const
Get a unique id hash.
Class to manage reading/writing restart data.
A class used to iterate over elements in a Mesh.
Enhancement of std::enable_shared_from_this.
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