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.
57 typedef LibUtilities::NekFactory<std::string, Filter,
59  const std::weak_ptr<EquationSystem> &,
60  const std::map<std::string, std::string> &>
63 
64 class Filter
65 {
66 public:
67  typedef std::map<std::string, std::string> ParamMap;
70  const std::weak_ptr<EquationSystem> &pEquation);
71  SOLVER_UTILS_EXPORT virtual ~Filter();
72 
73  SOLVER_UTILS_EXPORT inline void Initialise(
75  const NekDouble &time);
76  SOLVER_UTILS_EXPORT inline void Update(
78  const NekDouble &time);
79  SOLVER_UTILS_EXPORT inline void Finalise(
81  const NekDouble &time);
83 
84 protected:
86  const std::weak_ptr<EquationSystem> m_equ;
87 
88  virtual void v_Initialise(
90  const NekDouble &time) = 0;
91  virtual void v_Update(
93  const NekDouble &time) = 0;
94  virtual void v_Finalise(
96  const NekDouble &time) = 0;
97  virtual bool v_IsTimeDependent() = 0;
98 };
99 
100 inline void Filter::Initialise(
102  const NekDouble &time)
103 {
104  v_Initialise(pFields, time);
105 }
106 
107 inline void Filter::Update(
109  const NekDouble &time)
110 {
111  v_Update(pFields, time);
112 }
113 
114 inline void Filter::Finalise(
116  const NekDouble &time)
117 {
118  v_Finalise(pFields, time);
119 }
120 
122 {
123  return v_IsTimeDependent();
124 }
125 } // namespace SolverUtils
126 } // namespace Nektar
127 #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:114
LibUtilities::SessionReaderSharedPtr m_session
Definition: Filter.h:85
const std::weak_ptr< EquationSystem > m_equ
Definition: Filter.h:86
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:47
SOLVER_UTILS_EXPORT void Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Definition: Filter.h:100
SOLVER_UTILS_EXPORT bool IsTimeDependent()
Definition: Filter.h:121
virtual bool v_IsTimeDependent()=0
virtual SOLVER_UTILS_EXPORT ~Filter()
Definition: Filter.cpp:53
std::map< std::string, std::string > ParamMap
Definition: Filter.h:67
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:107
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
Definition: Filter.h:50
FilterFactory & GetFilterFactory()
Definition: Filter.cpp:41
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:61
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble