Nektar++
Interp.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Interp.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: Definition of interpolation routines
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_LIB_UTILTIES_FOUNDATIONS_INTERP_H
36 #define NEKTAR_LIB_UTILTIES_FOUNDATIONS_INTERP_H
37 
41 
42 //#include <LibUtilities/BasicUtils/BasicUtilsFwd.hpp> // for SharedArray
43 namespace Nektar
44 {
45 template <typename Dim, typename DataType> class Array;
46 }
47 
48 namespace Nektar
49 {
50 namespace LibUtilities
51 {
52 
53 // Physical Space Interpolation methods
54 
55 /** \brief this function interpolates a 1D function \f$f\f$ evaluated
56  * at the quadrature points of the basis \a fbasis0 to the
57  * function values at the quadrature points of the basis \a tbasis0
58  *
59  * Given a function \f$ f\f$ evaluated at the \a Q quadrature points
60  * of the basis \a fbasis0, this routine calculates, using
61  * \a (Q-1)th order polynomial interpolation, the function values
62  * at the \a Q2 quadrature points of the basis \a tbasis0.
63  *
64  * \param fbasis0 the basis at which's quadrature points the
65  * function is given
66  * \param from the array containg the function \f$ f\f$ evaluated
67  * at the quadrature points of \a fbasis0
68  * \param tbasis0 the basis to which's quadrature points the
69  * function should be interpolated
70  * \param to the array containg the function \f$ f\f$ evaluated
71  * at the quadrature points of \a tbasis0 (output of the function)
72  */
73 // 1D Interpolation
74 LIB_UTILITIES_EXPORT void Interp1D(const BasisKey &fbasis0,
75  const Array<OneD, const NekDouble> &from,
76  const BasisKey &tbasis0,
77  Array<OneD, NekDouble> &to);
78 
79 LIB_UTILITIES_EXPORT void Interp1D(const PointsKey &fpoints0,
80  const Array<OneD, const NekDouble> &from,
81  const PointsKey &tpoints0,
82  Array<OneD, NekDouble> &to);
83 
84 LIB_UTILITIES_EXPORT void Interp1D(const BasisKey &fbasis0,
85  const NekDouble *from,
86  const BasisKey &tbasis0, NekDouble *to);
87 
88 LIB_UTILITIES_EXPORT void Interp1D(const PointsKey &fpoints0,
89  const NekDouble *from,
90  const PointsKey &tpoints0, NekDouble *to);
91 
92 /** \brief this function interpolates a 2D function \f$f\f$ evaluated
93  * at the quadrature points of the 2D basis, constructed by
94  * \a fbasis0 and \a fbasis1, to the function values at the
95  * quadrature points of the 2D basis, constructed by \a tbasis0 and
96  * \a tbasis1
97  *
98  * Given a function \f$ f\f$ evaluated at the \a Q quadrature points
99  * of the first expansion basis, this routine calculates, using
100  * \a (Q-1)th order polynomial interpolation, the function values
101  * at the \a Q2 quadrature points of the second basis.
102  *
103  * \param fbasis0 the basis at which's quadrature points the
104  * function is given
105  * \param from the array containg the function \f$ f\f$ evaluated
106  * at the quadrature points of \a fbasis0
107  * \param tbasis0 the basis to which's quadrature points the
108  * function should be interpolated
109  * \param to the array containg the function \f$ f\f$ evaluated
110  * at the quadrature points of \a tbasis0 (output of the function)
111  */
112 // 2D Interpolation
113 LIB_UTILITIES_EXPORT void Interp2D(const BasisKey &fbasis0,
114  const BasisKey &fbasis1,
115  const Array<OneD, const NekDouble> &from,
116  const BasisKey &tbasis0,
117  const BasisKey &tbasis1,
118  Array<OneD, NekDouble> &to);
119 
120 LIB_UTILITIES_EXPORT void Interp2D(const PointsKey &fpoints0,
121  const PointsKey &fpoints1,
122  const Array<OneD, const NekDouble> &from,
123  const PointsKey &tpoints0,
124  const PointsKey &tpoints1,
125  Array<OneD, NekDouble> &to);
126 
127 LIB_UTILITIES_EXPORT void Interp2D(const PointsKey &fpoints0,
128  const PointsKey &fpoints1,
129  const NekDouble *from,
130  const PointsKey &tpoints0,
131  const PointsKey &tpoints1, NekDouble *to);
132 
133 /** \brief this function interpolates a 3D function \f$f\f$ evaluated
134  * at the quadrature points of the 3D basis, constructed by
135  * \a fbasis0, \a fbasis1, and \a fbasis2 to the function values at the
136  * quadrature points of the 3D basis, constructed by \a tbasis0,
137  * \a tbasis1, and \a tbasis2.
138  *
139  * Given a function \f$ f\f$ evaluated at the \a Q quadrature points
140  * of the first expansion basis, this routine calculates, using
141  * \a (Q-1)th order polynomial interpolation, the function values
142  * at the \a Q2 quadrature points of the second basis, and the function
143  * values at the \a Q3 quadrature points of the third basis.
144  *
145  * \param fbasis0 the basis at which's quadrature points the
146  * function is given
147  * \param from the array containg the function \f$ f\f$ evaluated
148  * at the quadrature points of \a fbasis0
149  * \param tbasis0 the basis to which's quadrature points the
150  * function should be interpolated
151  * \param to the array containg the function \f$ f\f$ evaluated
152  * at the quadrature points of \a tbasis0 (output of the function)
153  */
154 // 3D interpolation
156  const BasisKey &fbasis0, const BasisKey &fbasis1, const BasisKey &fbasis2,
157  const Array<OneD, const NekDouble> &from, const BasisKey &tbasis0,
158  const BasisKey &tbasis1, const BasisKey &tbasis2,
159  Array<OneD, NekDouble> &to);
160 
162  const PointsKey &fpoints0, const PointsKey &fpoints1,
163  const PointsKey &fpoints2, const Array<OneD, const NekDouble> &from,
164  const PointsKey &tpoints0, const PointsKey &tpoints1,
165  const PointsKey &tpoints2, Array<OneD, NekDouble> &to);
166 
168  const PointsKey &fpoints0, const PointsKey &fpoints1,
169  const PointsKey &fpoints2, const NekDouble *from, const PointsKey &tpoints0,
170  const PointsKey &tpoints1, const PointsKey &tpoints2, NekDouble *to);
171 
172 } // namespace LibUtilities
173 } // namespace Nektar
174 
175 #endif // FOUNDATIONS_H
#define LIB_UTILITIES_EXPORT
void Interp1D(const BasisKey &fbasis0, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, Array< OneD, NekDouble > &to)
this function interpolates a 1D function evaluated at the quadrature points of the basis fbasis0 to ...
Definition: Interp.cpp:52
void Interp3D(const BasisKey &fbasis0, const BasisKey &fbasis1, const BasisKey &fbasis2, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, const BasisKey &tbasis2, Array< OneD, NekDouble > &to)
this function interpolates a 3D function evaluated at the quadrature points of the 3D basis,...
Definition: Interp.cpp:167
void Interp2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
this function interpolates a 2D function evaluated at the quadrature points of the 2D basis,...
Definition: Interp.cpp:106
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble