Nektar++
TriExp.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: TriExp.cpp
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 // The above copyright notice and this permission notice shall be included
20 // in all copies or substantial portions of the Software.
21 //
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28 // DEALINGS IN THE SOFTWARE.
29 //
30 // Description: Expasion for triangular elements.
31 //
32 ///////////////////////////////////////////////////////////////////////////////
33 
34 #include <boost/core/ignore_unused.hpp>
35 
39 #include <LocalRegions/SegExp.h>
40 #include <LocalRegions/TriExp.h>
42 
43 using namespace std;
44 
45 namespace Nektar
46 {
47 namespace LocalRegions
48 {
49 TriExp::TriExp(const LibUtilities::BasisKey &Ba,
50  const LibUtilities::BasisKey &Bb,
52  : StdExpansion(LibUtilities::StdTriData::getNumberOfCoefficients(
53  Ba.GetNumModes(), (Bb.GetNumModes())),
54  2, Ba, Bb),
55  StdExpansion2D(LibUtilities::StdTriData::getNumberOfCoefficients(
56  Ba.GetNumModes(), (Bb.GetNumModes())),
57  Ba, Bb),
58  StdTriExp(Ba, Bb), Expansion(geom), Expansion2D(geom),
59  m_matrixManager(
60  std::bind(&Expansion2D::CreateMatrix, this, std::placeholders::_1),
61  std::string("TriExpMatrix")),
62  m_staticCondMatrixManager(std::bind(&Expansion::CreateStaticCondMatrix,
63  this, std::placeholders::_1),
64  std::string("TriExpStaticCondMatrix"))
65 {
66 }
67 
69  : StdExpansion(T), StdExpansion2D(T), StdTriExp(T), Expansion(T),
70  Expansion2D(T), m_matrixManager(T.m_matrixManager),
71  m_staticCondMatrixManager(T.m_staticCondMatrixManager)
72 {
73 }
74 
76 {
77  int nquad0 = m_base[0]->GetNumPoints();
78  int nquad1 = m_base[1]->GetNumPoints();
80  NekDouble ival;
81  Array<OneD, NekDouble> tmp(nquad0 * nquad1);
82 
83  // multiply inarray with Jacobian
84  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
85  {
86  Vmath::Vmul(nquad0 * nquad1, jac, 1, inarray, 1, tmp, 1);
87  }
88  else
89  {
90  Vmath::Smul(nquad0 * nquad1, jac[0], inarray, 1, tmp, 1);
91  }
92 
93  // call StdQuadExp version;
94  ival = StdTriExp::v_Integral(tmp);
95  return ival;
96 }
97 
99  Array<OneD, NekDouble> &out_d0,
100  Array<OneD, NekDouble> &out_d1,
101  Array<OneD, NekDouble> &out_d2)
102 {
103  int nquad0 = m_base[0]->GetNumPoints();
104  int nquad1 = m_base[1]->GetNumPoints();
105  int nqtot = nquad0 * nquad1;
106  const Array<TwoD, const NekDouble> &df =
107  m_metricinfo->GetDerivFactors(GetPointsKeys());
108 
109  Array<OneD, NekDouble> diff0(2 * nqtot);
110  Array<OneD, NekDouble> diff1(diff0 + nqtot);
111 
112  StdTriExp::v_PhysDeriv(inarray, diff0, diff1);
113 
114  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
115  {
116  if (out_d0.size())
117  {
118  Vmath::Vmul(nqtot, df[0], 1, diff0, 1, out_d0, 1);
119  Vmath::Vvtvp(nqtot, df[1], 1, diff1, 1, out_d0, 1, out_d0, 1);
120  }
121 
122  if (out_d1.size())
123  {
124  Vmath::Vmul(nqtot, df[2], 1, diff0, 1, out_d1, 1);
125  Vmath::Vvtvp(nqtot, df[3], 1, diff1, 1, out_d1, 1, out_d1, 1);
126  }
127 
128  if (out_d2.size())
129  {
130  Vmath::Vmul(nqtot, df[4], 1, diff0, 1, out_d2, 1);
131  Vmath::Vvtvp(nqtot, df[5], 1, diff1, 1, out_d2, 1, out_d2, 1);
132  }
133  }
134  else // regular geometry
135  {
136  if (out_d0.size())
137  {
138  Vmath::Smul(nqtot, df[0][0], diff0, 1, out_d0, 1);
139  Blas::Daxpy(nqtot, df[1][0], diff1, 1, out_d0, 1);
140  }
141 
142  if (out_d1.size())
143  {
144  Vmath::Smul(nqtot, df[2][0], diff0, 1, out_d1, 1);
145  Blas::Daxpy(nqtot, df[3][0], diff1, 1, out_d1, 1);
146  }
147 
148  if (out_d2.size())
149  {
150  Vmath::Smul(nqtot, df[4][0], diff0, 1, out_d2, 1);
151  Blas::Daxpy(nqtot, df[5][0], diff1, 1, out_d2, 1);
152  }
153  }
154 }
155 
156 void TriExp::v_PhysDeriv(const int dir,
157  const Array<OneD, const NekDouble> &inarray,
158  Array<OneD, NekDouble> &outarray)
159 {
160  switch (dir)
161  {
162  case 0:
163  {
164  PhysDeriv(inarray, outarray, NullNekDouble1DArray,
166  }
167  break;
168  case 1:
169  {
170  PhysDeriv(inarray, NullNekDouble1DArray, outarray,
172  }
173  break;
174  case 2:
175  {
177  outarray);
178  }
179  break;
180  default:
181  {
182  ASSERTL1(false, "input dir is out of range");
183  }
184  break;
185  }
186 }
187 
189  const Array<OneD, const NekDouble> &inarray,
191 {
192  if (!out.size())
193  {
194  return;
195  }
196 
197  int nquad0 = m_base[0]->GetNumPoints();
198  int nquad1 = m_base[1]->GetNumPoints();
199  int nqtot = nquad0 * nquad1;
200 
201  const Array<TwoD, const NekDouble> &df =
202  m_metricinfo->GetDerivFactors(GetPointsKeys());
203 
204  Array<OneD, NekDouble> diff0(2 * nqtot);
205  Array<OneD, NekDouble> diff1(diff0 + nqtot);
206 
207  // diff0 = du/d_xi, diff1 = du/d_eta
208  StdTriExp::v_PhysDeriv(inarray, diff0, diff1);
209 
210  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
211  {
213 
214  // D^v_xi = v_x*d_xi/dx + v_y*d_xi/dy + v_z*d_xi/dz
215  // D^v_eta = v_x*d_eta/dx + v_y*d_eta/dy + v_z*d_eta/dz
216  for (int i = 0; i < 2; ++i)
217  {
218  tangmat[i] = Array<OneD, NekDouble>(nqtot, 0.0);
219  for (int k = 0; k < (m_geom->GetCoordim()); ++k)
220  {
221  Vmath::Vvtvp(nqtot, &df[2 * k + i][0], 1, &direction[k * nqtot],
222  1, &tangmat[i][0], 1, &tangmat[i][0], 1);
223  }
224  }
225 
226  /// D_v = D^v_xi * du/d_xi + D^v_eta * du/d_eta
227  Vmath::Vmul(nqtot, &tangmat[0][0], 1, &diff0[0], 1, &out[0], 1);
228  Vmath::Vvtvp(nqtot, &tangmat[1][0], 1, &diff1[0], 1, &out[0], 1,
229  &out[0], 1);
230  }
231  else
232  {
234 
235  for (int i = 0; i < 2; ++i)
236  {
237  tangmat[i] = Array<OneD, NekDouble>(nqtot, 0.0);
238  for (int k = 0; k < (m_geom->GetCoordim()); ++k)
239  {
240  Vmath::Svtvp(nqtot, df[2 * k + i][0], &direction[k * nqtot], 1,
241  &tangmat[i][0], 1, &tangmat[i][0], 1);
242  }
243  }
244 
245  /// D_v = D^v_xi * du/d_xi + D^v_eta * du/d_eta
246  Vmath::Vmul(nqtot, &tangmat[0][0], 1, &diff0[0], 1, &out[0], 1);
247 
248  Vmath::Vvtvp(nqtot, &tangmat[1][0], 1, &diff1[0], 1, &out[0], 1,
249  &out[0], 1);
250  }
251 }
252 
254  Array<OneD, NekDouble> &outarray)
255 {
256  IProductWRTBase(inarray, outarray);
257 
258  // get Mass matrix inverse
259  MatrixKey masskey(StdRegions::eInvMass, DetShapeType(), *this);
260  DNekScalMatSharedPtr matsys = m_matrixManager[masskey];
261 
262  // copy inarray in case inarray == outarray
263  NekVector<NekDouble> in(m_ncoeffs, outarray, eCopy);
264  NekVector<NekDouble> out(m_ncoeffs, outarray, eWrapper);
265 
266  out = (*matsys) * in;
267 }
268 
270  const Array<OneD, const NekDouble> &inarray,
271  Array<OneD, NekDouble> &outarray)
272 {
273  int i, j;
274  int npoints[2] = {m_base[0]->GetNumPoints(), m_base[1]->GetNumPoints()};
275  int nmodes[2] = {m_base[0]->GetNumModes(), m_base[1]->GetNumModes()};
276 
277  fill(outarray.get(), outarray.get() + m_ncoeffs, 0.0);
278 
279  if (nmodes[0] == 1 && nmodes[1] == 1)
280  {
281  outarray[0] = inarray[0];
282  return;
283  }
284 
285  Array<OneD, NekDouble> physEdge[3];
286  Array<OneD, NekDouble> coeffEdge[3];
287  for (i = 0; i < 3; i++)
288  {
289  // define physEdge and add 1 so can interpolate grl10 points if
290  // necessary
291  physEdge[i] = Array<OneD, NekDouble>(max(npoints[i != 0], npoints[0]));
292  coeffEdge[i] = Array<OneD, NekDouble>(nmodes[i != 0]);
293  }
294 
295  for (i = 0; i < npoints[0]; i++)
296  {
297  physEdge[0][i] = inarray[i];
298  }
299 
300  // extract data in cartesian directions
301  for (i = 0; i < npoints[1]; i++)
302  {
303  physEdge[1][i] = inarray[npoints[0] - 1 + i * npoints[0]];
304  physEdge[2][i] = inarray[i * npoints[0]];
305  }
306 
307  SegExpSharedPtr segexp[3];
309  m_base[0]->GetBasisKey(), GetGeom2D()->GetEdge(0));
310 
312  {
313  for (i = 1; i < 3; i++)
314  {
316  m_base[i != 0]->GetBasisKey(), GetGeom2D()->GetEdge(i));
317  }
318  }
319  else // interploate using edge 0 GLL distribution
320  {
321  for (i = 1; i < 3; i++)
322  {
324  m_base[0]->GetBasisKey(), GetGeom2D()->GetEdge(i));
325 
326  LibUtilities::Interp1D(m_base[1]->GetPointsKey(), physEdge[i],
327  m_base[0]->GetPointsKey(), physEdge[i]);
328  }
329  npoints[1] = npoints[0];
330  }
331 
332  Array<OneD, unsigned int> mapArray;
333  Array<OneD, int> signArray;
334  NekDouble sign;
335  // define an orientation to get EdgeToElmtMapping from Cartesian data
336  StdRegions::Orientation orient[3] = {
338 
339  for (i = 0; i < 3; i++)
340  {
341  segexp[i]->FwdTransBndConstrained(physEdge[i], coeffEdge[i]);
342 
343  // this orient goes with the one above and so could
344  // probably set both to eForwards
345  GetTraceToElementMap(i, mapArray, signArray, orient[i]);
346  for (j = 0; j < nmodes[i != 0]; j++)
347  {
348  sign = (NekDouble)signArray[j];
349  outarray[mapArray[j]] = sign * coeffEdge[i][j];
350  }
351  }
352 
353  int nBoundaryDofs = NumBndryCoeffs();
354  int nInteriorDofs = m_ncoeffs - nBoundaryDofs;
355 
356  if (nInteriorDofs > 0)
357  {
360 
362  *this);
363  MassMatrixOp(outarray, tmp0, stdmasskey);
364  IProductWRTBase(inarray, tmp1);
365 
366  Vmath::Vsub(m_ncoeffs, tmp1, 1, tmp0, 1, tmp1, 1);
367 
368  // get Mass matrix inverse (only of interior DOF)
369  // use block (1,1) of the static condensed system
370  // note: this block alreay contains the inverse matrix
371  MatrixKey masskey(StdRegions::eMass, DetShapeType(), *this);
372  DNekScalMatSharedPtr matsys =
373  (m_staticCondMatrixManager[masskey])->GetBlock(1, 1);
374 
375  Array<OneD, NekDouble> rhs(nInteriorDofs);
376  Array<OneD, NekDouble> result(nInteriorDofs);
377 
378  GetInteriorMap(mapArray);
379 
380  for (i = 0; i < nInteriorDofs; i++)
381  {
382  rhs[i] = tmp1[mapArray[i]];
383  }
384 
385  Blas::Dgemv('N', nInteriorDofs, nInteriorDofs, matsys->Scale(),
386  &((matsys->GetOwnedMatrix())->GetPtr())[0], nInteriorDofs,
387  rhs.get(), 1, 0.0, result.get(), 1);
388 
389  for (i = 0; i < nInteriorDofs; i++)
390  {
391  outarray[mapArray[i]] = result[i];
392  }
393  }
394 }
395 
397  Array<OneD, NekDouble> &outarray)
398 {
399  IProductWRTBase_SumFac(inarray, outarray);
400 }
401 
403  const Array<OneD, const NekDouble> &inarray,
404  Array<OneD, NekDouble> &outarray)
405 {
406  IProductWRTDerivBase_SumFac(dir, inarray, outarray);
407 }
408 
410  const Array<OneD, const NekDouble> &inarray,
411  Array<OneD, NekDouble> &outarray, bool multiplybyweights)
412 {
413  int nquad0 = m_base[0]->GetNumPoints();
414  int nquad1 = m_base[1]->GetNumPoints();
415  int order0 = m_base[0]->GetNumModes();
416 
417  if (multiplybyweights)
418  {
419  Array<OneD, NekDouble> tmp(nquad0 * nquad1 + nquad1 * order0);
420  Array<OneD, NekDouble> wsp(tmp + nquad0 * nquad1);
421 
422  MultiplyByQuadratureMetric(inarray, tmp);
423  IProductWRTBase_SumFacKernel(m_base[0]->GetBdata(),
424  m_base[1]->GetBdata(), tmp, outarray, wsp);
425  }
426  else
427  {
428  Array<OneD, NekDouble> wsp(+nquad1 * order0);
429 
430  IProductWRTBase_SumFacKernel(m_base[0]->GetBdata(),
431  m_base[1]->GetBdata(), inarray, outarray,
432  wsp);
433  }
434 }
435 
437  const int dir, const Array<OneD, const NekDouble> &inarray,
438  Array<OneD, NekDouble> &outarray)
439 {
440  int nquad0 = m_base[0]->GetNumPoints();
441  int nquad1 = m_base[1]->GetNumPoints();
442  int nqtot = nquad0 * nquad1;
443  int nmodes0 = m_base[0]->GetNumModes();
444  int wspsize = max(max(nqtot, m_ncoeffs), nquad1 * nmodes0);
445 
446  Array<OneD, NekDouble> tmp0(4 * wspsize);
447  Array<OneD, NekDouble> tmp1(tmp0 + wspsize);
448  Array<OneD, NekDouble> tmp2(tmp0 + 2 * wspsize);
449  Array<OneD, NekDouble> tmp3(tmp0 + 3 * wspsize);
450 
452  tmp2D[0] = tmp1;
453  tmp2D[1] = tmp2;
454 
455  TriExp::v_AlignVectorToCollapsedDir(dir, inarray, tmp2D);
456 
457  MultiplyByQuadratureMetric(tmp1, tmp1);
458  MultiplyByQuadratureMetric(tmp2, tmp2);
459 
460  IProductWRTBase_SumFacKernel(m_base[0]->GetDbdata(), m_base[1]->GetBdata(),
461  tmp1, tmp3, tmp0);
462  IProductWRTBase_SumFacKernel(m_base[0]->GetBdata(), m_base[1]->GetDbdata(),
463  tmp2, outarray, tmp0);
464  Vmath::Vadd(m_ncoeffs, tmp3, 1, outarray, 1, outarray, 1);
465 }
466 
468  const int dir, const Array<OneD, const NekDouble> &inarray,
469  Array<OneD, Array<OneD, NekDouble>> &outarray)
470 {
471  ASSERTL1((dir == 0) || (dir == 1) || (dir == 2), "Invalid direction.");
472  ASSERTL1((dir == 2) ? (m_geom->GetCoordim() == 3) : true,
473  "Invalid direction.");
474 
475  int nquad0 = m_base[0]->GetNumPoints();
476  int nquad1 = m_base[1]->GetNumPoints();
477  int nqtot = nquad0 * nquad1;
478  int nmodes0 = m_base[0]->GetNumModes();
479  int wspsize = max(max(nqtot, m_ncoeffs), nquad1 * nmodes0);
480 
481  const Array<TwoD, const NekDouble> &df =
482  m_metricinfo->GetDerivFactors(GetPointsKeys());
483 
484  Array<OneD, NekDouble> tmp0(wspsize);
485  Array<OneD, NekDouble> tmp3(wspsize);
486  Array<OneD, NekDouble> gfac0(wspsize);
487  Array<OneD, NekDouble> gfac1(wspsize);
488 
489  Array<OneD, NekDouble> tmp1 = outarray[0];
490  Array<OneD, NekDouble> tmp2 = outarray[1];
491 
492  const Array<OneD, const NekDouble> &z0 = m_base[0]->GetZ();
493  const Array<OneD, const NekDouble> &z1 = m_base[1]->GetZ();
494 
495  // set up geometric factor: 2/(1-z1)
496  for (int i = 0; i < nquad1; ++i)
497  {
498  gfac0[i] = 2.0 / (1 - z1[i]);
499  }
500  for (int i = 0; i < nquad0; ++i)
501  {
502  gfac1[i] = 0.5 * (1 + z0[i]);
503  }
504 
505  for (int i = 0; i < nquad1; ++i)
506  {
507  Vmath::Smul(nquad0, gfac0[i], &inarray[0] + i * nquad0, 1,
508  &tmp0[0] + i * nquad0, 1);
509  }
510 
511  for (int i = 0; i < nquad1; ++i)
512  {
513  Vmath::Vmul(nquad0, &gfac1[0], 1, &tmp0[0] + i * nquad0, 1,
514  &tmp1[0] + i * nquad0, 1);
515  }
516 
517  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
518  {
519  Vmath::Vmul(nqtot, &df[2 * dir][0], 1, &tmp0[0], 1, &tmp0[0], 1);
520  Vmath::Vmul(nqtot, &df[2 * dir + 1][0], 1, &tmp1[0], 1, &tmp1[0], 1);
521  Vmath::Vmul(nqtot, &df[2 * dir + 1][0], 1, &inarray[0], 1, &tmp2[0], 1);
522  }
523  else
524  {
525  Vmath::Smul(nqtot, df[2 * dir][0], tmp0, 1, tmp0, 1);
526  Vmath::Smul(nqtot, df[2 * dir + 1][0], tmp1, 1, tmp1, 1);
527  Vmath::Smul(nqtot, df[2 * dir + 1][0], inarray, 1, tmp2, 1);
528  }
529  Vmath::Vadd(nqtot, tmp0, 1, tmp1, 1, tmp1, 1);
530 }
531 
533  const Array<OneD, const NekDouble> &direction,
534  const Array<OneD, const NekDouble> &inarray,
535  Array<OneD, NekDouble> &outarray)
536 {
537  IProductWRTDirectionalDerivBase_SumFac(direction, inarray, outarray);
538 }
539 
540 /**
541  * @brief Directinoal Derivative in the modal space in the dir
542  * direction of varcoeffs.
543  */
545  const Array<OneD, const NekDouble> &direction,
546  const Array<OneD, const NekDouble> &inarray,
547  Array<OneD, NekDouble> &outarray)
548 {
549  int i;
550  int shapedim = 2;
551  int nquad0 = m_base[0]->GetNumPoints();
552  int nquad1 = m_base[1]->GetNumPoints();
553  int nqtot = nquad0 * nquad1;
554  int nmodes0 = m_base[0]->GetNumModes();
555  int wspsize = max(max(nqtot, m_ncoeffs), nquad1 * nmodes0);
556 
557  const Array<TwoD, const NekDouble> &df =
558  m_metricinfo->GetDerivFactors(GetPointsKeys());
559 
560  Array<OneD, NekDouble> tmp0(6 * wspsize);
561  Array<OneD, NekDouble> tmp1(tmp0 + wspsize);
562  Array<OneD, NekDouble> tmp2(tmp0 + 2 * wspsize);
563  Array<OneD, NekDouble> tmp3(tmp0 + 3 * wspsize);
564  Array<OneD, NekDouble> gfac0(tmp0 + 4 * wspsize);
565  Array<OneD, NekDouble> gfac1(tmp0 + 5 * wspsize);
566 
567  const Array<OneD, const NekDouble> &z0 = m_base[0]->GetZ();
568  const Array<OneD, const NekDouble> &z1 = m_base[1]->GetZ();
569 
570  // set up geometric factor: 2/(1-z1)
571  for (i = 0; i < nquad1; ++i)
572  {
573  gfac0[i] = 2.0 / (1 - z1[i]);
574  }
575  for (i = 0; i < nquad0; ++i)
576  {
577  gfac1[i] = 0.5 * (1 + z0[i]);
578  }
579  for (i = 0; i < nquad1; ++i)
580  {
581  Vmath::Smul(nquad0, gfac0[i], &inarray[0] + i * nquad0, 1,
582  &tmp0[0] + i * nquad0, 1);
583  }
584  for (i = 0; i < nquad1; ++i)
585  {
586  Vmath::Vmul(nquad0, &gfac1[0], 1, &tmp0[0] + i * nquad0, 1,
587  &tmp1[0] + i * nquad0, 1);
588  }
589 
590  // Compute gmat \cdot e^j
591  Array<OneD, Array<OneD, NekDouble>> dfdir(shapedim);
592  Expansion::ComputeGmatcdotMF(df, direction, dfdir);
593 
594  Vmath::Vmul(nqtot, &dfdir[0][0], 1, &tmp0[0], 1, &tmp0[0], 1);
595  Vmath::Vmul(nqtot, &dfdir[1][0], 1, &tmp1[0], 1, &tmp1[0], 1);
596  Vmath::Vmul(nqtot, &dfdir[1][0], 1, &inarray[0], 1, &tmp2[0], 1);
597 
598  Vmath::Vadd(nqtot, &tmp0[0], 1, &tmp1[0], 1, &tmp1[0], 1);
599 
600  MultiplyByQuadratureMetric(tmp1, tmp1);
601  MultiplyByQuadratureMetric(tmp2, tmp2);
602 
603  IProductWRTBase_SumFacKernel(m_base[0]->GetDbdata(), m_base[1]->GetBdata(),
604  tmp1, tmp3, tmp0);
605  IProductWRTBase_SumFacKernel(m_base[0]->GetBdata(), m_base[1]->GetDbdata(),
606  tmp2, outarray, tmp0);
607  Vmath::Vadd(m_ncoeffs, tmp3, 1, outarray, 1, outarray, 1);
608 }
609 
613  Array<OneD, NekDouble> &outarray)
614 {
615  int nq = m_base[0]->GetNumPoints() * m_base[1]->GetNumPoints();
616  Array<OneD, NekDouble> Fn(nq);
617 
619  GetLeftAdjacentElementExp()->GetTraceNormal(
621 
622  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
623  {
624  Vmath::Vvtvvtp(nq, &normals[0][0], 1, &Fx[0], 1, &normals[1][0], 1,
625  &Fy[0], 1, &Fn[0], 1);
626  Vmath::Vvtvp(nq, &normals[2][0], 1, &Fz[0], 1, &Fn[0], 1, &Fn[0], 1);
627  }
628  else
629  {
630  Vmath::Svtsvtp(nq, normals[0][0], &Fx[0], 1, normals[1][0], &Fy[0], 1,
631  &Fn[0], 1);
632  Vmath::Svtvp(nq, normals[2][0], &Fz[0], 1, &Fn[0], 1, &Fn[0], 1);
633  }
634 
635  IProductWRTBase(Fn, outarray);
636 }
637 
639  const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
640  Array<OneD, NekDouble> &outarray)
641 {
642  NormVectorIProductWRTBase(Fvec[0], Fvec[1], Fvec[2], outarray);
643 }
644 
646 {
647 
649  m_base[0]->GetBasisKey(), m_base[1]->GetBasisKey());
650 }
651 
653 {
655  m_base[0]->GetPointsKey());
657  m_base[1]->GetPointsKey());
658 
660  bkey1);
661 }
662 
664  Array<OneD, NekDouble> &coords)
665 {
666  int i;
667 
668  ASSERTL1(Lcoords[0] >= -1.0 && Lcoords[1] <= 1.0 && Lcoords[1] >= -1.0 &&
669  Lcoords[1] <= 1.0,
670  "Local coordinates are not in region [-1,1]");
671 
672  m_geom->FillGeom();
673 
674  for (i = 0; i < m_geom->GetCoordim(); ++i)
675  {
676  coords[i] = m_geom->GetCoord(i, Lcoords);
677  }
678 }
679 
681  Array<OneD, NekDouble> &coords_1,
682  Array<OneD, NekDouble> &coords_2)
683 {
684  Expansion::v_GetCoords(coords_0, coords_1, coords_2);
685 }
686 
687 /**
688  * Given the local cartesian coordinate \a Lcoord evaluate the
689  * value of physvals at this point by calling through to the
690  * StdExpansion method
691  */
693  const Array<OneD, const NekDouble> &Lcoord,
694  const Array<OneD, const NekDouble> &physvals)
695 {
696  // Evaluate point in local (eta) coordinates.
697  return StdExpansion2D::v_PhysEvaluate(Lcoord, physvals);
698 }
699 
701  const Array<OneD, const NekDouble> &physvals)
702 {
704 
705  ASSERTL0(m_geom, "m_geom not defined");
706  m_geom->GetLocCoords(coord, Lcoord);
707 
708  return StdExpansion2D::v_PhysEvaluate(Lcoord, physvals);
709 }
710 
712  const Array<OneD, const NekDouble> &inarray,
713  std::array<NekDouble, 3> &firstOrderDerivs)
714 {
715  Array<OneD, NekDouble> Lcoord(2);
716  ASSERTL0(m_geom, "m_geom not defined");
717  m_geom->GetLocCoords(coord, Lcoord);
718  return StdTriExp::v_PhysEvaluate(Lcoord, inarray, firstOrderDerivs);
719 }
720 
722  const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp,
723  const Array<OneD, const NekDouble> &inarray,
725 {
726  int nquad0 = m_base[0]->GetNumPoints();
727  int nquad1 = m_base[1]->GetNumPoints();
728  int nt = 0;
729  // Extract in Cartesian direction because we have to deal with
730  // e.g. Gauss-Radau points.
731  switch (edge)
732  {
733  case 0:
734  Vmath::Vcopy(nquad0, &(inarray[0]), 1, &(outarray[0]), 1);
735  nt = nquad0;
736  break;
737  case 1:
738  Vmath::Vcopy(nquad1, &(inarray[0]) + (nquad0 - 1), nquad0,
739  &(outarray[0]), 1);
740  nt = nquad1;
741  break;
742  case 2:
743  Vmath::Vcopy(nquad1, &(inarray[0]), nquad0, &(outarray[0]), 1);
744  nt = nquad1;
745  break;
746  default:
747  ASSERTL0(false, "edge value (< 3) is out of range");
748  break;
749  }
750 
751  ASSERTL1(EdgeExp->GetBasis(0)->GetPointsType() ==
753  "Edge expansion should be GLL");
754 
755  // Interpolate if required
756  if (m_base[edge ? 1 : 0]->GetPointsKey() !=
757  EdgeExp->GetBasis(0)->GetPointsKey())
758  {
759  Array<OneD, NekDouble> outtmp(max(nquad0, nquad1));
760 
761  Vmath::Vcopy(nt, outarray, 1, outtmp, 1);
762 
763  LibUtilities::Interp1D(m_base[edge ? 1 : 0]->GetPointsKey(), outtmp,
764  EdgeExp->GetBasis(0)->GetPointsKey(), outarray);
765  }
766 
767  if (orient == StdRegions::eNoOrientation)
768  {
769  orient = GetTraceOrient(edge);
770  }
771 
772  // Reverse data if necessary
773  if (orient == StdRegions::eBackwards)
774  {
775  Vmath::Reverse(EdgeExp->GetNumPoints(0), &outarray[0], 1, &outarray[0],
776  1);
777  }
778 }
779 
780 void TriExp::v_GetTraceQFactors(const int edge,
781  Array<OneD, NekDouble> &outarray)
782 {
783  boost::ignore_unused(edge, outarray);
784  ASSERTL0(false, "Routine not implemented for triangular elements");
785 }
786 
787 void TriExp::v_GetTracePhysMap(const int edge, Array<OneD, int> &outarray)
788 {
789  int nquad0 = m_base[0]->GetNumPoints();
790  int nquad1 = m_base[1]->GetNumPoints();
791 
792  // Get points in Cartesian orientation
793  switch (edge)
794  {
795  case 0:
796  outarray = Array<OneD, int>(nquad0);
797  for (int i = 0; i < nquad0; ++i)
798  {
799  outarray[i] = i;
800  }
801  break;
802  case 1:
803  outarray = Array<OneD, int>(nquad1);
804  for (int i = 0; i < nquad1; ++i)
805  {
806  outarray[i] = (nquad0 - 1) + i * nquad0;
807  }
808  break;
809  case 2:
810  outarray = Array<OneD, int>(nquad1);
811  for (int i = 0; i < nquad1; ++i)
812  {
813  outarray[i] = i * nquad0;
814  }
815  break;
816  default:
817  ASSERTL0(false, "edge value (< 3) is out of range");
818  break;
819  }
820 }
821 
822 void TriExp::v_ComputeTraceNormal(const int edge)
823 {
824  int i;
825  const SpatialDomains::GeomFactorsSharedPtr &geomFactors =
826  GetGeom()->GetMetricInfo();
827 
829  for (i = 0; i < ptsKeys.size(); ++i)
830  {
831  // Need at least 2 points for computing normals
832  if (ptsKeys[i].GetNumPoints() == 1)
833  {
834  LibUtilities::PointsKey pKey(2, ptsKeys[i].GetPointsType());
835  ptsKeys[i] = pKey;
836  }
837  }
838 
839  const SpatialDomains::GeomType type = geomFactors->GetGtype();
840  const Array<TwoD, const NekDouble> &df =
841  geomFactors->GetDerivFactors(ptsKeys);
842  const Array<OneD, const NekDouble> &jac = geomFactors->GetJac(ptsKeys);
843  int nqe = m_base[0]->GetNumPoints();
844  int dim = GetCoordim();
845 
848  for (i = 0; i < dim; ++i)
849  {
850  normal[i] = Array<OneD, NekDouble>(nqe);
851  }
852 
853  size_t nqb = nqe;
854  size_t nbnd = edge;
857 
858  // Regular geometry case
859  if ((type == SpatialDomains::eRegular) ||
861  {
862  NekDouble fac;
863  // Set up normals
864  switch (edge)
865  {
866  case 0:
867  for (i = 0; i < GetCoordim(); ++i)
868  {
869  Vmath::Fill(nqe, -df[2 * i + 1][0], normal[i], 1);
870  }
871  break;
872  case 1:
873  for (i = 0; i < GetCoordim(); ++i)
874  {
875  Vmath::Fill(nqe, df[2 * i + 1][0] + df[2 * i][0], normal[i],
876  1);
877  }
878  break;
879  case 2:
880  for (i = 0; i < GetCoordim(); ++i)
881  {
882  Vmath::Fill(nqe, -df[2 * i][0], normal[i], 1);
883  }
884  break;
885  default:
886  ASSERTL0(false, "Edge is out of range (edge < 3)");
887  }
888 
889  // normalise
890  fac = 0.0;
891  for (i = 0; i < GetCoordim(); ++i)
892  {
893  fac += normal[i][0] * normal[i][0];
894  }
895  fac = 1.0 / sqrt(fac);
896 
897  Vmath::Fill(nqb, fac, length, 1);
898 
899  for (i = 0; i < GetCoordim(); ++i)
900  {
901  Vmath::Smul(nqe, fac, normal[i], 1, normal[i], 1);
902  }
903  }
904  else // Set up deformed normals
905  {
906  int j;
907 
908  int nquad0 = ptsKeys[0].GetNumPoints();
909  int nquad1 = ptsKeys[1].GetNumPoints();
910 
911  LibUtilities::PointsKey from_key;
912 
913  Array<OneD, NekDouble> normals(GetCoordim() * max(nquad0, nquad1), 0.0);
914  Array<OneD, NekDouble> edgejac(GetCoordim() * max(nquad0, nquad1), 0.0);
915 
916  // Extract Jacobian along edges and recover local
917  // derivates (dx/dr) for polynomial interpolation by
918  // multiplying m_gmat by jacobian
919  switch (edge)
920  {
921  case 0:
922  for (j = 0; j < nquad0; ++j)
923  {
924  edgejac[j] = jac[j];
925  for (i = 0; i < GetCoordim(); ++i)
926  {
927  normals[i * nquad0 + j] =
928  -df[2 * i + 1][j] * edgejac[j];
929  }
930  }
931  from_key = ptsKeys[0];
932  break;
933  case 1:
934  for (j = 0; j < nquad1; ++j)
935  {
936  edgejac[j] = jac[nquad0 * j + nquad0 - 1];
937  for (i = 0; i < GetCoordim(); ++i)
938  {
939  normals[i * nquad1 + j] =
940  (df[2 * i][nquad0 * j + nquad0 - 1] +
941  df[2 * i + 1][nquad0 * j + nquad0 - 1]) *
942  edgejac[j];
943  }
944  }
945  from_key = ptsKeys[1];
946  break;
947  case 2:
948  for (j = 0; j < nquad1; ++j)
949  {
950  edgejac[j] = jac[nquad0 * j];
951  for (i = 0; i < GetCoordim(); ++i)
952  {
953  normals[i * nquad1 + j] =
954  -df[2 * i][nquad0 * j] * edgejac[j];
955  }
956  }
957  from_key = ptsKeys[1];
958  break;
959  default:
960  ASSERTL0(false, "edge is out of range (edge < 3)");
961  }
962 
963  int nq = from_key.GetNumPoints();
964  Array<OneD, NekDouble> work(nqe, 0.0);
965 
966  // interpolate Jacobian and invert
967  LibUtilities::Interp1D(from_key, jac, m_base[0]->GetPointsKey(), work);
968  Vmath::Sdiv(nqe, 1.0, &work[0], 1, &work[0], 1);
969 
970  // interpolate
971  for (i = 0; i < GetCoordim(); ++i)
972  {
973  LibUtilities::Interp1D(from_key, &normals[i * nq],
974  m_base[0]->GetPointsKey(), &normal[i][0]);
975  Vmath::Vmul(nqe, work, 1, normal[i], 1, normal[i], 1);
976  }
977 
978  // normalise normal vectors
979  Vmath::Zero(nqe, work, 1);
980  for (i = 0; i < GetCoordim(); ++i)
981  {
982  Vmath::Vvtvp(nqe, normal[i], 1, normal[i], 1, work, 1, work, 1);
983  }
984 
985  Vmath::Vsqrt(nqe, work, 1, work, 1);
986  Vmath::Sdiv(nqe, 1.0, work, 1, work, 1);
987 
988  Vmath::Vcopy(nqb, work, 1, length, 1);
989 
990  for (i = 0; i < GetCoordim(); ++i)
991  {
992  Vmath::Vmul(nqe, normal[i], 1, work, 1, normal[i], 1);
993  }
994  }
995 
996  if (GetGeom()->GetEorient(edge) == StdRegions::eBackwards)
997  {
998  for (i = 0; i < GetCoordim(); ++i)
999  {
1000  if (geomFactors->GetGtype() == SpatialDomains::eDeformed)
1001  {
1002  Vmath::Reverse(nqe, normal[i], 1, normal[i], 1);
1003  }
1004  }
1005  }
1006 }
1007 
1009  const NekDouble *data, const std::vector<unsigned int> &nummodes,
1010  const int mode_offset, NekDouble *coeffs,
1011  std::vector<LibUtilities::BasisType> &fromType)
1012 {
1013  boost::ignore_unused(fromType);
1014 
1015  int data_order0 = nummodes[mode_offset];
1016  int fillorder0 = min(m_base[0]->GetNumModes(), data_order0);
1017  int data_order1 = nummodes[mode_offset + 1];
1018  int order1 = m_base[1]->GetNumModes();
1019  int fillorder1 = min(order1, data_order1);
1020 
1021  switch (m_base[0]->GetBasisType())
1022  {
1025  {
1026  int i;
1027  int cnt = 0;
1028  int cnt1 = 0;
1029 
1032  "Extraction routine not set up for this basis");
1033 
1034  Vmath::Zero(m_ncoeffs, coeffs, 1);
1035  for (i = 0; i < fillorder0; ++i)
1036  {
1037  Vmath::Vcopy(fillorder1 - i, &data[cnt], 1, &coeffs[cnt1], 1);
1038  cnt += data_order1 - i;
1039  cnt1 += order1 - i;
1040  }
1041  }
1042  break;
1043  default:
1044  ASSERTL0(false, "basis is either not set up or not hierarchicial");
1045  }
1046 }
1047 
1049 {
1050  return GetGeom2D()->GetEorient(edge);
1051 }
1052 
1054 {
1055  DNekMatSharedPtr returnval;
1056  switch (mkey.GetMatrixType())
1057  {
1065  returnval = Expansion2D::v_GenMatrix(mkey);
1066  break;
1067  default:
1068  returnval = StdTriExp::v_GenMatrix(mkey);
1069  break;
1070  }
1071 
1072  return returnval;
1073 }
1074 
1076 {
1077  LibUtilities::BasisKey bkey0 = m_base[0]->GetBasisKey();
1078  LibUtilities::BasisKey bkey1 = m_base[1]->GetBasisKey();
1081 
1082  return tmp->GetStdMatrix(mkey);
1083 }
1084 
1086 {
1087  return m_matrixManager[mkey];
1088 }
1089 
1091 {
1092  m_matrixManager.DeleteObject(mkey);
1093 }
1094 
1096 {
1097  return m_staticCondMatrixManager[mkey];
1098 }
1099 
1101 {
1102  m_staticCondMatrixManager.DeleteObject(mkey);
1103 }
1104 
1106  Array<OneD, NekDouble> &outarray,
1107  const StdRegions::StdMatrixKey &mkey)
1108 {
1109  StdExpansion::MassMatrixOp_MatFree(inarray, outarray, mkey);
1110 }
1111 
1113  Array<OneD, NekDouble> &outarray,
1114  const StdRegions::StdMatrixKey &mkey)
1115 {
1116  TriExp::LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
1117 }
1118 
1119 void TriExp::v_LaplacianMatrixOp(const int k1, const int k2,
1120  const Array<OneD, const NekDouble> &inarray,
1121  Array<OneD, NekDouble> &outarray,
1122  const StdRegions::StdMatrixKey &mkey)
1123 {
1124  StdExpansion::LaplacianMatrixOp_MatFree(k1, k2, inarray, outarray, mkey);
1125 }
1126 
1128  const Array<OneD, const NekDouble> &inarray,
1129  Array<OneD, NekDouble> &outarray,
1130  const StdRegions::StdMatrixKey &mkey)
1131 {
1132  StdExpansion::WeakDerivMatrixOp_MatFree(i, inarray, outarray, mkey);
1133 }
1134 
1136  const Array<OneD, const NekDouble> &inarray,
1137  Array<OneD, NekDouble> &outarray, const StdRegions::StdMatrixKey &mkey)
1138 {
1139  StdExpansion::WeakDirectionalDerivMatrixOp_MatFree(inarray, outarray, mkey);
1140 }
1141 
1143  const Array<OneD, const NekDouble> &inarray,
1144  Array<OneD, NekDouble> &outarray, const StdRegions::StdMatrixKey &mkey)
1145 {
1146  StdExpansion::MassLevelCurvatureMatrixOp_MatFree(inarray, outarray, mkey);
1147 }
1148 
1150  Array<OneD, NekDouble> &outarray,
1151  const StdRegions::StdMatrixKey &mkey)
1152 {
1153  TriExp::HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
1154 }
1155 
1157  const Array<OneD, const NekDouble> &inarray,
1159 {
1160  if (m_metrics.count(eMetricLaplacian00) == 0)
1161  {
1163  }
1164 
1165  int nquad0 = m_base[0]->GetNumPoints();
1166  int nquad1 = m_base[1]->GetNumPoints();
1167  int nqtot = nquad0 * nquad1;
1168  int nmodes0 = m_base[0]->GetNumModes();
1169  int nmodes1 = m_base[1]->GetNumModes();
1170  int wspsize =
1171  max(max(max(nqtot, m_ncoeffs), nquad1 * nmodes0), nquad0 * nmodes1);
1172 
1173  ASSERTL1(wsp.size() >= 3 * wspsize, "Workspace is of insufficient size.");
1174 
1175  const Array<OneD, const NekDouble> &base0 = m_base[0]->GetBdata();
1176  const Array<OneD, const NekDouble> &base1 = m_base[1]->GetBdata();
1177  const Array<OneD, const NekDouble> &dbase0 = m_base[0]->GetDbdata();
1178  const Array<OneD, const NekDouble> &dbase1 = m_base[1]->GetDbdata();
1179  const Array<OneD, const NekDouble> &metric00 =
1181  const Array<OneD, const NekDouble> &metric01 =
1183  const Array<OneD, const NekDouble> &metric11 =
1185 
1186  // Allocate temporary storage
1187  Array<OneD, NekDouble> wsp0(wsp);
1188  Array<OneD, NekDouble> wsp1(wsp + wspsize);
1189  Array<OneD, NekDouble> wsp2(wsp + 2 * wspsize);
1190 
1191  StdExpansion2D::PhysTensorDeriv(inarray, wsp1, wsp2);
1192 
1193  // wsp0 = k = g0 * wsp1 + g1 * wsp2 = g0 * du_dxi1 + g1 * du_dxi2
1194  // wsp2 = l = g1 * wsp1 + g2 * wsp2 = g0 * du_dxi1 + g1 * du_dxi2
1195  // where g0, g1 and g2 are the metric terms set up in the GeomFactors class
1196  // especially for this purpose
1197  Vmath::Vvtvvtp(nqtot, &metric00[0], 1, &wsp1[0], 1, &metric01[0], 1,
1198  &wsp2[0], 1, &wsp0[0], 1);
1199  Vmath::Vvtvvtp(nqtot, &metric01[0], 1, &wsp1[0], 1, &metric11[0], 1,
1200  &wsp2[0], 1, &wsp2[0], 1);
1201 
1202  // outarray = m = (D_xi1 * B)^T * k
1203  // wsp1 = n = (D_xi2 * B)^T * l
1204  IProductWRTBase_SumFacKernel(dbase0, base1, wsp0, outarray, wsp1);
1205  IProductWRTBase_SumFacKernel(base0, dbase1, wsp2, wsp1, wsp0);
1206 
1207  // outarray = outarray + wsp1
1208  // = L * u_hat
1209  Vmath::Vadd(m_ncoeffs, wsp1.get(), 1, outarray.get(), 1, outarray.get(), 1);
1210 }
1211 
1213 {
1214  if (m_metrics.count(eMetricQuadrature) == 0)
1215  {
1217  }
1218 
1219  unsigned int i, j;
1220  const SpatialDomains::GeomType type = m_metricinfo->GetGtype();
1221  const unsigned int nqtot = GetTotPoints();
1222  const unsigned int dim = 2;
1223  const MetricType m[3][3] = {
1227 
1228  Array<OneD, NekDouble> dEta_dXi[2] = {Array<OneD, NekDouble>(nqtot, 1.0),
1229  Array<OneD, NekDouble>(nqtot, 1.0)};
1230 
1231  for (i = 0; i < dim; ++i)
1232  {
1233  for (j = i; j < dim; ++j)
1234  {
1235  m_metrics[m[i][j]] = Array<OneD, NekDouble>(nqtot);
1236  }
1237  }
1238 
1239  const Array<OneD, const NekDouble> &z0 = m_base[0]->GetZ();
1240  const Array<OneD, const NekDouble> &z1 = m_base[1]->GetZ();
1241  const unsigned int nquad0 = m_base[0]->GetNumPoints();
1242  const unsigned int nquad1 = m_base[1]->GetNumPoints();
1243  const Array<TwoD, const NekDouble> &df =
1244  m_metricinfo->GetDerivFactors(GetPointsKeys());
1245 
1246  for (i = 0; i < nquad1; i++)
1247  {
1248  Blas::Dscal(nquad0, 2.0 / (1 - z1[i]), &dEta_dXi[0][0] + i * nquad0, 1);
1249  Blas::Dscal(nquad0, 2.0 / (1 - z1[i]), &dEta_dXi[1][0] + i * nquad0, 1);
1250  }
1251  for (i = 0; i < nquad0; i++)
1252  {
1253  Blas::Dscal(nquad1, 0.5 * (1 + z0[i]), &dEta_dXi[1][0] + i, nquad0);
1254  }
1255 
1256  Array<OneD, NekDouble> tmp(nqtot);
1257  if ((type == SpatialDomains::eRegular ||
1259  {
1260  Vmath::Smul(nqtot, df[0][0], &dEta_dXi[0][0], 1, &tmp[0], 1);
1261  Vmath::Svtvp(nqtot, df[1][0], &dEta_dXi[1][0], 1, &tmp[0], 1, &tmp[0],
1262  1);
1263 
1264  Vmath::Vmul(nqtot, &tmp[0], 1, &tmp[0], 1,
1265  &m_metrics[eMetricLaplacian00][0], 1);
1266  Vmath::Smul(nqtot, df[1][0], &tmp[0], 1,
1267  &m_metrics[eMetricLaplacian01][0], 1);
1268 
1269  Vmath::Smul(nqtot, df[2][0], &dEta_dXi[0][0], 1, &tmp[0], 1);
1270  Vmath::Svtvp(nqtot, df[3][0], &dEta_dXi[1][0], 1, &tmp[0], 1, &tmp[0],
1271  1);
1272 
1273  Vmath::Vvtvp(nqtot, &tmp[0], 1, &tmp[0], 1,
1274  &m_metrics[eMetricLaplacian00][0], 1,
1275  &m_metrics[eMetricLaplacian00][0], 1);
1276  Vmath::Svtvp(nqtot, df[3][0], &tmp[0], 1,
1277  &m_metrics[eMetricLaplacian01][0], 1,
1278  &m_metrics[eMetricLaplacian01][0], 1);
1279 
1280  if (GetCoordim() == 3)
1281  {
1282  Vmath::Smul(nqtot, df[4][0], &dEta_dXi[0][0], 1, &tmp[0], 1);
1283  Vmath::Svtvp(nqtot, df[5][0], &dEta_dXi[1][0], 1, &tmp[0], 1,
1284  &tmp[0], 1);
1285 
1286  Vmath::Vvtvp(nqtot, &tmp[0], 1, &tmp[0], 1,
1287  &m_metrics[eMetricLaplacian00][0], 1,
1288  &m_metrics[eMetricLaplacian00][0], 1);
1289  Vmath::Svtvp(nqtot, df[5][0], &tmp[0], 1,
1290  &m_metrics[eMetricLaplacian01][0], 1,
1291  &m_metrics[eMetricLaplacian01][0], 1);
1292  }
1293 
1294  NekDouble g2 = df[1][0] * df[1][0] + df[3][0] * df[3][0];
1295  if (GetCoordim() == 3)
1296  {
1297  g2 += df[5][0] * df[5][0];
1298  }
1299  Vmath::Fill(nqtot, g2, &m_metrics[eMetricLaplacian11][0], 1);
1300  }
1301  else
1302  {
1303 
1304  Vmath::Vmul(nqtot, &df[0][0], 1, &dEta_dXi[0][0], 1, &tmp[0], 1);
1305  Vmath::Vvtvp(nqtot, &df[1][0], 1, &dEta_dXi[1][0], 1, &tmp[0], 1,
1306  &tmp[0], 1);
1307 
1308  Vmath::Vmul(nqtot, &tmp[0], 1, &tmp[0], 1,
1309  &m_metrics[eMetricLaplacian00][0], 1);
1310  Vmath::Vmul(nqtot, &df[1][0], 1, &tmp[0], 1,
1311  &m_metrics[eMetricLaplacian01][0], 1);
1312  Vmath::Vmul(nqtot, &df[1][0], 1, &df[1][0], 1,
1313  &m_metrics[eMetricLaplacian11][0], 1);
1314 
1315  Vmath::Vmul(nqtot, &df[2][0], 1, &dEta_dXi[0][0], 1, &tmp[0], 1);
1316  Vmath::Vvtvp(nqtot, &df[3][0], 1, &dEta_dXi[1][0], 1, &tmp[0], 1,
1317  &tmp[0], 1);
1318 
1319  Vmath::Vvtvp(nqtot, &tmp[0], 1, &tmp[0], 1,
1320  &m_metrics[eMetricLaplacian00][0], 1,
1321  &m_metrics[eMetricLaplacian00][0], 1);
1322  Vmath::Vvtvp(nqtot, &df[3][0], 1, &tmp[0], 1,
1323  &m_metrics[eMetricLaplacian01][0], 1,
1324  &m_metrics[eMetricLaplacian01][0], 1);
1325  Vmath::Vvtvp(nqtot, &df[3][0], 1, &df[3][0], 1,
1326  &m_metrics[eMetricLaplacian11][0], 1,
1327  &m_metrics[eMetricLaplacian11][0], 1);
1328 
1329  if (GetCoordim() == 3)
1330  {
1331  Vmath::Vmul(nqtot, &df[4][0], 1, &dEta_dXi[0][0], 1, &tmp[0], 1);
1332  Vmath::Vvtvp(nqtot, &df[5][0], 1, &dEta_dXi[1][0], 1, &tmp[0], 1,
1333  &tmp[0], 1);
1334 
1335  Vmath::Vvtvp(nqtot, &tmp[0], 1, &tmp[0], 1,
1336  &m_metrics[eMetricLaplacian00][0], 1,
1337  &m_metrics[eMetricLaplacian00][0], 1);
1338  Vmath::Vvtvp(nqtot, &df[5][0], 1, &tmp[0], 1,
1339  &m_metrics[eMetricLaplacian01][0], 1,
1340  &m_metrics[eMetricLaplacian01][0], 1);
1341  Vmath::Vvtvp(nqtot, &df[5][0], 1, &df[5][0], 1,
1342  &m_metrics[eMetricLaplacian11][0], 1,
1343  &m_metrics[eMetricLaplacian11][0], 1);
1344  }
1345  }
1346 
1347  for (unsigned int i = 0; i < dim; ++i)
1348  {
1349  for (unsigned int j = i; j < dim; ++j)
1350  {
1351  MultiplyByQuadratureMetric(m_metrics[m[i][j]], m_metrics[m[i][j]]);
1352  }
1353  }
1354 }
1355 
1356 /**
1357  * Function is used to compute exactly the advective numerical flux on
1358  * theinterface of two elements with different expansions, hence an
1359  * appropriate number of Gauss points has to be used. The number of
1360  * Gauss points has to be equal to the number used by the highest
1361  * polynomial degree of the two adjacent elements. Furthermore, this
1362  * function is used to compute the sensor value in each element.
1363  *
1364  * @param numMin Is the reduced polynomial order
1365  * @param inarray Input array of coefficients
1366  * @param dumpVar Output array of reduced coefficients.
1367  */
1369  const Array<OneD, const NekDouble> &inarray,
1370  Array<OneD, NekDouble> &outarray)
1371 {
1372  int n_coeffs = inarray.size();
1373  int nquad0 = m_base[0]->GetNumPoints();
1374  int nquad1 = m_base[1]->GetNumPoints();
1375  int nqtot = nquad0 * nquad1;
1376  int nmodes0 = m_base[0]->GetNumModes();
1377  int nmodes1 = m_base[1]->GetNumModes();
1378  int numMin2 = nmodes0, i;
1379 
1380  Array<OneD, NekDouble> coeff(n_coeffs, 0.0);
1381  Array<OneD, NekDouble> phys_tmp(nqtot, 0.0);
1382  Array<OneD, NekDouble> tmp, tmp2;
1383 
1384  const LibUtilities::PointsKey Pkey0 = m_base[0]->GetPointsKey();
1385  const LibUtilities::PointsKey Pkey1 = m_base[1]->GetPointsKey();
1386 
1387  LibUtilities::BasisKey b0(m_base[0]->GetBasisType(), nmodes0, Pkey0);
1388  LibUtilities::BasisKey b1(m_base[1]->GetBasisType(), nmodes1, Pkey1);
1389  LibUtilities::BasisKey bortho0(LibUtilities::eOrtho_A, nmodes0, Pkey0);
1390  LibUtilities::BasisKey bortho1(LibUtilities::eOrtho_B, nmodes1, Pkey1);
1391 
1392  // Check if it is also possible to use the same InterCoeff routine
1393  // which is also used for Quadrilateral and Hexagonal shaped
1394  // elements
1395 
1396  // For now, set up the used basis on the standard element to
1397  // calculate the phys values, set up the orthogonal basis to do a
1398  // forward transform, to obtain the coefficients in orthogonal
1399  // coefficient space
1400  StdRegions::StdTriExpSharedPtr m_OrthoTriExp;
1402 
1405  bortho0, bortho1);
1406 
1407  m_TriExp->BwdTrans(inarray, phys_tmp);
1408  m_OrthoTriExp->FwdTrans(phys_tmp, coeff);
1409 
1410  for (i = 0; i < n_coeffs; i++)
1411  {
1412  if (i == numMin)
1413  {
1414  coeff[i] = 0.0;
1415  numMin += numMin2 - 1;
1416  numMin2 -= 1.0;
1417  }
1418  }
1419 
1420  m_OrthoTriExp->BwdTrans(coeff, phys_tmp);
1421  m_TriExp->FwdTrans(phys_tmp, outarray);
1422 }
1423 
1425  const StdRegions::StdMatrixKey &mkey)
1426 {
1427  int nq = GetTotPoints();
1428 
1429  // Calculate sqrt of the Jacobian
1431  Array<OneD, NekDouble> sqrt_jac(nq);
1432  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
1433  {
1434  Vmath::Vsqrt(nq, jac, 1, sqrt_jac, 1);
1435  }
1436  else
1437  {
1438  Vmath::Fill(nq, sqrt(jac[0]), sqrt_jac, 1);
1439  }
1440 
1441  // Multiply array by sqrt(Jac)
1442  Vmath::Vmul(nq, sqrt_jac, 1, array, 1, array, 1);
1443 
1444  // Apply std region filter
1445  StdTriExp::v_SVVLaplacianFilter(array, mkey);
1446 
1447  // Divide by sqrt(Jac)
1448  Vmath::Vdiv(nq, array, 1, sqrt_jac, 1, array, 1);
1449 }
1450 
1451 /** @brief: This method gets all of the factors which are
1452  required as part of the Gradient Jump Penalty
1453  stabilisation and involves the product of the normal and
1454  geometric factors along the element trace.
1455 */
1457  Array<OneD, Array<OneD, NekDouble>> &d0factors,
1458  Array<OneD, Array<OneD, NekDouble>> &d1factors,
1459  Array<OneD, Array<OneD, NekDouble>> &d2factors)
1460 {
1461  boost::ignore_unused(d2factors); // for 3D shapes
1462  int nquad0 = GetNumPoints(0);
1463  int nquad1 = GetNumPoints(1);
1464 
1465  const Array<TwoD, const NekDouble> &df =
1466  m_metricinfo->GetDerivFactors(GetPointsKeys());
1467 
1468  if (d0factors.size() != 3)
1469  {
1470  d0factors = Array<OneD, Array<OneD, NekDouble>>(3);
1471  d1factors = Array<OneD, Array<OneD, NekDouble>>(3);
1472  }
1473 
1474  if (d0factors[0].size() != nquad0)
1475  {
1476  d0factors[0] = Array<OneD, NekDouble>(nquad0);
1477  d1factors[0] = Array<OneD, NekDouble>(nquad0);
1478  }
1479 
1480  if (d0factors[1].size() != nquad1)
1481  {
1482  d0factors[1] = Array<OneD, NekDouble>(nquad1);
1483  d0factors[2] = Array<OneD, NekDouble>(nquad1);
1484  d1factors[1] = Array<OneD, NekDouble>(nquad1);
1485  d1factors[2] = Array<OneD, NekDouble>(nquad1);
1486  }
1487 
1488  // Outwards normals
1489  const Array<OneD, const Array<OneD, NekDouble>> &normal_0 =
1490  GetTraceNormal(0);
1491  const Array<OneD, const Array<OneD, NekDouble>> &normal_1 =
1492  GetTraceNormal(1);
1493  const Array<OneD, const Array<OneD, NekDouble>> &normal_2 =
1494  GetTraceNormal(2);
1495 
1496  int ncoords = normal_0.size();
1497 
1498  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
1499  {
1500 
1501  // d xi_2/dx n_x
1502  for (int i = 0; i < nquad0; ++i)
1503  {
1504  d1factors[0][i] = df[1][i] * normal_0[0][i];
1505  }
1506 
1507  // d xi_1/dx n_x
1508  for (int i = 0; i < nquad1; ++i)
1509  {
1510  d0factors[1][i] = df[0][(i + 1) * nquad0 - 1] * normal_1[0][i];
1511  d0factors[2][i] = df[0][i * nquad0] * normal_2[0][i];
1512  }
1513 
1514  for (int n = 1; n < ncoords; ++n)
1515  {
1516  // d xi_2/dy n_y
1517  // needs checking for 3D coords
1518  for (int i = 0; i < nquad0; ++i)
1519  {
1520  d1factors[0][i] += df[2 * n + 1][i] * normal_0[n][i];
1521  }
1522 
1523  // d xi_1/dy n_y
1524  // needs checking for 3D coords
1525  for (int i = 0; i < nquad1; ++i)
1526  {
1527  d0factors[1][i] +=
1528  df[2 * n][(i + 1) * nquad0 - 1] * normal_1[n][i];
1529  d0factors[2][i] += df[2 * n][i * nquad0] * normal_2[n][i];
1530  }
1531  }
1532 
1533  // d0 factors
1534  // d xi_1/dx n_x
1535  for (int i = 0; i < nquad0; ++i)
1536  {
1537  d0factors[0][i] = df[0][i] * normal_0[0][i];
1538  }
1539 
1540  // d xi_2/dx n_x
1541  for (int i = 0; i < nquad1; ++i)
1542  {
1543  d1factors[1][i] = df[1][(i + 1) * nquad0 - 1] * normal_1[0][i];
1544  d1factors[2][i] = df[1][i * nquad0] * normal_2[0][i];
1545  }
1546 
1547  for (int n = 1; n < ncoords; ++n)
1548  {
1549  // d xi_1/dy n_y
1550  // needs checking for 3D coords
1551  for (int i = 0; i < nquad0; ++i)
1552  {
1553  d0factors[0][i] += df[2 * n][i] * normal_0[n][i];
1554  }
1555 
1556  // d xi_2/dy n_y
1557  // needs checking for 3D coords
1558  for (int i = 0; i < nquad1; ++i)
1559  {
1560  d1factors[1][i] +=
1561  df[2 * n + 1][(i + 1) * nquad0 - 1] * normal_1[n][i];
1562  d1factors[2][i] += df[2 * n + 1][i * nquad0] * normal_2[n][i];
1563  }
1564  }
1565  }
1566  else
1567  {
1568  // d xi_2/dx n_x
1569  for (int i = 0; i < nquad0; ++i)
1570  {
1571  d1factors[0][i] = df[1][0] * normal_0[0][i];
1572  }
1573 
1574  // d xi_1/dx n_x
1575  for (int i = 0; i < nquad1; ++i)
1576  {
1577  d0factors[1][i] = df[0][0] * normal_1[0][i];
1578  d0factors[2][i] = df[0][0] * normal_2[0][i];
1579  }
1580 
1581  for (int n = 1; n < ncoords; ++n)
1582  {
1583  // d xi_2/dy n_y
1584  // needs checking for 3D coords
1585  for (int i = 0; i < nquad0; ++i)
1586  {
1587  d1factors[0][i] += df[2 * n + 1][0] * normal_0[n][i];
1588  }
1589 
1590  // d xi_1/dy n_y
1591  // needs checking for 3D coords
1592  for (int i = 0; i < nquad1; ++i)
1593  {
1594  d0factors[1][i] += df[2 * n][0] * normal_1[n][i];
1595  d0factors[2][i] += df[2 * n][0] * normal_2[n][i];
1596  }
1597  }
1598 
1599  // d1factors
1600  // d xi_1/dx n_x
1601  for (int i = 0; i < nquad0; ++i)
1602  {
1603  d0factors[0][i] = df[0][0] * normal_0[0][i];
1604  }
1605 
1606  // d xi_2/dx n_x
1607  for (int i = 0; i < nquad1; ++i)
1608  {
1609  d1factors[1][i] = df[1][0] * normal_1[0][i];
1610  d1factors[2][i] = df[1][0] * normal_2[0][i];
1611  }
1612 
1613  for (int n = 1; n < ncoords; ++n)
1614  {
1615  // d xi_1/dy n_y
1616  // needs checking for 3D coords
1617  for (int i = 0; i < nquad0; ++i)
1618  {
1619  d0factors[0][i] += df[2 * n][0] * normal_0[n][i];
1620  }
1621 
1622  // d xi_2/dy n_y
1623  // needs checking for 3D coords
1624  for (int i = 0; i < nquad1; ++i)
1625  {
1626  d1factors[1][i] += df[2 * n + 1][0] * normal_1[n][i];
1627  d1factors[2][i] += df[2 * n + 1][0] * normal_2[n][i];
1628  }
1629  }
1630  }
1631 }
1632 } // namespace LocalRegions
1633 } // namespace Nektar
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:249
#define sign(a, b)
return the sign(b)*a
Definition: Polylib.cpp:49
Describes the specification for a Basis.
Definition: Basis.h:50
Defines a specification for a set of points.
Definition: Points.h:59
unsigned int GetNumPoints() const
Definition: Points.h:104
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
SpatialDomains::Geometry2DSharedPtr GetGeom2D() const
Definition: Expansion2D.h:172
std::map< int, NormalVector > m_traceNormals
Definition: Expansion.h:278
std::map< int, Array< OneD, NekDouble > > m_elmtBndNormDirElmtLen
the element length in each element boundary(Vertex, edge or face) normal direction calculated based o...
Definition: Expansion.h:288
SpatialDomains::GeometrySharedPtr GetGeom() const
Definition: Expansion.cpp:171
SpatialDomains::GeometrySharedPtr m_geom
Definition: Expansion.h:275
ExpansionSharedPtr GetLeftAdjacentElementExp() const
Definition: Expansion.h:443
void ComputeGmatcdotMF(const Array< TwoD, const NekDouble > &df, const Array< OneD, const NekDouble > &direction, Array< OneD, Array< OneD, NekDouble >> &dfdir)
Definition: Expansion.cpp:608
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition: Expansion.cpp:535
int GetLeftAdjacentElementTrace() const
Definition: Expansion.h:456
SpatialDomains::GeomFactorsSharedPtr m_metricinfo
Definition: Expansion.h:276
StdRegions::Orientation GetTraceOrient(int trace)
Definition: Expansion.h:170
const NormalVector & GetTraceNormal(const int id)
Definition: Expansion.cpp:255
virtual void v_IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: TriExp.cpp:436
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition: TriExp.h:248
virtual StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const override
Definition: TriExp.cpp:645
virtual void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: TriExp.cpp:1149
virtual void v_WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: TriExp.cpp:1127
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals) override
This function evaluates the expansion at a single (arbitrary) point of the domain.
Definition: TriExp.cpp:700
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: TriExp.cpp:402
void v_DropLocMatrix(const MatrixKey &mkey) override
Definition: TriExp.cpp:1090
virtual void v_IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true) override
Definition: TriExp.cpp:409
virtual void v_AlignVectorToCollapsedDir(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray) override
Definition: TriExp.cpp:467
virtual void v_LaplacianMatrixOp_MatFree_Kernel(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp) override
Definition: TriExp.cpp:1156
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition: TriExp.cpp:680
virtual DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: TriExp.cpp:1095
virtual void v_GetTracePhysMap(const int edge, Array< OneD, int > &outarray) override
Definition: TriExp.cpp:787
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: TriExp.cpp:1075
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition: TriExp.h:250
virtual void v_IProductWRTDirectionalDerivBase(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: TriExp.cpp:532
virtual void v_PhysDirectionalDeriv(const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &direction, Array< OneD, NekDouble > &out) override
Physical derivative along a direction vector.
Definition: TriExp.cpp:188
virtual StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const override
Definition: TriExp.cpp:652
virtual void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: TriExp.cpp:1112
virtual void v_GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords) override
Definition: TriExp.cpp:663
virtual DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey) override
Definition: TriExp.cpp:1085
virtual StdRegions::Orientation v_GetTraceOrient(int edge) override
Definition: TriExp.cpp:1048
virtual NekDouble v_StdPhysEvaluate(const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals) override
Definition: TriExp.cpp:692
virtual void v_ComputeTraceNormal(const int edge) override
Definition: TriExp.cpp:822
virtual void v_GetTracePhysVals(const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient) override
Definition: TriExp.cpp:721
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: TriExp.cpp:1053
void v_DropLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: TriExp.cpp:1100
virtual void v_NormalTraceDerivFactors(Array< OneD, Array< OneD, NekDouble >> &factors, Array< OneD, Array< OneD, NekDouble >> &d0factors, Array< OneD, Array< OneD, NekDouble >> &d1factors) override
: This method gets all of the factors which are required as part of the Gradient Jump Penalty stabili...
Definition: TriExp.cpp:1456
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Calculate the inner product of inarray with respect to the basis B=base0[p]*base1[pq] and put into ou...
Definition: TriExp.cpp:396
virtual void v_GetTraceQFactors(const int edge, Array< OneD, NekDouble > &outarray) override
Definition: TriExp.cpp:780
virtual void v_WeakDirectionalDerivMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: TriExp.cpp:1135
virtual void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: TriExp.cpp:269
virtual void v_ReduceOrderCoeffs(int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: TriExp.cpp:1368
virtual void v_ExtractDataToCoeffs(const NekDouble *data, const std::vector< unsigned int > &nummodes, const int mode_offset, NekDouble *coeffs, std::vector< LibUtilities::BasisType > &fromType) override
Definition: TriExp.cpp:1008
virtual void v_MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: TriExp.cpp:1105
virtual void v_IProductWRTDirectionalDerivBase_SumFac(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Directinoal Derivative in the modal space in the dir direction of varcoeffs.
Definition: TriExp.cpp:544
virtual void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdRegions::StdMatrixKey &mkey) override
Definition: TriExp.cpp:1424
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) override
Calculate the derivative of the physical points.
Definition: TriExp.cpp:98
virtual void v_NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, const Array< OneD, const NekDouble > &Fz, Array< OneD, NekDouble > &outarray) override
Definition: TriExp.cpp:610
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Transform a given function from physical quadrature space to coefficient space.
Definition: TriExp.cpp:253
virtual void v_MassLevelCurvatureMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: TriExp.cpp:1142
TriExp(const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const SpatialDomains::Geometry2DSharedPtr &geom)
Constructor using BasisKey class for quadrature points and order definition.
Definition: TriExp.cpp:49
virtual NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray) override
Integrates the specified function over the domain.
Definition: TriExp.cpp:75
virtual void v_ComputeLaplacianMetric() override
Definition: TriExp.cpp:1212
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void IProductWRTBase_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0=true, bool doCheckCollDir1=true)
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
Definition: StdExpansion.h:140
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
Definition: StdExpansion.h:162
void HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
const LibUtilities::PointsKeyVector GetPointsKeys() const
void MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:758
void IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:619
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
this function calculates the inner product of a given function f with the different modes of the expa...
Definition: StdExpansion.h:534
void LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void GetTraceToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards, int P=-1, int Q=-1)
Definition: StdExpansion.h:690
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:373
void GetInteriorMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:680
LibUtilities::PointsType GetPointsType(const int dir) const
This function returns the type of quadrature points used in the dir direction.
Definition: StdExpansion.h:211
int GetNumPoints(const int dir) const
This function returns the number of quadrature points in the dir direction.
Definition: StdExpansion.h:224
void IProductWRTDirectionalDerivBase_SumFac(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true)
void MultiplyByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:729
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
Definition: StdExpansion.h:848
Array< OneD, LibUtilities::BasisSharedPtr > m_base
MatrixType GetMatrixType() const
Definition: StdMatrixKey.h:85
static void Dgemv(const char &trans, const int &m, const int &n, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = A x where A[m x n].
Definition: Blas.hpp:246
static void Dscal(const int &n, const double &alpha, double *x, const int &incx)
BLAS level 1: x = alpha x.
Definition: Blas.hpp:168
static void Daxpy(const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: y = alpha x plus y.
Definition: Blas.hpp:154
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:52
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:250
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:53
@ eModified_B
Principle Modified Functions .
Definition: BasisType.h:51
@ eOrtho_A
Principle Orthogonal Functions .
Definition: BasisType.h:44
@ eOrtho_B
Principle Orthogonal Functions .
Definition: BasisType.h:46
@ eModified_A
Principle Modified Functions .
Definition: BasisType.h:50
std::shared_ptr< SegExp > SegExpSharedPtr
Definition: SegExp.h:251
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:62
GeomType
Indicates the type of element geometry.
@ eRegular
Geometry is straight-sided with constant geometric factors.
@ eMovingRegular
Currently unused.
@ eDeformed
Geometry is curved or has non-constant factors.
std::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry.h:65
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::shared_ptr< StdTriExp > StdTriExpSharedPtr
Definition: StdTriExp.h:232
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:79
static Array< OneD, NekDouble > NullNekDouble1DArray
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75
double NekDouble
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
Definition: Vmath.cpp:534
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
svtvvtp (scalar times vector plus scalar times vector):
Definition: Vmath.cpp:751
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:209
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
Definition: Vmath.cpp:622
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:574
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:359
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.cpp:248
void Sdiv(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/y.
Definition: Vmath.cpp:324
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
Definition: Vmath.cpp:284
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:492
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:45
void Reverse(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1286
void Vvtvvtp(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtp (vector times vector plus vector times vector):
Definition: Vmath.cpp:692
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1255
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:419
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:294