Nektar++
Filter.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File Filter.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 filters.
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_SOLVERUTILS_FILTER_FILTER_H
36 #define NEKTAR_SOLVERUTILS_FILTER_FILTER_H
37 
40 #include <MultiRegions/ExpList.h>
42 
44 
45 namespace Nektar
46 {
47 namespace SolverUtils
48 {
49 class Filter;
50 class EquationSystem;
51 
52 /// A shared pointer to a Driver object
53 typedef std::shared_ptr<Filter> FilterSharedPtr;
54 
55 /// Datatype of the NekFactory used to instantiate classes derived from
56 /// the Driver class.
58  std::string, Filter,
60  const std::weak_ptr<EquationSystem>&,
61  const std::map<std::string, std::string>&
64 
65 class Filter
66 {
67 public:
68  typedef std::map<std::string, std::string> ParamMap;
71  const std::weak_ptr<EquationSystem> &pEquation);
72  SOLVER_UTILS_EXPORT virtual ~Filter();
73 
74  SOLVER_UTILS_EXPORT inline void Initialise(
76  const NekDouble &time);
77  SOLVER_UTILS_EXPORT inline void Update(
79  const NekDouble &time);
80  SOLVER_UTILS_EXPORT inline void Finalise(
82  const NekDouble &time);
84 
85 protected:
87  const std::weak_ptr<EquationSystem> m_equ;
88 
89  virtual void v_Initialise(
91  const NekDouble &time) = 0;
92  virtual void v_Update(
94  const NekDouble &time) = 0;
95  virtual void v_Finalise(
97  const NekDouble &time) = 0;
98  virtual bool v_IsTimeDependent() = 0;
99 };
100 
101 inline void Filter::Initialise(
103  const NekDouble &time)
104 {
105  v_Initialise(pFields, time);
106 }
107 
108 inline void Filter::Update(
110  const NekDouble &time)
111 {
112  v_Update(pFields, time);
113 }
114 
115 inline void Filter::Finalise(
117  const NekDouble &time)
118 {
119  v_Finalise(pFields, time);
120 }
121 
123 {
124  return v_IsTimeDependent();
125 }
126 }
127 }
128 #endif /* NEKTAR_SOLVERUTILS_FILTER_FILTER_H */
#define SOLVER_UTILS_EXPORT
Provides a generic Factory class.
Definition: NekFactory.hpp:105
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)=0
SOLVER_UTILS_EXPORT void Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Definition: Filter.h:115
LibUtilities::SessionReaderSharedPtr m_session
Definition: Filter.h:86
const std::weak_ptr< EquationSystem > m_equ
Definition: Filter.h:87
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)=0
SOLVER_UTILS_EXPORT Filter(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation)
Definition: Filter.cpp:48
SOLVER_UTILS_EXPORT void Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Definition: Filter.h:101
SOLVER_UTILS_EXPORT bool IsTimeDependent()
Definition: Filter.h:122
virtual bool v_IsTimeDependent()=0
virtual SOLVER_UTILS_EXPORT ~Filter()
Definition: Filter.cpp:55
std::map< std::string, std::string > ParamMap
Definition: Filter.h:68
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)=0
SOLVER_UTILS_EXPORT void Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Definition: Filter.h:108
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
Definition: Filter.h:50
LibUtilities::NekFactory< std::string, Filter, const LibUtilities::SessionReaderSharedPtr &, const std::weak_ptr< EquationSystem > &, const std::map< std::string, std::string > & > FilterFactory
Datatype of the NekFactory used to instantiate classes derived from the Driver class.
Definition: Filter.h:62
FilterFactory & GetFilterFactory()
Definition: Filter.cpp:41
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
double NekDouble