Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NodalTriExp.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File NodalTriExp.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: Header for NodalTriExp routines
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NODALTRIEXP_H
37 #define NODALTRIEXP_H
38 
40 #include <SpatialDomains/TriGeom.h>
41 
42 #include <LocalRegions/MatrixKey.h>
45 
46 namespace Nektar
47 {
48  namespace LocalRegions
49  {
50 
51  class NodalTriExp: virtual public StdRegions::StdNodalTriExp, virtual public Expansion2D
52  {
53  public:
54  /** \brief Constructor using BasisKey class for quadrature
55  points and order definition */
57  const LibUtilities::BasisKey &Bb,
58  const LibUtilities::PointsType Ntype,
60 
61  /// Copy Constructor
62  LOCAL_REGIONS_EXPORT NodalTriExp(const NodalTriExp &T);
63 
64  /// Destructor
66 
67 
68  LOCAL_REGIONS_EXPORT void GetCoords(Array<OneD,NekDouble> &coords_1,
69  Array<OneD,NekDouble> &coords_2,
70  Array<OneD,NekDouble> &coords_3 = NullNekDouble1DArray);
71  LOCAL_REGIONS_EXPORT void GetCoord(const Array<OneD, const NekDouble>& Lcoords,
72  Array<OneD,NekDouble> &coords);
73 
74  //----------------------------
75  // Integration Methods
76  //----------------------------
77 
78  /// \brief Integrate the physical point list \a inarray over region
79  LOCAL_REGIONS_EXPORT NekDouble Integral(const Array<OneD, const NekDouble> &inarray);
80 
81  /** \brief Inner product of \a inarray over region with respect to the
82  expansion basis (this)->_Base[0] and return in \a outarray */
83  void IProductWRTBase(const Array<OneD, const NekDouble>& inarray,
84  Array<OneD, NekDouble> &outarray)
85  {
86  NodalTriExp::IProductWRTBase_SumFac(inarray,outarray);
87  }
88 
89  void IProductWRTDerivBase(const int dir,
90  const Array<OneD, const NekDouble>& inarray,
91  Array<OneD, NekDouble> & outarray)
92  {
93  NodalTriExp::IProductWRTDerivBase_SumFac(dir,inarray,outarray);
94  }
95 
96  //-----------------------------
97  // Differentiation Methods
98  //-----------------------------
99 
100  LOCAL_REGIONS_EXPORT void PhysDeriv(const Array<OneD, const NekDouble> &inarray,
101  Array<OneD, NekDouble> &out_d0,
102  Array<OneD, NekDouble> &out_d1,
103  Array<OneD, NekDouble> &out_d2 = NullNekDouble1DArray);
104 
105  //----------------------------
106  // Evaluations Methods
107  //---------------------------
108 
109  /** \brief Forward transform from physical quadrature space
110  stored in \a inarray and evaluate the expansion coefficients and
111  store in \a (this)->_coeffs */
112  LOCAL_REGIONS_EXPORT void FwdTrans(const Array<OneD, const NekDouble> &inarray,
113  Array<OneD, NekDouble> &outarray);
114 
116  const Array<OneD, const NekDouble> &coord,
117  const Array<OneD, const NekDouble> & physvals);
118 
119  void MassMatrixOp(const Array<OneD, const NekDouble> &inarray,
120  Array<OneD,NekDouble> &outarray,
121  const StdRegions::StdMatrixKey &mkey)
122  {
123  StdExpansion::MassMatrixOp_MatFree(inarray,outarray,mkey);
124  }
125 
126  void LaplacianMatrixOp(const Array<OneD, const NekDouble> &inarray,
127  Array<OneD,NekDouble> &outarray,
128  const StdRegions::StdMatrixKey &mkey)
129  {
131  }
132 
133  void LaplacianMatrixOp(const int k1, const int k2,
134  const Array<OneD, const NekDouble> &inarray,
135  Array<OneD,NekDouble> &outarray,
136  const StdRegions::StdMatrixKey &mkey)
137  {
138  StdExpansion::LaplacianMatrixOp_MatFree(k1,k2,inarray,outarray,mkey);
139  }
140 
141  void WeakDerivMatrixOp(const int i,
142  const Array<OneD, const NekDouble> &inarray,
143  Array<OneD,NekDouble> &outarray,
144  const StdRegions::StdMatrixKey &mkey)
145  {
146  StdExpansion::WeakDerivMatrixOp_MatFree(i,inarray,outarray,mkey);
147  }
148 
149  void HelmholtzMatrixOp(const Array<OneD, const NekDouble> &inarray,
150  Array<OneD,NekDouble> &outarray,
151  const StdRegions::StdMatrixKey &mkey)
152  {
154  }
155 
156  protected:
157 
161 
162  void IProductWRTBase_SumFac(const Array<OneD, const NekDouble>& inarray,
163  Array<OneD, NekDouble> &outarray);
164  void IProductWRTBase_MatOp(const Array<OneD, const NekDouble>& inarray,
165  Array<OneD, NekDouble> &outarray);
166 
167  void IProductWRTDerivBase_SumFac(const int dir,
168  const Array<OneD, const NekDouble>& inarray,
169  Array<OneD, NekDouble> & outarray);
170  void IProductWRTDerivBase_MatOp(const int dir,
171  const Array<OneD, const NekDouble>& inarray,
172  Array<OneD, NekDouble> & outarray);
173 
174 
175  void GeneralMatrixOp_MatOp(const Array<OneD, const NekDouble> &inarray,
176  Array<OneD,NekDouble> &outarray,
177  const StdRegions::StdMatrixKey &mkey);
178 
180 
181  private:
184 
185 
186  //virtual StdRegions::ExpansionType v_DetExpansionType() const
187  //{
188  // return DetExpansionType();
189  //}
190 
192  {
194  }
195 
196  virtual void v_GetCoords(Array<OneD, NekDouble> &coords_0,
197  Array<OneD, NekDouble> &coords_1 = NullNekDouble1DArray,
198  Array<OneD, NekDouble> &coords_2 = NullNekDouble1DArray)
199  {
200  GetCoords(coords_0, coords_1, coords_2);
201  }
202 
203  virtual void v_GetCoord(const Array<OneD, const NekDouble> &lcoord,
204  Array<OneD, NekDouble> &coord)
205  {
206  GetCoord(lcoord, coord);
207  }
208 
209  virtual void v_GetNodalPoints(Array<OneD, const NekDouble> &x,
210  Array<OneD, const NekDouble> &y)
211  {
212  return StdNodalTriExp::GetNodalPoints(x,y);
213  }
214 
215  /** \brief Virtual call to integrate the physical point list \a inarray
216  over region (see SegExp::Integral) */
217  virtual NekDouble v_Integral(const Array<OneD, const NekDouble> &inarray )
218  {
219  return Integral(inarray);
220  }
221 
222  /** \brief Virtual call to TriExp::IProduct_WRT_B */
223  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray,
224  Array<OneD, NekDouble> &outarray)
225  {
226  IProductWRTBase(inarray,outarray);
227  }
228 
229  virtual void v_IProductWRTDerivBase (const int dir,
230  const Array<OneD, const NekDouble> &inarray,
231  Array<OneD, NekDouble> &outarray)
232  {
233  IProductWRTDerivBase(dir,inarray,outarray);
234  }
235 
236  virtual void v_StdPhysDeriv(
237  const Array<OneD, const NekDouble> &inarray,
238  Array<OneD, NekDouble> &out_d0,
239  Array<OneD, NekDouble> &out_d1,
240  Array<OneD, NekDouble> &out_d2 = NullNekDouble1DArray)
241  {
242  StdTriExp::v_PhysDeriv(inarray, out_d0, out_d1, out_d2);
243  }
244 
245  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
246  Array<OneD, NekDouble> &out_d0,
247  Array<OneD, NekDouble> &out_d1,
248  Array<OneD, NekDouble> &out_d2 = NullNekDouble1DArray)
249  {
250  PhysDeriv(inarray, out_d0, out_d1);
251  }
252 
253  virtual void v_PhysDeriv(const int dir,
254  const Array<OneD, const NekDouble>& inarray,
255  Array<OneD, NekDouble> &outarray)
256  {
257  Array<OneD,NekDouble> tmp;
258  switch(dir)
259  {
260  case 0:
261  {
262  PhysDeriv(inarray, outarray, tmp);
263  }
264  break;
265  case 1:
266  {
267  PhysDeriv(inarray, tmp, outarray);
268  }
269  break;
270  default:
271  {
272  ASSERTL1(dir >= 0 &&dir < 2,"input dir is out of range");
273  }
274  break;
275  }
276  }
277 
278  /// Virtual call to SegExp::FwdTrans
279  virtual void v_FwdTrans(const Array<OneD, const NekDouble> &inarray,
280  Array<OneD, NekDouble> &outarray)
281  {
282  FwdTrans(inarray,outarray);
283  }
284 
285  /// Virtual call to TriExp::Evaluate
287  const Array<OneD, const NekDouble> &coord,
288  const Array<OneD, const NekDouble> &physvals)
289 
290  {
291  return PhysEvaluate(coord, physvals);
292  }
293 
295  {
296  return CreateStdMatrix(mkey);
297  }
298 
300  {
301  return m_matrixManager[mkey];
302  }
303 
304 // virtual DNekScalMatSharedPtr v_GetLocMatrix(const StdRegions::MatrixType mtype, NekDouble lambdaval, NekDouble tau)
305 // {
306 // MatrixKey mkey(mtype,DetExpansionType(),*this,lambdaval,tau);
307 // return m_matrixManager[mkey];
308 // }
309 
311  {
312  return m_staticCondMatrixManager[mkey];
313  }
314 
315  virtual void v_BwdTrans_SumFac(const Array<OneD, const NekDouble>& inarray,
316  Array<OneD, NekDouble> &outarray)
317  {
318  StdNodalTriExp::v_BwdTrans_SumFac(inarray,outarray);
319  }
320 
321  virtual void v_IProductWRTBase_SumFac(const Array<OneD, const NekDouble>& inarray,
322  Array<OneD, NekDouble> &outarray)
323  {
324  IProductWRTBase_SumFac(inarray,outarray);
325  }
326 
327  virtual void v_IProductWRTDerivBase_SumFac(const int dir,
328  const Array<OneD, const NekDouble>& inarray,
329  Array<OneD, NekDouble> &outarray)
330  {
331  IProductWRTDerivBase_SumFac(dir,inarray,outarray);
332  }
333 
334  virtual void v_MassMatrixOp(const Array<OneD, const NekDouble> &inarray,
335  Array<OneD,NekDouble> &outarray,
336  const StdRegions::StdMatrixKey &mkey)
337  {
338  MassMatrixOp(inarray,outarray,mkey);
339  }
340 
341  virtual void v_LaplacianMatrixOp(const Array<OneD, const NekDouble> &inarray,
342  Array<OneD,NekDouble> &outarray,
343  const StdRegions::StdMatrixKey &mkey)
344  {
345  LaplacianMatrixOp(inarray,outarray,mkey);
346  }
347 
348  virtual void v_LaplacianMatrixOp(const int k1, const int k2,
349  const Array<OneD, const NekDouble> &inarray,
350  Array<OneD,NekDouble> &outarray,
351  const StdRegions::StdMatrixKey &mkey)
352  {
353  LaplacianMatrixOp(k1,k2,inarray,outarray,mkey);
354  }
355 
356  virtual void v_WeakDerivMatrixOp(const int i,
357  const Array<OneD, const NekDouble> &inarray,
358  Array<OneD,NekDouble> &outarray,
359  const StdRegions::StdMatrixKey &mkey)
360  {
361  WeakDerivMatrixOp(i,inarray,outarray,mkey);
362  }
363 
364  virtual void v_HelmholtzMatrixOp(const Array<OneD, const NekDouble> &inarray,
365  Array<OneD,NekDouble> &outarray,
366  const StdRegions::StdMatrixKey &mkey)
367  {
368  HelmholtzMatrixOp(inarray,outarray,mkey);
369  }
370 
371  void v_ComputeEdgeNormal(const int edge);
372  };
373 
374  // type defines for use of TriExp in a boost vector
375  typedef boost::shared_ptr<NodalTriExp> NodalTriExpSharedPtr;
376  typedef std::vector< NodalTriExpSharedPtr > NodalTriExpVector;
378 
379  } //end of namespace
380 } //end of namespace
381 
382 #endif // NODALTRIEXP_H
383