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 { template <typename Dim, typename DataType> class Array; }
44 
45 
46 namespace Nektar
47 {
48  namespace LibUtilities
49  {
50 
51  // Physical Space Interpolation methods
52 
53 
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,
87  NekDouble *to);
88 
89  LIB_UTILITIES_EXPORT void Interp1D(const PointsKey &fpoints0,
90  const NekDouble *from,
91  const PointsKey &tpoints0,
92  NekDouble *to);
93 
94 
95  /** \brief this function interpolates a 2D function \f$f\f$ evaluated
96  * at the quadrature points of the 2D basis, constructed by
97  * \a fbasis0 and \a fbasis1, to the function values at the
98  * quadrature points of the 2D basis, constructed by \a tbasis0 and
99  * \a tbasis1
100  *
101  * Given a function \f$ f\f$ evaluated at the \a Q quadrature points
102  * of the first expansion basis, this routine calculates, using
103  * \a (Q-1)th order polynomial interpolation, the function values
104  * at the \a Q2 quadrature points of the second basis.
105  *
106  * \param fbasis0 the basis at which's quadrature points the
107  * function is given
108  * \param from the array containg the function \f$ f\f$ evaluated
109  * at the quadrature points of \a fbasis0
110  * \param tbasis0 the basis to which's quadrature points the
111  * function should be interpolated
112  * \param to the array containg the function \f$ f\f$ evaluated
113  * at the quadrature points of \a tbasis0 (output of the function)
114  */
115  // 2D Interpolation
116  LIB_UTILITIES_EXPORT void Interp2D(const BasisKey &fbasis0,
117  const BasisKey &fbasis1,
118  const Array<OneD, const NekDouble>& from,
119  const BasisKey &tbasis0,
120  const BasisKey &tbasis1,
121  Array<OneD, NekDouble> &to);
122 
123  LIB_UTILITIES_EXPORT void Interp2D(const PointsKey &fpoints0,
124  const PointsKey &fpoints1,
125  const Array<OneD, const NekDouble>& from,
126  const PointsKey &tpoints0,
127  const PointsKey &tpoints1,
128  Array<OneD, NekDouble> &to);
129 
130  LIB_UTILITIES_EXPORT void Interp2D(const PointsKey &fpoints0,
131  const PointsKey &fpoints1,
132  const NekDouble *from,
133  const PointsKey &tpoints0,
134  const PointsKey &tpoints1,
135  NekDouble *to);
136 
137 
138  /** \brief this function interpolates a 3D function \f$f\f$ evaluated
139  * at the quadrature points of the 3D basis, constructed by
140  * \a fbasis0, \a fbasis1, and \a fbasis2 to the function values at the
141  * quadrature points of the 3D basis, constructed by \a tbasis0,
142  * \a tbasis1, and \a tbasis2.
143  *
144  * Given a function \f$ f\f$ evaluated at the \a Q quadrature points
145  * of the first expansion basis, this routine calculates, using
146  * \a (Q-1)th order polynomial interpolation, the function values
147  * at the \a Q2 quadrature points of the second basis, and the function
148  * values at the \a Q3 quadrature points of the third basis.
149  *
150  * \param fbasis0 the basis at which's quadrature points the
151  * function is given
152  * \param from the array containg the function \f$ f\f$ evaluated
153  * at the quadrature points of \a fbasis0
154  * \param tbasis0 the basis to which's quadrature points the
155  * function should be interpolated
156  * \param to the array containg the function \f$ f\f$ evaluated
157  * at the quadrature points of \a tbasis0 (output of the function)
158  */
159  // 3D interpolation
160  LIB_UTILITIES_EXPORT void Interp3D(const BasisKey &fbasis0,
161  const BasisKey &fbasis1,
162  const BasisKey &fbasis2,
163  const Array<OneD, const NekDouble>& from,
164  const BasisKey &tbasis0,
165  const BasisKey &tbasis1,
166  const BasisKey &tbasis2,
167  Array<OneD, NekDouble> &to);
168 
169 
170  LIB_UTILITIES_EXPORT void Interp3D(const PointsKey &fpoints0,
171  const PointsKey &fpoints1,
172  const PointsKey &fpoints2,
173  const Array<OneD, const NekDouble>& from,
174  const PointsKey &tpoints0,
175  const PointsKey &tpoints1,
176  const PointsKey &tpoints2,
177  Array<OneD, NekDouble> &to);
178 
179  LIB_UTILITIES_EXPORT void Interp3D(const PointsKey &fpoints0,
180  const PointsKey &fpoints1,
181  const PointsKey &fpoints2,
182  const NekDouble *from,
183  const PointsKey &tpoints0,
184  const PointsKey &tpoints1,
185  const PointsKey &tpoints2,
186  NekDouble *to);
187 
188 
189 
190  } // end of namespace
191 } // end of namespace
192 
193 #endif //FOUNDATIONS_H
194 
#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:53
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:185
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:115
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
double NekDouble