Nektar++
Driver.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: Driver.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Base class for Drivers.
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef SOLVERUTILS_DRIVER_H
36#define SOLVERUTILS_DRIVER_H
37
42
45
46namespace Nektar::SolverUtils
47{
48
49class Driver;
50
51/// A shared pointer to a Driver object
52typedef std::shared_ptr<Driver> DriverSharedPtr;
53
54/// Datatype of the NekFactory used to instantiate classes derived from
55/// the Driver class.
56typedef LibUtilities::NekFactory<std::string, Driver,
60
62
63/// Base class for the development of solvers.
64class Driver
65{
66public:
67 /// Destructor
68 virtual ~Driver() = default;
69
70 /// Initialise Object
71 SOLVER_UTILS_EXPORT inline void InitObject(std::ostream &out = std::cout);
72
73 /// Execute driver
74 SOLVER_UTILS_EXPORT inline void Execute(std::ostream &out = std::cout);
75
77
78protected:
79 /// Communication object
81
82 /// Session reader object
84
85 /// Coupling between SFD and arnoldi
87
88 /// MeshGraph object
90
91 /// Equation system to solve
93
94 /// number of equations
95 int m_nequ;
96
97 /// Evolution Operator
99
100 /// Initialises EquationSystem class members.
103
104 /// Virtual function for initialisation implementation.
106 std::ostream &out = std::cout);
107
108 /// Virtual function for solve implementation.
110 std::ostream &out = std::cout) = 0;
111
112 static std::string evolutionOperatorLookupIds[];
113 static std::string evolutionOperatorDef;
114 static std::string driverDefault;
115};
116
117inline void Driver::InitObject(std::ostream &out)
118{
119 v_InitObject(out);
120}
121
122inline void Driver::Execute(std::ostream &out)
123{
124 v_Execute(out);
125}
126
128{
129 return m_equ;
130}
131
132} // namespace Nektar::SolverUtils
133
134#endif // NEKTAR_SOLVERS_AUXILIARY_ADRBASE_H
#define SOLVER_UTILS_EXPORT
Provides a generic Factory class.
Base class for the development of solvers.
Definition: Driver.h:65
LibUtilities::SessionReaderSharedPtr session_LinNS
Coupling between SFD and arnoldi.
Definition: Driver.h:86
SOLVER_UTILS_EXPORT Array< OneD, EquationSystemSharedPtr > GetEqu()
Definition: Driver.h:127
LibUtilities::SessionReaderSharedPtr m_session
Session reader object.
Definition: Driver.h:83
virtual SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout)
Virtual function for initialisation implementation.
Definition: Driver.cpp:84
virtual SOLVER_UTILS_EXPORT void v_Execute(std::ostream &out=std::cout)=0
Virtual function for solve implementation.
static std::string evolutionOperatorLookupIds[]
Definition: Driver.h:112
Driver(const LibUtilities::SessionReaderSharedPtr pSession, const SpatialDomains::MeshGraphSharedPtr pGraph)
Initialises EquationSystem class members.
Definition: Driver.cpp:75
LibUtilities::CommSharedPtr m_comm
Communication object.
Definition: Driver.h:80
SpatialDomains::MeshGraphSharedPtr m_graph
MeshGraph object.
Definition: Driver.h:89
SOLVER_UTILS_EXPORT void InitObject(std::ostream &out=std::cout)
Initialise Object.
Definition: Driver.h:117
virtual ~Driver()=default
Destructor.
enum EvolutionOperatorType m_EvolutionOperator
Evolution Operator.
Definition: Driver.h:98
Array< OneD, EquationSystemSharedPtr > m_equ
Equation system to solve.
Definition: Driver.h:92
static std::string driverDefault
Definition: Driver.h:114
int m_nequ
number of equations
Definition: Driver.h:95
SOLVER_UTILS_EXPORT void Execute(std::ostream &out=std::cout)
Execute driver.
Definition: Driver.h:122
static std::string evolutionOperatorDef
Definition: Driver.h:113
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55
std::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
Definition: Driver.h:52
DriverFactory & GetDriverFactory()
Definition: Driver.cpp:66
LibUtilities::NekFactory< std::string, Driver, const LibUtilities::SessionReaderSharedPtr &, const SpatialDomains::MeshGraphSharedPtr & > DriverFactory
Datatype of the NekFactory used to instantiate classes derived from the Driver class.
Definition: Driver.h:59
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174