Advanced Multi-Physics (AMP)
On-Line Documentation
MeshFactory.h
Go to the documentation of this file.
1#ifndef included_AMP_Mesh_MeshFactory
2#define included_AMP_Mesh_MeshFactory
3
4#include "AMP/utils/FactoryStrategy.hpp"
5
6
7namespace AMP::IO {
8class RestartManager;
9}
10
11
12namespace AMP::Mesh {
13
14class Mesh;
15class MeshParameters;
16
17
18template<class MESH>
19std::unique_ptr<MESH> createMeshFromParams( std::shared_ptr<MeshParameters> params )
20{
21 return std::make_unique<MESH>( params );
22}
23template<class MESH>
24std::unique_ptr<MESH> createMeshFromRestart( int64_t fid, AMP::IO::RestartManager *manager )
25{
26 return std::make_unique<MESH>( fid, manager );
27}
28
29
32{
33public:
36 {
37 static MeshFactory singletonInstance;
38 return singletonInstance;
39 }
40
42 static std::shared_ptr<Mesh> create( std::shared_ptr<MeshParameters> parameters );
43
44
46 static std::shared_ptr<Mesh> create( int64_t fid, AMP::IO::RestartManager *manager );
47
49 template<class MESH>
50 static void registerMesh( const std::string &name )
51 {
52 FactoryStrategy<Mesh, std::shared_ptr<MeshParameters>>::registerFactory(
53 name, createMeshFromParams<MESH> );
54 FactoryStrategy<Mesh, int64_t, AMP::IO::RestartManager *>::registerFactory(
55 name, createMeshFromRestart<MESH> );
56 }
57};
58
59
60} // namespace AMP::Mesh
61
62#endif
Class to manage reading/writing restart data.
Mesh factory class.
Definition MeshFactory.h:32
static MeshFactory & getFactory()
get a singleton instance of the factory
Definition MeshFactory.h:35
static void registerMesh(const std::string &name)
Register a mesh with the factory.
Definition MeshFactory.h:50
static std::shared_ptr< Mesh > create(std::shared_ptr< MeshParameters > parameters)
Create the mesh from the parameters.
static std::shared_ptr< Mesh > create(int64_t fid, AMP::IO::RestartManager *manager)
Create the mesh from the restart file.
std::unique_ptr< MESH > createMeshFromParams(std::shared_ptr< MeshParameters > params)
Definition MeshFactory.h:19
std::unique_ptr< MESH > createMeshFromRestart(int64_t fid, AMP::IO::RestartManager *manager)
Definition MeshFactory.h:24



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