Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StdExpansion2D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File StdExpansion2D.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: Daughter of StdExpansion. This class contains routine
33 // which are common to 2D expansion. Typically this inolves physiocal
34 // space operations.
35 //
36 ///////////////////////////////////////////////////////////////////////////////
37 
38 #ifndef STDEXP2D_H
39 #define STDEXP2D_H
40 
43 
44 namespace Nektar
45 {
46 namespace StdRegions
47 {
48 
49  class StdExpansion2D: virtual public StdExpansion
50  {
51  public:
54  const LibUtilities::BasisKey &Bb);
55  STD_REGIONS_EXPORT StdExpansion2D(const StdExpansion2D &T);
57 
58  // Generic operations in different element
59 
60  /** \brief Calculate the 2D derivative in the local
61  * tensor/collapsed coordinate at the physical points
62  *
63  * This function is independent of the expansion basis and can
64  * therefore be defined for all tensor product distribution of
65  * quadrature points in a generic manner. The key operations are:
66  *
67  * - \f$ \frac{d}{d\eta_1} \rightarrow {\bf D^T_0 u } \f$ \n
68  * - \f$ \frac{d}{d\eta_2} \rightarrow {\bf D_1 u } \f$
69  *
70  * \param inarray array of physical points to be differentiated
71  * \param outarray_d0 the resulting array of derivative in the
72  * \f$\eta_1\f$ direction will be stored in outarray_d0 as output
73  * of the function
74  * \param outarray_d1 the resulting array of derivative in the
75  * \f$\eta_2\f$ direction will be stored in outarray_d1 as output
76  * of the function
77  *
78  * Recall that:
79  * \f$
80  * \hspace{1cm} \begin{array}{llll}
81  * \mbox{Shape} & \mbox{Cartesian coordinate range} &
82  * \mbox{Collapsed coord.} &
83  * \mbox{Collapsed coordinate definition}\\
84  * \mbox{Quadrilateral} & -1 \leq \xi_1,\xi_2 \leq 1
85  * & -1 \leq \eta_1,\eta_2 \leq 1
86  * & \eta_1 = \xi_1, \eta_2 = \xi_2\\
87  * \mbox{Triangle} & -1 \leq \xi_1,\xi_2; \xi_1+\xi_2 \leq 0
88  * & -1 \leq \eta_1,\eta_2 \leq 1
89  * & \eta_1 = \frac{2(1+\xi_1)}{(1-\xi_2)}-1, \eta_2 = \xi_2 \\
90  * \end{array} \f$
91  */
93  const Array<OneD, const NekDouble>& inarray,
94  Array<OneD, NekDouble> &outarray_d0,
95  Array<OneD, NekDouble> &outarray_d1);
96 
98  const Array<OneD, const NekDouble>& inarray,
99  const Array<OneD, const NekDouble>& w0,
100  const Array<OneD, const NekDouble>& w1);
101 
103  const Array<OneD, const NekDouble>& base0,
104  const Array<OneD, const NekDouble>& base1,
105  const Array<OneD, const NekDouble>& inarray,
106  Array<OneD, NekDouble> &outarray,
107  Array<OneD, NekDouble> &wsp,
108  bool doCheckCollDir0 = true,
109  bool doCheckCollDir1 = true);
110 
112  const Array<OneD, const NekDouble>& base0,
113  const Array<OneD, const NekDouble>& base1,
114  const Array<OneD, const NekDouble>& inarray,
115  Array<OneD, NekDouble> &outarray,
116  Array<OneD, NekDouble> &wsp,
117  bool doCheckCollDir0 = true,
118  bool doCheckCollDir1 = true);
119 
120  protected:
121 
122  /** \brief This function evaluates the expansion at a single
123  * (arbitrary) point of the domain
124  *
125  * This function is a wrapper around the virtual function
126  * \a v_PhysEvaluate()
127  *
128  * Based on the value of the expansion at the quadrature points,
129  * this function calculates the value of the expansion at an
130  * arbitrary single points (with coordinates \f$ \mathbf{x_c}\f$
131  * given by the pointer \a coords). This operation, equivalent to
132  * \f[ u(\mathbf{x_c}) = \sum_p \phi_p(\mathbf{x_c}) \hat{u}_p \f]
133  * is evaluated using Lagrangian interpolants through the quadrature
134  * points:
135  * \f[ u(\mathbf{x_c}) = \sum_p h_p(\mathbf{x_c}) u_p\f]
136  *
137  * This function requires that the physical value array
138  * \f$\mathbf{u}\f$ (implemented as the attribute #m_phys)
139  * is set.
140  *
141  * \param coords the coordinates of the single point
142  * \return returns the value of the expansion at the single point
143  */
145  const Array<OneD, const NekDouble>& coords,
146  const Array<OneD, const NekDouble>& physvals);
147 
149  const Array<OneD, DNekMatSharedPtr>& I,
150  const Array<OneD, const NekDouble> & physvals);
151 
153  const Array<OneD, const NekDouble>& base0,
154  const Array<OneD, const NekDouble>& base1,
155  const Array<OneD, const NekDouble>& inarray,
156  Array<OneD, NekDouble> &outarray,
157  Array<OneD, NekDouble> &wsp,
158  bool doCheckCollDir0,
159  bool doCheckCollDir1) = 0;
160 
162  const Array<OneD, const NekDouble>& base0,
163  const Array<OneD, const NekDouble>& base1,
164  const Array<OneD, const NekDouble>& inarray,
165  Array<OneD, NekDouble> &outarray,
166  Array<OneD, NekDouble> &wsp,
167  bool doCheckCollDir0,
168  bool doCheckCollDir1) = 0;
169 
171  const Array<OneD, const NekDouble> &inarray,
172  Array<OneD, NekDouble> &outarray,
173  const StdRegions::StdMatrixKey &mkey);
175  const Array<OneD, const NekDouble> &inarray,
176  Array<OneD, NekDouble> &outarray,
177  const StdRegions::StdMatrixKey &mkey);
178 
179  private:
180 
181  // Virtual Functions ----------------------------------------
182  virtual int v_GetShapeDimension() const
183  {
184  return 2;
185  }
186 
187  virtual int v_GetNfaces() const
188  {
189  return 0;
190  }
191 
192  virtual int v_GetCoordim(void)
193  {
194  return 2;
195  }
196  };
197 
198  typedef boost::shared_ptr<StdExpansion2D> StdExpansion2DSharedPtr;
199 
200 } //end of namespace
201 } //end of namespace
202 
203 #endif //STDEXP2D_H