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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Base class for Drivers.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef SOLVERUTILS_DRIVER_H
37 #define SOLVERUTILS_DRIVER_H
38 
43 
46 
47 namespace Nektar
48 {
49 namespace SolverUtils
50 {
51 
52 class Driver;
53 
54 /// A shared pointer to a Driver object
55 typedef boost::shared_ptr<Driver> DriverSharedPtr;
56 
57 /// Datatype of the NekFactory used to instantiate classes derived from
58 /// the Driver class.
59 typedef LibUtilities::NekFactory<std::string, Driver,
61 
62 SOLVER_UTILS_EXPORT DriverFactory& GetDriverFactory();
63 
64 /// Base class for the development of solvers.
65 class Driver
66 {
67 public:
68  /// Destructor
69  virtual ~Driver();
70 
71  /// Initialise Object
72  SOLVER_UTILS_EXPORT inline void InitObject(ostream &out = cout);
73 
74  /// Execute driver
75  SOLVER_UTILS_EXPORT inline void Execute(ostream &out = cout);
76 
78 
81 
82 
83 protected:
84  /// Communication object
86 
87  /// Session reader object
89 
90  /// I the Coupling between SFD and arnoldi
92 
93  /// Equation system to solve
95 
96  ///number of equations
97  int m_nequ;
98 
99  ///Evolution Operator
101 
102  /// Initialises EquationSystem class members.
104 
105  SOLVER_UTILS_EXPORT virtual void v_InitObject(ostream &out = cout);
106 
107  /// Virtual function for solve implementation.
108  SOLVER_UTILS_EXPORT virtual void v_Execute(ostream &out = cout) = 0;
109 
110 
113 
114 
115  static std::string evolutionOperatorLookupIds[];
116  static std::string evolutionOperatorDef;
117  static std::string driverDefault;
118 
119 };
120 
121 inline void Driver::InitObject(ostream &out)
122 {
123  v_InitObject(out);
124 }
125 
126 inline void Driver::Execute(ostream &out)
127 {
128  v_Execute(out);
129 }
130 
132 {
133  return m_equ;
134 }
135 
137 {
138  return v_GetRealEvl();
139 }
140 
142 {
143  return v_GetImagEvl();
144 }
145 
146 }
147 } //end of namespace
148 
149 #endif //NEKTAR_SOLVERS_AUXILIARY_ADRBASE_H
150 
boost::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
Definition: Driver.h:52
virtual SOLVER_UTILS_EXPORT void v_InitObject(ostream &out=cout)
Definition: Driver.cpp:90
Driver(const LibUtilities::SessionReaderSharedPtr pSession)
Initialises EquationSystem class members.
Definition: Driver.cpp:76
virtual ~Driver()
Destructor.
Definition: Driver.cpp:82
SOLVER_UTILS_EXPORT void Execute(ostream &out=cout)
Execute driver.
Definition: Driver.h:126
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:50
SOLVER_UTILS_EXPORT void InitObject(ostream &out=cout)
Initialise Object.
Definition: Driver.h:121
LibUtilities::SessionReaderSharedPtr session_LinNS
I the Coupling between SFD and arnoldi.
Definition: Driver.h:91
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > GetRealEvl(void)
Definition: Driver.h:136
static std::string evolutionOperatorLookupIds[]
Definition: Driver.h:115
LibUtilities::NekFactory< std::string, Driver, const LibUtilities::SessionReaderSharedPtr & > DriverFactory
Datatype of the NekFactory used to instantiate classes derived from the Driver class.
Definition: Driver.h:60
enum EvolutionOperatorType m_EvolutionOperator
Evolution Operator.
Definition: Driver.h:100
SOLVER_UTILS_EXPORT Array< OneD, EquationSystemSharedPtr > GetEqu()
Definition: Driver.h:131
virtual SOLVER_UTILS_EXPORT void v_Execute(ostream &out=cout)=0
Virtual function for solve implementation.
static std::string evolutionOperatorDef
Definition: Driver.h:116
Array< OneD, EquationSystemSharedPtr > m_equ
Equation system to solve.
Definition: Driver.h:94
#define SOLVER_UTILS_EXPORT
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDouble > v_GetImagEvl(void)
Definition: Driver.cpp:198
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > GetImagEvl(void)
Definition: Driver.h:141
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDouble > v_GetRealEvl(void)
Definition: Driver.cpp:192
DriverFactory & GetDriverFactory()
Definition: Driver.cpp:64
LibUtilities::CommSharedPtr m_comm
Communication object.
Definition: Driver.h:85
Base class for the development of solvers.
Definition: Driver.h:65
LibUtilities::SessionReaderSharedPtr m_session
Session reader object.
Definition: Driver.h:88
int m_nequ
number of equations
Definition: Driver.h:97
Provides a generic Factory class.
Definition: NekFactory.hpp:116
static std::string driverDefault
Definition: Driver.h:117