Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 // 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  class Driver;
52 
53  /// A shared pointer to a Driver object
54  typedef boost::shared_ptr<Driver> DriverSharedPtr;
55 
56  /// Datatype of the NekFactory used to instantiate classes derived from
57  /// the Driver class.
59  std::string, Driver,
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 
77  SOLVER_UTILS_EXPORT inline Array<OneD, EquationSystemSharedPtr> GetEqu();
78 
79  SOLVER_UTILS_EXPORT Array<OneD, NekDouble> GetRealEvl(void);
80  SOLVER_UTILS_EXPORT Array<OneD, NekDouble> GetImagEvl(void);
81 
82 
83  protected:
84  /// Communication object
86 
87  /// Session reader object
89 
90  /// Equation system to solve
91  Array<OneD, EquationSystemSharedPtr> m_equ;
92 
93  ///number of equations
94  int m_nequ;
95 
96  ///Evolution Operator
98 
99  /// Initialises EquationSystem class members.
101 
102  SOLVER_UTILS_EXPORT virtual void v_InitObject(ostream &out = cout);
103 
104  /// Virtual function for solve implementation.
105  SOLVER_UTILS_EXPORT virtual void v_Execute(ostream &out = cout) = 0;
106 
107 
108  SOLVER_UTILS_EXPORT virtual Array<OneD, NekDouble> v_GetRealEvl(void);
109  SOLVER_UTILS_EXPORT virtual Array<OneD, NekDouble> v_GetImagEvl(void);
110 
111 
112  static std::string evolutionOperatorLookupIds[];
113  static std::string evolutionOperatorDef;
114  static std::string driverDefault;
115 
116  };
117 
118  inline void Driver::InitObject(ostream &out)
119  {
120  v_InitObject(out);
121  }
122 
123  inline void Driver::Execute(ostream &out)
124  {
125  v_Execute(out);
126  }
127 
128  inline Array<OneD, EquationSystemSharedPtr> Driver::GetEqu()
129  {
130  return m_equ;
131  }
132 
133  inline Array<OneD, NekDouble> Driver::GetRealEvl()
134  {
135  return v_GetRealEvl();
136  }
137 
138  inline Array<OneD, NekDouble> Driver::GetImagEvl()
139  {
140  return v_GetImagEvl();
141  }
142  }
143 } //end of namespace
144 
145 #endif //NEKTAR_SOLVERS_AUXILIARY_ADRBASE_H
146