Nektar++
Loading...
Searching...
No Matches
QuadExp.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: QuadExp.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//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Expansion for quadrilateral elements.
32//
33///////////////////////////////////////////////////////////////////////////////
34
41#include <LocalRegions/SegExp.h>
42
43using namespace std;
44
46{
48 const LibUtilities::BasisKey &Bb,
50 : StdExpansion(Ba.GetNumModes() * Bb.GetNumModes(), 2, Ba, Bb),
51 StdExpansion2D(Ba.GetNumModes() * Bb.GetNumModes(), Ba, Bb),
52 StdQuadExp(Ba, Bb), Expansion(geom), Expansion2D(geom),
53 m_matrixManager(
54 std::bind(&Expansion2D::CreateMatrix, this, std::placeholders::_1)),
55 m_staticCondMatrixManager(std::bind(&Expansion::CreateStaticCondMatrix,
56 this, std::placeholders::_1))
57{
58}
59
61 : StdExpansion(T), StdExpansion2D(T), StdQuadExp(T), Expansion(T),
62 Expansion2D(T), m_matrixManager(T.m_matrixManager),
63 m_staticCondMatrixManager(T.m_staticCondMatrixManager)
64{
65}
66
68 const Array<OneD, const NekDouble> &inarray,
69 Array<OneD, NekDouble> &outarray)
70{
71 if ((m_base[0]->Collocation()) && (m_base[1]->Collocation()))
72 {
73 Vmath::Vcopy(m_ncoeffs, inarray, 1, outarray, 1);
74 }
75 else
76 {
77 int i, j;
78 int npoints[2] = {m_base[0]->GetNumPoints(), m_base[1]->GetNumPoints()};
79 int nmodes[2] = {m_base[0]->GetNumModes(), m_base[1]->GetNumModes()};
80
81 fill(outarray.data(), outarray.data() + m_ncoeffs, 0.0);
82
83 if (nmodes[0] == 1 && nmodes[1] == 1)
84 {
85 outarray[0] = inarray[0];
86 return;
87 }
88
89 Array<OneD, NekDouble> physEdge[4];
90 Array<OneD, NekDouble> coeffEdge[4];
91 for (i = 0; i < 4; i++)
92 {
93 physEdge[i] = Array<OneD, NekDouble>(npoints[i % 2]);
94 coeffEdge[i] = Array<OneD, NekDouble>(nmodes[i % 2]);
95 }
96
97 for (i = 0; i < npoints[0]; i++)
98 {
99 physEdge[0][i] = inarray[i];
100 physEdge[2][i] = inarray[npoints[0] * (npoints[1] - 1) + i];
101 }
102
103 for (i = 0; i < npoints[1]; i++)
104 {
105 physEdge[1][i] = inarray[npoints[0] - 1 + i * npoints[0]];
106 physEdge[3][i] = inarray[i * npoints[0]];
107 }
108
109 SegExpSharedPtr segexp[4];
110 for (i = 0; i < 4; i++)
111 {
113 m_base[i % 2]->GetBasisKey(), GetGeom2D()->GetEdge(i));
114 }
115
117 Array<OneD, int> signArray;
119
120 for (i = 0; i < 4; i++)
121 {
122 segexp[i % 2]->FwdTransBndConstrained(physEdge[i], coeffEdge[i]);
123
124 GetTraceToElementMap(i, mapArray, signArray);
125 for (j = 0; j < nmodes[i % 2]; j++)
126 {
127 sign = (NekDouble)signArray[j];
128 outarray[mapArray[j]] = sign * coeffEdge[i][j];
129 }
130 }
131
132 int nBoundaryDofs = NumBndryCoeffs();
133 int nInteriorDofs = m_ncoeffs - nBoundaryDofs;
134
135 if (nInteriorDofs > 0)
136 {
139
141 DetShapeType(), *this);
142 MassMatrixOp(outarray, tmp0, stdmasskey);
143 v_IProductWRTBase(inarray, tmp1);
144
145 Vmath::Vsub(m_ncoeffs, tmp1, 1, tmp0, 1, tmp1, 1);
146
147 // get Mass matrix inverse (only of interior DOF)
148 // use block (1,1) of the static condensed system
149 // note: this block alreay contains the inverse matrix
150 MatrixKey masskey(StdRegions::eMass, DetShapeType(), *this);
151 DNekScalMatSharedPtr matsys =
152 (m_staticCondMatrixManager[masskey])->GetBlock(1, 1);
153
154 Array<OneD, NekDouble> rhs(nInteriorDofs);
155 Array<OneD, NekDouble> result(nInteriorDofs);
156
157 GetInteriorMap(mapArray);
158
159 for (i = 0; i < nInteriorDofs; i++)
160 {
161 rhs[i] = tmp1[mapArray[i]];
162 }
163
164 Blas::Dgemv('N', nInteriorDofs, nInteriorDofs, matsys->Scale(),
165 &((matsys->GetOwnedMatrix())->GetPtr())[0],
166 nInteriorDofs, rhs.data(), 1, 0.0, result.data(), 1);
167
168 for (i = 0; i < nInteriorDofs; i++)
169 {
170 outarray[mapArray[i]] = result[i];
171 }
172 }
173 }
174}
175
177 const int dir, const Array<OneD, const NekDouble> &inarray,
178 Array<OneD, NekDouble> &outarray)
179{
180 ASSERTL1((dir == 0) || (dir == 1) || (dir == 2), "Invalid direction.");
181 ASSERTL1((dir == 2) ? (m_geom->GetCoordim() == 3) : true,
182 "Invalid direction.");
183
184 int nquad0 = m_base[0]->GetNumPoints();
185 int nquad1 = m_base[1]->GetNumPoints();
186 int nqtot = nquad0 * nquad1;
187
188 Array<OneD, NekDouble> tmp1(nqtot);
189 Array<OneD, NekDouble> tmp2(nqtot);
191
193 tmp2D[0] = tmp1;
194 tmp2D[1] = tmp2;
195
196 QuadExp::v_AlignVectorToCollapsedDir(dir, inarray, tmp2D);
197
198 const Array<OneD, const NekDouble> &jac = m_geomFactors->GetJac();
199 bool Deformed = (m_geomFactors->GetGtype() == SpatialDomains::eDeformed);
200
201 v_IProductWRTBaseKernel(m_base[0]->GetDbdata(), m_base[1]->GetBdata(), tmp1,
202 tmp3, jac, Deformed, false,
203 m_base[1]->Collocation());
204
205 v_IProductWRTBaseKernel(m_base[0]->GetBdata(), m_base[1]->GetDbdata(), tmp2,
206 outarray, jac, Deformed, m_base[0]->Collocation(),
207 false);
208
209 Vmath::Vadd(m_ncoeffs, tmp3, 1, outarray, 1, outarray, 1);
210}
211
213 const int dir, const Array<OneD, const NekDouble> &inarray,
215{
216 ASSERTL1((dir == 0) || (dir == 1) || (dir == 2), "Invalid direction.");
217 ASSERTL1((dir == 2) ? (m_geom->GetCoordim() == 3) : true,
218 "Invalid direction.");
219
220 int nqtot = m_base[0]->GetNumPoints() * m_base[1]->GetNumPoints();
221
222 const Array<TwoD, const NekDouble> &df = m_geomFactors->GetDerivFactors();
223
224 Array<OneD, NekDouble> tmp1 = outarray[0];
225 Array<OneD, NekDouble> tmp2 = outarray[1];
226
227 if (m_geomFactors->GetGtype() == SpatialDomains::eDeformed)
228 {
229 Vmath::Vmul(nqtot, &df[2 * dir][0], 1, inarray.data(), 1, tmp1.data(),
230 1);
231 Vmath::Vmul(nqtot, &df[2 * dir + 1][0], 1, inarray.data(), 1,
232 tmp2.data(), 1);
233 }
234 else
235 {
236 Vmath::Smul(nqtot, df[2 * dir][0], inarray.data(), 1, tmp1.data(), 1);
237 Vmath::Smul(nqtot, df[2 * dir + 1][0], inarray.data(), 1, tmp2.data(),
238 1);
239 }
240}
241
246{
247 int nq = m_base[0]->GetNumPoints() * m_base[1]->GetNumPoints();
249
251 GetLeftAdjacentElementExp()->GetTraceNormal(
253
254 if (m_geomFactors->GetGtype() == SpatialDomains::eDeformed)
255 {
256 Vmath::Vvtvvtp(nq, &normals[0][0], 1, &Fx[0], 1, &normals[1][0], 1,
257 &Fy[0], 1, &Fn[0], 1);
258 Vmath::Vvtvp(nq, &normals[2][0], 1, &Fz[0], 1, &Fn[0], 1, &Fn[0], 1);
259 }
260 else
261 {
262 Vmath::Svtsvtp(nq, normals[0][0], &Fx[0], 1, normals[1][0], &Fy[0], 1,
263 &Fn[0], 1);
264 Vmath::Svtvp(nq, normals[2][0], &Fz[0], 1, &Fn[0], 1, &Fn[0], 1);
265 }
266
267 IProductWRTBase(Fn, outarray);
268}
269
271 const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
272 Array<OneD, NekDouble> &outarray)
273{
274 NormVectorIProductWRTBase(Fvec[0], Fvec[1], Fvec[2], outarray);
275}
276
282
284{
286 m_base[0]->GetPointsKey());
288 m_base[1]->GetPointsKey());
289
291 bkey1);
292}
293
295 Array<OneD, NekDouble> &coords_1,
296 Array<OneD, NekDouble> &coords_2)
297{
298 Expansion::v_GetCoords(coords_0, coords_1, coords_2);
299}
300
303{
304 int i;
305
306 ASSERTL1(Lcoords[0] >= -1.0 && Lcoords[1] <= 1.0 && Lcoords[1] >= -1.0 &&
307 Lcoords[1] <= 1.0,
308 "Local coordinates are not in region [-1,1]");
309
310 m_geom->FillGeom();
311 for (i = 0; i < m_geom->GetCoordim(); ++i)
312 {
313 coords[i] = m_geom->GetCoord(i, Lcoords);
314 }
315}
316
318 const Array<OneD, NekDouble> &coord,
319 const Array<OneD, const NekDouble> &inarray,
320 std::array<NekDouble, 3> &firstOrderDerivs)
321{
322 Array<OneD, NekDouble> Lcoord(2);
323 ASSERTL0(m_geom, "m_geom not defined");
324 m_geom->GetLocCoords(coord, Lcoord);
325 return StdQuadExp::v_PhysEvalFirstDeriv(Lcoord, inarray, firstOrderDerivs);
326}
327
329 const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp,
330 const Array<OneD, const NekDouble> &inarray,
332{
333 v_GetLocTracePhysVals(edge, EdgeExp, inarray.data(), outarray);
334
335 if (orient == StdRegions::eNoOrientation)
336 {
337 orient = GetTraceOrient(edge);
338 }
339 // Reverse data if necessary
340 if (orient == StdRegions::eBackwards)
341 {
342 Vmath::Reverse(EdgeExp->GetNumPoints(0), &outarray[0], 1, &outarray[0],
343 1);
344 }
345}
346
348 const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp,
349 const double *inarray, Array<OneD, NekDouble> &outarray)
350{
351 int nquad0 = m_base[0]->GetNumPoints();
352 int nquad1 = m_base[1]->GetNumPoints();
353
354 // Implementation for all the basis except Gauss points
357 {
358 switch (edge)
359 {
360 case 0:
361 Vmath::Vcopy(nquad0, &(inarray[0]), 1, &(outarray[0]), 1);
362 break;
363 case 1:
364 Vmath::Vcopy(nquad1, &(inarray[0]) + (nquad0 - 1), nquad0,
365 &(outarray[0]), 1);
366 break;
367 case 2:
368 Vmath::Vcopy(nquad0, &(inarray[0]) + nquad0 * (nquad1 - 1), 1,
369 &(outarray[0]), 1);
370 break;
371 case 3:
372 Vmath::Vcopy(nquad1, &(inarray[0]), nquad0, &(outarray[0]), 1);
373 break;
374 default:
375 ASSERTL0(false, "edge value (< 3) is out of range");
376 break;
377 }
378 }
379 else
380 {
381 QuadExp::GetEdgeInterpVals(edge, inarray, outarray);
382 }
383
384 // Interpolate if required
385 if (m_base[edge % 2]->GetPointsKey() !=
386 EdgeExp->GetBasis(0)->GetPointsKey())
387 {
388 Array<OneD, NekDouble> outtmp(max(nquad0, nquad1));
389
390 outtmp = outarray;
391
392 LibUtilities::Interp1D(m_base[edge % 2]->GetPointsKey(), outtmp,
393 EdgeExp->GetBasis(0)->GetPointsKey(), outarray);
394 }
395}
396
397void QuadExp::GetEdgeInterpVals(const int edge,
398 const Array<OneD, const NekDouble> &inarray,
399 Array<OneD, NekDouble> &outarray)
400{
401 GetEdgeInterpVals(edge, inarray.data(), outarray);
402}
403
404void QuadExp::GetEdgeInterpVals(const int edge, const NekDouble *inarray,
405 Array<OneD, NekDouble> &outarray)
406{
407 int i;
408 int nq0 = m_base[0]->GetNumPoints();
409 int nq1 = m_base[1]->GetNumPoints();
410
412 factors[StdRegions::eFactorGaussEdge] = edge;
413
415 *this, factors);
416
417 DNekScalMatSharedPtr mat_gauss = m_matrixManager[key];
418
419 switch (edge)
420 {
421 case 0:
422 {
423 for (i = 0; i < nq0; i++)
424 {
425 outarray[i] = Vmath::Dot(
426 nq1, mat_gauss->GetOwnedMatrix()->GetPtr().data(), 1,
427 &inarray[i], nq0);
428 }
429 break;
430 }
431 case 1:
432 {
433 for (i = 0; i < nq1; i++)
434 {
435 outarray[i] = Vmath::Dot(
436 nq0, mat_gauss->GetOwnedMatrix()->GetPtr().data(), 1,
437 &inarray[i * nq0], 1);
438 }
439 break;
440 }
441 case 2:
442 {
443 for (i = 0; i < nq0; i++)
444 {
445 outarray[i] = Vmath::Dot(
446 nq1, mat_gauss->GetOwnedMatrix()->GetPtr().data(), 1,
447 &inarray[i], nq0);
448 }
449 break;
450 }
451 case 3:
452 {
453 for (i = 0; i < nq1; i++)
454 {
455 outarray[i] = Vmath::Dot(
456 nq0, mat_gauss->GetOwnedMatrix()->GetPtr().data(), 1,
457 &inarray[i * nq0], 1);
458 }
459 break;
460 }
461 default:
462 ASSERTL0(false, "edge value (< 3) is out of range");
463 break;
464 }
465}
466
467void QuadExp::v_GetTracePhysMap(const int edge, Array<OneD, int> &outarray)
468{
469 int nquad0 = m_base[0]->GetNumPoints();
470 int nquad1 = m_base[1]->GetNumPoints();
471
472 // Get points in Cartesian orientation
473 switch (edge)
474 {
475 case 0:
476 outarray = Array<OneD, int>(nquad0);
477 for (int i = 0; i < nquad0; ++i)
478 {
479 outarray[i] = i;
480 }
481 break;
482 case 1:
483 outarray = Array<OneD, int>(nquad1);
484 for (int i = 0; i < nquad1; ++i)
485 {
486 outarray[i] = (nquad0 - 1) + i * nquad0;
487 }
488 break;
489 case 2:
490 outarray = Array<OneD, int>(nquad0);
491 for (int i = 0; i < nquad0; ++i)
492 {
493 outarray[i] = i + nquad0 * (nquad1 - 1);
494 }
495 break;
496 case 3:
497 outarray = Array<OneD, int>(nquad1);
498 for (int i = 0; i < nquad1; ++i)
499 {
500 outarray[i] = i * nquad0;
501 }
502 break;
503 default:
504 ASSERTL0(false, "edge value (< 3) is out of range");
505 break;
506 }
507}
508
509void QuadExp::v_GetTraceQFactors(const int edge,
510 Array<OneD, NekDouble> &outarray)
511{
512 int i;
513 int nquad0 = m_base[0]->GetNumPoints();
514 int nquad1 = m_base[1]->GetNumPoints();
515
517 const Array<OneD, const NekDouble> &jac = m_geomFactors->GetJac();
518 const Array<TwoD, const NekDouble> &df = m_geomFactors->GetDerivFactors();
519
520 Array<OneD, NekDouble> j(max(nquad0, nquad1), 0.0);
521 Array<OneD, NekDouble> g0(max(nquad0, nquad1), 0.0);
522 Array<OneD, NekDouble> g1(max(nquad0, nquad1), 0.0);
523 Array<OneD, NekDouble> g2(max(nquad0, nquad1), 0.0);
524 Array<OneD, NekDouble> g3(max(nquad0, nquad1), 0.0);
525
526 if (m_geomFactors->GetGtype() == SpatialDomains::eDeformed)
527 {
528 // Implementation for all the basis except Gauss points
531 {
532 switch (edge)
533 {
534 case 0:
535 Vmath::Vcopy(nquad0, &(df[1][0]), 1, &(g1[0]), 1);
536 Vmath::Vcopy(nquad0, &(df[3][0]), 1, &(g3[0]), 1);
537 Vmath::Vcopy(nquad0, &(jac[0]), 1, &(j[0]), 1);
538
539 for (i = 0; i < nquad0; ++i)
540 {
541 outarray[i] =
542 j[i] * sqrt(g1[i] * g1[i] + g3[i] * g3[i]);
543 }
544 break;
545 case 1:
546 Vmath::Vcopy(nquad1, &(df[0][0]) + (nquad0 - 1), nquad0,
547 &(g0[0]), 1);
548
549 Vmath::Vcopy(nquad1, &(df[2][0]) + (nquad0 - 1), nquad0,
550 &(g2[0]), 1);
551
552 Vmath::Vcopy(nquad1, &(jac[0]) + (nquad0 - 1), nquad0,
553 &(j[0]), 1);
554
555 for (i = 0; i < nquad1; ++i)
556 {
557 outarray[i] =
558 j[i] * sqrt(g0[i] * g0[i] + g2[i] * g2[i]);
559 }
560 break;
561 case 2:
562
563 Vmath::Vcopy(nquad0, &(df[1][0]) + (nquad0 * (nquad1 - 1)),
564 1, &(g1[0]), 1);
565
566 Vmath::Vcopy(nquad0, &(df[3][0]) + (nquad0 * (nquad1 - 1)),
567 1, &(g3[0]), 1);
568
569 Vmath::Vcopy(nquad0, &(jac[0]) + (nquad0 * (nquad1 - 1)), 1,
570 &(j[0]), 1);
571
572 for (i = 0; i < nquad0; ++i)
573 {
574 outarray[i] =
575 j[i] * sqrt(g1[i] * g1[i] + g3[i] * g3[i]);
576 }
577 break;
578 case 3:
579
580 Vmath::Vcopy(nquad1, &(df[0][0]), nquad0, &(g0[0]), 1);
581 Vmath::Vcopy(nquad1, &(df[2][0]), nquad0, &(g2[0]), 1);
582 Vmath::Vcopy(nquad1, &(jac[0]), nquad0, &(j[0]), 1);
583
584 for (i = 0; i < nquad1; ++i)
585 {
586 outarray[i] =
587 j[i] * sqrt(g0[i] * g0[i] + g2[i] * g2[i]);
588 }
589 break;
590 default:
591 ASSERTL0(false, "edge value (< 3) is out of range");
592 break;
593 }
594 }
595 else
596 {
597 int nqtot = nquad0 * nquad1;
598 Array<OneD, NekDouble> tmp_gmat0(nqtot, 0.0);
599 Array<OneD, NekDouble> tmp_gmat1(nqtot, 0.0);
600 Array<OneD, NekDouble> tmp_gmat2(nqtot, 0.0);
601 Array<OneD, NekDouble> tmp_gmat3(nqtot, 0.0);
602 Array<OneD, NekDouble> g0_edge(max(nquad0, nquad1), 0.0);
603 Array<OneD, NekDouble> g1_edge(max(nquad0, nquad1), 0.0);
604 Array<OneD, NekDouble> g2_edge(max(nquad0, nquad1), 0.0);
605 Array<OneD, NekDouble> g3_edge(max(nquad0, nquad1), 0.0);
606 Array<OneD, NekDouble> jac_edge(max(nquad0, nquad1), 0.0);
607
608 switch (edge)
609 {
610 case 0:
611 Vmath::Vmul(nqtot, &(df[1][0]), 1, &jac[0], 1,
612 &(tmp_gmat1[0]), 1);
613 Vmath::Vmul(nqtot, &(df[3][0]), 1, &jac[0], 1,
614 &(tmp_gmat3[0]), 1);
615 QuadExp::GetEdgeInterpVals(edge, tmp_gmat1, g1_edge);
616 QuadExp::GetEdgeInterpVals(edge, tmp_gmat3, g3_edge);
617
618 for (i = 0; i < nquad0; ++i)
619 {
620 outarray[i] = sqrt(g1_edge[i] * g1_edge[i] +
621 g3_edge[i] * g3_edge[i]);
622 }
623 break;
624
625 case 1:
626 Vmath::Vmul(nqtot, &(df[0][0]), 1, &jac[0], 1,
627 &(tmp_gmat0[0]), 1);
628 Vmath::Vmul(nqtot, &(df[2][0]), 1, &jac[0], 1,
629 &(tmp_gmat2[0]), 1);
630 QuadExp::GetEdgeInterpVals(edge, tmp_gmat0, g0_edge);
631 QuadExp::GetEdgeInterpVals(edge, tmp_gmat2, g2_edge);
632
633 for (i = 0; i < nquad1; ++i)
634 {
635 outarray[i] = sqrt(g0_edge[i] * g0_edge[i] +
636 g2_edge[i] * g2_edge[i]);
637 }
638
639 break;
640 case 2:
641
642 Vmath::Vmul(nqtot, &(df[1][0]), 1, &jac[0], 1,
643 &(tmp_gmat1[0]), 1);
644 Vmath::Vmul(nqtot, &(df[3][0]), 1, &jac[0], 1,
645 &(tmp_gmat3[0]), 1);
646 QuadExp::GetEdgeInterpVals(edge, tmp_gmat1, g1_edge);
647 QuadExp::GetEdgeInterpVals(edge, tmp_gmat3, g3_edge);
648
649 for (i = 0; i < nquad0; ++i)
650 {
651 outarray[i] = sqrt(g1_edge[i] * g1_edge[i] +
652 g3_edge[i] * g3_edge[i]);
653 }
654
655 Vmath::Reverse(nquad0, &outarray[0], 1, &outarray[0], 1);
656
657 break;
658 case 3:
659 Vmath::Vmul(nqtot, &(df[0][0]), 1, &jac[0], 1,
660 &(tmp_gmat0[0]), 1);
661 Vmath::Vmul(nqtot, &(df[2][0]), 1, &jac[0], 1,
662 &(tmp_gmat2[0]), 1);
663 QuadExp::GetEdgeInterpVals(edge, tmp_gmat0, g0_edge);
664 QuadExp::GetEdgeInterpVals(edge, tmp_gmat2, g2_edge);
665
666 for (i = 0; i < nquad1; ++i)
667 {
668 outarray[i] = sqrt(g0_edge[i] * g0_edge[i] +
669 g2_edge[i] * g2_edge[i]);
670 }
671
672 Vmath::Reverse(nquad1, &outarray[0], 1, &outarray[0], 1);
673
674 break;
675 default:
676 ASSERTL0(false, "edge value (< 3) is out of range");
677 break;
678 }
679 }
680 }
681 else
682 {
683
684 switch (edge)
685 {
686 case 0:
687
688 for (i = 0; i < nquad0; ++i)
689 {
690 outarray[i] = jac[0] * sqrt(df[1][0] * df[1][0] +
691 df[3][0] * df[3][0]);
692 }
693 break;
694 case 1:
695 for (i = 0; i < nquad1; ++i)
696 {
697 outarray[i] = jac[0] * sqrt(df[0][0] * df[0][0] +
698 df[2][0] * df[2][0]);
699 }
700 break;
701 case 2:
702 for (i = 0; i < nquad0; ++i)
703 {
704 outarray[i] = jac[0] * sqrt(df[1][0] * df[1][0] +
705 df[3][0] * df[3][0]);
706 }
707 break;
708 case 3:
709 for (i = 0; i < nquad1; ++i)
710 {
711 outarray[i] = jac[0] * sqrt(df[0][0] * df[0][0] +
712 df[2][0] * df[2][0]);
713 }
714 break;
715 default:
716 ASSERTL0(false, "edge value (< 3) is out of range");
717 break;
718 }
719 }
720}
721
723{
724 int i;
725 SpatialDomains::GeomType type = m_geomFactors->GetGtype();
726
728 for (i = 0; i < ptsKeys.size(); ++i)
729 {
730 // Need at least 2 points for computing normals
731 if (ptsKeys[i].GetNumPoints() == 1)
732 {
733 LibUtilities::PointsKey pKey(2, ptsKeys[i].GetPointsType());
734 ptsKeys[i] = pKey;
735 }
736 }
737
739 m_geomFactors->ComputeDerivFactors(ptsKeys);
741 m_geomFactors->ComputeJac(ptsKeys);
742
743 // The points of normals should follow trace basis, not local basis.
745
746 int nqe = tobasis.GetNumPoints();
747 int vCoordDim = GetCoordim();
748
751 for (i = 0; i < vCoordDim; ++i)
752 {
753 normal[i] = Array<OneD, NekDouble>(nqe);
754 }
755
756 size_t nqb = nqe;
757 size_t nbnd = edge;
760
761 // Regular geometry case
762 if ((type == SpatialDomains::eRegular) ||
764 {
765 NekDouble fac;
766 // Set up normals
767 switch (edge)
768 {
769 case 0:
770 for (i = 0; i < vCoordDim; ++i)
771 {
772 Vmath::Fill(nqe, -df[2 * i + 1][0], normal[i], 1);
773 }
774 break;
775 case 1:
776 for (i = 0; i < vCoordDim; ++i)
777 {
778 Vmath::Fill(nqe, df[2 * i][0], normal[i], 1);
779 }
780 break;
781 case 2:
782 for (i = 0; i < vCoordDim; ++i)
783 {
784 Vmath::Fill(nqe, df[2 * i + 1][0], normal[i], 1);
785 }
786 break;
787 case 3:
788 for (i = 0; i < vCoordDim; ++i)
789 {
790 Vmath::Fill(nqe, -df[2 * i][0], normal[i], 1);
791 }
792 break;
793 default:
794 ASSERTL0(false, "edge is out of range (edge < 4)");
795 }
796
797 // normalise
798 fac = 0.0;
799 for (i = 0; i < vCoordDim; ++i)
800 {
801 fac += normal[i][0] * normal[i][0];
802 }
803 fac = 1.0 / sqrt(fac);
804
805 Vmath::Fill(nqb, fac, length, 1);
806
807 for (i = 0; i < vCoordDim; ++i)
808 {
809 Vmath::Smul(nqe, fac, normal[i], 1, normal[i], 1);
810 }
811 }
812 else // Set up deformed normals
813 {
814 int j;
815
816 int nquad0 = ptsKeys[0].GetNumPoints();
817 int nquad1 = ptsKeys[1].GetNumPoints();
818
820
821 Array<OneD, NekDouble> normals(vCoordDim * max(nquad0, nquad1), 0.0);
822 Array<OneD, NekDouble> edgejac(vCoordDim * max(nquad0, nquad1), 0.0);
823
824 // Extract Jacobian along edges and recover local
825 // derivates (dx/dr) for polynomial interpolation by
826 // multiplying m_gmat by jacobian
827
828 // Implementation for all the basis except Gauss points
831 {
832 switch (edge)
833 {
834 case 0:
835 for (j = 0; j < nquad0; ++j)
836 {
837 edgejac[j] = jac[j];
838 for (i = 0; i < vCoordDim; ++i)
839 {
840 normals[i * nquad0 + j] =
841 -df[2 * i + 1][j] * edgejac[j];
842 }
843 }
844 from_key = ptsKeys[0];
845 break;
846 case 1:
847 for (j = 0; j < nquad1; ++j)
848 {
849 edgejac[j] = jac[nquad0 * j + nquad0 - 1];
850 for (i = 0; i < vCoordDim; ++i)
851 {
852 normals[i * nquad1 + j] =
853 df[2 * i][nquad0 * j + nquad0 - 1] * edgejac[j];
854 }
855 }
856 from_key = ptsKeys[1];
857 break;
858 case 2:
859 for (j = 0; j < nquad0; ++j)
860 {
861 edgejac[j] = jac[nquad0 * (nquad1 - 1) + j];
862 for (i = 0; i < vCoordDim; ++i)
863 {
864 normals[i * nquad0 + j] =
865 (df[2 * i + 1][nquad0 * (nquad1 - 1) + j]) *
866 edgejac[j];
867 }
868 }
869 from_key = ptsKeys[0];
870 break;
871 case 3:
872 for (j = 0; j < nquad1; ++j)
873 {
874 edgejac[j] = jac[nquad0 * j];
875 for (i = 0; i < vCoordDim; ++i)
876 {
877 normals[i * nquad1 + j] =
878 -df[2 * i][nquad0 * j] * edgejac[j];
879 }
880 }
881 from_key = ptsKeys[1];
882 break;
883 default:
884 ASSERTL0(false, "edge is out of range (edge < 3)");
885 }
886 }
887 else
888 {
889 int nqtot = nquad0 * nquad1;
890 Array<OneD, NekDouble> tmp_gmat(nqtot, 0.0);
891 Array<OneD, NekDouble> tmp_gmat_edge(nqe, 0.0);
892
893 switch (edge)
894 {
895 case 0:
896 for (j = 0; j < nquad0; ++j)
897 {
898 for (i = 0; i < vCoordDim; ++i)
899 {
900 Vmath::Vmul(nqtot, &(df[2 * i + 1][0]), 1, &jac[0],
901 1, &(tmp_gmat[0]), 1);
902 QuadExp::GetEdgeInterpVals(edge, tmp_gmat,
903 tmp_gmat_edge);
904 normals[i * nquad0 + j] = -tmp_gmat_edge[j];
905 }
906 }
907 from_key = ptsKeys[0];
908 break;
909 case 1:
910 for (j = 0; j < nquad1; ++j)
911 {
912 for (i = 0; i < vCoordDim; ++i)
913 {
914 Vmath::Vmul(nqtot, &(df[2 * i][0]), 1, &jac[0], 1,
915 &(tmp_gmat[0]), 1);
916 QuadExp::GetEdgeInterpVals(edge, tmp_gmat,
917 tmp_gmat_edge);
918 normals[i * nquad1 + j] = tmp_gmat_edge[j];
919 }
920 }
921 from_key = ptsKeys[1];
922 break;
923 case 2:
924 for (j = 0; j < nquad0; ++j)
925 {
926 for (i = 0; i < vCoordDim; ++i)
927 {
928 Vmath::Vmul(nqtot, &(df[2 * i + 1][0]), 1, &jac[0],
929 1, &(tmp_gmat[0]), 1);
930 QuadExp::GetEdgeInterpVals(edge, tmp_gmat,
931 tmp_gmat_edge);
932 normals[i * nquad0 + j] = tmp_gmat_edge[j];
933 }
934 }
935 from_key = ptsKeys[0];
936 break;
937 case 3:
938 for (j = 0; j < nquad1; ++j)
939 {
940 for (i = 0; i < vCoordDim; ++i)
941 {
942 Vmath::Vmul(nqtot, &(df[2 * i][0]), 1, &jac[0], 1,
943 &(tmp_gmat[0]), 1);
944 QuadExp::GetEdgeInterpVals(edge, tmp_gmat,
945 tmp_gmat_edge);
946 normals[i * nquad1 + j] = -tmp_gmat_edge[j];
947 }
948 }
949 from_key = ptsKeys[1];
950 break;
951 default:
952 ASSERTL0(false, "edge is out of range (edge < 3)");
953 }
954 }
955
956 int nq = from_key.GetNumPoints();
957 Array<OneD, NekDouble> work(nqe, 0.0);
958
959 // interpolate Jacobian and invert
960 LibUtilities::Interp1D(from_key, jac, tobasis.GetPointsKey(), work);
961 Vmath::Sdiv(nqe, 1.0, &work[0], 1, &work[0], 1);
962
963 // interpolate
964 for (i = 0; i < GetCoordim(); ++i)
965 {
966 LibUtilities::Interp1D(from_key, &normals[i * nq],
967 tobasis.GetPointsKey(), &normal[i][0]);
968 Vmath::Vmul(nqe, work, 1, normal[i], 1, normal[i], 1);
969 }
970
971 // normalise normal vectors
972 Vmath::Zero(nqe, work, 1);
973 for (i = 0; i < GetCoordim(); ++i)
974 {
975 Vmath::Vvtvp(nqe, normal[i], 1, normal[i], 1, work, 1, work, 1);
976 }
977
978 Vmath::Vsqrt(nqe, work, 1, work, 1);
979 Vmath::Sdiv(nqe, 1.0, work, 1, work, 1);
980
981 Vmath::Vcopy(nqb, work, 1, length, 1);
982
983 for (i = 0; i < GetCoordim(); ++i)
984 {
985 Vmath::Vmul(nqe, normal[i], 1, work, 1, normal[i], 1);
986 }
987 }
988 if (GetGeom()->GetEorient(edge) == StdRegions::eBackwards)
989 {
990 for (i = 0; i < vCoordDim; ++i)
991 {
992 if (m_geomFactors->GetGtype() == SpatialDomains::eDeformed)
993 {
994 Vmath::Reverse(nqe, normal[i], 1, normal[i], 1);
995 }
996 }
997 }
998}
999
1001 const NekDouble *data, const std::vector<unsigned int> &nummodes,
1002 int mode_offset, NekDouble *coeffs,
1003 std::vector<LibUtilities::BasisType> &fromType)
1004{
1005 int data_order0 = nummodes[mode_offset];
1006 int fillorder0 = std::min(m_base[0]->GetNumModes(), data_order0);
1007
1008 int data_order1 = nummodes[mode_offset + 1];
1009 int order1 = m_base[1]->GetNumModes();
1010 int fillorder1 = min(order1, data_order1);
1011
1012 // Check if same basis
1013 if (fromType[0] != m_base[0]->GetBasisType() ||
1014 fromType[1] != m_base[1]->GetBasisType())
1015 {
1016 // Construct a quad with the appropriate basis type at our
1017 // quadrature points, and one more to do a forwards
1018 // transform. We can then copy the output to coeffs.
1019 StdRegions::StdQuadExp tmpQuad(
1020 LibUtilities::BasisKey(fromType[0], data_order0,
1021 m_base[0]->GetPointsKey()),
1022 LibUtilities::BasisKey(fromType[1], data_order1,
1023 m_base[1]->GetPointsKey()));
1024 StdRegions::StdQuadExp tmpQuad2(m_base[0]->GetBasisKey(),
1025 m_base[1]->GetBasisKey());
1026
1027 Array<OneD, const NekDouble> tmpData(tmpQuad.GetNcoeffs(), data);
1028 Array<OneD, NekDouble> tmpBwd(tmpQuad2.GetTotPoints());
1029 Array<OneD, NekDouble> tmpOut(tmpQuad2.GetNcoeffs());
1030
1031 tmpQuad.BwdTrans(tmpData, tmpBwd);
1032 tmpQuad2.FwdTrans(tmpBwd, tmpOut);
1033 Vmath::Vcopy(tmpOut.size(), &tmpOut[0], 1, coeffs, 1);
1034
1035 return;
1036 }
1037
1038 switch (m_base[0]->GetBasisType())
1039 {
1041 {
1042 int i;
1043 int cnt = 0;
1044 int cnt1 = 0;
1045
1047 "Extraction routine not set up for this basis");
1048
1049 Vmath::Zero(m_ncoeffs, coeffs, 1);
1050 for (i = 0; i < fillorder0; ++i)
1051 {
1052 Vmath::Vcopy(fillorder1, data + cnt, 1, coeffs + cnt1, 1);
1053 cnt += data_order1;
1054 cnt1 += order1;
1055 }
1056 }
1057 break;
1059 {
1060 LibUtilities::PointsKey p0(nummodes[0],
1062 LibUtilities::PointsKey p1(nummodes[1],
1064 LibUtilities::PointsKey t0(m_base[0]->GetNumModes(),
1066 LibUtilities::PointsKey t1(m_base[1]->GetNumModes(),
1068 LibUtilities::Interp2D(p0, p1, data, t0, t1, coeffs);
1069 }
1070 break;
1072 {
1073 // Assume that input is also Gll_Lagrange but no way to check;
1074 LibUtilities::PointsKey p0(nummodes[0],
1076 LibUtilities::PointsKey p1(nummodes[1],
1078 LibUtilities::PointsKey t0(m_base[0]->GetNumModes(),
1080 LibUtilities::PointsKey t1(m_base[1]->GetNumModes(),
1082 LibUtilities::Interp2D(p0, p1, data, t0, t1, coeffs);
1083 }
1084 break;
1085 default:
1086 ASSERTL0(false, "basis is either not set up or not hierarchicial");
1087 }
1088}
1089
1091{
1092 return m_geom->GetEorient(edge);
1093}
1094
1096{
1097 DNekMatSharedPtr returnval;
1098 switch (mkey.GetMatrixType())
1099 {
1107 returnval = Expansion2D::v_GenMatrix(mkey);
1108 break;
1109 default:
1110 returnval = StdQuadExp::v_GenMatrix(mkey);
1111 }
1112 return returnval;
1113}
1114
1116 const StdRegions::StdMatrixKey &mkey)
1117{
1118 LibUtilities::BasisKey bkey0 = m_base[0]->GetBasisKey();
1119 LibUtilities::BasisKey bkey1 = m_base[1]->GetBasisKey();
1122 return tmp->GetStdMatrix(mkey);
1123}
1124
1126{
1127 return m_matrixManager[mkey];
1128}
1129
1131{
1132 m_matrixManager.DeleteObject(mkey);
1133}
1134
1139
1141{
1142 m_staticCondMatrixManager.DeleteObject(mkey);
1143}
1144
1146 Array<OneD, NekDouble> &outarray,
1147 const StdRegions::StdMatrixKey &mkey)
1148{
1149 StdExpansion::MassMatrixOp_MatFree(inarray, outarray, mkey);
1150}
1151
1153 Array<OneD, NekDouble> &outarray,
1154 const StdRegions::StdMatrixKey &mkey)
1155{
1156 QuadExp::LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
1157}
1158
1159void QuadExp::v_LaplacianMatrixOp(const int k1, const int k2,
1160 const Array<OneD, const NekDouble> &inarray,
1161 Array<OneD, NekDouble> &outarray,
1162 const StdRegions::StdMatrixKey &mkey)
1163{
1164 StdExpansion::LaplacianMatrixOp_MatFree(k1, k2, inarray, outarray, mkey);
1165}
1166
1168 const Array<OneD, const NekDouble> &inarray,
1169 Array<OneD, NekDouble> &outarray,
1170 const StdRegions::StdMatrixKey &mkey)
1171{
1172 StdExpansion::WeakDerivMatrixOp_MatFree(i, inarray, outarray, mkey);
1173}
1174
1176 const Array<OneD, const NekDouble> &inarray,
1177 Array<OneD, NekDouble> &outarray, const StdRegions::StdMatrixKey &mkey)
1178{
1179 StdExpansion::WeakDirectionalDerivMatrixOp_MatFree(inarray, outarray, mkey);
1180}
1181
1183 const Array<OneD, const NekDouble> &inarray,
1184 Array<OneD, NekDouble> &outarray, const StdRegions::StdMatrixKey &mkey)
1185{
1186 StdExpansion::MassLevelCurvatureMatrixOp_MatFree(inarray, outarray, mkey);
1187}
1188
1190 Array<OneD, NekDouble> &outarray,
1191 const StdRegions::StdMatrixKey &mkey)
1192{
1193 QuadExp::HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
1194}
1195
1197 const Array<OneD, const NekDouble> &inarray,
1198 Array<OneD, NekDouble> &outarray)
1199{
1200 int n_coeffs = inarray.size();
1201
1202 Array<OneD, NekDouble> coeff(n_coeffs);
1203 Array<OneD, NekDouble> coeff_tmp(n_coeffs, 0.0);
1204 Array<OneD, NekDouble> tmp, tmp2;
1205
1206 int nmodes0 = m_base[0]->GetNumModes();
1207 int nmodes1 = m_base[1]->GetNumModes();
1208 int numMax = nmodes0;
1209
1210 Vmath::Vcopy(n_coeffs, inarray, 1, coeff_tmp, 1);
1211
1212 const LibUtilities::PointsKey Pkey0(nmodes0,
1214 const LibUtilities::PointsKey Pkey1(nmodes1,
1216 LibUtilities::BasisKey b0(m_base[0]->GetBasisType(), nmodes0, Pkey0);
1217 LibUtilities::BasisKey b1(m_base[1]->GetBasisType(), nmodes1, Pkey1);
1218 LibUtilities::BasisKey bortho0(LibUtilities::eOrtho_A, nmodes0, Pkey0);
1219 LibUtilities::BasisKey bortho1(LibUtilities::eOrtho_A, nmodes1, Pkey1);
1220
1221 LibUtilities::InterpCoeff2D(b0, b1, coeff_tmp, bortho0, bortho1, coeff);
1222
1223 Vmath::Zero(n_coeffs, coeff_tmp, 1);
1224
1225 int cnt = 0;
1226 for (int i = 0; i < numMin + 1; ++i)
1227 {
1228 Vmath::Vcopy(numMin, tmp = coeff + cnt, 1, tmp2 = coeff_tmp + cnt, 1);
1229
1230 cnt = i * numMax;
1231 }
1232
1233 LibUtilities::InterpCoeff2D(bortho0, bortho1, coeff_tmp, b0, b1, outarray);
1234}
1235
1237 const Array<OneD, const NekDouble> &inarray,
1239{
1240 if (m_metrics.count(eMetricLaplacian00) == 0)
1241 {
1243 }
1244
1245 int nquad0 = m_base[0]->GetNumPoints();
1246 int nquad1 = m_base[1]->GetNumPoints();
1247 int nqtot = nquad0 * nquad1;
1248 int nmodes0 = m_base[0]->GetNumModes();
1249 int nmodes1 = m_base[1]->GetNumModes();
1250 int wspsize =
1251 max(max(max(nqtot, m_ncoeffs), nquad1 * nmodes0), nquad0 * nmodes1);
1252
1253 ASSERTL1(wsp.size() >= 3 * wspsize, "Workspace is of insufficient size.");
1254
1255 const Array<OneD, const NekDouble> &base0 = m_base[0]->GetBdata();
1256 const Array<OneD, const NekDouble> &base1 = m_base[1]->GetBdata();
1257 const Array<OneD, const NekDouble> &dbase0 = m_base[0]->GetDbdata();
1258 const Array<OneD, const NekDouble> &dbase1 = m_base[1]->GetDbdata();
1259 const Array<OneD, const NekDouble> &metric00 =
1261 const Array<OneD, const NekDouble> &metric01 =
1263 const Array<OneD, const NekDouble> &metric11 =
1265
1266 // Allocate temporary storage
1267 Array<OneD, NekDouble> wsp0(wsp);
1268 Array<OneD, NekDouble> wsp1(wsp + wspsize);
1269 Array<OneD, NekDouble> wsp2(wsp + 2 * wspsize);
1270
1271 PhysTensorDeriv(inarray, wsp1, wsp2);
1272
1273 // wsp0 = k = g0 * wsp1 + g1 * wsp2 = g0 * du_dxi1 + g1 * du_dxi2
1274 // wsp2 = l = g1 * wsp1 + g2 * wsp2 = g0 * du_dxi1 + g1 * du_dxi2
1275 // where g0, g1 and g2 are the metric terms set up in the GeomFactors class
1276 // especially for this purpose
1277 Vmath::Vvtvvtp(nqtot, &metric00[0], 1, &wsp1[0], 1, &metric01[0], 1,
1278 &wsp2[0], 1, &wsp0[0], 1);
1279 Vmath::Vvtvvtp(nqtot, &metric01[0], 1, &wsp1[0], 1, &metric11[0], 1,
1280 &wsp2[0], 1, &wsp2[0], 1);
1281
1282 // outarray = m = (D_xi1 * B)^T * k
1283 // wsp1 = n = (D_xi2 * B)^T * l
1284 const Array<OneD, const NekDouble> &jac = m_geomFactors->GetJac();
1285 bool Deformed = (m_geomFactors->GetGtype() == SpatialDomains::eDeformed);
1286
1287 v_IProductWRTBaseKernel(dbase0, base1, wsp0, outarray, jac, Deformed, false,
1288 m_base[1]->Collocation());
1289 v_IProductWRTBaseKernel(base0, dbase1, wsp2, wsp1, jac, Deformed,
1290 m_base[1]->Collocation(), false);
1291
1292 // outarray = outarray + wsp1
1293 // = L * u_hat
1294 Vmath::Vadd(m_ncoeffs, wsp1.data(), 1, outarray.data(), 1, outarray.data(),
1295 1);
1296}
1297
1299{
1300 const SpatialDomains::GeomType type = m_geomFactors->GetGtype();
1301 const unsigned int nqtot = GetTotPoints();
1302 const unsigned int dim = 2;
1303 const MetricType m[3][3] = {
1307
1308 const Array<TwoD, const NekDouble> gmat =
1309 m_geomFactors->GetGmat(GetPointsKeys());
1310 for (unsigned int i = 0; i < dim; ++i)
1311 {
1312 for (unsigned int j = i; j < dim; ++j)
1313 {
1314 m_metrics[m[i][j]] = Array<OneD, NekDouble>(nqtot);
1315 if (type == SpatialDomains::eDeformed)
1316 {
1317 Vmath::Vcopy(nqtot, &gmat[i * dim + j][0], 1,
1318 &m_metrics[m[i][j]][0], 1);
1319 }
1320 else
1321 {
1322 Vmath::Fill(nqtot, gmat[i * dim + j][0], &m_metrics[m[i][j]][0],
1323 1);
1324 }
1325 }
1326 }
1327}
1328
1330 const StdRegions::StdMatrixKey &mkey)
1331{
1332 int nq = GetTotPoints();
1333
1334 // Calculate sqrt of the Jacobian
1336 Array<OneD, NekDouble> sqrt_jac(nq);
1337 if (m_geomFactors->GetGtype() == SpatialDomains::eDeformed)
1338 {
1339 Vmath::Vsqrt(nq, jac, 1, sqrt_jac, 1);
1340 }
1341 else
1342 {
1343 Vmath::Fill(nq, sqrt(jac[0]), sqrt_jac, 1);
1344 }
1345
1346 // Multiply array by sqrt(Jac)
1347 Vmath::Vmul(nq, sqrt_jac, 1, array, 1, array, 1);
1348
1349 // Apply std region filter
1350 StdQuadExp::v_SVVLaplacianFilter(array, mkey);
1351
1352 // Divide by sqrt(Jac)
1353 Vmath::Vdiv(nq, array, 1, sqrt_jac, 1, array, 1);
1354}
1355
1356} // 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 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
NekDouble v_PhysEvalFirstDeriv(const Array< OneD, NekDouble > &coord, const Array< OneD, const NekDouble > &inarray, std::array< NekDouble, 3 > &firstOrderDerivs) override
Definition QuadExp.cpp:317
void v_MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition QuadExp.cpp:1145
StdRegions::Orientation v_GetTraceOrient(int edge) override
Definition QuadExp.cpp:1090
DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey) override
Definition QuadExp.cpp:1135
void v_GetLocTracePhysVals(const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp, const NekDouble *inarray, Array< OneD, NekDouble > &outarray) override
Definition QuadExp.cpp:347
DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey) override
Definition QuadExp.cpp:1125
StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const override
Definition QuadExp.cpp:283
void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition QuadExp.cpp:1189
void v_GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords) override
Definition QuadExp.cpp:301
void GetEdgeInterpVals(const int edge, const NekDouble *inarray, Array< OneD, NekDouble > &outarray)
Definition QuadExp.cpp:404
void v_ComputeLaplacianMetric() override
Definition QuadExp.cpp:1298
void v_LaplacianMatrixOp_MatFree_Kernel(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp) override
Definition QuadExp.cpp:1236
void v_AlignVectorToCollapsedDir(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray) override
Definition QuadExp.cpp:212
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 QuadExp.cpp:242
void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition QuadExp.cpp:1152
void v_GetTracePhysVals(const int trace, const StdRegions::StdExpansionSharedPtr &TraceExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient) override
Definition QuadExp.cpp:328
void v_WeakDirectionalDerivMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition QuadExp.cpp:1175
void v_DropLocMatrix(const MatrixKey &mkey) override
Definition QuadExp.cpp:1130
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition QuadExp.h:206
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 QuadExp.cpp:1000
void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition QuadExp.cpp:294
void v_ComputeTraceNormal(const int edge) override
Definition QuadExp.cpp:722
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition QuadExp.h:208
StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const override
Definition QuadExp.cpp:277
DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition QuadExp.cpp:1095
void v_DropLocStaticCondMatrix(const MatrixKey &mkey) override
Definition QuadExp.cpp:1140
void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition QuadExp.cpp:176
void v_MassLevelCurvatureMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition QuadExp.cpp:1182
DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition QuadExp.cpp:1115
void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdRegions::StdMatrixKey &mkey) override
Definition QuadExp.cpp:1329
void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition QuadExp.cpp:67
void v_ReduceOrderCoeffs(int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition QuadExp.cpp:1196
void v_GetTracePhysMap(const int edge, Array< OneD, int > &outarray) override
Definition QuadExp.cpp:467
void v_GetTraceQFactors(const int edge, Array< OneD, NekDouble > &outarray) override
Definition QuadExp.cpp:509
void v_WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition QuadExp.cpp:1167
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 GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
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)
void BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Backward transformation from coefficient space to physical space.
LibUtilities::PointsType GetPointsType(const int dir) const
This function returns the type of quadrature points used in the dir direction.
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
int GetNumPoints(const int dir) const
This function returns the number of quadrature points in the dir direction.
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
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
void InterpCoeff2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
void Interp2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
this function interpolates a 2D function evaluated at the quadrature points of the 2D basis,...
Definition Interp.cpp:101
std::vector< PointsKey > PointsKeyVector
Definition Points.h:313
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition PointsType.h:51
@ eGaussGaussLegendre
1D Gauss-Gauss-Legendre quadrature points
Definition PointsType.h:46
@ eGauss_Lagrange
Lagrange Polynomials using the Gauss points.
Definition BasisType.h:57
@ eOrtho_A
Principle Orthogonal Functions .
Definition BasisType.h:42
@ eGLL_Lagrange
Lagrange for SEM basis .
Definition BasisType.h:56
@ 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< StdQuadExp > StdQuadExpSharedPtr
Definition StdQuadExp.h:181
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::map< ConstFactorType, NekDouble > ConstFactorMap
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
T Dot(int n, const T *w, const T *x)
dot product
Definition Vmath.hpp:761
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