Nektar++
Loading...
Searching...
No Matches
StdExpansion.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: StdExpansion.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: Definition of methods in class StdExpansion which is
32// the base class to all expansion shapes
33//
34///////////////////////////////////////////////////////////////////////////////
35
37#include <LibUtilities/Foundations/ManagerAccess.h> // for BasisManager, etc
40
41namespace Nektar::StdRegions
42{
43/** \brief Default constructor */
47
48StdExpansion::StdExpansion(const int numcoeffs, const int numbases,
49 const LibUtilities::BasisKey &Ba,
50 const LibUtilities::BasisKey &Bb,
51 const LibUtilities::BasisKey &Bc)
52 : m_base(numbases), m_elmt_id(0), m_ncoeffs(numcoeffs),
53 m_stdMatrixManager(std::bind(&StdExpansion::CreateStdMatrix, this,
54 std::placeholders::_1),
55 std::string("StdExpansionStdMatrix")),
56 m_stdStaticCondMatrixManager(
57 std::bind(&StdExpansion::CreateStdStaticCondMatrix, this,
58 std::placeholders::_1),
59 std::string("StdExpansionStdStaticCondMatrix")),
60 m_stdFacManager(
61 std::bind(&StdExpansion::CreateStdFac, this, std::placeholders::_1),
62 std::string("StdExpansionStdFac"))
63{
64 switch (m_base.size())
65 {
66 case 3:
68 "NULL Basis attempting to be used.");
70 /* Falls through. */
71 case 2:
73 "NULL Basis attempting to be used.");
75 /* Falls through. */
76 case 1:
78 "NULL Basis attempting to be used.");
80 break;
81 default:
82 break;
83 // ASSERTL0(false, "numbases incorrectly specified");
84 };
85
86} // end constructor
87
89 : std::enable_shared_from_this<StdExpansion>(T), m_base(T.m_base),
90 m_elmt_id(T.m_elmt_id), m_ncoeffs(T.m_ncoeffs),
91 m_stdMatrixManager(T.m_stdMatrixManager),
92 m_stdStaticCondMatrixManager(T.m_stdStaticCondMatrixManager),
93 m_stdFacManager(T.m_stdFacManager)
94{
95}
96
97// Destructor
101
104{
105 NekDouble val;
106 int ntot = GetTotPoints();
107 Array<OneD, NekDouble> wsp(ntot);
108
109 if (sol == NullNekDouble1DArray)
110 {
111 Vmath::Vabs(ntot, phys, 1, wsp, 1);
112 }
113 else
114 {
115 Vmath::Vsub(ntot, sol, 1, phys, 1, wsp, 1);
116 Vmath::Vabs(ntot, wsp, 1, wsp, 1);
117 }
118
119 val = Vmath::Vamax(ntot, wsp, 1);
120 return val;
121}
122
125{
126 NekDouble val;
127 int ntot = GetTotPoints();
128 Array<OneD, NekDouble> wsp(ntot);
129
130 if (sol.size() == 0)
131 {
132 Vmath::Vmul(ntot, phys, 1, phys, 1, wsp, 1);
133 }
134 else
135 {
136 Vmath::Vsub(ntot, sol, 1, phys, 1, wsp, 1);
137 Vmath::Vmul(ntot, wsp, 1, wsp, 1, wsp, 1);
138 }
139
140 val = Integral(wsp);
141
142 return (val < 0.0) ? 0.0 : sqrt(val);
143}
144
147{
148 int i;
149 NekDouble val;
150 int ntot = GetTotPoints();
151 int coordim = v_GetCoordim();
152 Array<OneD, NekDouble> wsp(3 * ntot);
153 Array<OneD, NekDouble> wsp_deriv = wsp + ntot;
154 Array<OneD, NekDouble> sum = wsp_deriv + ntot;
155
156 if (sol == NullNekDouble1DArray)
157 {
158 Vmath::Vcopy(ntot, phys, 1, wsp, 1);
159 Vmath::Vmul(ntot, phys, 1, phys, 1, sum, 1);
160 }
161 else
162 {
163 Vmath::Vsub(ntot, sol, 1, phys, 1, wsp, 1);
164 Vmath::Vmul(ntot, wsp, 1, wsp, 1, sum, 1);
165 }
166
167 for (i = 0; i < coordim; ++i)
168 {
169 v_PhysDeriv(i, wsp, wsp_deriv);
170 Vmath::Vvtvp(ntot, wsp_deriv, 1, wsp_deriv, 1, sum, 1, sum, 1);
171 }
172
173 val = sqrt(Integral(sum));
174
175 return val;
176}
177
179 const StdMatrixKey &mkey)
180{
181 DNekBlkMatSharedPtr returnval;
182
183 DNekMatSharedPtr mat = GetStdMatrix(mkey);
184 int nbdry = NumBndryCoeffs(); // also checks to see if this is a boundary
185 // interior decomposed expansion
186 int nint = m_ncoeffs - nbdry;
192
193 int i, j;
194
195 Array<OneD, unsigned int> bmap(nbdry);
196 Array<OneD, unsigned int> imap(nint);
197 GetBoundaryMap(bmap);
198 GetInteriorMap(imap);
199
200 for (i = 0; i < nbdry; ++i)
201 {
202 for (j = 0; j < nbdry; ++j)
203 {
204 (*A)(i, j) = (*mat)(bmap[i], bmap[j]);
205 }
206
207 for (j = 0; j < nint; ++j)
208 {
209 (*B)(i, j) = (*mat)(bmap[i], imap[j]);
210 }
211 }
212
213 for (i = 0; i < nint; ++i)
214 {
215 for (j = 0; j < nbdry; ++j)
216 {
217 (*C)(i, j) = (*mat)(imap[i], bmap[j]);
218 }
219
220 for (j = 0; j < nint; ++j)
221 {
222 (*D)(i, j) = (*mat)(imap[i], imap[j]);
223 }
224 }
225
226 // Calculate static condensed system
227 if (nint)
228 {
229 D->Invert();
230 (*B) = (*B) * (*D);
231 (*A) = (*A) - (*B) * (*C);
232 }
233
234 // set up block matrix system
235 Array<OneD, unsigned int> exp_size(2);
236 exp_size[0] = nbdry;
237 exp_size[1] = nint;
238 returnval =
240
241 returnval->SetBlock(0, 0, A);
242 returnval->SetBlock(0, 1, B);
243 returnval->SetBlock(1, 0, C);
244 returnval->SetBlock(1, 1, D);
245
246 return returnval;
247}
248
250{
251 int i;
252 DNekMatSharedPtr returnval;
253
254 switch (mkey.GetMatrixType())
255 {
256 case eInvMass:
257 {
258 StdMatrixKey masskey(eMass, mkey.GetShapeType(), *this,
261 DNekMatSharedPtr mmat = GetStdMatrix(masskey);
262
264 *mmat); // Populate standard mass matrix.
265 returnval->Invert();
266 }
267 break;
268 case eInvNBasisTrans:
269 {
270 StdMatrixKey tmpkey(eNBasisTrans, mkey.GetShapeType(), *this,
273 DNekMatSharedPtr tmpmat = GetStdMatrix(tmpkey);
275 *tmpmat); // Populate matrix.
276 returnval->Invert();
277 }
278 break;
279 case eBwdMat:
280 {
281 int nq = GetTotPoints();
283 Array<OneD, NekDouble> tmpout(nq);
284
285 returnval =
287 Array<OneD, NekDouble> Bwd_data = returnval->GetPtr();
288
290 this->DetShapeType(), *this);
291 DNekMatSharedPtr MatBwdTrans = GetStdMatrix(matkey);
292 Array<OneD, NekDouble> BwdTrans_data = MatBwdTrans->GetPtr();
293
294 for (i = 0; i < m_ncoeffs; ++i)
295 {
296 Array<OneD, NekDouble> tmpinn = BwdTrans_data + nq * i;
297 tmpout = Bwd_data + i;
298
299 Vmath::Vcopy(nq, tmpinn, 1, tmpout, m_ncoeffs);
300 }
301 }
302 break;
303 case eBwdTrans:
304 {
305 int nq = GetTotPoints();
307 Array<OneD, NekDouble> tmpout(nq);
308
309 returnval =
311
312 for (i = 0; i < m_ncoeffs; ++i)
313 {
314 Vmath::Zero(m_ncoeffs, tmpin, 1);
315 tmpin[i] = 1.0;
316
317 BwdTrans(tmpin, tmpout);
318
319 Vmath::Vcopy(nq, tmpout.data(), 1,
320 returnval->GetRawPtr() + i * nq, 1);
321 }
322 }
323 break;
324 case eInvBwdTrans:
325 {
326 // First, get BwdTrans matrix
328 this->DetShapeType(), *this);
329 DNekMatSharedPtr MatBwdTrans = GetStdMatrix(matkey);
330
331 int nq = GetTotPoints();
332 returnval =
334 // Then, copy to returnval and Invert it:
335 *returnval = *MatBwdTrans;
336 returnval->Invert();
337 }
338 break;
339 case eIProductWRTBase:
340 {
341 int nq = GetTotPoints();
342 Array<OneD, NekDouble> tmpin(nq);
344
345 returnval =
347
348 for (i = 0; i < nq; ++i)
349 {
350 Vmath::Zero(nq, tmpin, 1);
351 tmpin[i] = 1.0;
352
353 IProductWRTBase(tmpin, tmpout);
354
355 Vmath::Vcopy(m_ncoeffs, tmpout.data(), 1,
356 returnval->GetRawPtr() + i * m_ncoeffs, 1);
357 }
358 }
359 break;
361 {
363 this->DetShapeType(), *this);
364 DNekMatSharedPtr MatInvBwdTrans = GetStdMatrix(matkey);
365
367 Transpose(*MatInvBwdTrans));
368 }
369 break;
371 {
372 int nq = GetTotPoints();
373 Array<OneD, NekDouble> tmpin(nq);
375
376 returnval =
378
379 for (i = 0; i < nq; ++i)
380 {
381 Vmath::Zero(nq, tmpin, 1);
382 tmpin[i] = 1.0;
383
384 IProductWRTDerivBase(0, tmpin, tmpout);
385
386 Vmath::Vcopy(m_ncoeffs, tmpout.data(), 1,
387 returnval->GetRawPtr() + i * m_ncoeffs, 1);
388 }
389 }
390 break;
392 {
393 int nq = GetTotPoints();
394 Array<OneD, NekDouble> tmpin(nq);
396
397 returnval =
399
400 for (i = 0; i < nq; ++i)
401 {
402 Vmath::Zero(nq, tmpin, 1);
403 tmpin[i] = 1.0;
404
405 IProductWRTDerivBase(1, tmpin, tmpout);
406
407 Vmath::Vcopy(m_ncoeffs, tmpout.data(), 1,
408 returnval->GetRawPtr() + i * m_ncoeffs, 1);
409 }
410 }
411 break;
413 {
414 int nq = GetTotPoints();
415 Array<OneD, NekDouble> tmpin(nq);
417
418 returnval =
420
421 for (i = 0; i < nq; ++i)
422 {
423 Vmath::Zero(nq, tmpin, 1);
424 tmpin[i] = 1.0;
425
426 IProductWRTDerivBase(2, tmpin, tmpout);
427
428 Vmath::Vcopy(m_ncoeffs, tmpout.data(), 1,
429 returnval->GetRawPtr() + i * m_ncoeffs, 1);
430 }
431 }
432 break;
433 case eDerivBase0:
434 {
435 int nq = GetTotPoints();
436 returnval =
438 GenStdMatBwdDeriv(0, returnval);
439 }
440 break;
441 case eDerivBase1:
442 {
443 int nq = GetTotPoints();
444 returnval =
446 GenStdMatBwdDeriv(1, returnval);
447 }
448 break;
449 case eDerivBase2:
450 {
451 int nq = GetTotPoints();
452 returnval =
454 GenStdMatBwdDeriv(2, returnval);
455 }
456 break;
458 {
459 // check to see if equispaced basis
460 int nummodes = m_base[0]->GetNumModes();
461 bool equispaced = true;
462 for (i = 1; i < m_base.size(); ++i)
463 {
464 if (m_base[i]->GetNumModes() != nummodes)
465 {
466 equispaced = false;
467 }
468 }
469
470 ASSERTL0(equispaced,
471 "Currently need to have same num modes in all "
472 "directionmodes to use EquiSpacedToCoeff method");
473
474 int ntot = GetTotPoints();
475 Array<OneD, NekDouble> qmode(ntot);
477
478 returnval =
480 for (i = 0; i < m_ncoeffs; ++i)
481 {
482 // Get mode at quadrature points
483 FillMode(i, qmode);
484
485 // interpolate to equi spaced
486 PhysInterpToSimplexEquiSpaced(qmode, emode, nummodes);
487
488 // fill matrix
489 Vmath::Vcopy(m_ncoeffs, &emode[0], 1,
490 returnval->GetRawPtr() + i * m_ncoeffs, 1);
491 }
492 }
493 break;
495 {
499
501
502 returnval->Invert();
503 }
504 break;
505 case eCoeffsToGLL:
506 {
507 // check to see if equispaced basis
508 int nummodes = m_base[0]->GetNumModes();
509 bool equispaced = true;
510 for (int i = 1; i < m_base.size(); ++i)
511 {
512 if (m_base[i]->GetNumModes() != nummodes)
513 {
514 equispaced = false;
515 }
516 }
517
518 ASSERTL0(equispaced,
519 "Currently need to have same num modes in all "
520 "directionmodes to use EquiSpacedToCoeff method");
521
522 int ntot = GetTotPoints();
523 Array<OneD, NekDouble> qmode(ntot);
525
526 returnval =
528 for (int i = 0; i < m_ncoeffs; ++i)
529 {
530 // Get mode at quadrature points
531 FillMode(i, qmode);
532
533 // interpolate to equi spaced
534 PhysInterpToGLL(qmode, emode, nummodes);
535
536 // fill matrix
537 Vmath::Vcopy(m_ncoeffs, &emode[0], 1,
538 returnval->GetRawPtr() + i * m_ncoeffs, 1);
539 }
540 }
541 break;
542 case eGLLToCoeffs:
543 {
544 StdMatrixKey key(eCoeffsToGLL, mkey.GetShapeType(), *this,
547
549
550 returnval->Invert();
551 }
552 break;
553 case eMass:
554 case eHelmholtz:
555 case eLaplacian:
556 case eLaplacian00:
557 case eLaplacian01:
558 case eLaplacian02:
559 case eLaplacian10:
560 case eLaplacian11:
561 case eLaplacian12:
562 case eLaplacian20:
563 case eLaplacian21:
564 case eLaplacian22:
565 case eWeakDeriv0:
566 case eWeakDeriv1:
567 case eWeakDeriv2:
570 case eLinearAdvection:
573 {
575 returnval =
577 DNekMat &Mat = *returnval;
578
579 for (i = 0; i < m_ncoeffs; ++i)
580 {
581 Vmath::Zero(m_ncoeffs, tmp, 1);
582 tmp[i] = 1.0;
583
584 GeneralMatrixOp_MatFree(tmp, tmp, mkey);
585
586 Vmath::Vcopy(m_ncoeffs, &tmp[0], 1,
587 &(Mat.GetPtr())[0] + i * m_ncoeffs, 1);
588 }
589 }
590 break;
591 default:
592 {
594 "This type of matrix, " +
595 static_cast<std::string>(
597 ", can not be created using a general approach");
598 }
599 break;
600 }
601
602 return returnval;
603}
604
605std::shared_ptr<Array<OneD, const NekDouble>> StdExpansion::CreateStdFac(
606 [[maybe_unused]] const StdFacKey &mkey)
607{
608 Array<OneD, NekDouble> returnval;
609
610 switch (mkey.m_stdFacType)
611 {
612 case eWeights1:
613 {
614 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
615 m_base[1]->GetPointsKey(),
616 "PointsKey are differrent in CreateStdFac");
617
618 // deep copy of weights
619 returnval = m_base[1]->GetW();
620
621 int nquad1 = m_base[1]->GetNumPoints();
622
623 if (m_base[1]->GetPointsType() ==
624 LibUtilities::eGaussRadauMAlpha1Beta0 ||
625 m_base[1]->GetPointsType() ==
627 {
628 Vmath::Smul(nquad1, 0.5, returnval.data(), 1, returnval.data(),
629 1);
630 }
631 else
632 {
633 const Array<OneD, NekDouble> z1 = m_base[1]->GetZ();
634 for (int i = 0; i < nquad1; ++i)
635 {
636 returnval[i] *= 0.5 * (1 - z1[i]);
637 }
638 }
639 }
640 break;
641 case eWeights2:
642 {
643 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
644 m_base[2]->GetPointsKey(),
645 "PointsKey are differrent in CreateStdFac");
646
647 // deep copy of weights
648 returnval = m_base[2]->GetW();
649
650 int nquad2 = m_base[2]->GetNumPoints();
651
652 // For Prisms we need to do same scaling as for Weights1 code
653 if ((mkey.m_basisKey.GetBasisType() == LibUtilities::eModified_B) ||
654 mkey.m_basisKey.GetBasisType() == LibUtilities::eOrtho_B)
655 {
656 if (m_base[2]->GetPointsType() ==
657 LibUtilities::eGaussRadauMAlpha1Beta0 ||
658 m_base[2]->GetPointsType() ==
660 {
661 Vmath::Smul(nquad2, 0.5, returnval.data(), 1,
662 returnval.data(), 1);
663 }
664 else
665 {
666 const Array<OneD, NekDouble> z2 = m_base[2]->GetZ();
667 for (int i = 0; i < nquad2; ++i)
668 {
669 returnval[i] *= 0.5 * (1 - z2[i]);
670 }
671 }
672 }
673 else // case for Tets and Pyramids
674 {
675 switch (m_base[2]->GetPointsType())
676 {
677 // (2,0) Jacobi inner product.
678 case LibUtilities::eGaussRadauMAlpha2Beta0:
679 {
680 Vmath::Smul(nquad2, 0.25, returnval.data(), 1,
681 returnval.data(), 1);
682 }
683 break;
684 // (1,0) Jacobi inner product.
685 case LibUtilities::eGaussRadauMAlpha1Beta0:
687 {
688 const Array<OneD, NekDouble> z2 = m_base[2]->GetZ();
689
690 for (int i = 0; i < nquad2; ++i)
691 {
692 returnval[i] *= 0.25 * (1 - z2[i]);
693 }
694 }
695 break;
696 default:
697 {
698 const Array<OneD, NekDouble> z2 = m_base[2]->GetZ();
699 for (int i = 0; i < nquad2; ++i)
700 {
701 returnval[i] *= 0.25 * (1 - z2[i]) * (1 - z2[i]);
702 }
703 }
704 break;
705 }
706 }
707 }
708 break;
710 {
711 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
712 m_base[0]->GetPointsKey(),
713 "PointssKey are differrent in CreateStdFac");
714
715 int nquad0 = m_base[0]->GetNumPoints();
716
717 returnval = Array<OneD, NekDouble>(nquad0);
718
719 const Array<OneD, NekDouble> z0 = m_base[0]->GetZ();
720 for (int i = 0; i < nquad0; ++i)
721 {
722 returnval[i] = 0.5 * (1.0 + z0[i]);
723 }
724 }
725 break;
727 {
728 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
729 m_base[1]->GetPointsKey(),
730 "PointssKey are differrent in CreateStdFac");
731
732 int nquad1 = m_base[1]->GetNumPoints();
733
734 returnval = Array<OneD, NekDouble>(nquad1);
735
736 const Array<OneD, NekDouble> z1 = m_base[1]->GetZ();
737 for (int i = 0; i < nquad1; ++i)
738 {
739 returnval[i] = 0.5 * (1.0 + z1[i]);
740 }
741 }
742 break;
744 {
745 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
746 m_base[1]->GetPointsKey(),
747 "PointssKey are differrent in CreateStdFac");
748
749 int nquad1 = m_base[1]->GetNumPoints();
750
751 returnval = Array<OneD, NekDouble>(nquad1);
752
753 const Array<OneD, NekDouble> z1 = m_base[1]->GetZ();
754 for (int i = 0; i < nquad1; ++i)
755 {
756 returnval[i] = 2.0 / (1.0 - z1[i]);
757 }
758 }
759 break;
761 {
762 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
763 m_base[2]->GetPointsKey(),
764 "PointssKey are differrent in CreateStdFac");
765
766 int nquad2 = m_base[2]->GetNumPoints();
767
768 returnval = Array<OneD, NekDouble>(nquad2);
769
770 const Array<OneD, NekDouble> z2 = m_base[2]->GetZ();
771 for (int i = 0; i < nquad2; ++i)
772 {
773 returnval[i] = 2.0 / (1.0 - z2[i]);
774 }
775 }
776 break;
777 default:
778 NEKERROR(ErrorUtil::efatal, "Factor Type not defined");
779 break;
780 }
781 return std::make_shared<Array<OneD, const NekDouble>>(returnval);
782}
783
785 Array<OneD, NekDouble> &outarray,
786 const StdMatrixKey &mkey)
787{
788 switch (mkey.GetMatrixType())
789 {
790 case eMass:
791 MassMatrixOp(inarray, outarray, mkey);
792 break;
793 case eWeakDeriv0:
794 WeakDerivMatrixOp(0, inarray, outarray, mkey);
795 break;
796 case eWeakDeriv1:
797 WeakDerivMatrixOp(1, inarray, outarray, mkey);
798 break;
799 case eWeakDeriv2:
800 WeakDerivMatrixOp(2, inarray, outarray, mkey);
801 break;
803 WeakDirectionalDerivMatrixOp(inarray, outarray, mkey);
804 break;
806 MassLevelCurvatureMatrixOp(inarray, outarray, mkey);
807 break;
808 case eLinearAdvection:
809 LinearAdvectionMatrixOp(inarray, outarray, mkey);
810 break;
812 LinearAdvectionDiffusionReactionMatrixOp(inarray, outarray, mkey,
813 false);
814 break;
816 LinearAdvectionDiffusionReactionMatrixOp(inarray, outarray, mkey);
817 break;
818 case eLaplacian:
819 LaplacianMatrixOp(inarray, outarray, mkey);
820 break;
821 case eLaplacian00:
822 LaplacianMatrixOp(0, 0, inarray, outarray, mkey);
823 break;
824 case eLaplacian01:
825 LaplacianMatrixOp(0, 1, inarray, outarray, mkey);
826 break;
827 case eLaplacian02:
828 LaplacianMatrixOp(0, 2, inarray, outarray, mkey);
829 break;
830 case eLaplacian10:
831 LaplacianMatrixOp(1, 0, inarray, outarray, mkey);
832 break;
833 case eLaplacian11:
834 LaplacianMatrixOp(1, 1, inarray, outarray, mkey);
835 break;
836 case eLaplacian12:
837 LaplacianMatrixOp(1, 2, inarray, outarray, mkey);
838 break;
839 case eLaplacian20:
840 LaplacianMatrixOp(2, 0, inarray, outarray, mkey);
841 break;
842 case eLaplacian21:
843 LaplacianMatrixOp(2, 1, inarray, outarray, mkey);
844 break;
845 case eLaplacian22:
846 LaplacianMatrixOp(2, 2, inarray, outarray, mkey);
847 break;
848 case eHelmholtz:
849 HelmholtzMatrixOp(inarray, outarray, mkey);
850 break;
851 default:
853 "This matrix does not have an operator");
854 break;
855 }
856}
857
859 const Array<OneD, const NekDouble> &inarray,
860 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
861{
862 switch (mkey.GetMatrixType())
863 {
864 case eMass:
865 MassMatrixOp_MatFree(inarray, outarray, mkey);
866 break;
867 case eWeakDeriv0:
868 WeakDerivMatrixOp_MatFree(0, inarray, outarray, mkey);
869 break;
870 case eWeakDeriv1:
871 WeakDerivMatrixOp_MatFree(1, inarray, outarray, mkey);
872 break;
873 case eWeakDeriv2:
874 WeakDerivMatrixOp_MatFree(2, inarray, outarray, mkey);
875 break;
877 WeakDirectionalDerivMatrixOp_MatFree(inarray, outarray, mkey);
878 break;
880 MassLevelCurvatureMatrixOp_MatFree(inarray, outarray, mkey);
881 break;
882 case eLinearAdvection:
883 LinearAdvectionMatrixOp_MatFree(inarray, outarray, mkey);
884 break;
887 mkey, false);
888 break;
891 mkey);
892 break;
893 case eLaplacian:
894 LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
895 break;
896 case eLaplacian00:
897 LaplacianMatrixOp_MatFree(0, 0, inarray, outarray, mkey);
898 break;
899 case eLaplacian01:
900 LaplacianMatrixOp_MatFree(0, 1, inarray, outarray, mkey);
901 break;
902 case eLaplacian02:
903 LaplacianMatrixOp_MatFree(0, 2, inarray, outarray, mkey);
904 break;
905 case eLaplacian10:
906 LaplacianMatrixOp_MatFree(1, 0, inarray, outarray, mkey);
907 break;
908 case eLaplacian11:
909 LaplacianMatrixOp_MatFree(1, 1, inarray, outarray, mkey);
910 break;
911 case eLaplacian12:
912 LaplacianMatrixOp_MatFree(1, 2, inarray, outarray, mkey);
913 break;
914 case eLaplacian20:
915 LaplacianMatrixOp_MatFree(2, 0, inarray, outarray, mkey);
916 break;
917 case eLaplacian21:
918 LaplacianMatrixOp_MatFree(2, 1, inarray, outarray, mkey);
919 break;
920 case eLaplacian22:
921 LaplacianMatrixOp_MatFree(2, 2, inarray, outarray, mkey);
922 break;
923 case eHelmholtz:
924 HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
925 break;
926 default:
928 "This matrix does not have an operator");
929 break;
930 }
931}
932
934 const Array<OneD, const NekDouble> &inarray,
935 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
936{
937 int nq = GetTotPoints();
939
940 v_BwdTrans(inarray, tmp);
941
942 if (mkey.HasVarCoeff(eVarCoeffMass))
943 {
944 Vmath::Vmul(nq, mkey.GetVarCoeff(eVarCoeffMass), 1, tmp, 1, tmp, 1);
945 }
946
947 v_IProductWRTBase(tmp, outarray);
948}
949
951 const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
952 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
953{
954 ASSERTL1(k1 >= 0 && k1 < GetCoordim(), "invalid first argument");
955 ASSERTL1(k2 >= 0 && k2 < GetCoordim(), "invalid second argument");
956
957 int nq = GetTotPoints();
959 Array<OneD, NekDouble> dtmp(nq);
960 VarCoeffType varcoefftypes[3][3] = {
964
965 ConstFactorType constcoefftypes[3][3] = {
969
970 v_BwdTrans(inarray, tmp);
971 v_PhysDeriv(k2, tmp, dtmp);
973 {
974 if (k1 == k2)
975 {
976 // By default, k1 == k2 has \sigma = 1 (diagonal entries)
977 if (mkey.HasVarCoeff(varcoefftypes[k1][k1]))
978 {
979 Vmath::Vmul(nq, mkey.GetVarCoeff(varcoefftypes[k1][k1]), 1,
980 dtmp, 1, dtmp, 1);
981 }
982 v_IProductWRTDerivBase(k1, dtmp, outarray);
983 }
984 else
985 {
986 // By default, k1 != k2 has \sigma = 0 (off-diagonal entries)
987 if (mkey.HasVarCoeff(varcoefftypes[k1][k2]))
988 {
989 Vmath::Vmul(nq, mkey.GetVarCoeff(varcoefftypes[k1][k2]), 1,
990 dtmp, 1, dtmp, 1);
991 v_IProductWRTDerivBase(k1, dtmp, outarray);
992 }
993 else if (mkey.HasVarCoeff(
994 varcoefftypes[k2][k1])) // Check symmetric varcoeff
995 {
996 Vmath::Vmul(nq, mkey.GetVarCoeff(varcoefftypes[k2][k1]), 1,
997 dtmp, 1, dtmp, 1);
998 v_IProductWRTDerivBase(k1, dtmp, outarray);
999 }
1000 else
1001 {
1002 Vmath::Zero(GetNcoeffs(), outarray, 1);
1003 }
1004 }
1005 }
1006 else if (mkey.ConstFactorExists(eFactorCoeffD00) &&
1008 {
1009 if (k1 == k2)
1010 {
1011 // By default, k1 == k2 has \sigma = 1 (diagonal entries)
1012 if (mkey.ConstFactorExists(constcoefftypes[k1][k1]))
1013 {
1014 Vmath::Smul(nq, mkey.GetConstFactor(constcoefftypes[k1][k1]),
1015 dtmp, 1, dtmp, 1);
1016 }
1017 v_IProductWRTDerivBase(k1, dtmp, outarray);
1018 }
1019 else
1020 {
1021 // By default, k1 != k2 has \sigma = 0 (off-diagonal entries)
1022 if (mkey.ConstFactorExists(constcoefftypes[k1][k2]))
1023 {
1024 Vmath::Smul(nq, mkey.GetConstFactor(constcoefftypes[k1][k2]),
1025 dtmp, 1, dtmp, 1);
1026 v_IProductWRTDerivBase(k1, dtmp, outarray);
1027 }
1028 else
1029 {
1030 Vmath::Zero(GetNcoeffs(), outarray, 1);
1031 }
1032 }
1033 }
1034 else
1035 {
1036 // Multiply by svv tensor
1038 {
1039 Vmath::Vcopy(nq, dtmp, 1, tmp, 1);
1040 SVVLaplacianFilter(dtmp, mkey);
1041 Vmath::Vadd(nq, tmp, 1, dtmp, 1, dtmp, 1);
1042 }
1043 v_IProductWRTDerivBase(k1, dtmp, outarray);
1044 }
1045}
1046
1048 const Array<OneD, const NekDouble> &inarray,
1049 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1050{
1051 const int dim = GetCoordim();
1052
1053 int i, j;
1054
1056 Array<OneD, NekDouble> store2(m_ncoeffs, 0.0);
1057
1058 if ((mkey.GetNVarCoeff() == 0 &&
1061 {
1062 // just call diagonal matrix form of laplcian operator
1063 for (i = 0; i < dim; ++i)
1064 {
1065 LaplacianMatrixOp(i, i, inarray, store, mkey);
1066 Vmath::Vadd(m_ncoeffs, store, 1, store2, 1, store2, 1);
1067 }
1068 }
1069 else
1070 {
1071 const MatrixType mtype[3][3] = {
1075 StdMatrixKeySharedPtr mkeyij;
1076
1077 for (i = 0; i < dim; i++)
1078 {
1079 for (j = 0; j < dim; j++)
1080 {
1082 mkey, mtype[i][j]);
1083 LaplacianMatrixOp(i, j, inarray, store, *mkeyij);
1084 Vmath::Vadd(m_ncoeffs, store, 1, store2, 1, store2, 1);
1085 }
1086 }
1087 }
1088
1089 Vmath::Vcopy(m_ncoeffs, store2.data(), 1, outarray.data(), 1);
1090}
1091
1093 const int k1, const Array<OneD, const NekDouble> &inarray,
1094 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1095{
1097 int nq = GetTotPoints();
1098
1099 v_BwdTrans(inarray, tmp);
1100 v_PhysDeriv(k1, tmp, tmp);
1101
1103 if (mkey.HasVarCoeff(keys[k1]))
1104 {
1105 Vmath::Vmul(nq, &(mkey.GetVarCoeff(keys[k1]))[0], 1, &tmp[0], 1,
1106 &tmp[0], 1);
1107 }
1108
1109 v_IProductWRTBase(tmp, outarray);
1110}
1111
1113 const Array<OneD, const NekDouble> &inarray,
1114 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1115{
1116 int nq = GetTotPoints();
1117
1118 Array<OneD, NekDouble> tmp(nq), Dtmp(nq);
1119 Array<OneD, NekDouble> Mtmp(nq), Mout(m_ncoeffs);
1120
1121 v_BwdTrans(inarray, tmp);
1123
1124 v_IProductWRTBase(Dtmp, outarray);
1125
1126 // Compte M_{div tv}
1127 Vmath::Vmul(nq, &(mkey.GetVarCoeff(eVarCoeffMFDiv))[0], 1, &tmp[0], 1,
1128 &Mtmp[0], 1);
1129
1130 v_IProductWRTBase(Mtmp, Mout);
1131
1132 // Add D_tv + M_{div tv}
1133 Vmath::Vadd(m_ncoeffs, &Mout[0], 1, &outarray[0], 1, &outarray[0], 1);
1134}
1135
1137 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1138 [[maybe_unused]] Array<OneD, NekDouble> &outarray,
1139 [[maybe_unused]] const StdMatrixKey &mkey)
1140{
1141}
1142
1144 const Array<OneD, const NekDouble> &inarray,
1145 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1146{
1147 int i, ndir = 0;
1148
1149 VarCoeffType varcoefftypes[] = {eVarCoeffVelX, eVarCoeffVelY,
1151 // Count advection velocities
1152 for (auto &x : varcoefftypes)
1153 {
1154 if (mkey.HasVarCoeff(x))
1155 {
1156 ndir++;
1157 }
1158 }
1159
1160 ASSERTL0(ndir, "Must define at least one advection velocity");
1161 ASSERTL1(ndir <= GetCoordim(),
1162 "Number of constants is larger than coordinate dimensions");
1163
1164 int totpts = GetTotPoints();
1165 Array<OneD, NekDouble> tmp(3 * totpts);
1166 Array<OneD, NekDouble> tmp_deriv = tmp + totpts;
1167 Array<OneD, NekDouble> tmp_adv = tmp_deriv + totpts;
1168
1169 v_BwdTrans(inarray, tmp); // transform to PhysSpace
1170
1171 // Evaluate advection (u dx + v dy + w dz)
1172 Vmath::Zero(totpts, tmp_adv, 1);
1173 for (i = 0; i < ndir; ++i)
1174 {
1175 v_PhysDeriv(i, tmp, tmp_deriv);
1176 Vmath::Vvtvp(totpts, mkey.GetVarCoeff(varcoefftypes[i]), 1, tmp_deriv,
1177 1, tmp_adv, 1, tmp_adv, 1);
1178 }
1179
1180 v_IProductWRTBase(tmp_adv, outarray);
1181}
1182
1184 const Array<OneD, const NekDouble> &inarray,
1185 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1186 bool addDiffusionTerm)
1187{
1188 int i, ndir = 0;
1189
1190 VarCoeffType varcoefftypes[] = {eVarCoeffVelX, eVarCoeffVelY,
1192 // Count advection velocities
1193 for (auto &x : varcoefftypes)
1194 {
1195 if (mkey.HasVarCoeff(x))
1196 {
1197 ndir++;
1198 }
1199 }
1200
1201 ASSERTL0(ndir, "Must define at least one advection velocity");
1202 ASSERTL1(ndir <= GetCoordim(),
1203 "Number of constants is larger than coordinate dimensions");
1204
1205 NekDouble lambda = mkey.GetConstFactor(eFactorLambda);
1206 int totpts = GetTotPoints();
1207 Array<OneD, NekDouble> tmp(3 * totpts);
1208 Array<OneD, NekDouble> tmp_deriv = tmp + totpts;
1209 Array<OneD, NekDouble> tmp_adv = tmp_deriv + totpts;
1210
1211 v_BwdTrans(inarray, tmp); // transform this mode \phi_i into PhysSpace
1212
1213 // calculate advection u dx + v dy + ..
1214 Vmath::Zero(totpts, tmp_adv, 1);
1215 for (i = 0; i < ndir; ++i)
1216 {
1217 v_PhysDeriv(i, tmp, tmp_deriv);
1218 Vmath::Vvtvp(totpts, mkey.GetVarCoeff(varcoefftypes[i]), 1, tmp_deriv,
1219 1, tmp_adv, 1, tmp_adv, 1);
1220 }
1221
1222 // Add reaction term if lambda != 0.0
1223 if (lambda)
1224 {
1225 // Add mass varcoeff
1226 if (mkey.HasVarCoeff(eVarCoeffMass))
1227 {
1228 Vmath::Vmul(totpts, mkey.GetVarCoeff(eVarCoeffMass), 1, tmp, 1, tmp,
1229 1);
1230 }
1231
1232 Vmath::Svtvp(totpts, -lambda, tmp, 1, tmp_adv, 1, tmp_adv, 1);
1233 }
1234
1235 // Create mass matrix = Advection - Reaction
1236 v_IProductWRTBase(tmp_adv, outarray);
1237
1238 // Add Laplacian matrix
1239 if (addDiffusionTerm)
1240 {
1242 StdMatrixKey mkeylap(eLaplacian, DetShapeType(), *this,
1243 mkey.GetConstFactors(), mkey.GetVarCoeffs(),
1244 mkey.GetVarFactors(), mkey.GetNodalPointsType());
1245 LaplacianMatrixOp(inarray, lap, mkeylap);
1246
1247 Vmath::Vadd(m_ncoeffs, lap, 1, outarray, 1, outarray,
1248 1); // += Laplacian
1249 }
1250}
1251
1253 const Array<OneD, const NekDouble> &inarray,
1254 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1255{
1256 NekDouble lambda = mkey.GetConstFactor(eFactorLambda);
1258 StdMatrixKey mkeymass(eMass, DetShapeType(), *this);
1259 StdMatrixKey mkeylap(eLaplacian, DetShapeType(), *this,
1260 mkey.GetConstFactors(), mkey.GetVarCoeffs(),
1261 mkey.GetVarFactors(), mkey.GetNodalPointsType());
1262
1263 MassMatrixOp(inarray, tmp, mkeymass);
1264 LaplacianMatrixOp(inarray, outarray, mkeylap);
1265
1266 Vmath::Svtvp(m_ncoeffs, lambda, tmp, 1, outarray, 1, outarray, 1);
1267}
1268
1269// VIRTUAL INLINE FUNCTIONS FROM HEADER FILE
1271 [[maybe_unused]] const std::vector<unsigned int> &nummodes,
1272 [[maybe_unused]] int &modes_offset)
1273{
1274 NEKERROR(ErrorUtil::efatal, "This function is not defined for this class");
1275 return 0;
1276}
1277
1279 [[maybe_unused]] const Array<OneD, const NekDouble> &Fx,
1280 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1281{
1282 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
1283}
1284
1286 [[maybe_unused]] const Array<OneD, const NekDouble> &Fx,
1287 [[maybe_unused]] const Array<OneD, const NekDouble> &Fy,
1288 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1289{
1290 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
1291}
1292
1294 [[maybe_unused]] const Array<OneD, const NekDouble> &Fx,
1295 [[maybe_unused]] const Array<OneD, const NekDouble> &Fy,
1296 [[maybe_unused]] const Array<OneD, const NekDouble> &Fz,
1297 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1298{
1299 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
1300}
1301
1303 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
1304 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1305{
1306 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
1307}
1308
1310 [[maybe_unused]] const LocalRegions::MatrixKey &mkey)
1311{
1312 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
1314}
1315
1317 [[maybe_unused]] const LocalRegions::MatrixKey &mkey)
1318{
1319 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
1320}
1321
1323 [[maybe_unused]] StdRegions::Orientation dir,
1324 [[maybe_unused]] Array<OneD, const NekDouble> &inarray,
1325 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1326{
1327 NEKERROR(ErrorUtil::efatal, "This function is not defined for this shape");
1328}
1329
1331 [[maybe_unused]] const Array<OneD, const NekDouble> &Lcoord,
1332 [[maybe_unused]] const Array<OneD, const NekDouble> &physvals)
1333
1334{
1335 NEKERROR(ErrorUtil::efatal, "This function is not defined for this shape");
1336 return 0;
1337}
1338
1340 [[maybe_unused]] const Array<OneD, const NekDouble> &xi,
1341 [[maybe_unused]] Array<OneD, NekDouble> &eta)
1342{
1343 NEKERROR(ErrorUtil::efatal, "This function is not defined for this shape");
1344}
1345
1347 [[maybe_unused]] const Array<OneD, const NekDouble> &eta,
1348 [[maybe_unused]] Array<OneD, NekDouble> &xi)
1349{
1350 NEKERROR(ErrorUtil::efatal, "This function is not defined for this shape");
1351}
1352
1354 [[maybe_unused]] std::shared_ptr<StdExpansion> FromExp,
1355 [[maybe_unused]] const Array<OneD, const NekDouble> &fromData,
1356 [[maybe_unused]] Array<OneD, NekDouble> &toData,
1357 [[maybe_unused]] bool Traspose)
1358{
1359 ASSERTL0(false, "This function is not valid or not defined");
1360}
1361
1363 [[maybe_unused]] const int i, [[maybe_unused]] const int k,
1364 [[maybe_unused]] bool UseGLL) const
1365{
1366 ASSERTL0(false, "This function is not valid or not defined");
1368}
1369
1371 [[maybe_unused]] const int i, [[maybe_unused]] const int j) const
1372{
1373 ASSERTL0(false, "This function is not valid or not defined");
1375}
1376
1381
1383{
1384 ASSERTL0(false, "This function has not been defined for this expansion");
1385 return false;
1386}
1387
1389{
1390 return false;
1391}
1392
1393namespace
1394{
1395/**
1396 * @brief The orthogonal basis of direction @p dir of @p shape, as
1397 * SpatialDomains::MeshGraph::DefineBasisKeyFromExpansionType gives the
1398 * orthogonal expansion: Ortho_A in an uncollapsed direction, Ortho_B in a
1399 * direction collapsed once, and in the twice-collapsed direction Ortho_C,
1400 * or OrthoPyr_C for the pyramid.
1401 */
1402constexpr LibUtilities::BasisType OrthogonalBasisType(
1403 const LibUtilities::ShapeType shape, const unsigned int dir)
1404{
1405 switch (LibUtilities::ShapeTypeCollapseExponent(shape, dir))
1406 {
1407 case 0:
1409 case 1:
1411 default:
1412 if (shape == LibUtilities::ePyramid)
1413 {
1415 }
1417 }
1418}
1419} // namespace
1420
1421/**
1422 * @brief Whether the standard inverse mass matrix of the expansion is diagonal,
1423 * so that on an affine element the inverse mass is its diagonal over the
1424 * Jacobian: nmTot multiplies per element in place of the nmTot x nmTot
1425 * product.
1426 *
1427 * It is diagonal when the basis is collocated with its quadrature, or is
1428 * the shape's orthogonal one (OrthogonalBasisType()) and each direction's rule
1429 * integrates the product of two different modes exactly. In direction @c d the
1430 * modes have degree at most \f$D_d\f$, so two of them multiply to degree \f$2
1431 * D_d - 1\f$ at most where they differ, plus the collapse exponent; the rule's
1432 * Jacobi weight absorbs alpha of those factors. \f$D_d = P\f$ in every
1433 * direction of every shape, the orthogonal pyramid included: its
1434 * collapsed-direction modes carry \f$((1 - z)/2)^{\max(p, q)}\f$ with \f$r \le
1435 * P - \max(p, q)\f$. Nodal non-tensorial expansions, points types other than
1436 * Legendre and Jacobi(alpha, 0), and variable order across directions take the
1437 * dense path.
1438 */
1440{
1442 {
1443 return false;
1444 }
1445 const int dim = GetShapeDimension();
1446 // A collocated Lagrange basis is the identity at the quadrature
1447 // points, so its mass matrix is diag(w) whatever the rule's
1448 // exactness.
1449 bool collocated = true;
1450 for (int dir = 0; dir < dim; ++dir)
1451 {
1452 collocated = collocated && GetBasis(dir)->Collocation();
1453 }
1454 if (collocated)
1455 {
1456 return true;
1457 }
1458 const auto shape = DetShapeType();
1459 const int P = EvalBasisNumModesMax() - 1;
1460 for (int dir = 0; dir < dim; ++dir)
1461 {
1462 const auto &key = GetBasis(dir)->GetBasisKey();
1463 const int collapse =
1465 const int alpha =
1466 LibUtilities::PointsTypeJacobiAlpha(key.GetPointsType());
1467 const int degree = 2 * P - 1 + collapse;
1468 if (key.GetNumModes() != P + 1 ||
1469 key.GetBasisType() != OrthogonalBasisType(shape, dir) ||
1470 alpha < 0 || alpha > collapse ||
1472 key.GetPointsType(), key.GetNumPoints()) < degree - alpha)
1473 {
1474 return false;
1475 }
1476 }
1477 return true;
1478}
1479
1484
1486 [[maybe_unused]] const int dir,
1487 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1488 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1489{
1490 NEKERROR(ErrorUtil::efatal, "This method has not been defined");
1491}
1492
1493/**
1494 *
1495 */
1497 [[maybe_unused]] const Array<OneD, const NekDouble> &direction,
1498 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1499 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1500{
1501 NEKERROR(ErrorUtil::efatal, "This method has not been defined");
1502}
1503
1504/**
1505 * \brief Forward transform from physical quadrature space stored in \a
1506 * inarray and evaluate the expansion coefficients and store in \a
1507 * outarray
1508 *
1509 * Perform a forward transform using a Galerkin projection by taking the
1510 * inner product of the physical points and multiplying by the inverse
1511 * of the mass matrix using the Solve method of the standard matrix
1512 * container holding the local mass matrix, i.e. \f$ {\bf \hat{u}} =
1513 * {\bf M}^{-1} {\bf I} \f$ where \f$ {\bf I}[p] = \int^1_{-1}
1514 * \phi_p(\xi_1) u(\xi_1) d\xi_1 \f$
1515 *
1516 * This function stores the expansion coefficients calculated by the
1517 * transformation in the coefficient space array \a outarray
1518 *
1519 * \param inarray: array of physical quadrature points to be transformed
1520 * \param outarray: the coeffficients of the expansion
1521 */
1523 Array<OneD, NekDouble> &outarray)
1524{
1525 if (v_IsCollocatedBasis())
1526 {
1527 Vmath::Vcopy(m_ncoeffs, inarray, 1, outarray, 1);
1528 }
1529 else
1530 {
1531 v_IProductWRTBase(inarray, outarray);
1532
1533 // get Mass matrix inverse
1534 LibUtilities::PointsType nodalPointsType =
1538
1539 // get Mass matrix inverse
1543 StdRegions::NullVarFactorsMap, nodalPointsType);
1544 DNekMatSharedPtr matsys = GetStdMatrix(masskey);
1545
1546 // copy inarray in case inarray == outarray
1547 NekVector<NekDouble> in(m_ncoeffs, outarray, eCopy);
1548 NekVector<NekDouble> out(m_ncoeffs, outarray, eWrapper);
1549
1550 out = (*matsys) * in;
1551 }
1552}
1553
1554/**
1555 *
1556 */
1558 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1559 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1560{
1561 NEKERROR(ErrorUtil::efatal, "This method has not been defined");
1562}
1563
1564/**
1565 * @brief Calculate the derivative of the physical points
1566 * @see StdRegions#StdExpansion#PhysDeriv
1567 */
1569 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1570 [[maybe_unused]] Array<OneD, NekDouble> &out_d1,
1571 [[maybe_unused]] Array<OneD, NekDouble> &out_d2,
1572 [[maybe_unused]] Array<OneD, NekDouble> &out_d3)
1573{
1574 v_StdPhysDeriv(inarray, out_d1, out_d2, out_d3);
1575}
1576
1577/**
1578 * @brief Calculate the derivative of the physical points in a
1579 * given direction
1580 * @see StdRegions#StdExpansion#PhysDeriv
1581 */
1583 [[maybe_unused]] const int dir,
1584 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1585 [[maybe_unused]] Array<OneD, NekDouble> &out_d0)
1586
1587{
1588 NEKERROR(ErrorUtil::efatal, "This function is only valid for "
1589 "specific element types");
1590}
1591
1592/**
1593 * @brief Physical derivative along a direction vector.
1594 * @see StdRegions#StdExpansion#PhysDirectionalDeriv
1595 */
1597 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1598 [[maybe_unused]] const Array<OneD, const NekDouble> &direction,
1599 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1600{
1601 NEKERROR(ErrorUtil::efatal, "This function is only valid for "
1602 "specific element types");
1603}
1604
1606 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1607 [[maybe_unused]] Array<OneD, NekDouble> &out_d1,
1608 [[maybe_unused]] Array<OneD, NekDouble> &out_d2,
1609 [[maybe_unused]] Array<OneD, NekDouble> &out_d3)
1610{
1611 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1612}
1613
1615 [[maybe_unused]] const Array<OneD, const NekDouble> &coords,
1616 [[maybe_unused]] int mode)
1617{
1618 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1619 return 0;
1620}
1621
1623 [[maybe_unused]] const Array<OneD, const NekDouble> &coords,
1624 [[maybe_unused]] const Array<OneD, const NekDouble> &physvals)
1625{
1626 return v_StdPhysEvaluate(coords, physvals);
1627}
1628
1630 [[maybe_unused]] const Array<OneD, DNekMatSharedPtr> &I,
1631 [[maybe_unused]] const Array<OneD, const NekDouble> &physvals)
1632{
1633 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1634 return 0;
1635}
1636
1638 [[maybe_unused]] const Array<OneD, NekDouble> &coord,
1639 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1640 [[maybe_unused]] std::array<NekDouble, 3> &firstOrderDerivs)
1641{
1643 "PhysEvaluate first order derivative method does not exist"
1644 " for this shape type: " +
1645 static_cast<std::string>(
1647 return 0;
1648}
1649
1651 [[maybe_unused]] const Array<OneD, NekDouble> &coord,
1652 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1653 [[maybe_unused]] std::array<NekDouble, 3> &firstOrderDerivs,
1654 [[maybe_unused]] std::array<NekDouble, 6> &secondOrderDerivs)
1655{
1657 "PhysEvaluate second order derivative method does not exist"
1658 " for this shape type: " +
1659 static_cast<std::string>(
1661 return 0;
1662}
1663
1664void StdExpansion::v_FillMode([[maybe_unused]] const int mode,
1665 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1666{
1667 NEKERROR(ErrorUtil::efatal, "This function has not "
1668 "been defined for this shape");
1669}
1670
1672 [[maybe_unused]] const StdMatrixKey &mkey)
1673{
1674 NEKERROR(ErrorUtil::efatal, "This function has not "
1675 "been defined for this element");
1676 DNekMatSharedPtr returnval;
1677 return returnval;
1678}
1681 [[maybe_unused]] const StdMatrixKey &mkey)
1682{
1683 NEKERROR(ErrorUtil::efatal, "This function has not "
1684 "been defined for this element");
1685 DNekMatSharedPtr returnval;
1686 return returnval;
1687}
1688
1690 [[maybe_unused]] Array<OneD, NekDouble> &coords_0,
1691 [[maybe_unused]] Array<OneD, NekDouble> &coords_1,
1692 [[maybe_unused]] Array<OneD, NekDouble> &coords_2)
1693{
1694 NEKERROR(ErrorUtil::efatal, "Write coordinate definition method");
1695}
1696
1698 [[maybe_unused]] const Array<OneD, const NekDouble> &Lcoord,
1699 [[maybe_unused]] Array<OneD, NekDouble> &coord)
1700{
1701 NEKERROR(ErrorUtil::efatal, "Write coordinate definition method");
1702}
1703
1705{
1706 return GetShapeDimension();
1707}
1708
1710 [[maybe_unused]] Array<OneD, unsigned int> &outarray)
1711{
1712 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1713}
1714
1716 [[maybe_unused]] Array<OneD, unsigned int> &outarray)
1717{
1718 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1719}
1720
1721int StdExpansion::v_GetVertexMap([[maybe_unused]] const int localVertexId,
1722 [[maybe_unused]] bool useCoeffPacking)
1723{
1724 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1725 return 0;
1726}
1727
1729 [[maybe_unused]] const int tid,
1730 [[maybe_unused]] Array<OneD, unsigned int> &maparray,
1731 [[maybe_unused]] Array<OneD, int> &signarray,
1732 [[maybe_unused]] Orientation traceOrient, [[maybe_unused]] int P,
1733 [[maybe_unused]] int Q)
1734{
1735 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1736}
1737
1739 [[maybe_unused]] const unsigned int traceid,
1740 [[maybe_unused]] Array<OneD, unsigned int> &maparray)
1741{
1742 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1743}
1744
1746 [[maybe_unused]] const unsigned int tid,
1747 [[maybe_unused]] Array<OneD, unsigned int> &maparray,
1748 [[maybe_unused]] Array<OneD, int> &signarray,
1749 [[maybe_unused]] Orientation traceOrient, [[maybe_unused]] int P,
1750 [[maybe_unused]] int Q)
1751{
1752 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1753}
1754
1756 [[maybe_unused]] const int tid,
1757 [[maybe_unused]] Array<OneD, unsigned int> &maparray,
1758 [[maybe_unused]] Array<OneD, int> &signarray,
1759 [[maybe_unused]] const Orientation traceOrient)
1760{
1761 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1762}
1763
1764void StdExpansion::v_GetTraceNumModes([[maybe_unused]] const int tid,
1765 [[maybe_unused]] int &numModes0,
1766 [[maybe_unused]] int &numModes1,
1767 [[maybe_unused]] Orientation traceOrient)
1768{
1769 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1770}
1771
1773 [[maybe_unused]] const int vertex,
1774 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1775 [[maybe_unused]] NekDouble &outarray)
1776{
1777 NEKERROR(ErrorUtil::efatal, "Method does not exist for "
1778 "this shape or library");
1779}
1780
1787
1789 [[maybe_unused]] const int traceid,
1790 [[maybe_unused]] std::shared_ptr<StdExpansion> &exp)
1791{
1793 "Method does not exist for this shape or library");
1794}
1795
1797 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1798 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1799{
1801 "Method does not exist for this shape or library");
1802}
1803
1805 Array<OneD, NekDouble> &outarray,
1806 const StdMatrixKey &mkey)
1807{
1808 // If this function is not reimplemented on shape level, the function
1809 // below will be called
1810 MassMatrixOp_MatFree(inarray, outarray, mkey);
1811}
1812
1814 const Array<OneD, const NekDouble> &inarray,
1815 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1816{
1817 // If this function is not reimplemented on shape level, the function
1818 // below will be called
1819 LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
1820}
1821
1823 [[maybe_unused]] Array<OneD, NekDouble> &array,
1824 [[maybe_unused]] const StdMatrixKey &mkey)
1825{
1826 ASSERTL0(false, "This function is not defined in StdExpansion.");
1827}
1828
1830 [[maybe_unused]] Array<OneD, NekDouble> &array,
1831 [[maybe_unused]] const NekDouble alpha,
1832 [[maybe_unused]] const NekDouble exponent,
1833 [[maybe_unused]] const NekDouble cutoff)
1834{
1835 ASSERTL0(false, "This function is not defined in StdExpansion.");
1836}
1837
1839 [[maybe_unused]] int numMin,
1840 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1841 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1842{
1843 ASSERTL0(false, "This function is not defined in StdExpansion.");
1844}
1845
1847 const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
1848 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1849{
1850 // If this function is not reimplemented on shape level, the function
1851 // below will be called
1852 LaplacianMatrixOp_MatFree(k1, k2, inarray, outarray, mkey);
1853}
1854
1856 const int i, const Array<OneD, const NekDouble> &inarray,
1857 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1858{
1859 // If this function is not reimplemented on shape level, the function
1860 // below will be called
1861 WeakDerivMatrixOp_MatFree(i, inarray, outarray, mkey);
1862}
1863
1865 const Array<OneD, const NekDouble> &inarray,
1866 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1867{
1868 // If this function is not reimplemented on shape level, the function
1869 // below will be called
1870 WeakDirectionalDerivMatrixOp_MatFree(inarray, outarray, mkey);
1871}
1872
1874 const Array<OneD, const NekDouble> &inarray,
1875 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1876{
1877 // If this function is not reimplemented on shape level, the function
1878 // below will be called
1879 MassLevelCurvatureMatrixOp_MatFree(inarray, outarray, mkey);
1880}
1881
1883 const Array<OneD, const NekDouble> &inarray,
1884 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1885{
1886 // If this function is not reimplemented on shape level, the function
1887 // below will be called
1888 LinearAdvectionMatrixOp_MatFree(inarray, outarray, mkey);
1889}
1890
1892 const Array<OneD, const NekDouble> &inarray,
1893 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1894 bool addDiffusionTerm)
1895{
1896 // If this function is not reimplemented on shape level, the function
1897 // below will be called
1899 addDiffusionTerm);
1900}
1901
1903 const Array<OneD, const NekDouble> &inarray,
1904 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1905{
1906 // If this function is not reimplemented on shape level, the function
1907 // below will be called
1908 HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
1909}
1910
1912 const Array<OneD, const NekDouble> &inarray,
1913 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1914{
1915 // If this function is not reimplemented on shape level, the function
1916 // below will be called
1917 LaplacianMatrixOp_MatFree_GenericImpl(inarray, outarray, mkey);
1918}
1919
1921 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1922 [[maybe_unused]] Array<OneD, NekDouble> &outarray,
1923 [[maybe_unused]] Array<OneD, NekDouble> &wsp)
1924{
1925 ASSERTL0(false, "Not implemented.");
1926}
1927
1929 const Array<OneD, const NekDouble> &inarray,
1930 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1931{
1932 // If this function is not reimplemented on shape level, the function
1933 // below will be called
1934 HelmholtzMatrixOp_MatFree_GenericImpl(inarray, outarray, mkey);
1935}
1936
1938 [[maybe_unused]] const DNekScalMatSharedPtr &m_transformationmatrix)
1939{
1940 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
1941 return NullDNekMatSharedPtr;
1942}
1943
1945 Array<OneD, NekDouble> &outarray, int npset)
1946{
1947 PhysInterpToPoints(inarray, outarray, npset, ePhysInterpToGLL);
1948}
1949
1951 const Array<OneD, const NekDouble> &inarray,
1952 Array<OneD, NekDouble> &outarray, int npset)
1953{
1954 PhysInterpToPoints(inarray, outarray, npset, ePhysInterpToEquiSpaced);
1955}
1956
1958 const Array<OneD, const NekDouble> &inarray,
1959 Array<OneD, NekDouble> &outarray, int npset, MatrixType distrib)
1960{
1962 DNekMatSharedPtr intmat;
1963
1964 int nqtot = GetTotPoints();
1965 int np = 0;
1966 if (npset == -1) // use values from basis num points()
1967 {
1968 int nqbase;
1969 for (int i = 0; i < m_base.size(); ++i)
1970 {
1971 nqbase = m_base[i]->GetNumPoints();
1972 np = std::max(np, nqbase);
1973 }
1974
1975 StdMatrixKey Ikey(distrib, shape, *this);
1976 intmat = GetStdMatrix(Ikey);
1977 }
1978 else
1979 {
1980 np = npset;
1981
1982 ConstFactorMap cmap;
1983 cmap[eFactorConst] = np;
1984 StdMatrixKey Ikey(distrib, shape, *this, cmap);
1985 intmat = GetStdMatrix(Ikey);
1986 }
1987
1988 NekVector<NekDouble> in(nqtot, inarray, eWrapper);
1990 LibUtilities::GetNumberOfCoefficients(shape, np, np, np), outarray,
1991 eWrapper);
1992 out = (*intmat) * in;
1993}
1994
1996 [[maybe_unused]] Array<OneD, int> &conn, [[maybe_unused]] bool standard)
1997{
1999 "GetSimplexEquiSpacedConnectivity not"
2000 " implemented for " +
2001 static_cast<std::string>(
2003}
2004
2006 [[maybe_unused]] const StdRegions::Orientation orient,
2007 [[maybe_unused]] Array<OneD, int> &idmap, [[maybe_unused]] const int nq0,
2008 [[maybe_unused]] const int nq1, [[maybe_unused]] bool Forwards)
2009{
2011 "Method does not exist for this shape or library");
2012}
2013
2015 const Array<OneD, const NekDouble> &inarray,
2016 Array<OneD, NekDouble> &outarray)
2017{
2019
2020 // inarray has to be consistent with NumModes definition
2021 // There is also a check in GetStdMatrix to see if all
2022 // modes are of the same size
2023 ConstFactorMap cmap;
2024
2025 cmap[eFactorConst] = m_base[0]->GetNumModes();
2026 StdMatrixKey Ikey(eEquiSpacedToCoeffs, shape, *this, cmap);
2027 DNekMatSharedPtr intmat = GetStdMatrix(Ikey);
2028
2030 NekVector<NekDouble> out(m_ncoeffs, outarray, eWrapper);
2031 out = (*intmat) * in;
2032}
2033
2035 const Array<OneD, const NekDouble> &inarray,
2036 Array<OneD, NekDouble> &outarray)
2037{
2039
2040 // inarray has to be consistent with NumModes definition
2041 // There is also a check in GetStdMatrix to see if all
2042 // modes are of the same size
2043 ConstFactorMap cmap;
2044
2045 std::vector<unsigned int> nequivec(3, nequi);
2046 cmap[eFactorConst] = nequi;
2047 StdMatrixKey Ikey(eEquiSpacedToPhys, shape, *this, cmap);
2048 DNekMatSharedPtr intmat = GetStdMatrix(Ikey);
2049
2050 NekVector<NekDouble> in(GetNumberOfCoefficients(shape, nequivec), inarray,
2051 eWrapper);
2052 NekVector<NekDouble> out(GetTotPoints(), outarray, eWrapper);
2053 out = (*intmat) * in;
2054}
2055
2056} // namespace Nektar::StdRegions
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
std::map< int64_t, double > sum
Describes the specification for a Basis.
Definition Basis.h:45
Defines a specification for a set of points.
Definition Points.h:50
PointsType GetPointsType() const
Definition Points.h:90
static int GetDegreeOfExactness(const PointsType ptype, const int npt)
Get degree of exactness for quadrature points.
Definition Points.h:238
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
The base class for all shapes.
bool StdInvMassIsDiagonal()
Whether the standard inverse mass matrix is diagonal.
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
virtual void v_LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual int v_GetVertexMap(int localVertexId, bool useCoeffPacking=false)
std::shared_ptr< Array< OneD, const NekDouble > > CreateStdFac(const StdFacKey &mkey)
virtual void v_LocCollapsedToLocCoord(const Array< OneD, const NekDouble > &eta, Array< OneD, NekDouble > &xi)
virtual ~StdExpansion()
Destructor.
const LibUtilities::BasisSharedPtr & GetBasis(int dir) const
This function gets the shared point to basis in the dir direction.
virtual void v_PhysDirectionalDeriv(const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &direction, Array< OneD, NekDouble > &outarray)
Physical derivative along a direction vector.
StdExpansion()
Default Constructor.
void EquiSpacedToPhys(const int nequi, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
virtual void v_GetTraceToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards, int P=-1, int Q=-1)
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
virtual void v_GetCoord(const Array< OneD, const NekDouble > &Lcoord, Array< OneD, NekDouble > &coord)
void GeneralMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void FillMode(const int mode, Array< OneD, NekDouble > &outarray)
This function fills the array outarray with the mode-th mode of the expansion.
virtual NekDouble v_StdPhysEvaluate(const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals)
void PhysInterpToSimplexEquiSpaced(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int npset=-1)
This function performs an interpolation from the physical space points provided at input into an arra...
void WeakDirectionalDerivMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void WeakDerivMatrixOp_MatFree(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
DNekBlkMatSharedPtr CreateStdStaticCondMatrix(const StdMatrixKey &mkey)
Create the static condensation of a matrix when using a boundary interior decomposition.
void LaplacianMatrixOp_MatFree_GenericImpl(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void MassLevelCurvatureMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_0, Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2)
void LinearAdvectionDiffusionReactionMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey, bool addDiffusionTerm=true)
DNekMatSharedPtr GetStdMatrix(const StdMatrixKey &mkey)
virtual void v_GetElmtTraceToTraceMap(const unsigned int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards, int P=-1, int Q=-1)
virtual void v_NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
virtual void v_GetSimplexEquiSpacedConnectivity(Array< OneD, int > &conn, bool standard=true)
virtual void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdMatrixKey &mkey)
void WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
int EvalBasisNumModesMax(void) const
This function returns the maximum number of expansion modes over all local directions.
virtual void v_GetInteriorMap(Array< OneD, unsigned int > &outarray)
virtual void v_SetCoeffsToOrientation(StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
NekDouble Linf(const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &sol=NullNekDouble1DArray)
Function to evaluate the discrete error where is given by the array sol.
virtual NekDouble v_PhysEvalFirstSecondDeriv(const Array< OneD, NekDouble > &coord, const Array< OneD, const NekDouble > &inarray, std::array< NekDouble, 3 > &firstOrderDerivs, std::array< NekDouble, 6 > &secondOrderDerivs)
void EquiSpacedToCoeffs(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs a projection/interpolation from the equispaced points sometimes used in post-p...
void MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual bool v_IsCollocatedBasis() const =0
virtual void v_HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_WeakDirectionalDerivMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals)
virtual DNekMatSharedPtr v_BuildInverseTransformationMatrix(const DNekScalMatSharedPtr &m_transformationmatrix)
NekDouble L2(const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &sol=NullNekDouble1DArray)
Function to evaluate the discrete error, where is given by the array sol.
virtual void v_GetVertexPhysVals(const int vertex, const Array< OneD, const NekDouble > &inarray, NekDouble &outarray)
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Transform a given function from physical quadrature space to coefficient space.
virtual NekDouble v_PhysEvaluateInterp(const Array< OneD, DNekMatSharedPtr > &I, const Array< OneD, const NekDouble > &physvals)
void LinearAdvectionMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
DNekMatSharedPtr CreateGeneralMatrix(const StdMatrixKey &mkey)
this function generates the mass matrix
virtual void v_MassLevelCurvatureMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void PhysInterpToGLL(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int npset=-1)
virtual void v_GetTraceCoeffMap(const unsigned int traceid, Array< OneD, unsigned int > &maparray)
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...
virtual bool v_IsBoundaryInteriorExpansion() const
virtual void v_MultiplyByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_FillMode(const int mode, Array< OneD, NekDouble > &outarray)
void LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_ExponentialFilter(Array< OneD, NekDouble > &array, const NekDouble alpha, const NekDouble exponent, const NekDouble cutoff)
virtual const LibUtilities::BasisKey v_GetTraceBasisKey(const int i, const int k, bool UseGLL=false) const
void IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void MassLevelCurvatureMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
virtual void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual DNekMatSharedPtr v_GenMatrix(const StdMatrixKey &mkey)
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.
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdMatrixKey &mkey)
virtual void v_GenStdTraceExp(const int traceid, std::shared_ptr< StdExpansion > &exp)
virtual void v_ReOrientTracePhysMap(const StdRegions::Orientation orient, Array< OneD, int > &idmap, const int nq0, const int nq1, bool Forwards)
virtual void v_GetTraceNumModes(const int fid, int &numModes0, int &numModes1, Orientation traceOrient=eDir1FwdDir1_Dir2FwdDir2)
virtual void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_PhysInterp(std::shared_ptr< StdExpansion > FromExp, const Array< OneD, const NekDouble > &fromData, Array< OneD, NekDouble > &toData, bool Transpose)
LibUtilities::PointsType GetPointsType(const int dir) const
This function returns the type of quadrature points used in the dir direction.
virtual void v_GetBoundaryMap(Array< OneD, unsigned int > &outarray)
void GenStdMatBwdDeriv(const int dir, DNekMatSharedPtr &mat)
virtual void v_MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual const LibUtilities::PointsKey v_GetNodalPointsKey() const
virtual void v_WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void LinearAdvectionDiffusionReactionMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey, bool addDiffusionTerm=true)
virtual void v_LocCoordToLocCollapsed(const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta)
virtual NekDouble v_PhysEvaluateBasis(const Array< OneD, const NekDouble > &coords, int mode)
virtual void v_GetTraceInteriorToElementMap(const int eid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, const Orientation traceOrient=eForwards)
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)=0
Calculates the inner product of a given function f with the different modes of the expansion.
void PhysInterpToPoints(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int npset, MatrixType distrib)
virtual void v_LinearAdvectionDiffusionReactionMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey, bool addDiffusionTerm=true)
void HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_ReduceOrderCoeffs(int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_DropLocStaticCondMatrix(const LocalRegions::MatrixKey &mkey)
void WeakDirectionalDerivMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_LaplacianMatrixOp_MatFree_Kernel(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp)
NekDouble H1(const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &sol=NullNekDouble1DArray)
Function to evaluate the discrete error, where is given by the array sol.
virtual int v_CalcNumberOfCoefficients(const std::vector< unsigned int > &nummodes, int &modes_offset)
void SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdMatrixKey &mkey)
void HelmholtzMatrixOp_MatFree_GenericImpl(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)=0
virtual LibUtilities::PointsKey v_GetTracePointsKey(const int i, const int j) const
Array< OneD, LibUtilities::BasisSharedPtr > m_base
virtual NekDouble v_PhysEvalFirstDeriv(const Array< OneD, NekDouble > &coord, const Array< OneD, const NekDouble > &inarray, std::array< NekDouble, 3 > &firstOrderDerivs)
virtual void v_LinearAdvectionMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_IProductWRTDirectionalDerivBase(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void LinearAdvectionMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2, Array< OneD, NekDouble > &out_d3)
Calculate the derivative of the physical points.
virtual void v_StdPhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2, Array< OneD, NekDouble > &out_d3)
void MassMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void GeneralMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const LocalRegions::MatrixKey &mkey)
NekDouble Integral(const Array< OneD, const NekDouble > &inarray)
This function integrates the specified function over the domain.
LibUtilities::ShapeType GetShapeType() const
const Array< OneD, const NekDouble > & GetVarFactors(const StdRegions::ConstFactorType &type) const
const VarCoeffMap & GetVarCoeffs() const
MatrixType GetMatrixType() const
bool HasVarCoeff(const StdRegions::VarCoeffType &coeff) const
LibUtilities::PointsType GetNodalPointsType() const
const ConstFactorMap & GetConstFactors() const
const Array< OneD, const NekDouble > & GetVarCoeff(const StdRegions::VarCoeffType &coeff) const
NekDouble GetConstFactor(const ConstFactorType &factor) const
bool ConstFactorExists(const ConstFactorType &factor) const
const char *const ShapeTypeMap[SIZE_ShapeType]
Definition ShapeType.hpp:83
BasisManagerT & BasisManager(void)
static const BasisKey NullBasisKey(eNoBasisType, 0, NullPointsKey)
Defines a null basis with no type or points.
constexpr int ShapeTypeCollapseExponent(const ShapeType shape, const unsigned int dir)
Exponent of (1 - eta)/2 in the collapsed-coordinate Jacobian along direction dir of shape,...
constexpr int PointsTypeJacobiAlpha(const PointsType pointsType)
Exponent alpha of the (1 - x)^alpha weight a Gauss-type rule integrates against, or -1 for any other ...
Definition PointsType.h:151
constexpr int GetNumberOfCoefficients(ShapeType shape, std::vector< unsigned int > &modes, int offset=0)
@ eGaussGaussAlpha1Beta0
1D Gauss-Jacobi quadrature points,
Definition PointsType.h:100
@ eModified_B
Principle Modified Functions .
Definition BasisType.h:49
@ eOrtho_A
Principle Orthogonal Functions .
Definition BasisType.h:42
@ eOrtho_C
Principle Orthogonal Functions .
Definition BasisType.h:46
@ eOrtho_B
Principle Orthogonal Functions .
Definition BasisType.h:44
@ eOrthoPyr_C
Principle Orthogonal Functions .
Definition BasisType.h:51
static const PointsKey NullPointsKey(0, eNoPointsType)
static VarFactorsMap NullVarFactorsMap
const char *const MatrixTypeMap[]
std::map< ConstFactorType, NekDouble > ConstFactorMap
static ConstFactorMap NullConstFactorMap
static VarCoeffMap NullVarCoeffMap
std::shared_ptr< StdMatrixKey > StdMatrixKeySharedPtr
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
static DNekScalBlkMatSharedPtr NullDNekScalBlkMatSharedPtr
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
static DNekMatSharedPtr NullDNekMatSharedPtr
static Array< OneD, NekDouble > NullNekDouble1DArray
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
std::shared_ptr< DNekMat > DNekMatSharedPtr
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:74
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:398
void Vabs(int n, const T *x, const int incx, T *y, const int incy)
vabs: y = |x|
Definition Vmath.hpp:354
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:368
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:182
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:102
void Zero(int n, T *x, const int incx)
Zero vector.
Definition Vmath.hpp:275
T Vamax(int n, const T *x, const int incx)
Return the maximum absolute element in x called vamax to avoid conflict with max.
Definition Vmath.hpp:688
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition Vmath.hpp:828
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:222
STL namespace.
scalarT< T > sqrt(scalarT< T > in)
Definition scalar.hpp:289