Nektar++
TimeIntegrationSchemeOperators.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: TimeIntegrationSchemeOperators.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: Header file of time integration operators class
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_LIB_UTILITIES_TIME_INTEGRATION_TIME_INTEGRATION_SCHEME_OPERATORS
36 #define NEKTAR_LIB_UTILITIES_TIME_INTEGRATION_TIME_INTEGRATION_SCHEME_OPERATORS
37 
38 #include <string>
39 
40 #include <boost/core/ignore_unused.hpp>
41 
47 
48 ///////////////////////////////////////////////////////////////////////////////
49 
50 #define LUE LIB_UTILITIES_EXPORT
51 
52 namespace Nektar
53 {
54 namespace LibUtilities
55 {
56 
57 class TimeIntegrationSchemeOperators;
58 
59 typedef std::shared_ptr<TimeIntegrationSchemeOperators>
61 
62 /**
63  * @brief Binds a set of functions for use by time integration schemes.
64  */
66 {
67 public:
70 
71  typedef std::function<void(InArrayType &, OutArrayType &, const NekDouble)>
73  typedef std::function<void(InArrayType &, OutArrayType &, const NekDouble,
74  const NekDouble)>
76 
79 
82 
84  {
85  }
86 
87  template <typename FuncPointerT, typename ObjectPointerT>
88  void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
89  {
90  m_functors1[0] =
91  std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
92  std::placeholders::_3);
93  }
94 
95  template <typename FuncPointerT, typename ObjectPointerT>
96  void DefineProjection(FuncPointerT func, ObjectPointerT obj)
97  {
98  m_functors1[1] =
99  std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
100  std::placeholders::_3);
101  }
102 
103  template <typename FuncPointerT, typename ObjectPointerT>
104  void DefineImplicitSolve(FuncPointerT func, ObjectPointerT obj)
105  {
106  m_functors2[0] =
107  std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
108  std::placeholders::_3, std::placeholders::_4);
109  }
110 
111  inline void DoOdeRhs(InArrayType &inarray, OutArrayType &outarray,
112  const NekDouble time) const
113  {
114  ASSERTL1(m_functors1[0], "OdeRhs should be defined for this time "
115  "integration scheme");
116  m_functors1[0](inarray, outarray, time);
117  }
118 
119  inline void DoProjection(InArrayType &inarray, OutArrayType &outarray,
120  const NekDouble time) const
121  {
122  ASSERTL1(m_functors1[1], "Projection operation should be defined for "
123  "this time integration scheme");
124  m_functors1[1](inarray, outarray, time);
125  }
126 
127  inline void DoImplicitSolve(InArrayType &inarray, OutArrayType &outarray,
128  const NekDouble time,
129  const NekDouble lambda) const
130  {
131  ASSERTL1(m_functors2[0], "ImplicitSolve should be defined for this "
132  "time integration scheme");
133  m_functors2[0](inarray, outarray, time, lambda);
134  }
135 
136 protected:
139 
140 private:
141 };
142 
143 } // namespace LibUtilities
144 } // namespace Nektar
145 
146 #endif
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:249
Binds a set of functions for use by time integration schemes.
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
void DoImplicitSolve(InArrayType &inarray, OutArrayType &outarray, const NekDouble time, const NekDouble lambda) const
void DefineImplicitSolve(FuncPointerT func, ObjectPointerT obj)
void DoProjection(InArrayType &inarray, OutArrayType &outarray, const NekDouble time) const
const Array< OneD, const Array< OneD, NekDouble > > InArrayType
void DoOdeRhs(InArrayType &inarray, OutArrayType &outarray, const NekDouble time) const
std::function< void(InArrayType &, OutArrayType &, const NekDouble, const NekDouble)> FunctorType2
std::function< void(InArrayType &, OutArrayType &, const NekDouble)> FunctorType1
std::shared_ptr< TimeIntegrationSchemeOperators > TimeIntegrationSchemeOperatorsSharedPtr
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble