Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Definition of interpolation routines
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIB_UTILTIES_FOUNDATIONS_INTERP_H
37 #define NEKTAR_LIB_UTILTIES_FOUNDATIONS_INTERP_H
38 
42 
43 //#include <LibUtilities/BasicUtils/BasicUtilsFwd.hpp> // for SharedArray
44 namespace Nektar { template <typename Dim, typename DataType> class Array; }
45 
46 
47 namespace Nektar
48 {
49  namespace LibUtilities
50  {
51 
52  // Physical Space Interpolation methods
53 
54 
55 
56  /** \brief this function interpolates a 1D function \f$f\f$ evaluated
57  * at the quadrature points of the basis \a fbasis0 to the
58  * function values at the quadrature points of the basis \a tbasis0
59  *
60  * Given a function \f$ f\f$ evaluated at the \a Q quadrature points
61  * of the basis \a fbasis0, this routine calculates, using
62  * \a (Q-1)th order polynomial interpolation, the function values
63  * at the \a Q2 quadrature points of the basis \a tbasis0.
64  *
65  * \param fbasis0 the basis at which's quadrature points the
66  * function is given
67  * \param from the array containg the function \f$ f\f$ evaluated
68  * at the quadrature points of \a fbasis0
69  * \param tbasis0 the basis to which's quadrature points the
70  * function should be interpolated
71  * \param to the array containg the function \f$ f\f$ evaluated
72  * at the quadrature points of \a tbasis0 (output of the function)
73  */
74  // 1D Interpolation
75  LIB_UTILITIES_EXPORT void Interp1D(const BasisKey &fbasis0,
76  const Array<OneD, const NekDouble>& from,
77  const BasisKey &tbasis0,
78  Array<OneD, NekDouble> &to);
79 
80  LIB_UTILITIES_EXPORT void Interp1D(const PointsKey &fpoints0,
81  const Array<OneD, const NekDouble>& from,
82  const PointsKey &tpoints0,
83  Array<OneD, NekDouble> &to);
84 
85  LIB_UTILITIES_EXPORT void Interp1D(const BasisKey &fbasis0,
86  const NekDouble *from,
87  const BasisKey &tbasis0,
88  NekDouble *to);
89 
90  LIB_UTILITIES_EXPORT void Interp1D(const PointsKey &fpoints0,
91  const NekDouble *from,
92  const PointsKey &tpoints0,
93  NekDouble *to);
94 
95 
96  /** \brief this function interpolates a 2D function \f$f\f$ evaluated
97  * at the quadrature points of the 2D basis, constructed by
98  * \a fbasis0 and \a fbasis1, to the function values at the
99  * quadrature points of the 2D basis, constructed by \a tbasis0 and
100  * \a tbasis1
101  *
102  * Given a function \f$ f\f$ evaluated at the \a Q quadrature points
103  * of the first expansion basis, this routine calculates, using
104  * \a (Q-1)th order polynomial interpolation, the function values
105  * at the \a Q2 quadrature points of the second basis.
106  *
107  * \param fbasis0 the basis at which's quadrature points the
108  * function is given
109  * \param from the array containg the function \f$ f\f$ evaluated
110  * at the quadrature points of \a fbasis0
111  * \param tbasis0 the basis to which's quadrature points the
112  * function should be interpolated
113  * \param to the array containg the function \f$ f\f$ evaluated
114  * at the quadrature points of \a tbasis0 (output of the function)
115  */
116  // 2D Interpolation
117  LIB_UTILITIES_EXPORT void Interp2D(const BasisKey &fbasis0,
118  const BasisKey &fbasis1,
119  const Array<OneD, const NekDouble>& from,
120  const BasisKey &tbasis0,
121  const BasisKey &tbasis1,
122  Array<OneD, NekDouble> &to);
123 
124  LIB_UTILITIES_EXPORT void Interp2D(const PointsKey &fpoints0,
125  const PointsKey &fpoints1,
126  const Array<OneD, const NekDouble>& from,
127  const PointsKey &tpoints0,
128  const PointsKey &tpoints1,
129  Array<OneD, NekDouble> &to);
130 
131  LIB_UTILITIES_EXPORT void Interp2D(const PointsKey &fpoints0,
132  const PointsKey &fpoints1,
133  const NekDouble *from,
134  const PointsKey &tpoints0,
135  const PointsKey &tpoints1,
136  NekDouble *to);
137 
138 
139  /** \brief this function interpolates a 3D function \f$f\f$ evaluated
140  * at the quadrature points of the 3D basis, constructed by
141  * \a fbasis0, \a fbasis1, and \a fbasis2 to the function values at the
142  * quadrature points of the 3D basis, constructed by \a tbasis0,
143  * \a tbasis1, and \a tbasis2.
144  *
145  * Given a function \f$ f\f$ evaluated at the \a Q quadrature points
146  * of the first expansion basis, this routine calculates, using
147  * \a (Q-1)th order polynomial interpolation, the function values
148  * at the \a Q2 quadrature points of the second basis, and the function
149  * values at the \a Q3 quadrature points of the third basis.
150  *
151  * \param fbasis0 the basis at which's quadrature points the
152  * function is given
153  * \param from the array containg the function \f$ f\f$ evaluated
154  * at the quadrature points of \a fbasis0
155  * \param tbasis0 the basis to which's quadrature points the
156  * function should be interpolated
157  * \param to the array containg the function \f$ f\f$ evaluated
158  * at the quadrature points of \a tbasis0 (output of the function)
159  */
160  // 3D interpolation
161  LIB_UTILITIES_EXPORT void Interp3D(const BasisKey &fbasis0,
162  const BasisKey &fbasis1,
163  const BasisKey &fbasis2,
164  const Array<OneD, const NekDouble>& from,
165  const BasisKey &tbasis0,
166  const BasisKey &tbasis1,
167  const BasisKey &tbasis2,
168  Array<OneD, NekDouble> &to);
169 
170 
171  LIB_UTILITIES_EXPORT void Interp3D(const PointsKey &fpoints0,
172  const PointsKey &fpoints1,
173  const PointsKey &fpoints2,
174  const Array<OneD, const NekDouble>& from,
175  const PointsKey &tpoints0,
176  const PointsKey &tpoints1,
177  const PointsKey &tpoints2,
178  Array<OneD, NekDouble> &to);
179 
180  LIB_UTILITIES_EXPORT void Interp3D(const PointsKey &fpoints0,
181  const PointsKey &fpoints1,
182  const PointsKey &fpoints2,
183  const NekDouble *from,
184  const PointsKey &tpoints0,
185  const PointsKey &tpoints1,
186  const PointsKey &tpoints2,
187  NekDouble *to);
188 
189 
190 
191  } // end of namespace
192 } // end of namespace
193 
194 #endif //FOUNDATIONS_H
195