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 
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.
59  std::string, Driver,
62 
63 SOLVER_UTILS_EXPORT DriverFactory& GetDriverFactory();
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 
84 protected:
85  /// Communication object
87 
88  /// Session reader object
89  LibUtilities::SessionReaderSharedPtr m_session;
90 
91  /// I the Coupling between SFD and arnoldi
92  LibUtilities::SessionReaderSharedPtr session_LinNS;
93 
94  /// MeshGraph object
96 
97  /// Equation system to solve
99 
100  ///number of equations
101  int m_nequ;
102 
103  ///Evolution Operator
105 
106  /// Initialises EquationSystem class members.
107  Driver(const LibUtilities::SessionReaderSharedPtr pSession,
109 
110  SOLVER_UTILS_EXPORT virtual void v_InitObject(std::ostream &out = std::cout);
111 
112  /// Virtual function for solve implementation.
113  SOLVER_UTILS_EXPORT virtual void v_Execute(std::ostream &out = std::cout) = 0;
114 
115 
118 
119 
120  static std::string evolutionOperatorLookupIds[];
121  static std::string evolutionOperatorDef;
122  static std::string driverDefault;
123 
124 };
125 
126 inline void Driver::InitObject(std::ostream &out)
127 {
128  v_InitObject(out);
129 }
130 
131 inline void Driver::Execute(std::ostream &out)
132 {
133  v_Execute(out);
134 }
135 
137 {
138  return m_equ;
139 }
140 
142 {
143  return v_GetRealEvl();
144 }
145 
147 {
148  return v_GetImagEvl();
149 }
150 
151 }
152 } //end of namespace
153 
154 #endif //NEKTAR_SOLVERS_AUXILIARY_ADRBASE_H
155 
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
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< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
std::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
Definition: Driver.h:51
virtual ~Driver()
Destructor.
Definition: Driver.cpp:82
virtual SOLVER_UTILS_EXPORT void v_Execute(std::ostream &out=std::cout)=0
Virtual function for solve implementation.
LibUtilities::SessionReaderSharedPtr session_LinNS
I the Coupling between SFD and arnoldi.
Definition: Driver.h:92
virtual SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout)
Definition: Driver.cpp:90
SpatialDomains::MeshGraphSharedPtr m_graph
MeshGraph object.
Definition: Driver.h:95
Driver(const LibUtilities::SessionReaderSharedPtr pSession, const SpatialDomains::MeshGraphSharedPtr pGraph)
Initialises EquationSystem class members.
Definition: Driver.cpp:74
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > GetRealEvl(void)
Definition: Driver.h:141
static std::string evolutionOperatorLookupIds[]
Definition: Driver.h:120
enum EvolutionOperatorType m_EvolutionOperator
Evolution Operator.
Definition: Driver.h:104
SOLVER_UTILS_EXPORT Array< OneD, EquationSystemSharedPtr > GetEqu()
Definition: Driver.h:136
SOLVER_UTILS_EXPORT void InitObject(std::ostream &out=std::cout)
Initialise Object.
Definition: Driver.h:126
static std::string evolutionOperatorDef
Definition: Driver.h:121
Array< OneD, EquationSystemSharedPtr > m_equ
Equation system to solve.
Definition: Driver.h:98
#define SOLVER_UTILS_EXPORT
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDouble > v_GetImagEvl(void)
Definition: Driver.cpp:204
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > GetImagEvl(void)
Definition: Driver.h:146
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDouble > v_GetRealEvl(void)
Definition: Driver.cpp:198
DriverFactory & GetDriverFactory()
Definition: Driver.cpp:65
LibUtilities::CommSharedPtr m_comm
Communication object.
Definition: Driver.h:86
Base class for the development of solvers.
Definition: Driver.h:66
SOLVER_UTILS_EXPORT void Execute(std::ostream &out=std::cout)
Execute driver.
Definition: Driver.h:131
std::shared_ptr< SessionReader > SessionReaderSharedPtr
LibUtilities::SessionReaderSharedPtr m_session
Session reader object.
Definition: Driver.h:89
int m_nequ
number of equations
Definition: Driver.h:101
Provides a generic Factory class.
Definition: NekFactory.hpp:103
static std::string driverDefault
Definition: Driver.h:122