Nektar++
Loading...
Searching...
No Matches
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
37#include <LocalRegions/SegExp.h>
38#include <LocalRegions/TriExp.h>
40
41using namespace std;
42
44{
46 const LibUtilities::BasisKey &Bb,
48 : StdExpansion(LibUtilities::StdTriData::getNumberOfCoefficients(
49 Ba.GetNumModes(), (Bb.GetNumModes())),
50 2, Ba, Bb),
51 StdExpansion2D(LibUtilities::StdTriData::getNumberOfCoefficients(
52 Ba.GetNumModes(), (Bb.GetNumModes())),
53 Ba, Bb),
54 StdTriExp(Ba, Bb), Expansion(geom), Expansion2D(geom),
55 m_matrixManager(
56 std::bind(&Expansion2D::CreateMatrix, this, std::placeholders::_1)),
57 m_staticCondMatrixManager(std::bind(&Expansion::CreateStaticCondMatrix,
58 this, std::placeholders::_1))
59{
60}
61
63 : StdExpansion(T), StdExpansion2D(T), StdTriExp(T), Expansion(T),
64 Expansion2D(T), m_matrixManager(T.m_matrixManager),
65 m_staticCondMatrixManager(T.m_staticCondMatrixManager)
66{
67}
68
70 const Array<OneD, const NekDouble> &inarray,
71 Array<OneD, NekDouble> &outarray)
72{
73 int i, j;
74 int npoints[2] = {m_base[0]->GetNumPoints(), m_base[1]->GetNumPoints()};
75 int nmodes[2] = {m_base[0]->GetNumModes(), m_base[1]->GetNumModes()};
76
77 fill(outarray.data(), outarray.data() + m_ncoeffs, 0.0);
78
79 if (nmodes[0] == 1 && nmodes[1] == 1)
80 {
81 outarray[0] = inarray[0];
82 return;
83 }
84
85 Array<OneD, NekDouble> physEdge[3];
86 Array<OneD, NekDouble> coeffEdge[3];
87 for (i = 0; i < 3; i++)
88 {
89 // define physEdge and add 1 so can interpolate grl10 points if
90 // necessary
91 physEdge[i] = Array<OneD, NekDouble>(max(npoints[i != 0], npoints[0]));
92 coeffEdge[i] = Array<OneD, NekDouble>(nmodes[i != 0]);
93 }
94
95 for (i = 0; i < npoints[0]; i++)
96 {
97 physEdge[0][i] = inarray[i];
98 }
99
100 // extract data in cartesian directions
101 for (i = 0; i < npoints[1]; i++)
102 {
103 physEdge[1][i] = inarray[npoints[0] - 1 + i * npoints[0]];
104 physEdge[2][i] = inarray[i * npoints[0]];
105 }
106
107 SegExpSharedPtr segexp[3];
109 m_base[0]->GetBasisKey(), GetGeom2D()->GetEdge(0));
110
112 {
113 for (i = 1; i < 3; i++)
114 {
116 m_base[i != 0]->GetBasisKey(), GetGeom2D()->GetEdge(i));
117 }
118 }
119 else // interploate using edge 0 GLL distribution
120 {
121 for (i = 1; i < 3; i++)
122 {
124 m_base[0]->GetBasisKey(), GetGeom2D()->GetEdge(i));
125
126 LibUtilities::Interp1D(m_base[1]->GetPointsKey(), physEdge[i],
127 m_base[0]->GetPointsKey(), physEdge[i]);
128 }
129 npoints[1] = npoints[0];
130 }
131
133 Array<OneD, int> signArray;
135
136 for (i = 0; i < 3; i++)
137 {
138 segexp[i]->FwdTransBndConstrained(physEdge[i], coeffEdge[i]);
139
140 // this orient goes with the one above and so could
141 // probably set both to eForwards
142 GetTraceToElementMap(i, mapArray, signArray);
143 for (j = 0; j < nmodes[i != 0]; j++)
144 {
145 sign = (NekDouble)signArray[j];
146 outarray[mapArray[j]] = sign * coeffEdge[i][j];
147 }
148 }
149
150 int nBoundaryDofs = NumBndryCoeffs();
151 int nInteriorDofs = m_ncoeffs - nBoundaryDofs;
152
153 if (nInteriorDofs > 0)
154 {
157
159 *this);
160 MassMatrixOp(outarray, tmp0, stdmasskey);
161 v_IProductWRTBase(inarray, tmp1);
162
163 Vmath::Vsub(m_ncoeffs, tmp1, 1, tmp0, 1, tmp1, 1);
164
165 // get Mass matrix inverse (only of interior DOF)
166 // use block (1,1) of the static condensed system
167 // note: this block alreay contains the inverse matrix
168 MatrixKey masskey(StdRegions::eMass, DetShapeType(), *this);
169 DNekScalMatSharedPtr matsys =
170 (m_staticCondMatrixManager[masskey])->GetBlock(1, 1);
171
172 Array<OneD, NekDouble> rhs(nInteriorDofs);
173 Array<OneD, NekDouble> result(nInteriorDofs);
174
175 GetInteriorMap(mapArray);
176
177 for (i = 0; i < nInteriorDofs; i++)
178 {
179 rhs[i] = tmp1[mapArray[i]];
180 }
181
182 Blas::Dgemv('N', nInteriorDofs, nInteriorDofs, matsys->Scale(),
183 &((matsys->GetOwnedMatrix())->GetPtr())[0], nInteriorDofs,
184 rhs.data(), 1, 0.0, result.data(), 1);
185
186 for (i = 0; i < nInteriorDofs; i++)
187 {
188 outarray[mapArray[i]] = result[i];
189 }
190 }
191}
192
194 const Array<OneD, const NekDouble> &inarray,
195 Array<OneD, NekDouble> &outarray)
196{
197 int nquad0 = m_base[0]->GetNumPoints();
198 int nquad1 = m_base[1]->GetNumPoints();
199 int nqtot = nquad0 * nquad1;
200
201 Array<OneD, NekDouble> tmp1(nqtot);
202 Array<OneD, NekDouble> tmp2(nqtot);
205 tmp2D[0] = tmp1;
206 tmp2D[1] = tmp2;
207
208 TriExp::v_AlignVectorToCollapsedDir(dir, inarray, tmp2D);
209
210 const Array<OneD, const NekDouble> &jac = m_geomFactors->GetJac();
211
212 bool Deformed = (m_geomFactors->GetGtype() == SpatialDomains::eDeformed);
213
214 v_IProductWRTBaseKernel(m_base[0]->GetDbdata(), m_base[1]->GetBdata(), tmp1,
215 tmp3, jac, Deformed);
216
217 v_IProductWRTBaseKernel(m_base[0]->GetBdata(), m_base[1]->GetDbdata(), tmp2,
218 outarray, jac, Deformed);
219
220 Vmath::Vadd(m_ncoeffs, tmp3, 1, outarray, 1, outarray, 1);
221}
222
224 const int dir, const Array<OneD, const NekDouble> &inarray,
226{
227 ASSERTL1((dir == 0) || (dir == 1) || (dir == 2), "Invalid direction.");
228 ASSERTL1((dir == 2) ? (m_geom->GetCoordim() == 3) : true,
229 "Invalid direction.");
230
231 int nquad0 = m_base[0]->GetNumPoints();
232 int nquad1 = m_base[1]->GetNumPoints();
233 int nqtot = nquad0 * nquad1;
234 int nmodes0 = m_base[0]->GetNumModes();
235 int wspsize = max(max(nqtot, m_ncoeffs), nquad1 * nmodes0);
236
237 const Array<TwoD, const NekDouble> &df = m_geomFactors->GetDerivFactors();
238
239 Array<OneD, NekDouble> tmp0(wspsize);
240 Array<OneD, NekDouble> tmp3(wspsize);
241
242 Array<OneD, NekDouble> tmp1 = outarray[0];
243 Array<OneD, NekDouble> tmp2 = outarray[1];
244
245 // get geometric factor: 2/(1-z1)
247 m_base[1]->GetBasisKey());
249
250 // get geometric facotr: 0.5*(1-z0)
252 m_base[0]->GetBasisKey());
254
255 for (int i = 0; i < nquad1; ++i)
256 {
257 Vmath::Smul(nquad0, gfac0[i], &inarray[0] + i * nquad0, 1,
258 &tmp0[0] + i * nquad0, 1);
259 }
260
261 for (int i = 0; i < nquad1; ++i)
262 {
263 Vmath::Vmul(nquad0, &gfac1[0], 1, &tmp0[0] + i * nquad0, 1,
264 &tmp1[0] + i * nquad0, 1);
265 }
266
267 if (m_geomFactors->GetGtype() == SpatialDomains::eDeformed)
268 {
269 Vmath::Vmul(nqtot, &df[2 * dir][0], 1, &tmp0[0], 1, &tmp0[0], 1);
270 Vmath::Vmul(nqtot, &df[2 * dir + 1][0], 1, &tmp1[0], 1, &tmp1[0], 1);
271 Vmath::Vmul(nqtot, &df[2 * dir + 1][0], 1, &inarray[0], 1, &tmp2[0], 1);
272 }
273 else
274 {
275 Vmath::Smul(nqtot, df[2 * dir][0], tmp0, 1, tmp0, 1);
276 Vmath::Smul(nqtot, df[2 * dir + 1][0], tmp1, 1, tmp1, 1);
277 Vmath::Smul(nqtot, df[2 * dir + 1][0], inarray, 1, tmp2, 1);
278 }
279 Vmath::Vadd(nqtot, tmp0, 1, tmp1, 1, tmp1, 1);
280}
281
283 const Array<OneD, const NekDouble> &direction,
284 const Array<OneD, const NekDouble> &inarray,
285 Array<OneD, NekDouble> &outarray)
286{
287 int i;
288 int shapedim = 2;
289 int nquad0 = m_base[0]->GetNumPoints();
290 int nquad1 = m_base[1]->GetNumPoints();
291 int nqtot = nquad0 * nquad1;
292
293 const Array<TwoD, const NekDouble> &df = m_geomFactors->GetDerivFactors();
294
295 Array<OneD, NekDouble> tmp0(nqtot);
296 Array<OneD, NekDouble> tmp1(nqtot);
297 Array<OneD, NekDouble> tmp2(nqtot);
299
300 // get geometric factor: 2/(1-z1)
302 m_base[1]->GetBasisKey());
304
305 // get geometric facotr: 0.5*(1-z0)
307 m_base[0]->GetBasisKey());
309
310 for (i = 0; i < nquad1; ++i)
311 {
312 Vmath::Smul(nquad0, gfac0[i], &inarray[0] + i * nquad0, 1,
313 &tmp0[0] + i * nquad0, 1);
314 }
315 for (i = 0; i < nquad1; ++i)
316 {
317 Vmath::Vmul(nquad0, &gfac1[0], 1, &tmp0[0] + i * nquad0, 1,
318 &tmp1[0] + i * nquad0, 1);
319 }
320
321 // Compute gmat \cdot e^j
322 Array<OneD, Array<OneD, NekDouble>> dfdir(shapedim);
323 Expansion::ComputeGmatcdotMF(df, direction, dfdir);
324
325 Vmath::Vmul(nqtot, &dfdir[0][0], 1, &tmp0[0], 1, &tmp0[0], 1);
326 Vmath::Vmul(nqtot, &dfdir[1][0], 1, &tmp1[0], 1, &tmp1[0], 1);
327 Vmath::Vmul(nqtot, &dfdir[1][0], 1, &inarray[0], 1, &tmp2[0], 1);
328
329 Vmath::Vadd(nqtot, &tmp0[0], 1, &tmp1[0], 1, &tmp1[0], 1);
330
331 const Array<OneD, const NekDouble> &jac = m_geomFactors->GetJac();
332 bool Deformed = (m_geomFactors->GetGtype() == SpatialDomains::eDeformed);
333
334 v_IProductWRTBaseKernel(m_base[0]->GetDbdata(), m_base[1]->GetBdata(), tmp1,
335 tmp3, jac, Deformed);
336
337 v_IProductWRTBaseKernel(m_base[0]->GetBdata(), m_base[1]->GetDbdata(), tmp2,
338 outarray, jac, Deformed);
339
340 Vmath::Vadd(m_ncoeffs, tmp3, 1, outarray, 1, outarray, 1);
341}
342
346 Array<OneD, NekDouble> &outarray)
347{
348 int nq = m_base[0]->GetNumPoints() * m_base[1]->GetNumPoints();
350
352 GetLeftAdjacentElementExp()->GetTraceNormal(
354
355 if (m_geomFactors->GetGtype() == SpatialDomains::eDeformed)
356 {
357 Vmath::Vvtvvtp(nq, &normals[0][0], 1, &Fx[0], 1, &normals[1][0], 1,
358 &Fy[0], 1, &Fn[0], 1);
359 Vmath::Vvtvp(nq, &normals[2][0], 1, &Fz[0], 1, &Fn[0], 1, &Fn[0], 1);
360 }
361 else
362 {
363 Vmath::Svtsvtp(nq, normals[0][0], &Fx[0], 1, normals[1][0], &Fy[0], 1,
364 &Fn[0], 1);
365 Vmath::Svtvp(nq, normals[2][0], &Fz[0], 1, &Fn[0], 1, &Fn[0], 1);
366 }
367
368 IProductWRTBase(Fn, outarray);
369}
370
372 const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
373 Array<OneD, NekDouble> &outarray)
374{
375 NormVectorIProductWRTBase(Fvec[0], Fvec[1], Fvec[2], outarray);
376}
377
379{
380
382 m_base[0]->GetBasisKey(), m_base[1]->GetBasisKey());
383}
384
386{
388 m_base[0]->GetPointsKey());
390 m_base[1]->GetPointsKey());
391
393 bkey1);
394}
395
398{
399 int i;
400
401 ASSERTL1(Lcoords[0] >= -1.0 && Lcoords[1] <= 1.0 && Lcoords[1] >= -1.0 &&
402 Lcoords[1] <= 1.0,
403 "Local coordinates are not in region [-1,1]");
404
405 m_geom->FillGeom();
406
407 for (i = 0; i < m_geom->GetCoordim(); ++i)
408 {
409 coords[i] = m_geom->GetCoord(i, Lcoords);
410 }
411}
412
414 Array<OneD, NekDouble> &coords_1,
415 Array<OneD, NekDouble> &coords_2)
416{
417 Expansion::v_GetCoords(coords_0, coords_1, coords_2);
418}
419
421 const Array<OneD, NekDouble> &coord,
422 const Array<OneD, const NekDouble> &inarray,
423 std::array<NekDouble, 3> &firstOrderDerivs)
424{
425 Array<OneD, NekDouble> Lcoord(2);
426 ASSERTL0(m_geom, "m_geom not defined");
427 m_geom->GetLocCoords(coord, Lcoord);
428 return StdTriExp::v_PhysEvalFirstDeriv(Lcoord, inarray, firstOrderDerivs);
429}
430
432 const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp,
433 const Array<OneD, const NekDouble> &inarray,
435{
436 v_GetLocTracePhysVals(edge, EdgeExp, inarray.data(), outarray);
437 if (orient == StdRegions::eNoOrientation)
438 {
439 orient = GetTraceOrient(edge);
440 }
441
442 // Reverse data if necessary
443 if (orient == StdRegions::eBackwards)
444 {
445 Vmath::Reverse(EdgeExp->GetNumPoints(0), &outarray[0], 1, &outarray[0],
446 1);
447 }
448}
449
451 const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp,
452 const NekDouble *inarray, Array<OneD, NekDouble> &outarray)
453{
454 int nquad0 = m_base[0]->GetNumPoints();
455 int nquad1 = m_base[1]->GetNumPoints();
456 int nt = 0;
457 // Extract in Cartesian direction because we have to deal with
458 // e.g. Gauss-Radau points.
459 switch (edge)
460 {
461 case 0:
462 Vmath::Vcopy(nquad0, &(inarray[0]), 1, &(outarray[0]), 1);
463 nt = nquad0;
464 break;
465 case 1:
466 Vmath::Vcopy(nquad1, &(inarray[0]) + (nquad0 - 1), nquad0,
467 &(outarray[0]), 1);
468 nt = nquad1;
469 break;
470 case 2:
471 Vmath::Vcopy(nquad1, &(inarray[0]), nquad0, &(outarray[0]), 1);
472 nt = nquad1;
473 break;
474 default:
475 ASSERTL0(false, "edge value (< 3) is out of range");
476 break;
477 }
478
479 ASSERTL1(EdgeExp->GetBasis(0)->GetPointsType() ==
481 "Edge expansion should be GLL");
482
483 // Interpolate if required
484 if (m_base[edge ? 1 : 0]->GetPointsKey() !=
485 EdgeExp->GetBasis(0)->GetPointsKey())
486 {
487 Array<OneD, NekDouble> outtmp(max(nquad0, nquad1));
488
489 Vmath::Vcopy(nt, outarray, 1, outtmp, 1);
490
491 LibUtilities::Interp1D(m_base[edge ? 1 : 0]->GetPointsKey(), outtmp,
492 EdgeExp->GetBasis(0)->GetPointsKey(), outarray);
493 }
494}
495
497 [[maybe_unused]] const int edge,
498 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
499{
500 ASSERTL0(false, "Routine not implemented for triangular elements");
501}
502
503void TriExp::v_GetTracePhysMap(const int edge, Array<OneD, int> &outarray)
504{
505 int nquad0 = m_base[0]->GetNumPoints();
506 int nquad1 = m_base[1]->GetNumPoints();
507
508 // Get points in Cartesian orientation
509 switch (edge)
510 {
511 case 0:
512 outarray = Array<OneD, int>(nquad0);
513 for (int i = 0; i < nquad0; ++i)
514 {
515 outarray[i] = i;
516 }
517 break;
518 case 1:
519 outarray = Array<OneD, int>(nquad1);
520 for (int i = 0; i < nquad1; ++i)
521 {
522 outarray[i] = (nquad0 - 1) + i * nquad0;
523 }
524 break;
525 case 2:
526 outarray = Array<OneD, int>(nquad1);
527 for (int i = 0; i < nquad1; ++i)
528 {
529 outarray[i] = i * nquad0;
530 }
531 break;
532 default:
533 ASSERTL0(false, "edge value (< 3) is out of range");
534 break;
535 }
536}
537
539{
540 int i;
542 for (i = 0; i < ptsKeys.size(); ++i)
543 {
544 // Need at least 2 points for computing normals
545 if (ptsKeys[i].GetNumPoints() == 1)
546 {
547 LibUtilities::PointsKey pKey(2, ptsKeys[i].GetPointsType());
548 ptsKeys[i] = pKey;
549 }
550 }
551
552 const SpatialDomains::GeomType type = m_geomFactors->GetGtype();
554 m_geomFactors->ComputeDerivFactors(ptsKeys);
556 m_geomFactors->ComputeJac(ptsKeys);
557
558 // The points of normals should follow trace basis, not local basis.
560
561 int nqe = tobasis.GetNumPoints();
562 int dim = GetCoordim();
563
566 for (i = 0; i < dim; ++i)
567 {
568 normal[i] = Array<OneD, NekDouble>(nqe);
569 }
570
571 size_t nqb = nqe;
572 size_t nbnd = edge;
575
576 // Regular geometry case
577 if ((type == SpatialDomains::eRegular) ||
579 {
580 NekDouble fac;
581 // Set up normals
582 switch (edge)
583 {
584 case 0:
585 for (i = 0; i < GetCoordim(); ++i)
586 {
587 Vmath::Fill(nqe, -df[2 * i + 1][0], normal[i], 1);
588 }
589 break;
590 case 1:
591 for (i = 0; i < GetCoordim(); ++i)
592 {
593 Vmath::Fill(nqe, df[2 * i + 1][0] + df[2 * i][0], normal[i],
594 1);
595 }
596 break;
597 case 2:
598 for (i = 0; i < GetCoordim(); ++i)
599 {
600 Vmath::Fill(nqe, -df[2 * i][0], normal[i], 1);
601 }
602 break;
603 default:
604 ASSERTL0(false, "Edge is out of range (edge < 3)");
605 }
606
607 // normalise
608 fac = 0.0;
609 for (i = 0; i < GetCoordim(); ++i)
610 {
611 fac += normal[i][0] * normal[i][0];
612 }
613 fac = 1.0 / sqrt(fac);
614
615 Vmath::Fill(nqb, fac, length, 1);
616
617 for (i = 0; i < GetCoordim(); ++i)
618 {
619 Vmath::Smul(nqe, fac, normal[i], 1, normal[i], 1);
620 }
621 }
622 else // Set up deformed normals
623 {
624 int j;
625
626 int nquad0 = ptsKeys[0].GetNumPoints();
627 int nquad1 = ptsKeys[1].GetNumPoints();
628
630
631 Array<OneD, NekDouble> normals(GetCoordim() * max(nquad0, nquad1), 0.0);
632 Array<OneD, NekDouble> edgejac(GetCoordim() * max(nquad0, nquad1), 0.0);
633
634 // Extract Jacobian along edges and recover local
635 // derivates (dx/dr) for polynomial interpolation by
636 // multiplying m_gmat by jacobian
637 switch (edge)
638 {
639 case 0:
640 for (j = 0; j < nquad0; ++j)
641 {
642 edgejac[j] = jac[j];
643 for (i = 0; i < GetCoordim(); ++i)
644 {
645 normals[i * nquad0 + j] =
646 -df[2 * i + 1][j] * edgejac[j];
647 }
648 }
649 from_key = ptsKeys[0];
650 break;
651 case 1:
652 for (j = 0; j < nquad1; ++j)
653 {
654 edgejac[j] = jac[nquad0 * j + nquad0 - 1];
655 for (i = 0; i < GetCoordim(); ++i)
656 {
657 normals[i * nquad1 + j] =
658 (df[2 * i][nquad0 * j + nquad0 - 1] +
659 df[2 * i + 1][nquad0 * j + nquad0 - 1]) *
660 edgejac[j];
661 }
662 }
663 from_key = ptsKeys[1];
664 break;
665 case 2:
666 for (j = 0; j < nquad1; ++j)
667 {
668 edgejac[j] = jac[nquad0 * j];
669 for (i = 0; i < GetCoordim(); ++i)
670 {
671 normals[i * nquad1 + j] =
672 -df[2 * i][nquad0 * j] * edgejac[j];
673 }
674 }
675 from_key = ptsKeys[1];
676 break;
677 default:
678 ASSERTL0(false, "edge is out of range (edge < 3)");
679 }
680
681 int nq = from_key.GetNumPoints();
682 Array<OneD, NekDouble> work(nqe, 0.0);
683
684 // interpolate Jacobian and invert
685 LibUtilities::Interp1D(from_key, jac, tobasis.GetPointsKey(), work);
686 Vmath::Sdiv(nqe, 1.0, &work[0], 1, &work[0], 1);
687
688 // interpolate
689 for (i = 0; i < GetCoordim(); ++i)
690 {
691 LibUtilities::Interp1D(from_key, &normals[i * nq],
692 tobasis.GetPointsKey(), &normal[i][0]);
693 Vmath::Vmul(nqe, work, 1, normal[i], 1, normal[i], 1);
694 }
695
696 // normalise normal vectors
697 Vmath::Zero(nqe, work, 1);
698 for (i = 0; i < GetCoordim(); ++i)
699 {
700 Vmath::Vvtvp(nqe, normal[i], 1, normal[i], 1, work, 1, work, 1);
701 }
702
703 Vmath::Vsqrt(nqe, work, 1, work, 1);
704 Vmath::Sdiv(nqe, 1.0, work, 1, work, 1);
705
706 Vmath::Vcopy(nqb, work, 1, length, 1);
707
708 for (i = 0; i < GetCoordim(); ++i)
709 {
710 Vmath::Vmul(nqe, normal[i], 1, work, 1, normal[i], 1);
711 }
712 }
713
714 if (GetGeom()->GetEorient(edge) == StdRegions::eBackwards)
715 {
716 for (i = 0; i < GetCoordim(); ++i)
717 {
718 if (m_geomFactors->GetGtype() == SpatialDomains::eDeformed)
719 {
720 Vmath::Reverse(nqe, normal[i], 1, normal[i], 1);
721 }
722 }
723 }
724}
725
727 const NekDouble *data, const std::vector<unsigned int> &nummodes,
728 const int mode_offset, NekDouble *coeffs,
729 [[maybe_unused]] std::vector<LibUtilities::BasisType> &fromType)
730{
731 int data_order0 = nummodes[mode_offset];
732 int fillorder0 = min(m_base[0]->GetNumModes(), data_order0);
733 int data_order1 = nummodes[mode_offset + 1];
734 int order1 = m_base[1]->GetNumModes();
735 int fillorder1 = min(order1, data_order1);
736
737 switch (m_base[0]->GetBasisType())
738 {
741 {
742 int i;
743 int cnt = 0;
744 int cnt1 = 0;
745
748 "Extraction routine not set up for this basis");
749
750 Vmath::Zero(m_ncoeffs, coeffs, 1);
751 for (i = 0; i < fillorder0; ++i)
752 {
753 Vmath::Vcopy(fillorder1 - i, &data[cnt], 1, &coeffs[cnt1], 1);
754 cnt += data_order1 - i;
755 cnt1 += order1 - i;
756 }
757 }
758 break;
759 default:
760 ASSERTL0(false, "basis is either not set up or not hierarchicial");
761 }
762}
763
768
770{
771 DNekMatSharedPtr returnval;
772 switch (mkey.GetMatrixType())
773 {
781 returnval = Expansion2D::v_GenMatrix(mkey);
782 break;
783 default:
784 returnval = StdTriExp::v_GenMatrix(mkey);
785 break;
786 }
787
788 return returnval;
789}
790
792{
793 LibUtilities::BasisKey bkey0 = m_base[0]->GetBasisKey();
794 LibUtilities::BasisKey bkey1 = m_base[1]->GetBasisKey();
797
798 return tmp->GetStdMatrix(mkey);
799}
800
805
807{
808 m_matrixManager.DeleteObject(mkey);
809}
810
815
817{
818 m_staticCondMatrixManager.DeleteObject(mkey);
819}
820
822 Array<OneD, NekDouble> &outarray,
823 const StdRegions::StdMatrixKey &mkey)
824{
825 StdExpansion::MassMatrixOp_MatFree(inarray, outarray, mkey);
826}
827
829 Array<OneD, NekDouble> &outarray,
830 const StdRegions::StdMatrixKey &mkey)
831{
832 TriExp::LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
833}
834
835void TriExp::v_LaplacianMatrixOp(const int k1, const int k2,
836 const Array<OneD, const NekDouble> &inarray,
837 Array<OneD, NekDouble> &outarray,
838 const StdRegions::StdMatrixKey &mkey)
839{
840 StdExpansion::LaplacianMatrixOp_MatFree(k1, k2, inarray, outarray, mkey);
841}
842
844 const Array<OneD, const NekDouble> &inarray,
845 Array<OneD, NekDouble> &outarray,
846 const StdRegions::StdMatrixKey &mkey)
847{
848 StdExpansion::WeakDerivMatrixOp_MatFree(i, inarray, outarray, mkey);
849}
850
852 const Array<OneD, const NekDouble> &inarray,
854{
855 StdExpansion::WeakDirectionalDerivMatrixOp_MatFree(inarray, outarray, mkey);
856}
857
859 const Array<OneD, const NekDouble> &inarray,
861{
862 StdExpansion::MassLevelCurvatureMatrixOp_MatFree(inarray, outarray, mkey);
863}
864
866 Array<OneD, NekDouble> &outarray,
867 const StdRegions::StdMatrixKey &mkey)
868{
869 TriExp::HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
870}
871
873 const Array<OneD, const NekDouble> &inarray,
875{
876 if (m_metrics.count(eMetricLaplacian00) == 0)
877 {
879 }
880
881 int nquad0 = m_base[0]->GetNumPoints();
882 int nquad1 = m_base[1]->GetNumPoints();
883 int nqtot = nquad0 * nquad1;
884 int nmodes0 = m_base[0]->GetNumModes();
885 int nmodes1 = m_base[1]->GetNumModes();
886 int wspsize =
887 max(max(max(nqtot, m_ncoeffs), nquad1 * nmodes0), nquad0 * nmodes1);
888
889 ASSERTL1(wsp.size() >= 3 * wspsize, "Workspace is of insufficient size.");
890
891 const Array<OneD, const NekDouble> &base0 = m_base[0]->GetBdata();
892 const Array<OneD, const NekDouble> &base1 = m_base[1]->GetBdata();
893 const Array<OneD, const NekDouble> &dbase0 = m_base[0]->GetDbdata();
894 const Array<OneD, const NekDouble> &dbase1 = m_base[1]->GetDbdata();
895 const Array<OneD, const NekDouble> &metric00 =
897 const Array<OneD, const NekDouble> &metric01 =
899 const Array<OneD, const NekDouble> &metric11 =
901
902 // Allocate temporary storage
903 Array<OneD, NekDouble> wsp0(wsp);
904 Array<OneD, NekDouble> wsp1(wsp + wspsize);
905 Array<OneD, NekDouble> wsp2(wsp + 2 * wspsize);
906
907 PhysTensorDeriv(inarray, wsp1, wsp2);
908
909 // wsp0 = k = g0 * wsp1 + g1 * wsp2 = g0 * du_dxi1 + g1 * du_dxi2
910 // wsp2 = l = g1 * wsp1 + g2 * wsp2 = g0 * du_dxi1 + g1 * du_dxi2
911 // where g0, g1 and g2 are the metric terms set up in the GeomFactors class
912 // especially for this purpose
913 Vmath::Vvtvvtp(nqtot, &metric00[0], 1, &wsp1[0], 1, &metric01[0], 1,
914 &wsp2[0], 1, &wsp0[0], 1);
915 Vmath::Vvtvvtp(nqtot, &metric01[0], 1, &wsp1[0], 1, &metric11[0], 1,
916 &wsp2[0], 1, &wsp2[0], 1);
917
918 // outarray = m = (D_xi1 * B)^T * k
919 // wsp1 = n = (D_xi2 * B)^T * l
920 const Array<OneD, const NekDouble> &jac = m_geomFactors->GetJac();
921 bool Deformed = (m_geomFactors->GetGtype() == SpatialDomains::eDeformed);
922
923 v_IProductWRTBaseKernel(dbase0, base1, wsp0, outarray, jac, Deformed);
924 v_IProductWRTBaseKernel(base0, dbase1, wsp2, wsp1, jac, Deformed);
925
926 // outarray = outarray + wsp1
927 // = L * u_hat
928 Vmath::Vadd(m_ncoeffs, wsp1.data(), 1, outarray.data(), 1, outarray.data(),
929 1);
930}
931
933{
934 unsigned int i, j;
935 const SpatialDomains::GeomType type = m_geomFactors->GetGtype();
936 const unsigned int nqtot = GetTotPoints();
937 const unsigned int dim = 2;
938 const MetricType m[3][3] = {
942
943 Array<OneD, NekDouble> dEta_dXi[2] = {Array<OneD, NekDouble>(nqtot, 1.0),
944 Array<OneD, NekDouble>(nqtot, 1.0)};
945
946 for (i = 0; i < dim; ++i)
947 {
948 for (j = i; j < dim; ++j)
949 {
950 m_metrics[m[i][j]] = Array<OneD, NekDouble>(nqtot);
951 }
952 }
953
954 const unsigned int nquad0 = m_base[0]->GetNumPoints();
955 const unsigned int nquad1 = m_base[1]->GetNumPoints();
956 const Array<TwoD, const NekDouble> &df = m_geomFactors->GetDerivFactors();
957
958 // get geometric factor: 2/(1-z1)
960 m_base[1]->GetBasisKey());
962 for (i = 0; i < nquad1; i++)
963 {
964 Blas::Dscal(nquad0, gfac0[i], &dEta_dXi[0][0] + i * nquad0, 1);
965 Blas::Dscal(nquad0, gfac0[i], &dEta_dXi[1][0] + i * nquad0, 1);
966 }
967
968 // get geometric facotr: 0.5*(1-z0)
970 m_base[0]->GetBasisKey());
972 for (i = 0; i < nquad0; i++)
973 {
974 Blas::Dscal(nquad1, gfac1[i], &dEta_dXi[1][0] + i, nquad0);
975 }
976
977 Array<OneD, NekDouble> tmp(nqtot);
978 if ((type == SpatialDomains::eRegular ||
980 {
981 Vmath::Smul(nqtot, df[0][0], &dEta_dXi[0][0], 1, &tmp[0], 1);
982 Vmath::Svtvp(nqtot, df[1][0], &dEta_dXi[1][0], 1, &tmp[0], 1, &tmp[0],
983 1);
984
985 Vmath::Vmul(nqtot, &tmp[0], 1, &tmp[0], 1,
987 Vmath::Smul(nqtot, df[1][0], &tmp[0], 1,
989
990 Vmath::Smul(nqtot, df[2][0], &dEta_dXi[0][0], 1, &tmp[0], 1);
991 Vmath::Svtvp(nqtot, df[3][0], &dEta_dXi[1][0], 1, &tmp[0], 1, &tmp[0],
992 1);
993
994 Vmath::Vvtvp(nqtot, &tmp[0], 1, &tmp[0], 1,
997 Vmath::Svtvp(nqtot, df[3][0], &tmp[0], 1,
1000
1001 if (GetCoordim() == 3)
1002 {
1003 Vmath::Smul(nqtot, df[4][0], &dEta_dXi[0][0], 1, &tmp[0], 1);
1004 Vmath::Svtvp(nqtot, df[5][0], &dEta_dXi[1][0], 1, &tmp[0], 1,
1005 &tmp[0], 1);
1006
1007 Vmath::Vvtvp(nqtot, &tmp[0], 1, &tmp[0], 1,
1010 Vmath::Svtvp(nqtot, df[5][0], &tmp[0], 1,
1013 }
1014
1015 NekDouble g2 = df[1][0] * df[1][0] + df[3][0] * df[3][0];
1016 if (GetCoordim() == 3)
1017 {
1018 g2 += df[5][0] * df[5][0];
1019 }
1020 Vmath::Fill(nqtot, g2, &m_metrics[eMetricLaplacian11][0], 1);
1021 }
1022 else
1023 {
1024
1025 Vmath::Vmul(nqtot, &df[0][0], 1, &dEta_dXi[0][0], 1, &tmp[0], 1);
1026 Vmath::Vvtvp(nqtot, &df[1][0], 1, &dEta_dXi[1][0], 1, &tmp[0], 1,
1027 &tmp[0], 1);
1028
1029 Vmath::Vmul(nqtot, &tmp[0], 1, &tmp[0], 1,
1031 Vmath::Vmul(nqtot, &df[1][0], 1, &tmp[0], 1,
1033 Vmath::Vmul(nqtot, &df[1][0], 1, &df[1][0], 1,
1035
1036 Vmath::Vmul(nqtot, &df[2][0], 1, &dEta_dXi[0][0], 1, &tmp[0], 1);
1037 Vmath::Vvtvp(nqtot, &df[3][0], 1, &dEta_dXi[1][0], 1, &tmp[0], 1,
1038 &tmp[0], 1);
1039
1040 Vmath::Vvtvp(nqtot, &tmp[0], 1, &tmp[0], 1,
1043 Vmath::Vvtvp(nqtot, &df[3][0], 1, &tmp[0], 1,
1046 Vmath::Vvtvp(nqtot, &df[3][0], 1, &df[3][0], 1,
1049
1050 if (GetCoordim() == 3)
1051 {
1052 Vmath::Vmul(nqtot, &df[4][0], 1, &dEta_dXi[0][0], 1, &tmp[0], 1);
1053 Vmath::Vvtvp(nqtot, &df[5][0], 1, &dEta_dXi[1][0], 1, &tmp[0], 1,
1054 &tmp[0], 1);
1055
1056 Vmath::Vvtvp(nqtot, &tmp[0], 1, &tmp[0], 1,
1059 Vmath::Vvtvp(nqtot, &df[5][0], 1, &tmp[0], 1,
1062 Vmath::Vvtvp(nqtot, &df[5][0], 1, &df[5][0], 1,
1065 }
1066 }
1067}
1068
1069/**
1070 * Function is used to compute exactly the advective numerical flux on
1071 * theinterface of two elements with different expansions, hence an
1072 * appropriate number of Gauss points has to be used. The number of
1073 * Gauss points has to be equal to the number used by the highest
1074 * polynomial degree of the two adjacent elements. Furthermore, this
1075 * function is used to compute the sensor value in each element.
1076 *
1077 * @param numMin Is the reduced polynomial order
1078 * @param inarray Input array of coefficients
1079 * @param dumpVar Output array of reduced coefficients.
1080 */
1082 const Array<OneD, const NekDouble> &inarray,
1083 Array<OneD, NekDouble> &outarray)
1084{
1085 int n_coeffs = inarray.size();
1086 int nquad0 = m_base[0]->GetNumPoints();
1087 int nquad1 = m_base[1]->GetNumPoints();
1088 int nqtot = nquad0 * nquad1;
1089 int nmodes0 = m_base[0]->GetNumModes();
1090 int nmodes1 = m_base[1]->GetNumModes();
1091 int numMin2 = nmodes0, i;
1092
1093 Array<OneD, NekDouble> coeff(n_coeffs, 0.0);
1094 Array<OneD, NekDouble> phys_tmp(nqtot, 0.0);
1095 Array<OneD, NekDouble> tmp, tmp2;
1096
1097 const LibUtilities::PointsKey Pkey0 = m_base[0]->GetPointsKey();
1098 const LibUtilities::PointsKey Pkey1 = m_base[1]->GetPointsKey();
1099
1100 LibUtilities::BasisKey b0(m_base[0]->GetBasisType(), nmodes0, Pkey0);
1101 LibUtilities::BasisKey b1(m_base[1]->GetBasisType(), nmodes1, Pkey1);
1102 LibUtilities::BasisKey bortho0(LibUtilities::eOrtho_A, nmodes0, Pkey0);
1103 LibUtilities::BasisKey bortho1(LibUtilities::eOrtho_B, nmodes1, Pkey1);
1104
1105 // Check if it is also possible to use the same InterCoeff routine
1106 // which is also used for Quadrilateral and Hexagonal shaped
1107 // elements
1108
1109 // For now, set up the used basis on the standard element to
1110 // calculate the phys values, set up the orthogonal basis to do a
1111 // forward transform, to obtain the coefficients in orthogonal
1112 // coefficient space
1113 StdRegions::StdTriExpSharedPtr m_OrthoTriExp;
1115
1118 bortho0, bortho1);
1119
1120 m_TriExp->BwdTrans(inarray, phys_tmp);
1121 m_OrthoTriExp->FwdTrans(phys_tmp, coeff);
1122
1123 for (i = 0; i < n_coeffs; i++)
1124 {
1125 if (i == numMin)
1126 {
1127 coeff[i] = 0.0;
1128 numMin += numMin2 - 1;
1129 numMin2 -= 1.0;
1130 }
1131 }
1132
1133 m_OrthoTriExp->BwdTrans(coeff, phys_tmp);
1134 m_TriExp->FwdTrans(phys_tmp, outarray);
1135}
1136
1138 const StdRegions::StdMatrixKey &mkey)
1139{
1140 int nq = GetTotPoints();
1141
1142 // Calculate sqrt of the Jacobian
1144 Array<OneD, NekDouble> sqrt_jac(nq);
1145 if (m_geomFactors->GetGtype() == SpatialDomains::eDeformed)
1146 {
1147 Vmath::Vsqrt(nq, jac, 1, sqrt_jac, 1);
1148 }
1149 else
1150 {
1151 Vmath::Fill(nq, sqrt(jac[0]), sqrt_jac, 1);
1152 }
1153
1154 // Multiply array by sqrt(Jac)
1155 Vmath::Vmul(nq, sqrt_jac, 1, array, 1, array, 1);
1156
1157 // Apply std region filter
1158 StdTriExp::v_SVVLaplacianFilter(array, mkey);
1159
1160 // Divide by sqrt(Jac)
1161 Vmath::Vdiv(nq, array, 1, sqrt_jac, 1, array, 1);
1162}
1163
1164} // namespace Nektar::LocalRegions
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define sign(a, b)
return the sign(b)*a
Definition Polylib.cpp:47
Describes the specification for a Basis.
Definition Basis.h:45
int GetNumPoints() const
Return points order at which basis is defined.
Definition Basis.h:120
PointsKey GetPointsKey() const
Return distribution of points.
Definition Basis.h:137
Defines a specification for a set of points.
Definition Points.h:50
size_t GetNumPoints() const
Definition Points.h:85
DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
SpatialDomains::Geometry2D * GetGeom2D() const
void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Calculates the inner product of a given function f with the different modes of the expansion.
std::map< int, NormalVector > m_traceNormals
Definition Expansion.h:309
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:319
SpatialDomains::Geometry * GetGeom() const
ExpansionSharedPtr GetLeftAdjacentElementExp() const
Definition Expansion.h:531
SpatialDomains::Geometry * m_geom
Definition Expansion.h:306
void ComputeGmatcdotMF(const Array< TwoD, const NekDouble > &df, const Array< OneD, const NekDouble > &direction, Array< OneD, Array< OneD, NekDouble > > &dfdir)
void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
int GetLeftAdjacentElementTrace() const
Definition Expansion.h:544
StdRegions::Orientation GetTraceOrient(int trace)
Definition Expansion.h:181
SpatialDomains::GeomFactorsUniquePtr m_geomFactors
Definition Expansion.h:307
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition TriExp.h:198
StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const override
Definition TriExp.cpp:378
void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition TriExp.cpp:865
NekDouble v_PhysEvalFirstDeriv(const Array< OneD, NekDouble > &coord, const Array< OneD, const NekDouble > &inarray, std::array< NekDouble, 3 > &firstOrderDerivs) override
Definition TriExp.cpp:420
void v_WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition TriExp.cpp:843
void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition TriExp.cpp:193
void v_AlignVectorToCollapsedDir(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray) override
Definition TriExp.cpp:223
void v_DropLocMatrix(const MatrixKey &mkey) override
Definition TriExp.cpp:806
void v_LaplacianMatrixOp_MatFree_Kernel(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp) override
Definition TriExp.cpp:872
void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition TriExp.cpp:413
DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey) override
Definition TriExp.cpp:811
void v_GetTracePhysMap(const int edge, Array< OneD, int > &outarray) override
Definition TriExp.cpp:503
DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition TriExp.cpp:791
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition TriExp.h:200
void v_IProductWRTDirectionalDerivBase(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition TriExp.cpp:282
StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const override
Definition TriExp.cpp:385
void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition TriExp.cpp:828
void v_GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords) override
Definition TriExp.cpp:396
DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey) override
Definition TriExp.cpp:801
StdRegions::Orientation v_GetTraceOrient(int edge) override
Definition TriExp.cpp:764
TriExp(const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, SpatialDomains::Geometry2D *geom)
Constructor using BasisKey class for quadrature points and order definition.
Definition TriExp.cpp:45
void v_ComputeTraceNormal(const int edge) override
Definition TriExp.cpp:538
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:431
DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition TriExp.cpp:769
void v_DropLocStaticCondMatrix(const MatrixKey &mkey) override
Definition TriExp.cpp:816
void v_GetTraceQFactors(const int edge, Array< OneD, NekDouble > &outarray) override
Definition TriExp.cpp:496
void v_WeakDirectionalDerivMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition TriExp.cpp:851
void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition TriExp.cpp:69
void v_GetLocTracePhysVals(const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp, const NekDouble *inarray, Array< OneD, NekDouble > &outarray) override
Definition TriExp.cpp:450
void v_ReduceOrderCoeffs(int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition TriExp.cpp:1081
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:726
void v_MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition TriExp.cpp:821
void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdRegions::StdMatrixKey &mkey) override
Definition TriExp.cpp:1137
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:343
void v_MassLevelCurvatureMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition TriExp.cpp:858
void v_ComputeLaplacianMetric() override
Definition TriExp.cpp:932
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
2D geometry information
Definition Geometry2D.h:50
NekDouble GetCoord(const int i, const Array< OneD, const NekDouble > &Lcoord)
Given local collapsed coordinate Lcoord, return the value of physical coordinate in direction i.
Definition Geometry.h:559
NekDouble GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this ge...
Definition Geometry.h:549
int GetCoordim() const
Return the coordinate dimension of this object (i.e. the dimension of the space in which this object ...
Definition Geometry.h:277
void FillGeom()
Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements.
Definition Geometry.h:461
StdRegions::Orientation GetEorient(const int i) const
Returns the orientation of edge i with respect to the ordering of edges in the standard element.
Definition Geometry.h:378
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray_d0, Array< OneD, NekDouble > &outarray_d1)
Calculate the 2D derivative in the local tensor/collapsed coordinate at the physical points.
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
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)
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
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...
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)
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
void GetInteriorMap(Array< OneD, unsigned int > &outarray)
LibUtilities::PointsType GetPointsType(const int dir) const
This function returns the type of quadrature points used in the dir direction.
int GetNumPoints(const int dir) const
This function returns the number of quadrature points in the dir direction.
Array< OneD, const NekDouble > GetStdFac(const StdFacKey &mkey)
const LibUtilities::BasisKey GetTraceBasisKey(const int i, int k=-1, bool UseGLL=false) const
This function returns the basis key belonging to the i-th trace.
Array< OneD, LibUtilities::BasisSharedPtr > m_base
MatrixType GetMatrixType() const
void v_IProductWRTBaseKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const Array< OneD, NekDouble > &jac, const bool Deformed, const bool CollDir0=false, const bool CollDir1=false) override
Inner product of inarray over region with respect to the expansion basis (this)->m_base[0] and return...
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 = alpha A x plus beta y where A[m x n].
Definition Blas.hpp:152
static void Dscal(const int &n, const double &alpha, double *x, const int &incx)
BLAS level 1: x = alpha x.
Definition Blas.hpp:124
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:47
std::vector< PointsKey > PointsKeyVector
Definition Points.h:313
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition PointsType.h:51
@ eModified_B
Principle Modified Functions .
Definition BasisType.h:49
@ eOrtho_A
Principle Orthogonal Functions .
Definition BasisType.h:42
@ eOrtho_B
Principle Orthogonal Functions .
Definition BasisType.h:44
@ eModified_A
Principle Modified Functions .
Definition BasisType.h:48
std::shared_ptr< SegExp > SegExpSharedPtr
Definition SegExp.h:208
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< StdExpansion > StdExpansionSharedPtr
std::shared_ptr< StdTriExp > StdTriExpSharedPtr
Definition StdTriExp.h:177
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
std::shared_ptr< DNekMat > DNekMatSharedPtr
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
Definition Vmath.hpp:340
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
Svtsvtp (scalar times vector plus scalar times vector):
Definition Vmath.hpp:473
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.hpp:72
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.hpp:396
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.hpp:366
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.hpp:180
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.hpp:100
void Sdiv(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/x.
Definition Vmath.hpp:154
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.hpp:126
void Zero(int n, T *x, const int incx)
Zero vector.
Definition Vmath.hpp:273
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition Vmath.hpp:54
void Reverse(int n, const T *x, const int incx, T *y, const int incy)
Definition Vmath.hpp:844
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.hpp:439
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition Vmath.hpp:825
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.hpp:220
STL namespace.
scalarT< T > max(scalarT< T > lhs, scalarT< T > rhs)
Definition scalar.hpp:305
scalarT< T > min(scalarT< T > lhs, scalarT< T > rhs)
Definition scalar.hpp:300
scalarT< T > sqrt(scalarT< T > in)
Definition scalar.hpp:290