Nektar++
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
46 namespace Nektar
47 {
48 namespace SolverUtils
49 {
50 
51 class Driver;
52 
53 /// A shared pointer to a Driver object
54 typedef std::shared_ptr<Driver> DriverSharedPtr;
55 
56 /// Datatype of the NekFactory used to instantiate classes derived from
57 /// the Driver class.
58 typedef LibUtilities::NekFactory<std::string, Driver,
62 
64 
65 /// Base class for the development of solvers.
66 class Driver
67 {
68 public:
69  /// Destructor
70  virtual ~Driver();
71 
72  /// Initialise Object
73  SOLVER_UTILS_EXPORT inline void InitObject(std::ostream &out = std::cout);
74 
75  /// Execute driver
76  SOLVER_UTILS_EXPORT inline void Execute(std::ostream &out = std::cout);
77 
79 
82 
83 protected:
84  /// Communication object
86 
87  /// Session reader object
89 
90  /// I the Coupling between SFD and arnoldi
92 
93  /// MeshGraph object
95 
96  /// Equation system to solve
98 
99  /// number of equations
100  int m_nequ;
101 
102  /// Evolution Operator
104 
105  /// Initialises EquationSystem class members.
108 
109  SOLVER_UTILS_EXPORT virtual void v_InitObject(
110  std::ostream &out = std::cout);
111 
112  /// Virtual function for solve implementation.
114  std::ostream &out = std::cout) = 0;
115 
118 
119  static std::string evolutionOperatorLookupIds[];
120  static std::string evolutionOperatorDef;
121  static std::string driverDefault;
122 };
123 
124 inline void Driver::InitObject(std::ostream &out)
125 {
126  v_InitObject(out);
127 }
128 
129 inline void Driver::Execute(std::ostream &out)
130 {
131  v_Execute(out);
132 }
133 
135 {
136  return m_equ;
137 }
138 
140 {
141  return v_GetRealEvl();
142 }
143 
145 {
146  return v_GetImagEvl();
147 }
148 
149 } // namespace SolverUtils
150 } // namespace Nektar
151 
152 #endif // NEKTAR_SOLVERS_AUXILIARY_ADRBASE_H
#define SOLVER_UTILS_EXPORT
Provides a generic Factory class.
Definition: NekFactory.hpp:105
Base class for the development of solvers.
Definition: Driver.h:67
LibUtilities::SessionReaderSharedPtr session_LinNS
I the Coupling between SFD and arnoldi.
Definition: Driver.h:91
virtual ~Driver()
Destructor.
Definition: Driver.cpp:79
SOLVER_UTILS_EXPORT Array< OneD, EquationSystemSharedPtr > GetEqu()
Definition: Driver.h:134
LibUtilities::SessionReaderSharedPtr m_session
Session reader object.
Definition: Driver.h:88
virtual SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout)
Definition: Driver.cpp:87
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > GetImagEvl(void)
Definition: Driver.h:144
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:119
Driver(const LibUtilities::SessionReaderSharedPtr pSession, const SpatialDomains::MeshGraphSharedPtr pGraph)
Initialises EquationSystem class members.
Definition: Driver.cpp:73
LibUtilities::CommSharedPtr m_comm
Communication object.
Definition: Driver.h:85
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > GetRealEvl(void)
Definition: Driver.h:139
SpatialDomains::MeshGraphSharedPtr m_graph
MeshGraph object.
Definition: Driver.h:94
SOLVER_UTILS_EXPORT void InitObject(std::ostream &out=std::cout)
Initialise Object.
Definition: Driver.h:124
enum EvolutionOperatorType m_EvolutionOperator
Evolution Operator.
Definition: Driver.h:103
Array< OneD, EquationSystemSharedPtr > m_equ
Equation system to solve.
Definition: Driver.h:97
static std::string driverDefault
Definition: Driver.h:121
int m_nequ
number of equations
Definition: Driver.h:100
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDouble > v_GetRealEvl(void)
Definition: Driver.cpp:205
SOLVER_UTILS_EXPORT void Execute(std::ostream &out=std::cout)
Execute driver.
Definition: Driver.h:129
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDouble > v_GetImagEvl(void)
Definition: Driver.cpp:211
static std::string evolutionOperatorDef
Definition: Driver.h:120
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:54
std::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
Definition: Driver.h:51
DriverFactory & GetDriverFactory()
Definition: Driver.cpp:64
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:61
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:172
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2