Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 
185 
186  private:
189 
190 
191  //virtual StdRegions::ExpansionType v_DetExpansionType() const
192  //{
193  // return DetExpansionType();
194  //}
195 
197  {
198  return StdNodalTriExp::GenNBasisTransMatrix();
199  }
200 
201  virtual void v_GetCoords(Array<OneD, NekDouble> &coords_0,
204  {
205  GetCoords(coords_0, coords_1, coords_2);
206  }
207 
208  virtual void v_GetCoord(const Array<OneD, const NekDouble> &lcoord,
209  Array<OneD, NekDouble> &coord)
210  {
211  GetCoord(lcoord, coord);
212  }
213 
216  {
217  return StdNodalTriExp::GetNodalPoints(x,y);
218  }
219 
220  /** \brief Virtual call to integrate the physical point list \a inarray
221  over region (see SegExp::Integral) */
223  {
224  return Integral(inarray);
225  }
226 
227  /** \brief Virtual call to TriExp::IProduct_WRT_B */
228  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray,
229  Array<OneD, NekDouble> &outarray)
230  {
231  IProductWRTBase(inarray,outarray);
232  }
233 
234  virtual void v_IProductWRTDerivBase (const int dir,
235  const Array<OneD, const NekDouble> &inarray,
236  Array<OneD, NekDouble> &outarray)
237  {
238  IProductWRTDerivBase(dir,inarray,outarray);
239  }
240 
241  virtual void v_StdPhysDeriv(
242  const Array<OneD, const NekDouble> &inarray,
243  Array<OneD, NekDouble> &out_d0,
244  Array<OneD, NekDouble> &out_d1,
246  {
247  StdTriExp::v_PhysDeriv(inarray, out_d0, out_d1, out_d2);
248  }
249 
250  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
251  Array<OneD, NekDouble> &out_d0,
252  Array<OneD, NekDouble> &out_d1,
254  {
255  PhysDeriv(inarray, out_d0, out_d1);
256  }
257 
258  virtual void v_PhysDeriv(const int dir,
259  const Array<OneD, const NekDouble>& inarray,
260  Array<OneD, NekDouble> &outarray)
261  {
263  switch(dir)
264  {
265  case 0:
266  {
267  PhysDeriv(inarray, outarray, tmp);
268  }
269  break;
270  case 1:
271  {
272  PhysDeriv(inarray, tmp, outarray);
273  }
274  break;
275  default:
276  {
277  ASSERTL1(dir >= 0 &&dir < 2,"input dir is out of range");
278  }
279  break;
280  }
281  }
282 
283  /// Virtual call to SegExp::FwdTrans
284  virtual void v_FwdTrans(const Array<OneD, const NekDouble> &inarray,
285  Array<OneD, NekDouble> &outarray)
286  {
287  FwdTrans(inarray,outarray);
288  }
289 
290  /// Virtual call to TriExp::Evaluate
292  const Array<OneD, const NekDouble> &coord,
293  const Array<OneD, const NekDouble> &physvals)
294 
295  {
296  return PhysEvaluate(coord, physvals);
297  }
298 
300  {
301  return CreateStdMatrix(mkey);
302  }
303 
305  {
306  return m_matrixManager[mkey];
307  }
308 
309 // virtual DNekScalMatSharedPtr v_GetLocMatrix(const StdRegions::MatrixType mtype, NekDouble lambdaval, NekDouble tau)
310 // {
311 // MatrixKey mkey(mtype,DetExpansionType(),*this,lambdaval,tau);
312 // return m_matrixManager[mkey];
313 // }
314 
316  {
317  return m_staticCondMatrixManager[mkey];
318  }
319 
320  virtual void v_BwdTrans_SumFac(const Array<OneD, const NekDouble>& inarray,
321  Array<OneD, NekDouble> &outarray)
322  {
323  StdNodalTriExp::v_BwdTrans_SumFac(inarray,outarray);
324  }
325 
327  Array<OneD, NekDouble> &outarray,
328  bool multiplybyweights = true)
329  {
330  IProductWRTBase_SumFac(inarray,outarray);
331  }
332 
333  virtual void v_IProductWRTDerivBase_SumFac(const int dir,
334  const Array<OneD, const NekDouble>& inarray,
335  Array<OneD, NekDouble> &outarray)
336  {
337  IProductWRTDerivBase_SumFac(dir,inarray,outarray);
338  }
339 
340  virtual void v_MassMatrixOp(const Array<OneD, const NekDouble> &inarray,
341  Array<OneD,NekDouble> &outarray,
342  const StdRegions::StdMatrixKey &mkey)
343  {
344  MassMatrixOp(inarray,outarray,mkey);
345  }
346 
348  Array<OneD,NekDouble> &outarray,
349  const StdRegions::StdMatrixKey &mkey)
350  {
351  LaplacianMatrixOp(inarray,outarray,mkey);
352  }
353 
354  virtual void v_LaplacianMatrixOp(const int k1, const int k2,
355  const Array<OneD, const NekDouble> &inarray,
356  Array<OneD,NekDouble> &outarray,
357  const StdRegions::StdMatrixKey &mkey)
358  {
359  LaplacianMatrixOp(k1,k2,inarray,outarray,mkey);
360  }
361 
362  virtual void v_WeakDerivMatrixOp(const int i,
363  const Array<OneD, const NekDouble> &inarray,
364  Array<OneD,NekDouble> &outarray,
365  const StdRegions::StdMatrixKey &mkey)
366  {
367  WeakDerivMatrixOp(i,inarray,outarray,mkey);
368  }
369 
371  Array<OneD,NekDouble> &outarray,
372  const StdRegions::StdMatrixKey &mkey)
373  {
374  HelmholtzMatrixOp(inarray,outarray,mkey);
375  }
376 
377  void v_ComputeEdgeNormal(const int edge);
378  };
379 
380  // type defines for use of TriExp in a boost vector
381  typedef boost::shared_ptr<NodalTriExp> NodalTriExpSharedPtr;
382  typedef std::vector< NodalTriExpSharedPtr > NodalTriExpVector;
384 
385  } //end of namespace
386 } //end of namespace
387 
388 #endif // NODALTRIEXP_H
389 
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Virtual call to SegExp::FwdTrans.
Definition: NodalTriExp.h:284
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:383
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:354
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:299
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:250
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition: NodalTriExp.h:187
std::vector< NodalTriExpSharedPtr > NodalTriExpVector
Definition: NodalTriExp.h:382
virtual void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:347
virtual void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:370
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:258
virtual StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const
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:304
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:214
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:315
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: NodalTriExp.h:234
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:241
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:362
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:188
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals)
Virtual call to TriExp::Evaluate.
Definition: NodalTriExp.h:291
virtual void v_BwdTrans_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: NodalTriExp.h:320
virtual void v_IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true)
Definition: NodalTriExp.h:326
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Virtual call to TriExp::IProduct_WRT_B.
Definition: NodalTriExp.h:228
DNekScalBlkMatSharedPtr CreateStaticCondMatrix(const MatrixKey &mkey)
virtual DNekMatSharedPtr v_GenNBasisTransMatrix()
Definition: NodalTriExp.h:196
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:208
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:222
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_0, Array< OneD, NekDouble > &coords_1=NullNekDouble1DArray, Array< OneD, NekDouble > &coords_2=NullNekDouble1DArray)
Definition: NodalTriExp.h:201
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:333
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:228
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:340
boost::shared_ptr< NodalTriExp > NodalTriExpSharedPtr
Definition: NodalTriExp.h:381