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
47{
48namespace SolverUtils
49{
50
51class Driver;
52
53/// A shared pointer to a Driver object
54typedef std::shared_ptr<Driver> DriverSharedPtr;
55
56/// Datatype of the NekFactory used to instantiate classes derived from
57/// the Driver class.
58typedef LibUtilities::NekFactory<std::string, Driver,
62
64
65/// Base class for the development of solvers.
66class Driver
67{
68public:
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
80protected:
81 /// Communication object
83
84 /// Session reader object
86
87 /// Coupling between SFD and arnoldi
89
90 /// MeshGraph object
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.
105
106 /// Virtual function for initialisation implementation.
108 std::ostream &out = std::cout);
109
110 /// Virtual function for solve implementation.
112 std::ostream &out = std::cout) = 0;
113
114 static std::string evolutionOperatorLookupIds[];
115 static std::string evolutionOperatorDef;
116 static std::string driverDefault;
117};
118
119inline void Driver::InitObject(std::ostream &out)
120{
121 v_InitObject(out);
122}
123
124inline void Driver::Execute(std::ostream &out)
125{
126 v_Execute(out);
127}
128
130{
131 return m_equ;
132}
133
134} // namespace SolverUtils
135} // namespace Nektar
136
137#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
Coupling between SFD and arnoldi.
Definition: Driver.h:88
virtual ~Driver()
Destructor.
Definition: Driver.cpp:85
SOLVER_UTILS_EXPORT Array< OneD, EquationSystemSharedPtr > GetEqu()
Definition: Driver.h:129
LibUtilities::SessionReaderSharedPtr m_session
Session reader object.
Definition: Driver.h:85
virtual SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout)
Virtual function for initialisation implementation.
Definition: Driver.cpp:93
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:114
Driver(const LibUtilities::SessionReaderSharedPtr pSession, const SpatialDomains::MeshGraphSharedPtr pGraph)
Initialises EquationSystem class members.
Definition: Driver.cpp:76
LibUtilities::CommSharedPtr m_comm
Communication object.
Definition: Driver.h:82
SpatialDomains::MeshGraphSharedPtr m_graph
MeshGraph object.
Definition: Driver.h:91
SOLVER_UTILS_EXPORT void InitObject(std::ostream &out=std::cout)
Initialise Object.
Definition: Driver.h:119
enum EvolutionOperatorType m_EvolutionOperator
Evolution Operator.
Definition: Driver.h:100
Array< OneD, EquationSystemSharedPtr > m_equ
Equation system to solve.
Definition: Driver.h:94
static std::string driverDefault
Definition: Driver.h:116
int m_nequ
number of equations
Definition: Driver.h:97
SOLVER_UTILS_EXPORT void Execute(std::ostream &out=std::cout)
Execute driver.
Definition: Driver.h:124
static std::string evolutionOperatorDef
Definition: Driver.h:115
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:57
std::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
Definition: Driver.h:54
DriverFactory & GetDriverFactory()
Definition: Driver.cpp:67
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:176
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2