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
36#include <LibUtilities/Foundations/ManagerAccess.h> // for BasisManager, etc
38
40{
41/** \brief Default constructor */
45
46StdExpansion::StdExpansion(const int numcoeffs, const int numbases,
47 const LibUtilities::BasisKey &Ba,
48 const LibUtilities::BasisKey &Bb,
49 const LibUtilities::BasisKey &Bc)
50 : m_base(numbases), m_elmt_id(0), m_ncoeffs(numcoeffs),
51 m_stdMatrixManager(std::bind(&StdExpansion::CreateStdMatrix, this,
52 std::placeholders::_1),
53 std::string("StdExpansionStdMatrix")),
54 m_stdStaticCondMatrixManager(
55 std::bind(&StdExpansion::CreateStdStaticCondMatrix, this,
56 std::placeholders::_1),
57 std::string("StdExpansionStdStaticCondMatrix")),
58 m_stdFacManager(
59 std::bind(&StdExpansion::CreateStdFac, this, std::placeholders::_1),
60 std::string("StdExpansionStdFac"))
61{
62 switch (m_base.size())
63 {
64 case 3:
66 "NULL Basis attempting to be used.");
68 /* Falls through. */
69 case 2:
71 "NULL Basis attempting to be used.");
73 /* Falls through. */
74 case 1:
76 "NULL Basis attempting to be used.");
78 break;
79 default:
80 break;
81 // ASSERTL0(false, "numbases incorrectly specified");
82 };
83
84} // end constructor
85
87 : std::enable_shared_from_this<StdExpansion>(T), m_base(T.m_base),
88 m_elmt_id(T.m_elmt_id), m_ncoeffs(T.m_ncoeffs),
89 m_stdMatrixManager(T.m_stdMatrixManager),
90 m_stdStaticCondMatrixManager(T.m_stdStaticCondMatrixManager),
91 m_stdFacManager(T.m_stdFacManager)
92{
93}
94
95// Destructor
99
102{
103 NekDouble val;
104 int ntot = GetTotPoints();
105 Array<OneD, NekDouble> wsp(ntot);
106
107 if (sol == NullNekDouble1DArray)
108 {
109 Vmath::Vabs(ntot, phys, 1, wsp, 1);
110 }
111 else
112 {
113 Vmath::Vsub(ntot, sol, 1, phys, 1, wsp, 1);
114 Vmath::Vabs(ntot, wsp, 1, wsp, 1);
115 }
116
117 val = Vmath::Vamax(ntot, wsp, 1);
118 return val;
119}
120
123{
124 NekDouble val;
125 int ntot = GetTotPoints();
126 Array<OneD, NekDouble> wsp(ntot);
127
128 if (sol.size() == 0)
129 {
130 Vmath::Vmul(ntot, phys, 1, phys, 1, wsp, 1);
131 }
132 else
133 {
134 Vmath::Vsub(ntot, sol, 1, phys, 1, wsp, 1);
135 Vmath::Vmul(ntot, wsp, 1, wsp, 1, wsp, 1);
136 }
137
138 val = Integral(wsp);
139
140 return (val < 0.0) ? 0.0 : sqrt(val);
141}
142
145{
146 int i;
147 NekDouble val;
148 int ntot = GetTotPoints();
149 int coordim = v_GetCoordim();
150 Array<OneD, NekDouble> wsp(3 * ntot);
151 Array<OneD, NekDouble> wsp_deriv = wsp + ntot;
152 Array<OneD, NekDouble> sum = wsp_deriv + ntot;
153
154 if (sol == NullNekDouble1DArray)
155 {
156 Vmath::Vcopy(ntot, phys, 1, wsp, 1);
157 Vmath::Vmul(ntot, phys, 1, phys, 1, sum, 1);
158 }
159 else
160 {
161 Vmath::Vsub(ntot, sol, 1, phys, 1, wsp, 1);
162 Vmath::Vmul(ntot, wsp, 1, wsp, 1, sum, 1);
163 }
164
165 for (i = 0; i < coordim; ++i)
166 {
167 v_PhysDeriv(i, wsp, wsp_deriv);
168 Vmath::Vvtvp(ntot, wsp_deriv, 1, wsp_deriv, 1, sum, 1, sum, 1);
169 }
170
171 val = sqrt(Integral(sum));
172
173 return val;
174}
175
177 const StdMatrixKey &mkey)
178{
179 DNekBlkMatSharedPtr returnval;
180
181 DNekMatSharedPtr mat = GetStdMatrix(mkey);
182 int nbdry = NumBndryCoeffs(); // also checks to see if this is a boundary
183 // interior decomposed expansion
184 int nint = m_ncoeffs - nbdry;
190
191 int i, j;
192
193 Array<OneD, unsigned int> bmap(nbdry);
194 Array<OneD, unsigned int> imap(nint);
195 GetBoundaryMap(bmap);
196 GetInteriorMap(imap);
197
198 for (i = 0; i < nbdry; ++i)
199 {
200 for (j = 0; j < nbdry; ++j)
201 {
202 (*A)(i, j) = (*mat)(bmap[i], bmap[j]);
203 }
204
205 for (j = 0; j < nint; ++j)
206 {
207 (*B)(i, j) = (*mat)(bmap[i], imap[j]);
208 }
209 }
210
211 for (i = 0; i < nint; ++i)
212 {
213 for (j = 0; j < nbdry; ++j)
214 {
215 (*C)(i, j) = (*mat)(imap[i], bmap[j]);
216 }
217
218 for (j = 0; j < nint; ++j)
219 {
220 (*D)(i, j) = (*mat)(imap[i], imap[j]);
221 }
222 }
223
224 // Calculate static condensed system
225 if (nint)
226 {
227 D->Invert();
228 (*B) = (*B) * (*D);
229 (*A) = (*A) - (*B) * (*C);
230 }
231
232 // set up block matrix system
233 Array<OneD, unsigned int> exp_size(2);
234 exp_size[0] = nbdry;
235 exp_size[1] = nint;
236 returnval =
238
239 returnval->SetBlock(0, 0, A);
240 returnval->SetBlock(0, 1, B);
241 returnval->SetBlock(1, 0, C);
242 returnval->SetBlock(1, 1, D);
243
244 return returnval;
245}
246
248{
249 int i;
250 DNekMatSharedPtr returnval;
251
252 switch (mkey.GetMatrixType())
253 {
254 case eInvMass:
255 {
256 StdMatrixKey masskey(eMass, mkey.GetShapeType(), *this,
259 DNekMatSharedPtr mmat = GetStdMatrix(masskey);
260
262 *mmat); // Populate standard mass matrix.
263 returnval->Invert();
264 }
265 break;
266 case eInvNBasisTrans:
267 {
268 StdMatrixKey tmpkey(eNBasisTrans, mkey.GetShapeType(), *this,
271 DNekMatSharedPtr tmpmat = GetStdMatrix(tmpkey);
273 *tmpmat); // Populate matrix.
274 returnval->Invert();
275 }
276 break;
277 case eBwdMat:
278 {
279 int nq = GetTotPoints();
281 Array<OneD, NekDouble> tmpout(nq);
282
283 returnval =
285 Array<OneD, NekDouble> Bwd_data = returnval->GetPtr();
286
288 this->DetShapeType(), *this);
289 DNekMatSharedPtr MatBwdTrans = GetStdMatrix(matkey);
290 Array<OneD, NekDouble> BwdTrans_data = MatBwdTrans->GetPtr();
291
292 for (i = 0; i < m_ncoeffs; ++i)
293 {
294 Array<OneD, NekDouble> tmpinn = BwdTrans_data + nq * i;
295 tmpout = Bwd_data + i;
296
297 Vmath::Vcopy(nq, tmpinn, 1, tmpout, m_ncoeffs);
298 }
299 }
300 break;
301 case eBwdTrans:
302 {
303 int nq = GetTotPoints();
305 Array<OneD, NekDouble> tmpout(nq);
306
307 returnval =
309
310 for (i = 0; i < m_ncoeffs; ++i)
311 {
312 Vmath::Zero(m_ncoeffs, tmpin, 1);
313 tmpin[i] = 1.0;
314
315 BwdTrans(tmpin, tmpout);
316
317 Vmath::Vcopy(nq, tmpout.data(), 1,
318 returnval->GetRawPtr() + i * nq, 1);
319 }
320 }
321 break;
322 case eInvBwdTrans:
323 {
324 // First, get BwdTrans matrix
326 this->DetShapeType(), *this);
327 DNekMatSharedPtr MatBwdTrans = GetStdMatrix(matkey);
328
329 int nq = GetTotPoints();
330 returnval =
332 // Then, copy to returnval and Invert it:
333 *returnval = *MatBwdTrans;
334 returnval->Invert();
335 }
336 break;
337 case eIProductWRTBase:
338 {
339 int nq = GetTotPoints();
340 Array<OneD, NekDouble> tmpin(nq);
342
343 returnval =
345
346 for (i = 0; i < nq; ++i)
347 {
348 Vmath::Zero(nq, tmpin, 1);
349 tmpin[i] = 1.0;
350
351 IProductWRTBase(tmpin, tmpout);
352
353 Vmath::Vcopy(m_ncoeffs, tmpout.data(), 1,
354 returnval->GetRawPtr() + i * m_ncoeffs, 1);
355 }
356 }
357 break;
359 {
361 this->DetShapeType(), *this);
362 DNekMatSharedPtr MatInvBwdTrans = GetStdMatrix(matkey);
363
365 Transpose(*MatInvBwdTrans));
366 }
367 break;
369 {
370 int nq = GetTotPoints();
371 Array<OneD, NekDouble> tmpin(nq);
373
374 returnval =
376
377 for (i = 0; i < nq; ++i)
378 {
379 Vmath::Zero(nq, tmpin, 1);
380 tmpin[i] = 1.0;
381
382 IProductWRTDerivBase(0, tmpin, tmpout);
383
384 Vmath::Vcopy(m_ncoeffs, tmpout.data(), 1,
385 returnval->GetRawPtr() + i * m_ncoeffs, 1);
386 }
387 }
388 break;
390 {
391 int nq = GetTotPoints();
392 Array<OneD, NekDouble> tmpin(nq);
394
395 returnval =
397
398 for (i = 0; i < nq; ++i)
399 {
400 Vmath::Zero(nq, tmpin, 1);
401 tmpin[i] = 1.0;
402
403 IProductWRTDerivBase(1, tmpin, tmpout);
404
405 Vmath::Vcopy(m_ncoeffs, tmpout.data(), 1,
406 returnval->GetRawPtr() + i * m_ncoeffs, 1);
407 }
408 }
409 break;
411 {
412 int nq = GetTotPoints();
413 Array<OneD, NekDouble> tmpin(nq);
415
416 returnval =
418
419 for (i = 0; i < nq; ++i)
420 {
421 Vmath::Zero(nq, tmpin, 1);
422 tmpin[i] = 1.0;
423
424 IProductWRTDerivBase(2, tmpin, tmpout);
425
426 Vmath::Vcopy(m_ncoeffs, tmpout.data(), 1,
427 returnval->GetRawPtr() + i * m_ncoeffs, 1);
428 }
429 }
430 break;
431 case eDerivBase0:
432 {
433 int nq = GetTotPoints();
434 returnval =
436 GenStdMatBwdDeriv(0, returnval);
437 }
438 break;
439 case eDerivBase1:
440 {
441 int nq = GetTotPoints();
442 returnval =
444 GenStdMatBwdDeriv(1, returnval);
445 }
446 break;
447 case eDerivBase2:
448 {
449 int nq = GetTotPoints();
450 returnval =
452 GenStdMatBwdDeriv(2, returnval);
453 }
454 break;
456 {
457 // check to see if equispaced basis
458 int nummodes = m_base[0]->GetNumModes();
459 bool equispaced = true;
460 for (i = 1; i < m_base.size(); ++i)
461 {
462 if (m_base[i]->GetNumModes() != nummodes)
463 {
464 equispaced = false;
465 }
466 }
467
468 ASSERTL0(equispaced,
469 "Currently need to have same num modes in all "
470 "directionmodes to use EquiSpacedToCoeff method");
471
472 int ntot = GetTotPoints();
473 Array<OneD, NekDouble> qmode(ntot);
475
476 returnval =
478 for (i = 0; i < m_ncoeffs; ++i)
479 {
480 // Get mode at quadrature points
481 FillMode(i, qmode);
482
483 // interpolate to equi spaced
484 PhysInterpToSimplexEquiSpaced(qmode, emode, nummodes);
485
486 // fill matrix
487 Vmath::Vcopy(m_ncoeffs, &emode[0], 1,
488 returnval->GetRawPtr() + i * m_ncoeffs, 1);
489 }
490 }
491 break;
493 {
497
499
500 returnval->Invert();
501 }
502 break;
503 case eCoeffsToGLL:
504 {
505 // check to see if equispaced basis
506 int nummodes = m_base[0]->GetNumModes();
507 bool equispaced = true;
508 for (int i = 1; i < m_base.size(); ++i)
509 {
510 if (m_base[i]->GetNumModes() != nummodes)
511 {
512 equispaced = false;
513 }
514 }
515
516 ASSERTL0(equispaced,
517 "Currently need to have same num modes in all "
518 "directionmodes to use EquiSpacedToCoeff method");
519
520 int ntot = GetTotPoints();
521 Array<OneD, NekDouble> qmode(ntot);
523
524 returnval =
526 for (int i = 0; i < m_ncoeffs; ++i)
527 {
528 // Get mode at quadrature points
529 FillMode(i, qmode);
530
531 // interpolate to equi spaced
532 PhysInterpToGLL(qmode, emode, nummodes);
533
534 // fill matrix
535 Vmath::Vcopy(m_ncoeffs, &emode[0], 1,
536 returnval->GetRawPtr() + i * m_ncoeffs, 1);
537 }
538 }
539 break;
540 case eGLLToCoeffs:
541 {
542 StdMatrixKey key(eCoeffsToGLL, mkey.GetShapeType(), *this,
545
547
548 returnval->Invert();
549 }
550 break;
551 case eMass:
552 case eHelmholtz:
553 case eLaplacian:
554 case eLaplacian00:
555 case eLaplacian01:
556 case eLaplacian02:
557 case eLaplacian10:
558 case eLaplacian11:
559 case eLaplacian12:
560 case eLaplacian20:
561 case eLaplacian21:
562 case eLaplacian22:
563 case eWeakDeriv0:
564 case eWeakDeriv1:
565 case eWeakDeriv2:
568 case eLinearAdvection:
571 {
573 returnval =
575 DNekMat &Mat = *returnval;
576
577 for (i = 0; i < m_ncoeffs; ++i)
578 {
579 Vmath::Zero(m_ncoeffs, tmp, 1);
580 tmp[i] = 1.0;
581
582 GeneralMatrixOp_MatFree(tmp, tmp, mkey);
583
584 Vmath::Vcopy(m_ncoeffs, &tmp[0], 1,
585 &(Mat.GetPtr())[0] + i * m_ncoeffs, 1);
586 }
587 }
588 break;
589 default:
590 {
592 "This type of matrix, " +
593 static_cast<std::string>(
595 ", can not be created using a general approach");
596 }
597 break;
598 }
599
600 return returnval;
601}
602
603std::shared_ptr<Array<OneD, const NekDouble>> StdExpansion::CreateStdFac(
604 [[maybe_unused]] const StdFacKey &mkey)
605{
606 Array<OneD, NekDouble> returnval;
607
608 switch (mkey.m_stdFacType)
609 {
610 case eWeights1:
611 {
612 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
613 m_base[1]->GetPointsKey(),
614 "PointsKey are differrent in CreateStdFac");
615
616 // deep copy of weights
617 returnval = m_base[1]->GetW();
618
619 int nquad1 = m_base[1]->GetNumPoints();
620
621 if (m_base[1]->GetPointsType() ==
622 LibUtilities::eGaussRadauMAlpha1Beta0)
623 {
624 Blas::Dscal(nquad1, 0.5, returnval.data(), 1);
625 }
626 else
627 {
628 const Array<OneD, NekDouble> z1 = m_base[1]->GetZ();
629 for (int i = 0; i < nquad1; ++i)
630 {
631 returnval[i] *= 0.5 * (1 - z1[i]);
632 }
633 }
634 }
635 break;
636 case eWeights2:
637 {
638 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
639 m_base[2]->GetPointsKey(),
640 "PointsKey are differrent in CreateStdFac");
641
642 // deep copy of weights
643 returnval = m_base[2]->GetW();
644
645 int nquad2 = m_base[2]->GetNumPoints();
646
647 // For Prisms we need to do same scaling as for Weights1 code
648 if ((mkey.m_basisKey.GetBasisType() == LibUtilities::eModified_B) ||
649 mkey.m_basisKey.GetBasisType() == LibUtilities::eOrtho_B)
650 {
651 if (m_base[2]->GetPointsType() ==
652 LibUtilities::eGaussRadauMAlpha1Beta0)
653 {
654 Blas::Dscal(nquad2, 0.5, returnval.data(), 1);
655 }
656 else
657 {
658 const Array<OneD, NekDouble> z2 = m_base[2]->GetZ();
659 for (int i = 0; i < nquad2; ++i)
660 {
661 returnval[i] *= 0.5 * (1 - z2[i]);
662 }
663 }
664 }
665 else // case for Tets and Pyramids
666 {
667 switch (m_base[2]->GetPointsType())
668 {
669 // (2,0) Jacobi inner product.
670 case LibUtilities::eGaussRadauMAlpha2Beta0:
671 {
672 Blas::Dscal(nquad2, 0.25, returnval.data(), 1);
673 }
674 break;
675 // (1,0) Jacobi inner product.
676 case LibUtilities::eGaussRadauMAlpha1Beta0:
677 {
678 const Array<OneD, NekDouble> z2 = m_base[2]->GetZ();
679
680 for (int i = 0; i < nquad2; ++i)
681 {
682 returnval[i] *= 0.25 * (1 - z2[i]);
683 }
684 }
685 break;
686 default:
687 {
688 const Array<OneD, NekDouble> z2 = m_base[2]->GetZ();
689 for (int i = 0; i < nquad2; ++i)
690 {
691 returnval[i] *= 0.25 * (1 - z2[i]) * (1 - z2[i]);
692 }
693 }
694 break;
695 }
696 }
697 }
698 break;
700 {
701 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
702 m_base[0]->GetPointsKey(),
703 "PointssKey are differrent in CreateStdFac");
704
705 int nquad0 = m_base[0]->GetNumPoints();
706
707 returnval = Array<OneD, NekDouble>(nquad0);
708
709 const Array<OneD, NekDouble> z0 = m_base[0]->GetZ();
710 for (int i = 0; i < nquad0; ++i)
711 {
712 returnval[i] = 0.5 * (1.0 + z0[i]);
713 }
714 }
715 break;
717 {
718 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
719 m_base[1]->GetPointsKey(),
720 "PointssKey are differrent in CreateStdFac");
721
722 int nquad1 = m_base[1]->GetNumPoints();
723
724 returnval = Array<OneD, NekDouble>(nquad1);
725
726 const Array<OneD, NekDouble> z1 = m_base[1]->GetZ();
727 for (int i = 0; i < nquad1; ++i)
728 {
729 returnval[i] = 0.5 * (1.0 + z1[i]);
730 }
731 }
732 break;
734 {
735 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
736 m_base[1]->GetPointsKey(),
737 "PointssKey are differrent in CreateStdFac");
738
739 int nquad1 = m_base[1]->GetNumPoints();
740
741 returnval = Array<OneD, NekDouble>(nquad1);
742
743 const Array<OneD, NekDouble> z1 = m_base[1]->GetZ();
744 for (int i = 0; i < nquad1; ++i)
745 {
746 returnval[i] = 2.0 / (1.0 - z1[i]);
747 }
748 }
749 break;
751 {
752 ASSERTL1(mkey.m_basisKey.GetPointsKey() ==
753 m_base[2]->GetPointsKey(),
754 "PointssKey are differrent in CreateStdFac");
755
756 int nquad2 = m_base[2]->GetNumPoints();
757
758 returnval = Array<OneD, NekDouble>(nquad2);
759
760 const Array<OneD, NekDouble> z2 = m_base[2]->GetZ();
761 for (int i = 0; i < nquad2; ++i)
762 {
763 returnval[i] = 2.0 / (1.0 - z2[i]);
764 }
765 }
766 break;
767 default:
768 NEKERROR(ErrorUtil::efatal, "Factor Type not defined");
769 break;
770 }
771 return std::make_shared<Array<OneD, const NekDouble>>(returnval);
772}
773
775 Array<OneD, NekDouble> &outarray,
776 const StdMatrixKey &mkey)
777{
778 switch (mkey.GetMatrixType())
779 {
780 case eMass:
781 MassMatrixOp(inarray, outarray, mkey);
782 break;
783 case eWeakDeriv0:
784 WeakDerivMatrixOp(0, inarray, outarray, mkey);
785 break;
786 case eWeakDeriv1:
787 WeakDerivMatrixOp(1, inarray, outarray, mkey);
788 break;
789 case eWeakDeriv2:
790 WeakDerivMatrixOp(2, inarray, outarray, mkey);
791 break;
793 WeakDirectionalDerivMatrixOp(inarray, outarray, mkey);
794 break;
796 MassLevelCurvatureMatrixOp(inarray, outarray, mkey);
797 break;
798 case eLinearAdvection:
799 LinearAdvectionMatrixOp(inarray, outarray, mkey);
800 break;
802 LinearAdvectionDiffusionReactionMatrixOp(inarray, outarray, mkey,
803 false);
804 break;
806 LinearAdvectionDiffusionReactionMatrixOp(inarray, outarray, mkey);
807 break;
808 case eLaplacian:
809 LaplacianMatrixOp(inarray, outarray, mkey);
810 break;
811 case eLaplacian00:
812 LaplacianMatrixOp(0, 0, inarray, outarray, mkey);
813 break;
814 case eLaplacian01:
815 LaplacianMatrixOp(0, 1, inarray, outarray, mkey);
816 break;
817 case eLaplacian02:
818 LaplacianMatrixOp(0, 2, inarray, outarray, mkey);
819 break;
820 case eLaplacian10:
821 LaplacianMatrixOp(1, 0, inarray, outarray, mkey);
822 break;
823 case eLaplacian11:
824 LaplacianMatrixOp(1, 1, inarray, outarray, mkey);
825 break;
826 case eLaplacian12:
827 LaplacianMatrixOp(1, 2, inarray, outarray, mkey);
828 break;
829 case eLaplacian20:
830 LaplacianMatrixOp(2, 0, inarray, outarray, mkey);
831 break;
832 case eLaplacian21:
833 LaplacianMatrixOp(2, 1, inarray, outarray, mkey);
834 break;
835 case eLaplacian22:
836 LaplacianMatrixOp(2, 2, inarray, outarray, mkey);
837 break;
838 case eHelmholtz:
839 HelmholtzMatrixOp(inarray, outarray, mkey);
840 break;
841 default:
843 "This matrix does not have an operator");
844 break;
845 }
846}
847
849 const Array<OneD, const NekDouble> &inarray,
850 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
851{
852 switch (mkey.GetMatrixType())
853 {
854 case eMass:
855 MassMatrixOp_MatFree(inarray, outarray, mkey);
856 break;
857 case eWeakDeriv0:
858 WeakDerivMatrixOp_MatFree(0, inarray, outarray, mkey);
859 break;
860 case eWeakDeriv1:
861 WeakDerivMatrixOp_MatFree(1, inarray, outarray, mkey);
862 break;
863 case eWeakDeriv2:
864 WeakDerivMatrixOp_MatFree(2, inarray, outarray, mkey);
865 break;
867 WeakDirectionalDerivMatrixOp_MatFree(inarray, outarray, mkey);
868 break;
870 MassLevelCurvatureMatrixOp_MatFree(inarray, outarray, mkey);
871 break;
872 case eLinearAdvection:
873 LinearAdvectionMatrixOp_MatFree(inarray, outarray, mkey);
874 break;
877 mkey, false);
878 break;
881 mkey);
882 break;
883 case eLaplacian:
884 LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
885 break;
886 case eLaplacian00:
887 LaplacianMatrixOp_MatFree(0, 0, inarray, outarray, mkey);
888 break;
889 case eLaplacian01:
890 LaplacianMatrixOp_MatFree(0, 1, inarray, outarray, mkey);
891 break;
892 case eLaplacian02:
893 LaplacianMatrixOp_MatFree(0, 2, inarray, outarray, mkey);
894 break;
895 case eLaplacian10:
896 LaplacianMatrixOp_MatFree(1, 0, inarray, outarray, mkey);
897 break;
898 case eLaplacian11:
899 LaplacianMatrixOp_MatFree(1, 1, inarray, outarray, mkey);
900 break;
901 case eLaplacian12:
902 LaplacianMatrixOp_MatFree(1, 2, inarray, outarray, mkey);
903 break;
904 case eLaplacian20:
905 LaplacianMatrixOp_MatFree(2, 0, inarray, outarray, mkey);
906 break;
907 case eLaplacian21:
908 LaplacianMatrixOp_MatFree(2, 1, inarray, outarray, mkey);
909 break;
910 case eLaplacian22:
911 LaplacianMatrixOp_MatFree(2, 2, inarray, outarray, mkey);
912 break;
913 case eHelmholtz:
914 HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
915 break;
916 default:
918 "This matrix does not have an operator");
919 break;
920 }
921}
922
924 const Array<OneD, const NekDouble> &inarray,
925 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
926{
927 int nq = GetTotPoints();
929
930 v_BwdTrans(inarray, tmp);
931
932 if (mkey.HasVarCoeff(eVarCoeffMass))
933 {
934 Vmath::Vmul(nq, mkey.GetVarCoeff(eVarCoeffMass), 1, tmp, 1, tmp, 1);
935 }
936
937 v_IProductWRTBase(tmp, outarray);
938}
939
941 const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
942 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
943{
944 ASSERTL1(k1 >= 0 && k1 < GetCoordim(), "invalid first argument");
945 ASSERTL1(k2 >= 0 && k2 < GetCoordim(), "invalid second argument");
946
947 int nq = GetTotPoints();
949 Array<OneD, NekDouble> dtmp(nq);
950 VarCoeffType varcoefftypes[3][3] = {
954
955 ConstFactorType constcoefftypes[3][3] = {
959
960 v_BwdTrans(inarray, tmp);
961 v_PhysDeriv(k2, tmp, dtmp);
963 {
964 if (k1 == k2)
965 {
966 // By default, k1 == k2 has \sigma = 1 (diagonal entries)
967 if (mkey.HasVarCoeff(varcoefftypes[k1][k1]))
968 {
969 Vmath::Vmul(nq, mkey.GetVarCoeff(varcoefftypes[k1][k1]), 1,
970 dtmp, 1, dtmp, 1);
971 }
972 v_IProductWRTDerivBase(k1, dtmp, outarray);
973 }
974 else
975 {
976 // By default, k1 != k2 has \sigma = 0 (off-diagonal entries)
977 if (mkey.HasVarCoeff(varcoefftypes[k1][k2]))
978 {
979 Vmath::Vmul(nq, mkey.GetVarCoeff(varcoefftypes[k1][k2]), 1,
980 dtmp, 1, dtmp, 1);
981 v_IProductWRTDerivBase(k1, dtmp, outarray);
982 }
983 else if (mkey.HasVarCoeff(
984 varcoefftypes[k2][k1])) // Check symmetric varcoeff
985 {
986 Vmath::Vmul(nq, mkey.GetVarCoeff(varcoefftypes[k2][k1]), 1,
987 dtmp, 1, dtmp, 1);
988 v_IProductWRTDerivBase(k1, dtmp, outarray);
989 }
990 else
991 {
992 Vmath::Zero(GetNcoeffs(), outarray, 1);
993 }
994 }
995 }
996 else if (mkey.ConstFactorExists(eFactorCoeffD00) &&
998 {
999 if (k1 == k2)
1000 {
1001 // By default, k1 == k2 has \sigma = 1 (diagonal entries)
1002 if (mkey.ConstFactorExists(constcoefftypes[k1][k1]))
1003 {
1004 Vmath::Smul(nq, mkey.GetConstFactor(constcoefftypes[k1][k1]),
1005 dtmp, 1, dtmp, 1);
1006 }
1007 v_IProductWRTDerivBase(k1, dtmp, outarray);
1008 }
1009 else
1010 {
1011 // By default, k1 != k2 has \sigma = 0 (off-diagonal entries)
1012 if (mkey.ConstFactorExists(constcoefftypes[k1][k2]))
1013 {
1014 Vmath::Smul(nq, mkey.GetConstFactor(constcoefftypes[k1][k2]),
1015 dtmp, 1, dtmp, 1);
1016 v_IProductWRTDerivBase(k1, dtmp, outarray);
1017 }
1018 else
1019 {
1020 Vmath::Zero(GetNcoeffs(), outarray, 1);
1021 }
1022 }
1023 }
1024 else
1025 {
1026 // Multiply by svv tensor
1028 {
1029 Vmath::Vcopy(nq, dtmp, 1, tmp, 1);
1030 SVVLaplacianFilter(dtmp, mkey);
1031 Vmath::Vadd(nq, tmp, 1, dtmp, 1, dtmp, 1);
1032 }
1033 v_IProductWRTDerivBase(k1, dtmp, outarray);
1034 }
1035}
1036
1038 const Array<OneD, const NekDouble> &inarray,
1039 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1040{
1041 const int dim = GetCoordim();
1042
1043 int i, j;
1044
1046 Array<OneD, NekDouble> store2(m_ncoeffs, 0.0);
1047
1048 if ((mkey.GetNVarCoeff() == 0 &&
1051 {
1052 // just call diagonal matrix form of laplcian operator
1053 for (i = 0; i < dim; ++i)
1054 {
1055 LaplacianMatrixOp(i, i, inarray, store, mkey);
1056 Vmath::Vadd(m_ncoeffs, store, 1, store2, 1, store2, 1);
1057 }
1058 }
1059 else
1060 {
1061 const MatrixType mtype[3][3] = {
1065 StdMatrixKeySharedPtr mkeyij;
1066
1067 for (i = 0; i < dim; i++)
1068 {
1069 for (j = 0; j < dim; j++)
1070 {
1072 mkey, mtype[i][j]);
1073 LaplacianMatrixOp(i, j, inarray, store, *mkeyij);
1074 Vmath::Vadd(m_ncoeffs, store, 1, store2, 1, store2, 1);
1075 }
1076 }
1077 }
1078
1079 Vmath::Vcopy(m_ncoeffs, store2.data(), 1, outarray.data(), 1);
1080}
1081
1083 const int k1, const Array<OneD, const NekDouble> &inarray,
1084 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1085{
1087 int nq = GetTotPoints();
1088
1089 v_BwdTrans(inarray, tmp);
1090 v_PhysDeriv(k1, tmp, tmp);
1091
1093 if (mkey.HasVarCoeff(keys[k1]))
1094 {
1095 Vmath::Vmul(nq, &(mkey.GetVarCoeff(keys[k1]))[0], 1, &tmp[0], 1,
1096 &tmp[0], 1);
1097 }
1098
1099 v_IProductWRTBase(tmp, outarray);
1100}
1101
1103 const Array<OneD, const NekDouble> &inarray,
1104 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1105{
1106 int nq = GetTotPoints();
1107
1108 Array<OneD, NekDouble> tmp(nq), Dtmp(nq);
1109 Array<OneD, NekDouble> Mtmp(nq), Mout(m_ncoeffs);
1110
1111 v_BwdTrans(inarray, tmp);
1113
1114 v_IProductWRTBase(Dtmp, outarray);
1115
1116 // Compte M_{div tv}
1117 Vmath::Vmul(nq, &(mkey.GetVarCoeff(eVarCoeffMFDiv))[0], 1, &tmp[0], 1,
1118 &Mtmp[0], 1);
1119
1120 v_IProductWRTBase(Mtmp, Mout);
1121
1122 // Add D_tv + M_{div tv}
1123 Vmath::Vadd(m_ncoeffs, &Mout[0], 1, &outarray[0], 1, &outarray[0], 1);
1124}
1125
1127 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1128 [[maybe_unused]] Array<OneD, NekDouble> &outarray,
1129 [[maybe_unused]] const StdMatrixKey &mkey)
1130{
1131}
1132
1134 const Array<OneD, const NekDouble> &inarray,
1135 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1136{
1137 int i, ndir = 0;
1138
1139 VarCoeffType varcoefftypes[] = {eVarCoeffVelX, eVarCoeffVelY,
1141 // Count advection velocities
1142 for (auto &x : varcoefftypes)
1143 {
1144 if (mkey.HasVarCoeff(x))
1145 {
1146 ndir++;
1147 }
1148 }
1149
1150 ASSERTL0(ndir, "Must define at least one advection velocity");
1151 ASSERTL1(ndir <= GetCoordim(),
1152 "Number of constants is larger than coordinate dimensions");
1153
1154 int totpts = GetTotPoints();
1155 Array<OneD, NekDouble> tmp(3 * totpts);
1156 Array<OneD, NekDouble> tmp_deriv = tmp + totpts;
1157 Array<OneD, NekDouble> tmp_adv = tmp_deriv + totpts;
1158
1159 v_BwdTrans(inarray, tmp); // transform to PhysSpace
1160
1161 // Evaluate advection (u dx + v dy + w dz)
1162 Vmath::Zero(totpts, tmp_adv, 1);
1163 for (i = 0; i < ndir; ++i)
1164 {
1165 v_PhysDeriv(i, tmp, tmp_deriv);
1166 Vmath::Vvtvp(totpts, mkey.GetVarCoeff(varcoefftypes[i]), 1, tmp_deriv,
1167 1, tmp_adv, 1, tmp_adv, 1);
1168 }
1169
1170 v_IProductWRTBase(tmp_adv, outarray);
1171}
1172
1174 const Array<OneD, const NekDouble> &inarray,
1175 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1176 bool addDiffusionTerm)
1177{
1178 int i, ndir = 0;
1179
1180 VarCoeffType varcoefftypes[] = {eVarCoeffVelX, eVarCoeffVelY,
1182 // Count advection velocities
1183 for (auto &x : varcoefftypes)
1184 {
1185 if (mkey.HasVarCoeff(x))
1186 {
1187 ndir++;
1188 }
1189 }
1190
1191 ASSERTL0(ndir, "Must define at least one advection velocity");
1192 ASSERTL1(ndir <= GetCoordim(),
1193 "Number of constants is larger than coordinate dimensions");
1194
1195 NekDouble lambda = mkey.GetConstFactor(eFactorLambda);
1196 int totpts = GetTotPoints();
1197 Array<OneD, NekDouble> tmp(3 * totpts);
1198 Array<OneD, NekDouble> tmp_deriv = tmp + totpts;
1199 Array<OneD, NekDouble> tmp_adv = tmp_deriv + totpts;
1200
1201 v_BwdTrans(inarray, tmp); // transform this mode \phi_i into PhysSpace
1202
1203 // calculate advection u dx + v dy + ..
1204 Vmath::Zero(totpts, tmp_adv, 1);
1205 for (i = 0; i < ndir; ++i)
1206 {
1207 v_PhysDeriv(i, tmp, tmp_deriv);
1208 Vmath::Vvtvp(totpts, mkey.GetVarCoeff(varcoefftypes[i]), 1, tmp_deriv,
1209 1, tmp_adv, 1, tmp_adv, 1);
1210 }
1211
1212 // Add reaction term if lambda != 0.0
1213 if (lambda)
1214 {
1215 // Add mass varcoeff
1216 if (mkey.HasVarCoeff(eVarCoeffMass))
1217 {
1218 Vmath::Vmul(totpts, mkey.GetVarCoeff(eVarCoeffMass), 1, tmp, 1, tmp,
1219 1);
1220 }
1221
1222 Vmath::Svtvp(totpts, -lambda, tmp, 1, tmp_adv, 1, tmp_adv, 1);
1223 }
1224
1225 // Create mass matrix = Advection - Reaction
1226 v_IProductWRTBase(tmp_adv, outarray);
1227
1228 // Add Laplacian matrix
1229 if (addDiffusionTerm)
1230 {
1232 StdMatrixKey mkeylap(eLaplacian, DetShapeType(), *this,
1233 mkey.GetConstFactors(), mkey.GetVarCoeffs(),
1234 mkey.GetVarFactors(), mkey.GetNodalPointsType());
1235 LaplacianMatrixOp(inarray, lap, mkeylap);
1236
1237 Vmath::Vadd(m_ncoeffs, lap, 1, outarray, 1, outarray,
1238 1); // += Laplacian
1239 }
1240}
1241
1243 const Array<OneD, const NekDouble> &inarray,
1244 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1245{
1246 NekDouble lambda = mkey.GetConstFactor(eFactorLambda);
1248 StdMatrixKey mkeymass(eMass, DetShapeType(), *this);
1249 StdMatrixKey mkeylap(eLaplacian, DetShapeType(), *this,
1250 mkey.GetConstFactors(), mkey.GetVarCoeffs(),
1251 mkey.GetVarFactors(), mkey.GetNodalPointsType());
1252
1253 MassMatrixOp(inarray, tmp, mkeymass);
1254 LaplacianMatrixOp(inarray, outarray, mkeylap);
1255
1256 Blas::Daxpy(m_ncoeffs, lambda, tmp, 1, outarray, 1);
1257}
1258
1259// VIRTUAL INLINE FUNCTIONS FROM HEADER FILE
1261 [[maybe_unused]] const std::vector<unsigned int> &nummodes,
1262 [[maybe_unused]] int &modes_offset)
1263{
1264 NEKERROR(ErrorUtil::efatal, "This function is not defined for this class");
1265 return 0;
1266}
1267
1269 [[maybe_unused]] const Array<OneD, const NekDouble> &Fx,
1270 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1271{
1272 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
1273}
1274
1276 [[maybe_unused]] const Array<OneD, const NekDouble> &Fx,
1277 [[maybe_unused]] const Array<OneD, const NekDouble> &Fy,
1278 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1279{
1280 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
1281}
1282
1284 [[maybe_unused]] const Array<OneD, const NekDouble> &Fx,
1285 [[maybe_unused]] const Array<OneD, const NekDouble> &Fy,
1286 [[maybe_unused]] const Array<OneD, const NekDouble> &Fz,
1287 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1288{
1289 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
1290}
1291
1293 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
1294 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1295{
1296 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
1297}
1298
1300 [[maybe_unused]] const LocalRegions::MatrixKey &mkey)
1301{
1302 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
1304}
1305
1307 [[maybe_unused]] const LocalRegions::MatrixKey &mkey)
1308{
1309 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
1310}
1311
1313 [[maybe_unused]] StdRegions::Orientation dir,
1314 [[maybe_unused]] Array<OneD, const NekDouble> &inarray,
1315 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1316{
1317 NEKERROR(ErrorUtil::efatal, "This function is not defined for this shape");
1318}
1319
1321 [[maybe_unused]] const Array<OneD, const NekDouble> &Lcoord,
1322 [[maybe_unused]] const Array<OneD, const NekDouble> &physvals)
1323
1324{
1325 NEKERROR(ErrorUtil::efatal, "This function is not defined for this shape");
1326 return 0;
1327}
1328
1330 [[maybe_unused]] const Array<OneD, const NekDouble> &xi,
1331 [[maybe_unused]] Array<OneD, NekDouble> &eta)
1332{
1333 NEKERROR(ErrorUtil::efatal, "This function is not defined for this shape");
1334}
1335
1337 [[maybe_unused]] const Array<OneD, const NekDouble> &eta,
1338 [[maybe_unused]] Array<OneD, NekDouble> &xi)
1339{
1340 NEKERROR(ErrorUtil::efatal, "This function is not defined for this shape");
1341}
1342
1344 [[maybe_unused]] std::shared_ptr<StdExpansion> FromExp,
1345 [[maybe_unused]] const Array<OneD, const NekDouble> &fromData,
1346 [[maybe_unused]] Array<OneD, NekDouble> &toData,
1347 [[maybe_unused]] bool Traspose)
1348{
1349 ASSERTL0(false, "This function is not valid or not defined");
1350}
1351
1353 [[maybe_unused]] const int i, [[maybe_unused]] const int k,
1354 [[maybe_unused]] bool UseGLL) const
1355{
1356 ASSERTL0(false, "This function is not valid or not defined");
1358}
1359
1361 [[maybe_unused]] const int i, [[maybe_unused]] const int j) const
1362{
1363 ASSERTL0(false, "This function is not valid or not defined");
1365}
1366
1371
1373{
1374 ASSERTL0(false, "This function has not been defined for this expansion");
1375 return false;
1376}
1377
1379{
1380 return false;
1381}
1382
1384 [[maybe_unused]] const int dir,
1385 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1386 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1387{
1388 NEKERROR(ErrorUtil::efatal, "This method has not been defined");
1389}
1390
1391/**
1392 *
1393 */
1395 [[maybe_unused]] const Array<OneD, const NekDouble> &direction,
1396 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1397 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1398{
1399 NEKERROR(ErrorUtil::efatal, "This method has not been defined");
1400}
1401
1402/**
1403 * \brief Forward transform from physical quadrature space stored in \a
1404 * inarray and evaluate the expansion coefficients and store in \a
1405 * outarray
1406 *
1407 * Perform a forward transform using a Galerkin projection by taking the
1408 * inner product of the physical points and multiplying by the inverse
1409 * of the mass matrix using the Solve method of the standard matrix
1410 * container holding the local mass matrix, i.e. \f$ {\bf \hat{u}} =
1411 * {\bf M}^{-1} {\bf I} \f$ where \f$ {\bf I}[p] = \int^1_{-1}
1412 * \phi_p(\xi_1) u(\xi_1) d\xi_1 \f$
1413 *
1414 * This function stores the expansion coefficients calculated by the
1415 * transformation in the coefficient space array \a outarray
1416 *
1417 * \param inarray: array of physical quadrature points to be transformed
1418 * \param outarray: the coeffficients of the expansion
1419 */
1421 Array<OneD, NekDouble> &outarray)
1422{
1423 if (v_IsCollocatedBasis())
1424 {
1425 Vmath::Vcopy(m_ncoeffs, inarray, 1, outarray, 1);
1426 }
1427 else
1428 {
1429 v_IProductWRTBase(inarray, outarray);
1430
1431 // get Mass matrix inverse
1432 LibUtilities::PointsType nodalPointsType =
1436
1437 // get Mass matrix inverse
1441 StdRegions::NullVarFactorsMap, nodalPointsType);
1442 DNekMatSharedPtr matsys = GetStdMatrix(masskey);
1443
1444 // copy inarray in case inarray == outarray
1445 NekVector<NekDouble> in(m_ncoeffs, outarray, eCopy);
1446 NekVector<NekDouble> out(m_ncoeffs, outarray, eWrapper);
1447
1448 out = (*matsys) * in;
1449 }
1450}
1451
1452/**
1453 *
1454 */
1456 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1457 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1458{
1459 NEKERROR(ErrorUtil::efatal, "This method has not been defined");
1460}
1461
1462/**
1463 * @brief Calculate the derivative of the physical points
1464 * @see StdRegions#StdExpansion#PhysDeriv
1465 */
1467 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1468 [[maybe_unused]] Array<OneD, NekDouble> &out_d1,
1469 [[maybe_unused]] Array<OneD, NekDouble> &out_d2,
1470 [[maybe_unused]] Array<OneD, NekDouble> &out_d3)
1471{
1472 v_StdPhysDeriv(inarray, out_d1, out_d2, out_d3);
1473}
1474
1475/**
1476 * @brief Calculate the derivative of the physical points in a
1477 * given direction
1478 * @see StdRegions#StdExpansion#PhysDeriv
1479 */
1481 [[maybe_unused]] const int dir,
1482 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1483 [[maybe_unused]] Array<OneD, NekDouble> &out_d0)
1484
1485{
1486 NEKERROR(ErrorUtil::efatal, "This function is only valid for "
1487 "specific element types");
1488}
1489
1490/**
1491 * @brief Physical derivative along a direction vector.
1492 * @see StdRegions#StdExpansion#PhysDirectionalDeriv
1493 */
1495 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1496 [[maybe_unused]] const Array<OneD, const NekDouble> &direction,
1497 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1498{
1499 NEKERROR(ErrorUtil::efatal, "This function is only valid for "
1500 "specific element types");
1501}
1502
1504 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1505 [[maybe_unused]] Array<OneD, NekDouble> &out_d1,
1506 [[maybe_unused]] Array<OneD, NekDouble> &out_d2,
1507 [[maybe_unused]] Array<OneD, NekDouble> &out_d3)
1508{
1509 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1510}
1511
1513 [[maybe_unused]] const Array<OneD, const NekDouble> &coords,
1514 [[maybe_unused]] int mode)
1515{
1516 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1517 return 0;
1518}
1519
1521 [[maybe_unused]] const Array<OneD, const NekDouble> &coords,
1522 [[maybe_unused]] const Array<OneD, const NekDouble> &physvals)
1523{
1524 return v_StdPhysEvaluate(coords, physvals);
1525}
1526
1528 [[maybe_unused]] const Array<OneD, DNekMatSharedPtr> &I,
1529 [[maybe_unused]] const Array<OneD, const NekDouble> &physvals)
1530{
1531 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1532 return 0;
1533}
1534
1536 [[maybe_unused]] const Array<OneD, NekDouble> &coord,
1537 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1538 [[maybe_unused]] std::array<NekDouble, 3> &firstOrderDerivs)
1539{
1541 "PhysEvaluate first order derivative method does not exist"
1542 " for this shape type: " +
1543 static_cast<std::string>(
1545 return 0;
1546}
1547
1549 [[maybe_unused]] const Array<OneD, NekDouble> &coord,
1550 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1551 [[maybe_unused]] std::array<NekDouble, 3> &firstOrderDerivs,
1552 [[maybe_unused]] std::array<NekDouble, 6> &secondOrderDerivs)
1553{
1555 "PhysEvaluate second order derivative method does not exist"
1556 " for this shape type: " +
1557 static_cast<std::string>(
1559 return 0;
1560}
1561
1562void StdExpansion::v_FillMode([[maybe_unused]] const int mode,
1563 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1564{
1565 NEKERROR(ErrorUtil::efatal, "This function has not "
1566 "been defined for this shape");
1567}
1568
1570 [[maybe_unused]] const StdMatrixKey &mkey)
1571{
1572 NEKERROR(ErrorUtil::efatal, "This function has not "
1573 "been defined for this element");
1574 DNekMatSharedPtr returnval;
1575 return returnval;
1576}
1577
1579 [[maybe_unused]] const StdMatrixKey &mkey)
1580{
1581 NEKERROR(ErrorUtil::efatal, "This function has not "
1582 "been defined for this element");
1583 DNekMatSharedPtr returnval;
1584 return returnval;
1585}
1586
1588 [[maybe_unused]] Array<OneD, NekDouble> &coords_0,
1589 [[maybe_unused]] Array<OneD, NekDouble> &coords_1,
1590 [[maybe_unused]] Array<OneD, NekDouble> &coords_2)
1591{
1592 NEKERROR(ErrorUtil::efatal, "Write coordinate definition method");
1593}
1594
1596 [[maybe_unused]] const Array<OneD, const NekDouble> &Lcoord,
1597 [[maybe_unused]] Array<OneD, NekDouble> &coord)
1598{
1599 NEKERROR(ErrorUtil::efatal, "Write coordinate definition method");
1600}
1601
1603{
1604 return GetShapeDimension();
1605}
1606
1608 [[maybe_unused]] Array<OneD, unsigned int> &outarray)
1609{
1610 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1611}
1612
1614 [[maybe_unused]] Array<OneD, unsigned int> &outarray)
1615{
1616 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1617}
1618
1619int StdExpansion::v_GetVertexMap([[maybe_unused]] const int localVertexId,
1620 [[maybe_unused]] bool useCoeffPacking)
1621{
1622 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1623 return 0;
1624}
1625
1627 [[maybe_unused]] const int tid,
1628 [[maybe_unused]] Array<OneD, unsigned int> &maparray,
1629 [[maybe_unused]] Array<OneD, int> &signarray,
1630 [[maybe_unused]] Orientation traceOrient, [[maybe_unused]] int P,
1631 [[maybe_unused]] int Q)
1632{
1633 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1634}
1635
1637 [[maybe_unused]] const unsigned int traceid,
1638 [[maybe_unused]] Array<OneD, unsigned int> &maparray)
1639{
1640 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1642
1644 [[maybe_unused]] const unsigned int tid,
1645 [[maybe_unused]] Array<OneD, unsigned int> &maparray,
1646 [[maybe_unused]] Array<OneD, int> &signarray,
1647 [[maybe_unused]] Orientation traceOrient, [[maybe_unused]] int P,
1648 [[maybe_unused]] int Q)
1649{
1650 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1651}
1652
1654 [[maybe_unused]] const int tid,
1655 [[maybe_unused]] Array<OneD, unsigned int> &maparray,
1656 [[maybe_unused]] Array<OneD, int> &signarray,
1657 [[maybe_unused]] const Orientation traceOrient)
1658{
1659 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1660}
1661
1662void StdExpansion::v_GetTraceNumModes([[maybe_unused]] const int tid,
1663 [[maybe_unused]] int &numModes0,
1664 [[maybe_unused]] int &numModes1,
1665 [[maybe_unused]] Orientation traceOrient)
1666{
1667 NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape");
1668}
1669
1671 [[maybe_unused]] const int vertex,
1672 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1673 [[maybe_unused]] NekDouble &outarray)
1674{
1675 NEKERROR(ErrorUtil::efatal, "Method does not exist for "
1676 "this shape or library");
1677}
1678
1685
1687 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1688 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1689{
1691 "Method does not exist for this shape or library");
1692}
1693
1695 Array<OneD, NekDouble> &outarray,
1696 const StdMatrixKey &mkey)
1697{
1698 // If this function is not reimplemented on shape level, the function
1699 // below will be called
1700 MassMatrixOp_MatFree(inarray, outarray, mkey);
1701}
1702
1704 const Array<OneD, const NekDouble> &inarray,
1705 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1706{
1707 // If this function is not reimplemented on shape level, the function
1708 // below will be called
1709 LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
1710}
1711
1713 [[maybe_unused]] Array<OneD, NekDouble> &array,
1714 [[maybe_unused]] const StdMatrixKey &mkey)
1715{
1716 ASSERTL0(false, "This function is not defined in StdExpansion.");
1717}
1718
1720 [[maybe_unused]] Array<OneD, NekDouble> &array,
1721 [[maybe_unused]] const NekDouble alpha,
1722 [[maybe_unused]] const NekDouble exponent,
1723 [[maybe_unused]] const NekDouble cutoff)
1724{
1725 ASSERTL0(false, "This function is not defined in StdExpansion.");
1726}
1727
1729 [[maybe_unused]] int numMin,
1730 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1731 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
1732{
1733 ASSERTL0(false, "This function is not defined in StdExpansion.");
1734}
1735
1737 const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
1738 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1739{
1740 // If this function is not reimplemented on shape level, the function
1741 // below will be called
1742 LaplacianMatrixOp_MatFree(k1, k2, inarray, outarray, mkey);
1743}
1744
1746 const int i, const Array<OneD, const NekDouble> &inarray,
1747 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1748{
1749 // If this function is not reimplemented on shape level, the function
1750 // below will be called
1751 WeakDerivMatrixOp_MatFree(i, inarray, outarray, mkey);
1752}
1753
1755 const Array<OneD, const NekDouble> &inarray,
1756 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1757{
1758 // If this function is not reimplemented on shape level, the function
1759 // below will be called
1760 WeakDirectionalDerivMatrixOp_MatFree(inarray, outarray, mkey);
1761}
1762
1764 const Array<OneD, const NekDouble> &inarray,
1765 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1766{
1767 // If this function is not reimplemented on shape level, the function
1768 // below will be called
1769 MassLevelCurvatureMatrixOp_MatFree(inarray, outarray, mkey);
1770}
1771
1773 const Array<OneD, const NekDouble> &inarray,
1774 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1775{
1776 // If this function is not reimplemented on shape level, the function
1777 // below will be called
1778 LinearAdvectionMatrixOp_MatFree(inarray, outarray, mkey);
1779}
1780
1782 const Array<OneD, const NekDouble> &inarray,
1783 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1784 bool addDiffusionTerm)
1785{
1786 // If this function is not reimplemented on shape level, the function
1787 // below will be called
1789 addDiffusionTerm);
1790}
1791
1793 const Array<OneD, const NekDouble> &inarray,
1794 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1795{
1796 // If this function is not reimplemented on shape level, the function
1797 // below will be called
1798 HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
1799}
1800
1802 const Array<OneD, const NekDouble> &inarray,
1803 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1804{
1805 // If this function is not reimplemented on shape level, the function
1806 // below will be called
1807 LaplacianMatrixOp_MatFree_GenericImpl(inarray, outarray, mkey);
1808}
1809
1811 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1812 [[maybe_unused]] Array<OneD, NekDouble> &outarray,
1813 [[maybe_unused]] Array<OneD, NekDouble> &wsp)
1814{
1815 ASSERTL0(false, "Not implemented.");
1816}
1817
1819 const Array<OneD, const NekDouble> &inarray,
1820 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
1821{
1822 // If this function is not reimplemented on shape level, the function
1823 // below will be called
1824 HelmholtzMatrixOp_MatFree_GenericImpl(inarray, outarray, mkey);
1825}
1826
1828 [[maybe_unused]] const DNekScalMatSharedPtr &m_transformationmatrix)
1829{
1830 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
1831 return NullDNekMatSharedPtr;
1832}
1833
1835 Array<OneD, NekDouble> &outarray, int npset)
1836{
1837 PhysInterpToPoints(inarray, outarray, npset, ePhysInterpToGLL);
1838}
1839
1841 const Array<OneD, const NekDouble> &inarray,
1842 Array<OneD, NekDouble> &outarray, int npset)
1843{
1844 PhysInterpToPoints(inarray, outarray, npset, ePhysInterpToEquiSpaced);
1845}
1846
1848 const Array<OneD, const NekDouble> &inarray,
1849 Array<OneD, NekDouble> &outarray, int npset, MatrixType distrib)
1850{
1852 DNekMatSharedPtr intmat;
1853
1854 int nqtot = GetTotPoints();
1855 int np = 0;
1856 if (npset == -1) // use values from basis num points()
1857 {
1858 int nqbase;
1859 for (int i = 0; i < m_base.size(); ++i)
1860 {
1861 nqbase = m_base[i]->GetNumPoints();
1862 np = std::max(np, nqbase);
1863 }
1864
1865 StdMatrixKey Ikey(distrib, shape, *this);
1866 intmat = GetStdMatrix(Ikey);
1867 }
1868 else
1869 {
1870 np = npset;
1871
1872 ConstFactorMap cmap;
1873 cmap[eFactorConst] = np;
1874 StdMatrixKey Ikey(distrib, shape, *this, cmap);
1875 intmat = GetStdMatrix(Ikey);
1876 }
1877
1878 NekVector<NekDouble> in(nqtot, inarray, eWrapper);
1880 LibUtilities::GetNumberOfCoefficients(shape, np, np, np), outarray,
1881 eWrapper);
1882 out = (*intmat) * in;
1883}
1884
1886 [[maybe_unused]] Array<OneD, int> &conn, [[maybe_unused]] bool standard)
1887{
1889 "GetSimplexEquiSpacedConnectivity not"
1890 " implemented for " +
1891 static_cast<std::string>(
1893}
1894
1896 [[maybe_unused]] const StdRegions::Orientation orient,
1897 [[maybe_unused]] Array<OneD, int> &idmap, [[maybe_unused]] const int nq0,
1898 [[maybe_unused]] const int nq1, [[maybe_unused]] bool Forwards)
1899{
1901 "Method does not exist for this shape or library");
1902}
1903
1905 const Array<OneD, const NekDouble> &inarray,
1906 Array<OneD, NekDouble> &outarray)
1907{
1909
1910 // inarray has to be consistent with NumModes definition
1911 // There is also a check in GetStdMatrix to see if all
1912 // modes are of the same size
1913 ConstFactorMap cmap;
1914
1915 cmap[eFactorConst] = m_base[0]->GetNumModes();
1916 StdMatrixKey Ikey(eEquiSpacedToCoeffs, shape, *this, cmap);
1917 DNekMatSharedPtr intmat = GetStdMatrix(Ikey);
1918
1920 NekVector<NekDouble> out(m_ncoeffs, outarray, eWrapper);
1921 out = (*intmat) * in;
1922}
1923
1925 const Array<OneD, const NekDouble> &inarray,
1926 Array<OneD, NekDouble> &outarray)
1927{
1929
1930 // inarray has to be consistent with NumModes definition
1931 // There is also a check in GetStdMatrix to see if all
1932 // modes are of the same size
1933 ConstFactorMap cmap;
1934
1935 std::vector<unsigned int> nequivec(3, nequi);
1936 cmap[eFactorConst] = nequi;
1937 StdMatrixKey Ikey(eEquiSpacedToPhys, shape, *this, cmap);
1938 DNekMatSharedPtr intmat = GetStdMatrix(Ikey);
1939
1940 NekVector<NekDouble> in(GetNumberOfCoefficients(shape, nequivec), inarray,
1941 eWrapper);
1942 NekVector<NekDouble> out(GetTotPoints(), outarray, eWrapper);
1943 out = (*intmat) * in;
1944}
1945
1946} // 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...
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 std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
The base class for all shapes.
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.
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)
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_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
static void Dscal(const int &n, const double &alpha, double *x, const int &incx)
BLAS level 1: x = alpha x.
Definition Blas.hpp:124
static void Daxpy(const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: y = alpha x plus y.
Definition Blas.hpp:117
const char *const ShapeTypeMap[SIZE_ShapeType]
Definition ShapeType.hpp:81
BasisManagerT & BasisManager(void)
static const BasisKey NullBasisKey(eNoBasisType, 0, NullPointsKey)
Defines a null basis with no type or points.
constexpr int GetNumberOfCoefficients(ShapeType shape, std::vector< unsigned int > &modes, int offset=0)
@ eModified_B
Principle Modified Functions .
Definition BasisType.h:49
@ eOrtho_B
Principle Orthogonal Functions .
Definition BasisType.h:44
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: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 Vabs(int n, const T *x, const int incx, T *y, const int incy)
vabs: y = |x|
Definition Vmath.hpp:352
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition Vmath.hpp:366
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition Vmath.hpp:180
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition Vmath.hpp:100
void Zero(int n, T *x, const int incx)
Zero vector.
Definition Vmath.hpp:273
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:685
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 > sqrt(scalarT< T > in)
Definition scalar.hpp:290