Nektar++
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TimeIntegrationSchemeOperators.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: TimeIntegrationOperators.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 /**
64  * @brief Binds a set of functions for use by time integration schemes.
65  */
67 {
68 public:
71 
72  typedef std::function<void(InArrayType &, OutArrayType &, const NekDouble)>
74  typedef std::function<void(InArrayType &, OutArrayType &, const NekDouble,
75  const NekDouble)>
77 
80 
83 
85  {
86  }
87 
88  template <typename FuncPointerT, typename ObjectPointerT>
89  void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
90  {
91  m_functors1[0] =
92  std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
93  std::placeholders::_3);
94  }
95 
96  template <typename FuncPointerT, typename ObjectPointerT>
97  void DefineOdeExplicitRhs(FuncPointerT func, ObjectPointerT obj)
98  {
99  m_functors1[1] =
100  std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
101  std::placeholders::_3);
102  }
103 
104  template <typename FuncPointerT, typename ObjectPointerT>
105  void DefineOdeImplicitRhs(FuncPointerT func, ObjectPointerT obj)
106  {
107  m_functors1[2] =
108  std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
109  std::placeholders::_3);
110  }
111 
112  template <typename FuncPointerT, typename ObjectPointerT>
113  void DefineProjection(FuncPointerT func, ObjectPointerT obj)
114  {
115  m_functors1[3] =
116  std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
117  std::placeholders::_3);
118  }
119 
120  template <typename FuncPointerT, typename ObjectPointerT>
121  void DefineImplicitSolve(FuncPointerT func, ObjectPointerT obj)
122  {
123  m_functors2[0] =
124  std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
125  std::placeholders::_3, std::placeholders::_4);
126  }
127 
128  inline void DoOdeRhs(InArrayType &inarray, OutArrayType &outarray,
129  const NekDouble time) const
130  {
131  ASSERTL1(m_functors1[0], "OdeRhs should be defined for this time "
132  "integration scheme");
133  m_functors1[0](inarray, outarray, time);
134  }
135 
136  inline void DoOdeExplicitRhs(InArrayType &inarray, OutArrayType &outarray,
137  const NekDouble time) const
138  {
139  ASSERTL1(m_functors1[1], "OdeExplicitRhs should be defined for this "
140  "time integration scheme");
141  m_functors1[1](inarray, outarray, time);
142  }
143 
144  inline void DoOdeImplicitRhs(InArrayType &inarray, OutArrayType &outarray,
145  const NekDouble time) const
146  {
147  ASSERTL1(m_functors1[2], "OdeImplictRhs should be defined for this "
148  "time integration scheme");
149  m_functors1[2](inarray, outarray, time);
150  }
151 
152  inline void DoProjection(InArrayType &inarray, OutArrayType &outarray,
153  const NekDouble time) const
154  {
155  ASSERTL1(m_functors1[3], "Projection operation should be defined for "
156  "this time integration scheme");
157  m_functors1[3](inarray, outarray, time);
158  }
159 
160  inline void DoImplicitSolve(InArrayType &inarray, OutArrayType &outarray,
161  const NekDouble time,
162  const NekDouble lambda) const
163  {
164  ASSERTL1(m_functors2[0], "ImplicitSolve should be defined for this "
165  "time integration scheme");
166  m_functors2[0](inarray, outarray, time, lambda);
167  }
168 
169 protected:
172 
173 private:
174 
175 };
176 
177 }
178 }
179 
180 #endif
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:250
Binds a set of functions for use by time integration schemes.
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
void DefineOdeExplicitRhs(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
void DoOdeExplicitRhs(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
void DefineOdeImplicitRhs(FuncPointerT func, ObjectPointerT obj)
std::function< void(InArrayType &, OutArrayType &, const NekDouble, const NekDouble)> FunctorType2
std::function< void(InArrayType &, OutArrayType &, const NekDouble)> FunctorType1
void DoOdeImplicitRhs(InArrayType &inarray, OutArrayType &outarray, const NekDouble time) const
std::shared_ptr< TimeIntegrationSchemeOperators > TimeIntegrationSchemeOperatorsSharedPtr
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
double NekDouble