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 
69  Array<OneD,NekDouble> &coords_2,
72  Array<OneD,NekDouble> &coords);
73 
74  //----------------------------
75  // Integration Methods
76  //----------------------------
77 
78  /// \brief Integrate the physical point list \a inarray over region
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 */
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 
101  Array<OneD, NekDouble> &out_d0,
102  Array<OneD, NekDouble> &out_d1,
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 */
113  Array<OneD, NekDouble> &outarray);
114 
116  const Array<OneD, const NekDouble> &coord,
117  const Array<OneD, const NekDouble> & physvals);
118 
120  Array<OneD,NekDouble> &outarray,
121  const StdRegions::StdMatrixKey &mkey)
122  {
123  StdExpansion::MassMatrixOp_MatFree(inarray,outarray,mkey);
124  }
125 
127  Array<OneD,NekDouble> &outarray,
128  const StdRegions::StdMatrixKey &mkey)
129  {
130  StdExpansion::LaplacianMatrixOp_MatFree_GenericImpl(inarray,outarray,mkey);
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 
150  Array<OneD,NekDouble> &outarray,
151  const StdRegions::StdMatrixKey &mkey)
152  {
153  StdExpansion::HelmholtzMatrixOp_MatFree_GenericImpl(inarray,outarray,mkey);
154  }
155 
156  protected:
157 
161 
163  Array<OneD, NekDouble> &outarray,
164  bool multiplybyweights = true);
166  Array<OneD, NekDouble> &outarray);
167 
168  void IProductWRTDerivBase_SumFac(const int dir,
169  const Array<OneD, const NekDouble>& inarray,
170  Array<OneD, NekDouble> & outarray);
171  void IProductWRTDerivBase_MatOp(const int dir,
172  const Array<OneD, const NekDouble>& inarray,
173  Array<OneD, NekDouble> & outarray);
174 
175 
177  Array<OneD,NekDouble> &outarray,
178  const StdRegions::StdMatrixKey &mkey);
179 
181 
183 
184  private:
187 
188 
189  //virtual StdRegions::ExpansionType v_DetExpansionType() const
190  //{
191  // return DetExpansionType();
192  //}
193 
195  {
196  return StdNodalTriExp::GenNBasisTransMatrix();
197  }
198 
199  virtual void v_GetCoords(Array<OneD, NekDouble> &coords_0,
202  {
203  GetCoords(coords_0, coords_1, coords_2);
204  }
205 
206  virtual void v_GetCoord(const Array<OneD, const NekDouble> &lcoord,
207  Array<OneD, NekDouble> &coord)
208  {
209  GetCoord(lcoord, coord);
210  }
211 
214  {
215  return StdNodalTriExp::GetNodalPoints(x,y);
216  }
217 
218  /** \brief Virtual call to integrate the physical point list \a inarray
219  over region (see SegExp::Integral) */
221  {
222  return Integral(inarray);
223  }
224 
225  /** \brief Virtual call to TriExp::IProduct_WRT_B */
226  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray,
227  Array<OneD, NekDouble> &outarray)
228  {
229  IProductWRTBase(inarray,outarray);
230  }
231 
232  virtual void v_IProductWRTDerivBase (const int dir,
233  const Array<OneD, const NekDouble> &inarray,
234  Array<OneD, NekDouble> &outarray)
235  {
236  IProductWRTDerivBase(dir,inarray,outarray);
237  }
238 
239  virtual void v_StdPhysDeriv(
240  const Array<OneD, const NekDouble> &inarray,
241  Array<OneD, NekDouble> &out_d0,
242  Array<OneD, NekDouble> &out_d1,
244  {
245  StdTriExp::v_PhysDeriv(inarray, out_d0, out_d1, out_d2);
246  }
247 
248  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
249  Array<OneD, NekDouble> &out_d0,
250  Array<OneD, NekDouble> &out_d1,
252  {
253  PhysDeriv(inarray, out_d0, out_d1);
254  }
255 
256  virtual void v_PhysDeriv(const int dir,
257  const Array<OneD, const NekDouble>& inarray,
258  Array<OneD, NekDouble> &outarray)
259  {
261  switch(dir)
262  {
263  case 0:
264  {
265  PhysDeriv(inarray, outarray, tmp);
266  }
267  break;
268  case 1:
269  {
270  PhysDeriv(inarray, tmp, outarray);
271  }
272  break;
273  default:
274  {
275  ASSERTL1(dir >= 0 &&dir < 2,"input dir is out of range");
276  }
277  break;
278  }
279  }
280 
281  /// Virtual call to SegExp::FwdTrans
282  virtual void v_FwdTrans(const Array<OneD, const NekDouble> &inarray,
283  Array<OneD, NekDouble> &outarray)
284  {
285  FwdTrans(inarray,outarray);
286  }
287 
288  /// Virtual call to TriExp::Evaluate
290  const Array<OneD, const NekDouble> &coord,
291  const Array<OneD, const NekDouble> &physvals)
292 
293  {
294  return PhysEvaluate(coord, physvals);
295  }
296 
298  {
299  return CreateStdMatrix(mkey);
300  }
301 
303  {
304  return m_matrixManager[mkey];
305  }
306 
307 // virtual DNekScalMatSharedPtr v_GetLocMatrix(const StdRegions::MatrixType mtype, NekDouble lambdaval, NekDouble tau)
308 // {
309 // MatrixKey mkey(mtype,DetExpansionType(),*this,lambdaval,tau);
310 // return m_matrixManager[mkey];
311 // }
312 
314  {
315  return m_staticCondMatrixManager[mkey];
316  }
317 
318  virtual void v_BwdTrans_SumFac(const Array<OneD, const NekDouble>& inarray,
319  Array<OneD, NekDouble> &outarray)
320  {
321  StdNodalTriExp::v_BwdTrans_SumFac(inarray,outarray);
322  }
323 
325  Array<OneD, NekDouble> &outarray,
326  bool multiplybyweights = true)
327  {
328  IProductWRTBase_SumFac(inarray,outarray);
329  }
330 
331  virtual void v_IProductWRTDerivBase_SumFac(const int dir,
332  const Array<OneD, const NekDouble>& inarray,
333  Array<OneD, NekDouble> &outarray)
334  {
335  IProductWRTDerivBase_SumFac(dir,inarray,outarray);
336  }
337 
338  virtual void v_MassMatrixOp(const Array<OneD, const NekDouble> &inarray,
339  Array<OneD,NekDouble> &outarray,
340  const StdRegions::StdMatrixKey &mkey)
341  {
342  MassMatrixOp(inarray,outarray,mkey);
343  }
344 
346  Array<OneD,NekDouble> &outarray,
347  const StdRegions::StdMatrixKey &mkey)
348  {
349  LaplacianMatrixOp(inarray,outarray,mkey);
350  }
351 
352  virtual void v_LaplacianMatrixOp(const int k1, const int k2,
353  const Array<OneD, const NekDouble> &inarray,
354  Array<OneD,NekDouble> &outarray,
355  const StdRegions::StdMatrixKey &mkey)
356  {
357  LaplacianMatrixOp(k1,k2,inarray,outarray,mkey);
358  }
359 
360  virtual void v_WeakDerivMatrixOp(const int i,
361  const Array<OneD, const NekDouble> &inarray,
362  Array<OneD,NekDouble> &outarray,
363  const StdRegions::StdMatrixKey &mkey)
364  {
365  WeakDerivMatrixOp(i,inarray,outarray,mkey);
366  }
367 
369  Array<OneD,NekDouble> &outarray,
370  const StdRegions::StdMatrixKey &mkey)
371  {
372  HelmholtzMatrixOp(inarray,outarray,mkey);
373  }
374 
375  void v_ComputeEdgeNormal(const int edge);
376  };
377 
378  // type defines for use of TriExp in a boost vector
379  typedef boost::shared_ptr<NodalTriExp> NodalTriExpSharedPtr;
380  typedef std::vector< NodalTriExpSharedPtr > NodalTriExpVector;
382 
383  } //end of namespace
384 } //end of namespace
385 
386 #endif // NODALTRIEXP_H
387 
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Virtual call to SegExp::FwdTrans.
Definition: NodalTriExp.h:282
NodalTriExp(const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const LibUtilities::PointsType Ntype, const SpatialDomains::TriGeomSharedPtr &geom)
Constructor using BasisKey class for quadrature points and order definition.
Definition: NodalTriExp.cpp:45
void v_ComputeEdgeNormal(const int edge)
static Array< OneD, NekDouble > NullNekDouble1DArray
void GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords)
void IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true)
void IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
std::vector< NodalTriExpSharedPtr >::iterator NodalTriExpVectorIter
Definition: NodalTriExp.h:381
virtual StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const
void LaplacianMatrixOp(const int k1, const int k2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:133
void IProductWRTBase_MatOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
Differentiation Methods.
void IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: NodalTriExp.h:89
virtual void v_LaplacianMatrixOp(const int k1, const int k2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:352
boost::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:70
void GeneralMatrixOp_MatOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
NekDouble PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals)
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:297
virtual void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
Calculate the derivative of the physical points.
Definition: NodalTriExp.h:248
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition: NodalTriExp.h:185
std::vector< NodalTriExpSharedPtr > NodalTriExpVector
Definition: NodalTriExp.h:380
virtual void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:345
virtual void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:368
void WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:141
virtual void v_PhysDeriv(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Calculate the derivative of the physical points in a given direction.
Definition: NodalTriExp.h:256
void IProductWRTDerivBase_MatOp(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey)
Definition: NodalTriExp.h:302
boost::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:74
virtual void v_GetNodalPoints(Array< OneD, const NekDouble > &x, Array< OneD, const NekDouble > &y)
Definition: NodalTriExp.h:212
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Forward transform from physical quadrature space stored in inarray and evaluate the expansion coeffic...
double NekDouble
void HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:149
virtual DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey)
Definition: NodalTriExp.h:313
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: NodalTriExp.h:232
virtual void v_StdPhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
Definition: NodalTriExp.h:239
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey)
virtual void v_WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:360
NekDouble Integral(const Array< OneD, const NekDouble > &inarray)
Integrate the physical point list inarray over region.
Definition: NodalTriExp.cpp:99
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition: NodalTriExp.h:186
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals)
Virtual call to TriExp::Evaluate.
Definition: NodalTriExp.h:289
virtual void v_BwdTrans_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: NodalTriExp.h:318
virtual void v_IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true)
Definition: NodalTriExp.h:324
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Virtual call to TriExp::IProduct_WRT_B.
Definition: NodalTriExp.h:226
DNekScalBlkMatSharedPtr CreateStaticCondMatrix(const MatrixKey &mkey)
virtual DNekMatSharedPtr v_GenNBasisTransMatrix()
Definition: NodalTriExp.h:194
boost::shared_ptr< TriGeom > TriGeomSharedPtr
Definition: TriGeom.h:58
virtual void v_GetCoord(const Array< OneD, const NekDouble > &lcoord, Array< OneD, NekDouble > &coord)
Definition: NodalTriExp.h:206
virtual NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray)
Virtual call to integrate the physical point list inarray over region (see SegExp::Integral) ...
Definition: NodalTriExp.h:220
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_0, Array< OneD, NekDouble > &coords_1=NullNekDouble1DArray, Array< OneD, NekDouble > &coords_2=NullNekDouble1DArray)
Definition: NodalTriExp.h:199
void GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3=NullNekDouble1DArray)
void MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:119
void LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:126
#define LOCAL_REGIONS_EXPORT
virtual void v_IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: NodalTriExp.h:331
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
DNekScalMatSharedPtr CreateMatrix(const MatrixKey &mkey)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Inner product of inarray over region with respect to the expansion basis (this)->_Base[0] and return ...
Definition: NodalTriExp.h:83
Describes the specification for a Basis.
Definition: Basis.h:50
DNekMatSharedPtr CreateStdMatrix(const StdRegions::StdMatrixKey &mkey)
virtual void v_MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:338
boost::shared_ptr< NodalTriExp > NodalTriExpSharedPtr
Definition: NodalTriExp.h:379