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
45
46///////////////////////////////////////////////////////////////////////////////
47
48#define LUE LIB_UTILITIES_EXPORT
49
51{
52
53class TimeIntegrationSchemeOperators;
54
55typedef std::shared_ptr<TimeIntegrationSchemeOperators>
57
58/**
59 * @brief Binds a set of functions for use by time integration schemes.
60 */
62{
63public:
66
67 typedef std::function<void(InArrayType &, OutArrayType &, const NekDouble)>
69 typedef std::function<void(InArrayType &, OutArrayType &, const NekDouble,
70 const NekDouble)>
72
75
78
80 {
81 }
82
83 template <typename FuncPointerT, typename ObjectPointerT>
84 void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
85 {
86 m_functors1[0] =
87 std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
88 std::placeholders::_3);
89 }
90
91 template <typename FuncPointerT, typename ObjectPointerT>
92 void DefineProjection(FuncPointerT func, ObjectPointerT obj)
93 {
94 m_functors1[1] =
95 std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
96 std::placeholders::_3);
97 }
98
99 template <typename FuncPointerT, typename ObjectPointerT>
100 void DefineImplicitSolve(FuncPointerT func, ObjectPointerT obj)
101 {
102 m_functors2[0] =
103 std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
104 std::placeholders::_3, std::placeholders::_4);
105 }
106
107 inline void DoOdeRhs(InArrayType &inarray, OutArrayType &outarray,
108 const NekDouble time) const
109 {
110 ASSERTL1(m_functors1[0], "OdeRhs should be defined for this time "
111 "integration scheme");
112 m_functors1[0](inarray, outarray, time);
113 }
114
115 inline void DoProjection(InArrayType &inarray, OutArrayType &outarray,
116 const NekDouble time) const
117 {
118 ASSERTL1(m_functors1[1], "Projection operation should be defined for "
119 "this time integration scheme");
120 m_functors1[1](inarray, outarray, time);
121 }
122
123 inline void DoImplicitSolve(InArrayType &inarray, OutArrayType &outarray,
124 const NekDouble time,
125 const NekDouble lambda) const
126 {
127 ASSERTL1(m_functors2[0], "ImplicitSolve should be defined for this "
128 "time integration scheme");
129 m_functors2[0](inarray, outarray, time, lambda);
130 }
131
132protected:
135
136private:
137};
138
139} // namespace Nektar::LibUtilities
140
141#endif
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
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
double NekDouble