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
42
44
45namespace Nektar::SolverUtils
46{
47class Filter;
48class EquationSystem;
49
50/// A shared pointer to a Driver object
51typedef std::shared_ptr<Filter> FilterSharedPtr;
52
53/// Datatype of the NekFactory used to instantiate classes derived from
54/// the Driver class.
55typedef LibUtilities::NekFactory<std::string, Filter,
57 const std::shared_ptr<EquationSystem> &,
58 const std::map<std::string, std::string> &>
61
62class Filter
63{
64public:
65 typedef std::map<std::string, std::string> ParamMap;
68 const std::shared_ptr<EquationSystem> &pEquation);
70
73 const NekDouble &time);
74 SOLVER_UTILS_EXPORT inline void Update(
76 const NekDouble &time);
77 SOLVER_UTILS_EXPORT inline void Finalise(
79 const NekDouble &time);
81
82protected:
84 const std::weak_ptr<EquationSystem> m_equ;
85
86 virtual void v_Initialise(
88 const NekDouble &time) = 0;
89 virtual void v_Update(
91 const NekDouble &time) = 0;
92 virtual void v_Finalise(
94 const NekDouble &time) = 0;
95 virtual bool v_IsTimeDependent() = 0;
96};
97
100 const NekDouble &time)
101{
102 v_Initialise(pFields, time);
103}
104
105inline void Filter::Update(
107 const NekDouble &time)
108{
109 v_Update(pFields, time);
110}
111
114 const NekDouble &time)
115{
116 v_Finalise(pFields, time);
117}
118
120{
121 return v_IsTimeDependent();
122}
123} // namespace Nektar::SolverUtils
124#endif /* NEKTAR_SOLVERUTILS_FILTER_FILTER_H */
#define SOLVER_UTILS_EXPORT
Provides a generic Factory class.
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:112
LibUtilities::SessionReaderSharedPtr m_session
Definition: Filter.h:83
const std::weak_ptr< EquationSystem > m_equ
Definition: Filter.h:84
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)=0
SOLVER_UTILS_EXPORT void Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Definition: Filter.h:98
SOLVER_UTILS_EXPORT Filter(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< EquationSystem > &pEquation)
SOLVER_UTILS_EXPORT bool IsTimeDependent()
Definition: Filter.h:119
virtual bool v_IsTimeDependent()=0
virtual SOLVER_UTILS_EXPORT ~Filter()
std::map< std::string, std::string > ParamMap
Definition: Filter.h:65
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:105
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
Definition: Filter.h:51
FilterFactory & GetFilterFactory()
LibUtilities::NekFactory< std::string, Filter, const LibUtilities::SessionReaderSharedPtr &, const std::shared_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:59
double NekDouble