Nektar++
StdExpansion.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: StdExpansion.h
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: Class definition StdExpansion which is the base class
32// to all expansion shapes
33//
34///////////////////////////////////////////////////////////////////////////////
35
36#ifndef NEKTAR_LIB_STDREGIONS_STANDARDEXPANSION_H
37#define NEKTAR_LIB_STDREGIONS_STANDARDEXPANSION_H
38
39#include <fstream>
40#include <memory>
41#include <vector>
42
43#include <set>
44
50{
51class MatrixKey;
52class Expansion;
53} // namespace Nektar::LocalRegions
54
55namespace Nektar::StdRegions
56{
57
58/** \brief The base class for all shapes
59 *
60 * This is the lowest level basic class for all shapes and so
61 * contains the definition of common data and common routine to all
62 * elements
63 */
64class StdExpansion : public std::enable_shared_from_this<StdExpansion>
65{
66public:
67 /** \brief Default Constructor */
69
70 /** \brief Constructor */
72 const int numcoeffs, const int numbases,
76
77 /** \brief Copy Constructor */
79
80 /** \brief Destructor */
82
83 // Standard Expansion Routines Applicable Regardless of Region
84
85 /** \brief This function returns the number of 1D bases used in
86 * the expansion
87 *
88 * \return returns the number of 1D bases used in the expansion,
89 * which is equal to number dimension of the expansion
90 */
91 inline int GetNumBases() const
92 {
93 return m_base.size();
94 }
95
96 /** \brief This function gets the shared point to basis
97 *
98 * \return returns the shared pointer to the bases
99 */
101 const
102 {
103 return (m_base);
104 }
105
106 /** \brief This function gets the shared point to basis in
107 * the \a dir direction
108 *
109 * \return returns the shared pointer to the basis in
110 * directin \a dir
111 */
112 inline const LibUtilities::BasisSharedPtr &GetBasis(int dir) const
113 {
114 ASSERTL1(dir < m_base.size(), "dir is larger than number of bases");
115 return (m_base[dir]);
116 }
117
118 /** \brief This function returns the total number of coefficients
119 * used in the expansion
120 *
121 * \return returns the total number of coefficients (which is
122 * equivalent to the total number of modes) used in the expansion
123 */
124 inline int GetNcoeffs(void) const
125 {
126 return (m_ncoeffs);
127 }
128
129 /** \brief This function returns the total number of quadrature
130 * points used in the element
131 *
132 * \return returns the total number of quadrature points
133 */
134 inline int GetTotPoints() const
135 {
136 int nqtot = 1;
137
138 for (size_t i = 0; i < m_base.size(); ++i)
139 {
140 nqtot *= m_base[i]->GetNumPoints();
141 }
142
143 return nqtot;
144 }
145
146 /** \brief This function returns the type of basis used in the \a dir
147 * direction
148 *
149 * The different types of bases implemented in the code are defined
150 * in the LibUtilities::BasisType enumeration list. As a result, the
151 * function will return one of the types of this enumeration list.
152 *
153 * \param dir the direction
154 * \return returns the type of basis used in the \a dir direction
155 */
156 inline LibUtilities::BasisType GetBasisType(const int dir) const
157 {
158 ASSERTL1(dir < m_base.size(), "dir is larger than m_numbases");
159 return (m_base[dir]->GetBasisType());
160 }
161
162 /** \brief This function returns the number of expansion modes
163 * in the \a dir direction
164 *
165 * \param dir the direction
166 * \return returns the number of expansion modes in the \a dir
167 * direction
168 */
169 inline int GetBasisNumModes(const int dir) const
170 {
171 ASSERTL1(dir < m_base.size(), "dir is larger than m_numbases");
172 return (m_base[dir]->GetNumModes());
173 }
174
175 /** \brief This function returns the maximum number of
176 * expansion modes over all local directions
177 *
178 * \return returns the maximum number of expansion modes
179 * over all local directions
180 */
181 inline int EvalBasisNumModesMax(void) const
182 {
183 int returnval = 0;
184
185 for (size_t i = 0; i < m_base.size(); ++i)
186 {
187 returnval = std::max(returnval, m_base[i]->GetNumModes());
188 }
189
190 return returnval;
191 }
192
193 /** \brief This function returns the type of quadrature points used
194 * in the \a dir direction
195 *
196 * The different types of quadrature points implemented in the code
197 * are defined in the LibUtilities::PointsType enumeration list.
198 * As a result, the function will return one of the types of this
199 * enumeration list.
200 *
201 * \param dir the direction
202 * \return returns the type of quadrature points used in the \a dir
203 * direction
204 */
205 inline LibUtilities::PointsType GetPointsType(const int dir) const
206 {
207 ASSERTL1(dir < m_base.size(), "dir is larger than m_numbases");
208 return (m_base[dir]->GetPointsType());
209 }
210
211 /** \brief This function returns the number of quadrature points
212 * in the \a dir direction
213 *
214 * \param dir the direction
215 * \return returns the number of quadrature points in the \a dir
216 * direction
217 */
218 inline int GetNumPoints(const int dir) const
219 {
220 ASSERTL1(dir < m_base.size() || dir == 0,
221 "dir is larger than m_numbases");
222 return (m_base.size() > 0 ? m_base[dir]->GetNumPoints() : 1);
223 }
224
225 /** \brief This function returns a pointer to the array containing
226 * the quadrature points in \a dir direction
227 *
228 * \param dir the direction
229 * \return returns a pointer to the array containing
230 * the quadrature points in \a dir direction
231 */
232 inline const Array<OneD, const NekDouble> &GetPoints(const int dir) const
233 {
234 return m_base[dir]->GetZ();
235 }
236
237 // Wrappers around virtual Functions
238 /** \brief This function returns the number of vertices of the
239 * expansion domain
240 *
241 * This function is a wrapper around the virtual function
242 * \a v_GetNverts()
243 *
244 * \return returns the number of vertices of the expansion domain
245 */
246 int GetNverts() const
247 {
248 return v_GetNverts();
249 }
250
251 /** \brief This function returns the number of expansion coefficients
252 * belonging to the \a i-th trace
253 *
254 * This function is a wrapper around the virtual function
255 * \a v_GetTraceNcoeffs()
256 *
257 * \param i specifies which trace
258 * \return returns the number of expansion coefficients belonging to
259 * the \a i-th trace
260 */
261 int GetTraceNcoeffs(const int i) const
262 {
263 return v_GetTraceNcoeffs(i);
264 }
265
266 int GetTraceIntNcoeffs(const int i) const
267 {
268 return v_GetTraceIntNcoeffs(i);
269 }
270
271 /** \brief This function returns the number of quadrature points
272 * belonging to the \a i-th trace
273 *
274 * This function is a wrapper around the virtual function
275 * \a v_GetTraceNumPoints()
276 *
277 * \param i specifies which trace id
278 * \return returns the number of quadrature points belonging to
279 * the \a i-th trace
280 */
281 int GetTraceNumPoints(const int i) const
282 {
283 return v_GetTraceNumPoints(i);
284 }
285
286 /** \brief This function returns the basis key belonging
287 * to the \a i-th trace
288 *
289 * This function is a wrapper around the virtual function
290 * \a v_GetTraceBasisKey()
291 *
292 * \param i specifies which trace id
293 * \param k is the direction of the basis key for 2D traces
294 * \param UseGll use GLL quadrature points in Trace Expansion (defaulted to
295 * false)
296 *
297 * \return returns the number of Basis key of the ith
298 * trace in the k th direction (when trace is a 2D
299 * object)
300 */
301 const LibUtilities::BasisKey GetTraceBasisKey(const int i, int k = -1,
302 bool UseGLL = false) const
303 {
304 return v_GetTraceBasisKey(i, k, UseGLL);
305 }
306
307 /** \brief This function returns the basis key belonging
308 * to the \a i-th trace
309 *
310 * This function is a wrapper around the virtual function
311 * \a v_GetTracePointsKey()
312 *
313 * \param i specifies which trace id
314 * \param k is the direction of the basis key for 2D traces
315 *
316 * \return returns the number of Points key of the ith
317 * trace in the k th direction (when trace is a 2D
318 * object)
319 */
320 LibUtilities::PointsKey GetTracePointsKey(const int i, int k = -1) const
321 {
322 return v_GetTracePointsKey(i, k);
323 }
324
325 int NumBndryCoeffs(void) const
326 {
327 return v_NumBndryCoeffs();
328 }
329
330 int NumDGBndryCoeffs(void) const
331 {
332 return v_NumDGBndryCoeffs();
333 }
334
335 /** \brief This function returns the type of expansion
336 * Nodal point type if defined
337 *
338 * This function is a wrapper around the virtual function
339 * \a v_GetNodalPointsKey()
340 *
341 */
343 {
344 return v_GetNodalPointsKey();
345 };
346
347 /**
348 * @brief Returns the number of trace elements connected to this
349 * element.
350 *
351 * For example, a quadrilateral has four edges, so this function
352 * would return 4.
353 */
354 int GetNtraces() const
355 {
356 return v_GetNtraces();
357 }
358
359 /** \brief This function returns the shape of the expansion domain
360 *
361 * This function is a wrapper around the virtual function
362 * \a v_DetShapeType()
363 *
364 * The different shape types implemented in the code are defined
365 * in the ::ShapeType enumeration list. As a result, the
366 * function will return one of the types of this enumeration list.
367 *
368 * \return returns the shape of the expansion domain
369 */
371 {
372 return v_DetShapeType();
373 }
374
375 std::shared_ptr<StdExpansion> GetStdExp() const
376 {
377 return v_GetStdExp();
378 }
379
380 std::shared_ptr<StdExpansion> GetLinStdExp(void) const
381 {
382 return v_GetLinStdExp();
383 }
384
386 {
387 return v_GetShapeDimension();
388 }
389
391 {
393 }
394
396 {
398 }
399
401 Array<OneD, NekDouble> &outarray)
402 {
403 v_NodalToModal(inarray, outarray);
404 }
405
406 /** \brief This function performs the Backward transformation from
407 * coefficient space to physical space
408 *
409 * This function is a wrapper around the virtual function
410 * \a v_BwdTrans()
411 *
412 * Based on the expansion coefficients, this function evaluates the
413 * expansion at the quadrature points. This is equivalent to the
414 * operation \f[ u(\xi_{1i}) =
415 * \sum_{p=0}^{P-1} \hat{u}_p \phi_p(\xi_{1i}) \f] which can be
416 * evaluated as \f$ {\bf u} = {\bf B}^T {\bf \hat{u}} \f$ with
417 * \f${\bf B}[i][j] = \phi_i(\xi_{j})\f$
418 *
419 * This function requires that the coefficient array
420 * \f$\mathbf{\hat{u}}\f$ provided as \a inarray.
421 *
422 * The resulting array
423 * \f$\mathbf{u}[m]=u(\mathbf{\xi}_m)\f$ containing the
424 * expansion evaluated at the quadrature points, is stored
425 * in the \a outarray.
426 *
427 * \param inarray contains the values of the expansion
428 * coefficients (input of the function)
429 *
430 * \param outarray contains the values of the expansion evaluated
431 * at the quadrature points (output of the function)
432 */
434 Array<OneD, NekDouble> &outarray)
435 {
436 v_BwdTrans(inarray, outarray);
437 }
438
439 /**
440 * @brief This function performs the Forward transformation from
441 * physical space to coefficient space.
442 */
443 inline void FwdTrans(const Array<OneD, const NekDouble> &inarray,
444 Array<OneD, NekDouble> &outarray);
445
447 Array<OneD, NekDouble> &outarray)
448 {
449 v_FwdTransBndConstrained(inarray, outarray);
450 }
451
452 /** \brief This function integrates the specified function over the
453 * domain
454 *
455 * This function is a wrapper around the virtual function
456 * \a v_Integral()
457 *
458 * Based on the values of the function evaluated at the quadrature
459 * points (which are stored in \a inarray), this function calculates
460 * the integral of this function over the domain. This is
461 * equivalent to the numerical evaluation of the operation
462 * \f[ I=\int u(\mathbf{\xi})d \mathbf{\xi}\f]
463 *
464 * \param inarray values of the function to be integrated evaluated
465 * at the quadrature points (i.e.
466 * \a inarray[m]=\f$u(\mathbf{\xi}_m)\f$)
467 * \return returns the value of the calculated integral
468 *
469 * Inputs:\n
470
471 - \a inarray: definition of function to be returned at quadrature point
472 of expansion.
473
474 Outputs:\n
475
476 - returns \f$\int^1_{-1}\int^1_{-1} u(\xi_1, \xi_2) J[i,j] d
477 \xi_1 d \xi_2 \f$ where \f$inarray[i,j] =
478 u(\xi_{1i},\xi_{2j}) \f$ and \f$ J[i,j] \f$ is the
479 Jacobian evaluated at the quadrature point.
480 *
481 */
483 {
484 return v_Integral(inarray);
485 }
486
487 /** \brief This function fills the array \a outarray with the
488 * \a mode-th mode of the expansion
489 *
490 * This function is a wrapper around the virtual function
491 * \a v_FillMode()
492 *
493 * The requested mode is evaluated at the quadrature points
494 *
495 * \param mode the mode that should be filled
496 * \param outarray contains the values of the \a mode-th mode of the
497 * expansion evaluated at the quadrature points (output of the
498 * function)
499 */
500 void FillMode(const int mode, Array<OneD, NekDouble> &outarray)
501 {
502 v_FillMode(mode, outarray);
503 }
504
505 /** \brief this function calculates the inner product of a given
506 * function \a f with the different modes of the expansion
507 *
508 * This function is a wrapper around the virtual function
509 * \a v_IProductWRTBase()
510 *
511 * This is equivalent to the numerical evaluation of
512 * \f[ I[p] = \int \phi_p(\mathbf{x}) f(\mathbf{x}) d\mathbf{x}\f]
513 * \f$ \begin{array}{rcl} I_{pq} = (\phi_q \phi_q, u) & = &
514 \sum_{i=0}^{nq_0} \sum_{j=0}^{nq_1} \phi_p(\xi_{0,i})
515 \phi_q(\xi_{1,j}) w^0_i w^1_j u(\xi_{0,i} \xi_{1,j})
516 J_{i,j}\\ & = & \sum_{i=0}^{nq_0} \phi_p(\xi_{0,i})
517 \sum_{j=0}^{nq_1} \phi_q(\xi_{1,j}) \tilde{u}_{i,j}
518 J_{i,j} \end{array} \f$
519
520 where
521
522 \f$ \tilde{u}_{i,j} = w^0_i w^1_j u(\xi_{0,i},\xi_{1,j}) \f$
523
524 which can be implemented as
525
526 \f$ f_{qi} = \sum_{j=0}^{nq_1} \phi_q(\xi_{1,j}) \tilde{u}_{i,j} =
527 {\bf B_1 U} \f$
528 \f$ I_{pq} = \sum_{i=0}^{nq_0} \phi_p(\xi_{0,i}) f_{qi} =
529 {\bf B_0 F} \f$
530 *
531 * \param inarray contains the values of the function \a f
532 * evaluated at the quadrature points
533 * \param outarray contains the values of the inner product of \a f
534 * with the different modes, i.e. \f$ outarray[p] = I[p]\f$
535 * (output of the function)
536 */
538 Array<OneD, NekDouble> &outarray)
539 {
540 v_IProductWRTBase(inarray, outarray);
541 }
542
544 const Array<OneD, const NekDouble> &inarray,
545 Array<OneD, NekDouble> &outarray, int coll_check)
546 {
547 v_IProductWRTBase(base, inarray, outarray, coll_check);
548 }
549
550 void IProductWRTDerivBase(const int dir,
551 const Array<OneD, const NekDouble> &inarray,
552 Array<OneD, NekDouble> &outarray)
553 {
554 v_IProductWRTDerivBase(dir, inarray, outarray);
555 }
556
558 const Array<OneD, const NekDouble> &direction,
559 const Array<OneD, const NekDouble> &inarray,
560 Array<OneD, NekDouble> &outarray)
561 {
562 v_IProductWRTDirectionalDerivBase(direction, inarray, outarray);
563 }
564
565 /// \brief Get the element id of this expansion when used
566 /// in a list by returning value of #m_elmt_id
567 inline int GetElmtId()
568 {
569 return m_elmt_id;
570 }
571
572 /// \brief Set the element id of this expansion when used
573 /// in a list by returning value of #m_elmt_id
574 inline void SetElmtId(const int id)
575 {
576 m_elmt_id = id;
577 }
578
579 /** \brief this function returns the physical coordinates of the
580 * quadrature points of the expansion
581 *
582 * This function is a wrapper around the virtual function
583 * \a v_GetCoords()
584 *
585 * \param coords an array containing the coordinates of the
586 * quadrature points (output of the function)
587 */
591 {
592 v_GetCoords(coords_1, coords_2, coords_3);
593 }
594
595 /** \brief given the coordinates of a point of the element in the
596 * local collapsed coordinate system, this function calculates the
597 * physical coordinates of the point
598 *
599 * This function is a wrapper around the virtual function
600 * \a v_GetCoord()
601 *
602 * \param Lcoords the coordinates in the local collapsed
603 * coordinate system
604 * \param coords the physical coordinates (output of the function)
605 */
608 {
609 v_GetCoord(Lcoord, coord);
610 }
611
613 {
614 return m_stdMatrixManager[mkey];
615 }
616
618 {
619 return m_stdStaticCondMatrixManager[mkey];
620 }
621
623 Array<OneD, NekDouble> &outarray)
624 {
625 v_NormVectorIProductWRTBase(Fx, outarray);
626 }
627
629 const Array<OneD, NekDouble> &Fy,
630 Array<OneD, NekDouble> &outarray)
631 {
632 v_NormVectorIProductWRTBase(Fx, Fy, outarray);
633 }
634
638 Array<OneD, NekDouble> &outarray)
639 {
640 v_NormVectorIProductWRTBase(Fx, Fy, Fz, outarray);
641 }
642
644 const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
645 Array<OneD, NekDouble> &outarray)
646 {
647 v_NormVectorIProductWRTBase(Fvec, outarray);
648 }
649
651 const LocalRegions::MatrixKey &mkey)
652 {
653 return v_GetLocStaticCondMatrix(mkey);
654 }
655
657 const LocalRegions::MatrixKey &mkey)
658 {
659 return v_DropLocStaticCondMatrix(mkey);
660 }
661
662 int CalcNumberOfCoefficients(const std::vector<unsigned int> &nummodes,
663 int &modes_offset)
664 {
665 return v_CalcNumberOfCoefficients(nummodes, modes_offset);
666 }
667
668 // virtual functions related to LocalRegions
671 const Array<OneD, const NekDouble> &physvals);
672
674 {
675 return v_GetCoordim();
676 }
677
679 {
680 v_GetBoundaryMap(outarray);
681 }
682
684 {
685 v_GetInteriorMap(outarray);
686 }
687
688 int GetVertexMap(const int localVertexId, bool useCoeffPacking = false)
689 {
690 return v_GetVertexMap(localVertexId, useCoeffPacking);
691 }
692
693 void GetTraceToElementMap(const int tid,
695 Array<OneD, int> &signarray,
696 Orientation traceOrient = eForwards, int P = -1,
697 int Q = -1)
698 {
699 v_GetTraceToElementMap(tid, maparray, signarray, traceOrient, P, Q);
700 }
701
702 void GetTraceCoeffMap(const unsigned int traceid,
704 {
705 v_GetTraceCoeffMap(traceid, maparray);
706 }
707
708 void GetElmtTraceToTraceMap(const unsigned int tid,
710 Array<OneD, int> &signarray,
711 Orientation traceOrient = eForwards, int P = -1,
712 int Q = -1)
713 {
714 v_GetElmtTraceToTraceMap(tid, maparray, signarray, traceOrient, P, Q);
715 }
716
719 Array<OneD, int> &signarray,
720 const Orientation traceOrient = eForwards)
721 {
722 v_GetTraceInteriorToElementMap(tid, maparray, signarray, traceOrient);
723 }
724
726 const int tid, int &numModes0, int &numModes1,
727 const Orientation traceOrient = eDir1FwdDir1_Dir2FwdDir2)
728 {
729 v_GetTraceNumModes(tid, numModes0, numModes1, traceOrient);
730 }
731
733 Array<OneD, NekDouble> &outarray)
734 {
735 v_MultiplyByQuadratureMetric(inarray, outarray);
736 }
737
739 const Array<OneD, const NekDouble> &inarray,
740 Array<OneD, NekDouble> &outarray)
741 {
742 v_MultiplyByStdQuadratureMetric(inarray, outarray);
743 }
744
745 // Matrix Routines
746
747 /** \brief this function generates the mass matrix
748 * \f$\mathbf{M}[i][j] =
749 * \int \phi_i(\mathbf{x}) \phi_j(\mathbf{x}) d\mathbf{x}\f$
750 *
751 * \return returns the mass matrix
752 */
753
756
758 const Array<OneD, const NekDouble> &inarray,
759 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
760
762 Array<OneD, NekDouble> &outarray,
763 const StdMatrixKey &mkey)
764 {
765 v_MassMatrixOp(inarray, outarray, mkey);
766 }
767
769 Array<OneD, NekDouble> &outarray,
770 const StdMatrixKey &mkey)
771 {
772 v_LaplacianMatrixOp(inarray, outarray, mkey);
773 }
774
775 void ReduceOrderCoeffs(int numMin,
776 const Array<OneD, const NekDouble> &inarray,
777 Array<OneD, NekDouble> &outarray)
778 {
779 v_ReduceOrderCoeffs(numMin, inarray, outarray);
780 }
781
783 const StdMatrixKey &mkey)
784 {
785 v_SVVLaplacianFilter(array, mkey);
786 }
787
789 const NekDouble exponent, const NekDouble cutoff)
790 {
791 v_ExponentialFilter(array, alpha, exponent, cutoff);
792 }
793
794 void LaplacianMatrixOp(const int k1, const int k2,
795 const Array<OneD, const NekDouble> &inarray,
796 Array<OneD, NekDouble> &outarray,
797 const StdMatrixKey &mkey)
798 {
799 v_LaplacianMatrixOp(k1, k2, inarray, outarray, mkey);
800 }
801
802 void WeakDerivMatrixOp(const int i,
803 const Array<OneD, const NekDouble> &inarray,
804 Array<OneD, NekDouble> &outarray,
805 const StdMatrixKey &mkey)
806 {
807 v_WeakDerivMatrixOp(i, inarray, outarray, mkey);
808 }
809
811 const Array<OneD, const NekDouble> &inarray,
812 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
813 {
814 v_WeakDirectionalDerivMatrixOp(inarray, outarray, mkey);
815 }
816
818 Array<OneD, NekDouble> &outarray,
819 const StdMatrixKey &mkey)
820 {
821 v_MassLevelCurvatureMatrixOp(inarray, outarray, mkey);
822 }
823
825 Array<OneD, NekDouble> &outarray,
826 const StdMatrixKey &mkey)
827 {
828 v_LinearAdvectionMatrixOp(inarray, outarray, mkey);
829 }
830
832 const Array<OneD, const NekDouble> &inarray,
833 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
834 bool addDiffusionTerm = true)
835 {
836 v_LinearAdvectionDiffusionReactionMatrixOp(inarray, outarray, mkey,
837 addDiffusionTerm);
838 }
839
840 /**
841 * @param inarray Input array @f$ \mathbf{u} @f$.
842 * @param outarray Output array @f$ \boldsymbol{\nabla^2u}
843 * + \lambda \boldsymbol{u} @f$.
844 * @param mkey
845 */
847 Array<OneD, NekDouble> &outarray,
848 const StdMatrixKey &mkey)
849 {
850 v_HelmholtzMatrixOp(inarray, outarray, mkey);
851 }
852
854 {
855 return v_GenMatrix(mkey);
856 }
857
862 {
863 v_PhysDeriv(inarray, out_d0, out_d1, out_d2);
864 }
865
866 void PhysDeriv(const int dir, const Array<OneD, const NekDouble> &inarray,
867 Array<OneD, NekDouble> &outarray)
868 {
869 v_PhysDeriv(dir, inarray, outarray);
870 }
871
874 {
875 v_PhysDeriv_s(inarray, out_ds);
876 }
877
880 {
881 v_PhysDeriv_n(inarray, out_dn);
882 }
883
885 const Array<OneD, const NekDouble> &direction,
886 Array<OneD, NekDouble> &outarray)
887 {
888 v_PhysDirectionalDeriv(inarray, direction, outarray);
889 }
890
895 {
896 v_StdPhysDeriv(inarray, out_d0, out_d1, out_d2);
897 }
898
899 void StdPhysDeriv(const int dir,
900 const Array<OneD, const NekDouble> &inarray,
901 Array<OneD, NekDouble> &outarray)
902 {
903 v_StdPhysDeriv(dir, inarray, outarray);
904 }
905
906 /** \brief This function evaluates the expansion at a single
907 * (arbitrary) point of the domain
908 *
909 * This function is a wrapper around the virtual function
910 * \a v_PhysEvaluate()
911 *
912 * Based on the value of the expansion at the quadrature
913 * points provided in \a physvals, this function
914 * calculates the value of the expansion at an arbitrary
915 * single points (with coordinates \f$ \mathbf{x_c}\f$
916 * given by the pointer \a coords). This operation,
917 * equivalent to \f[ u(\mathbf{x_c}) = \sum_p
918 * \phi_p(\mathbf{x_c}) \hat{u}_p \f] is evaluated using
919 * Lagrangian interpolants through the quadrature points:
920 * \f[ u(\mathbf{x_c}) = \sum_p h_p(\mathbf{x_c}) u_p\f]
921 *
922 * \param coords the coordinates of the single point
923 * \param physvals the interpolated field at the quadrature points
924 *
925 * \return returns the value of the expansion at the
926 * single point
927 */
929 const Array<OneD, const NekDouble> &physvals)
930 {
931 return v_PhysEvaluate(coords, physvals);
932 }
933
934 /** \brief This function evaluates the first derivative of the expansion
935 * at a single (arbitrary) point of the domain
936 *
937 * This function is a wrapper around the virtual function
938 * \a v_PhysEvaluate()
939
940 * Based on the value of the expansion at the quadrature
941 * points provided in \a physvals, this function
942 * calculates the value of the expansion at a set of points
943 * given in \a coords
944 */
946 const Array<OneD, const NekDouble> &inarray,
947 std::array<NekDouble, 3> &firstOrderDerivs)
948
949 {
950 return v_PhysEvalFirstDeriv(coord, inarray, firstOrderDerivs);
951 }
952
954 const Array<OneD, const NekDouble> &inarray,
955 std::array<NekDouble, 3> &firstOrderDerivs,
956 std::array<NekDouble, 6> &secondOrderDerivs)
957
958 {
959 return v_PhysEvalFirstSecondDeriv(coord, inarray, firstOrderDerivs,
960 secondOrderDerivs);
961 }
962
963 /** \brief This function evaluates the expansion at a single
964 * (arbitrary) point of the domain
965 *
966 * This function is a wrapper around the virtual function
967 * \a v_PhysEvaluate()
968 *
969 * Based on the value of the expansion at the quadrature
970 * points provided in \a physvals, this function
971 * calculates the value of the expansion at an arbitrary
972 * single points associated with the interpolation
973 * matrices provided in \f$ I \f$.
974 *
975 * \param I an Array of lagrange interpolantes evaluated
976 * at the coordinate and going through the local physical
977 * quadrature
978 * \param physvals the interpolated field at the quadrature points
979 *
980 * \return returns the value of the expansion at the
981 * single point
982 */
984 const Array<OneD, const NekDouble> &physvals)
985 {
986 return v_PhysEvaluateInterp(I, physvals);
987 }
988
989 /**
990 * @brief This function evaluates the basis function mode @p mode at a
991 * point @p coords of the domain.
992 *
993 * This function uses barycentric interpolation with the tensor
994 * product separation of the basis function to improve performance.
995 *
996 * @param coord The coordinate inside the standard region.
997 * @param mode The mode number to be evaluated.
998 *
999 * @return The value of the basis function @p mode at @p coords.
1000 */
1002 int mode)
1003 {
1004 return v_PhysEvaluateBasis(coords, mode);
1005 }
1006
1007 /**
1008 * \brief Convert local cartesian coordinate \a xi into local
1009 * collapsed coordinates \a eta
1010 **/
1013 {
1014 v_LocCoordToLocCollapsed(xi, eta);
1015 }
1016
1017 /**
1018 * \brief Convert local collapsed coordinates \a eta into local
1019 * cartesian coordinate \a xi
1020 **/
1023 {
1024 v_LocCollapsedToLocCoord(eta, xi);
1025 }
1026
1027 /** \brief interpolate from one set of quadrature points available from
1028 * FromExp to the set of quadrature points in the current expansion. If the
1029 * points are the same this routine will just copy the data
1030 **/
1031 void PhysInterp(std::shared_ptr<StdExpansion> fromExp,
1032 const Array<OneD, const NekDouble> &fromData,
1033 Array<OneD, NekDouble> &toData)
1034 {
1035 v_PhysInterp(fromExp, fromData, toData);
1036 }
1037
1039 const std::vector<unsigned int> &nummodes, int &modes_offset);
1040
1043 Array<OneD, NekDouble> &outarray);
1044
1048 Array<OneD, NekDouble> &outarray);
1049
1054 Array<OneD, NekDouble> &outarray);
1055
1057 const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
1058 Array<OneD, NekDouble> &outarray);
1059
1061 const LocalRegions::MatrixKey &mkey);
1062
1064 const LocalRegions::MatrixKey &mkey);
1065
1066 /** \brief Function to evaluate the discrete \f$ L_\infty\f$
1067 * error \f$ |\epsilon|_\infty = \max |u - u_{exact}|\f$ where \f$
1068 * u_{exact}\f$ is given by the array \a sol.
1069 *
1070 * This function takes the physical value space array \a m_phys as
1071 * approximate solution
1072 *
1073 * \param sol array of solution function at physical quadrature
1074 * points
1075 * \return returns the \f$ L_\infty \f$ error as a NekDouble.
1076 */
1080
1081 /** \brief Function to evaluate the discrete \f$ L_2\f$ error,
1082 * \f$ | \epsilon |_{2} = \left [ \int^1_{-1} [u - u_{exact}]^2
1083 * dx \right]^{1/2} d\xi_1 \f$ where \f$ u_{exact}\f$ is given by
1084 * the array \a sol.
1085 *
1086 * This function takes the physical value space array \a m_phys as
1087 * approximate solution
1088 *
1089 * \param sol array of solution function at physical quadrature
1090 * points
1091 * \return returns the \f$ L_2 \f$ error as a double.
1092 */
1094 L2(const Array<OneD, const NekDouble> &phys,
1096
1097 /** \brief Function to evaluate the discrete \f$ H^1\f$
1098 * error, \f$ | \epsilon |^1_{2} = \left [ \int^1_{-1} [u -
1099 * u_{exact}]^2 + \nabla(u - u_{exact})\cdot\nabla(u -
1100 * u_{exact})\cdot dx \right]^{1/2} d\xi_1 \f$ where \f$
1101 * u_{exact}\f$ is given by the array \a sol.
1102 *
1103 * This function takes the physical value space array
1104 * \a m_phys as approximate solution
1105 *
1106 * \param sol array of solution function at physical quadrature
1107 * points
1108 * \return returns the \f$ H_1 \f$ error as a double.
1109 */
1111 H1(const Array<OneD, const NekDouble> &phys,
1113
1114 // I/O routines
1116 {
1118 p.reserve(m_base.size());
1119 for (size_t i = 0; i < m_base.size(); ++i)
1120 {
1121 p.push_back(m_base[i]->GetPointsKey());
1122 }
1123 return p;
1124 }
1125
1127 const DNekScalMatSharedPtr &m_transformationmatrix)
1128 {
1129 return v_BuildInverseTransformationMatrix(m_transformationmatrix);
1130 }
1131
1132 /** \brief This function performs an interpolation from
1133 * the physical space points provided at input into an
1134 * array of equispaced points which are not the collapsed
1135 * coordinate. So for a tetrahedron you will only get a
1136 * tetrahedral number of values.
1137 *
1138 * This is primarily used for output purposes to get a
1139 * better distribution of points more suitable for most
1140 * postprocessing
1141 */
1143 const Array<OneD, const NekDouble> &inarray,
1144 Array<OneD, NekDouble> &outarray, int npset = -1);
1145
1146 /** \brief This function provides the connectivity of
1147 * local simplices (triangles or tets) to connect the
1148 * equispaced data points provided by
1149 * PhysInterpToSimplexEquiSpaced
1150 *
1151 * This is a virtual call to the function
1152 * \a v_GetSimplexEquiSpaceConnectivity
1153 */
1155 Array<OneD, int> &conn, bool standard = true)
1156 {
1157 v_GetSimplexEquiSpacedConnectivity(conn, standard);
1158 }
1159
1160 /** \brief This function performs a
1161 * projection/interpolation from the equispaced points
1162 * sometimes used in post-processing onto the coefficient
1163 * space
1164 *
1165 * This is primarily used for output purposes to use a
1166 * more even distribution of points more suitable for alot of
1167 * postprocessing
1168 */
1170 const Array<OneD, const NekDouble> &inarray,
1171 Array<OneD, NekDouble> &outarray);
1172
1173 template <class T> std::shared_ptr<T> as()
1174 {
1175 return std::dynamic_pointer_cast<T>(shared_from_this());
1176 }
1177
1179 Array<OneD, NekDouble> &outarray,
1180 bool multiplybyweights = true)
1181 {
1182 v_IProductWRTBase_SumFac(inarray, outarray, multiplybyweights);
1183 }
1184
1186 DNekMatSharedPtr &mat)
1187 {
1188 v_GenStdMatBwdDeriv(dir, mat);
1189 }
1190
1191protected:
1193 m_base; /**< Bases needed for the expansion */
1195 int m_ncoeffs; /**< Total number of coefficients used in the expansion */
1196
1201
1203 {
1204 return v_CreateStdMatrix(mkey);
1205 }
1206
1207 /** \brief Create the static condensation of a matrix when
1208 using a boundary interior decomposition
1209
1210 If a matrix system can be represented by
1211 \f$ Mat = \left [ \begin{array}{cc}
1212 A & B \\
1213 C & D \end{array} \right ] \f$
1214 This routine creates a matrix containing the statically
1215 condense system of the form
1216 \f$ Mat = \left [ \begin{array}{cc}
1217 A - B D^{-1} C & B D^{-1} \\
1218 D^{-1} C & D^{-1} \end{array} \right ] \f$
1219 **/
1222
1224 Array<OneD, NekDouble> &outarray)
1225 {
1226 v_BwdTrans_SumFac(inarray, outarray);
1227 }
1228
1230 const int dir, const Array<OneD, const NekDouble> &inarray,
1231 Array<OneD, NekDouble> &outarray)
1232 {
1233 v_IProductWRTDerivBase_SumFac(dir, inarray, outarray);
1234 }
1235
1237 const Array<OneD, const NekDouble> &direction,
1238 const Array<OneD, const NekDouble> &inarray,
1239 Array<OneD, NekDouble> &outarray)
1240 {
1241 v_IProductWRTDirectionalDerivBase_SumFac(direction, inarray, outarray);
1242 }
1243
1244 // The term _MatFree denotes that the action of the
1245 // MatrixOperation is done withouth actually using the
1246 // matrix (which then needs to be stored/calculated).
1247 // Although this does not strictly mean that no matrix
1248 // operations are involved in the evaluation of the
1249 // operation, we use this term in the same context used as
1250 // in the following paper: R. C. Kirby, M. G. Knepley,
1251 // A. Logg, and L. R. Scott, "Optimizing the evaluation of
1252 // finite element matrices," SISC 27:741-758 (2005)
1254 const Array<OneD, const NekDouble> &inarray,
1255 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1256
1258 const Array<OneD, const NekDouble> &inarray,
1259 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1260
1262 Array<OneD, NekDouble> &outarray,
1263 const StdMatrixKey &mkey)
1264 {
1265 v_LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
1266 }
1267
1269 const Array<OneD, const NekDouble> &inarray,
1271 {
1272 v_LaplacianMatrixOp_MatFree_Kernel(inarray, outarray, wsp);
1273 }
1274
1276 const Array<OneD, const NekDouble> &inarray,
1277 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1278
1280 const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
1281 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1282
1284 const int i, const Array<OneD, const NekDouble> &inarray,
1285 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1286
1288 const Array<OneD, const NekDouble> &inarray,
1289 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1290
1292 const Array<OneD, const NekDouble> &inarray,
1293 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1294
1296 const Array<OneD, const NekDouble> &inarray,
1297 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1298
1300 const Array<OneD, const NekDouble> &inarray,
1301 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1302 bool addDiffusionTerm = true);
1303
1305 Array<OneD, NekDouble> &outarray,
1306 const StdMatrixKey &mkey)
1307 {
1308 v_HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
1309 }
1310
1312 const Array<OneD, const NekDouble> &inarray,
1313 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1314
1317 Array<OneD, NekDouble> &outarray);
1318
1320 const Array<OneD, const NekDouble> &Lcoord,
1321 const Array<OneD, const NekDouble> &physvals);
1322
1324 [[maybe_unused]] const int dir, [[maybe_unused]] DNekMatSharedPtr &mat)
1325 {
1326 NEKERROR(ErrorUtil::efatal, "not defined");
1327 }
1328
1330 const Array<OneD, const NekDouble> &inarray,
1331 Array<OneD, NekDouble> &outarray);
1332
1333 /**
1334 * @brief This function performs the barycentric interpolation of
1335 * the polynomial stored in @p coord at a point @p physvals using
1336 * barycentric interpolation weights in direction @tparam DIR.
1337 * It can also perform the barycentric interpolation of the
1338 * derivative of the polynomial if @tparam DERIV is set to true,
1339 * which outputs in to @param deriv.
1340 *
1341 * This method is intended to be used a helper function for
1342 * StdExpansion::PhysEvaluate and its elemental instances, so that
1343 * the calling method should provide @p coord for x, y and z
1344 * sequentially and the appropriate @p physvals and @p weights for
1345 * that particular direction.
1346 *
1347 * @param coord The coordinate of the single point.
1348 * @param physvals The polynomial stored at each quadrature point.
1349 * @param deriv The value of the derivative.
1350 * @param deriv The value of the 2nd derivative.
1351 * @tparam DIR The direction of evaluation.
1352 * @tparam DERIV Bool to find derivative.
1353 *
1354 * @return The value of @p physvals at @p coord in direction @p dir.
1355 */
1356 template <int DIR, bool DERIV = false, bool DERIV2 = false>
1357 inline NekDouble BaryEvaluate(const NekDouble &coord,
1358 const NekDouble *physvals, NekDouble &deriv,
1359 NekDouble &deriv2)
1360 {
1361 NekDouble numer1 = 0.0, numer2 = 0.0, numer3 = 0.0, numer4 = 0.0,
1362 numer5 = 0.0, denom = 0.0;
1363
1364 ASSERTL2(DIR < m_base.size(),
1365 "Direction should be less than shape dimension.");
1366
1367 const Array<OneD, const NekDouble> &z = m_base[DIR]->GetZ();
1368 const Array<OneD, const NekDouble> &bw = m_base[DIR]->GetBaryWeights();
1369
1370 const size_t nquad = z.size();
1371
1372 for (size_t i = 0; i < nquad; ++i)
1373 {
1374 NekDouble xdiff = z[i] - coord;
1375 NekDouble pval = physvals[i];
1376
1377 /*
1378 * (in this specific case) you actually
1379 * want to do the comparison exactly
1380 * (believe it or not!) See chapter 7 of
1381 * the paper here:
1382 *https://people.maths.ox.ac.uk/trefethen/barycentric.pdf
1383 */
1384 if ((!DERIV && xdiff == 0.0) ||
1385 ((DERIV || DERIV2) && std::abs(xdiff) < 1e-15))
1386 {
1387
1388 if constexpr (DERIV2)
1389 {
1390 DNekMatSharedPtr D0 = m_base[DIR]->GetD();
1391
1392 // take ith row of z and multiply with physvals
1393 Array<OneD, NekDouble> tmp(nquad);
1394 for (int kk = 0; kk < nquad; kk++)
1395 {
1396 tmp[kk] = Vmath::Dot(nquad, &(D0->GetPtr())[kk], nquad,
1397 &physvals[0], 1);
1398 }
1399
1400 deriv2 = Vmath::Dot(nquad, &(D0->GetPtr())[i], nquad,
1401 &tmp[0], 1);
1402 deriv = tmp[i];
1403 }
1404 else if constexpr (DERIV)
1405 {
1406 DNekMatSharedPtr D0 = m_base[DIR]->GetD();
1407
1408 // take ith row of z and multiply with physvals
1409 deriv = Vmath::Dot(z.size(), &(D0->GetPtr())[i], z.size(),
1410 &physvals[0], 1);
1411 }
1412
1413 return pval;
1414 }
1415
1416 NekDouble tmp = bw[i] / xdiff;
1417 numer1 += tmp * pval;
1418 denom += tmp;
1419
1420 if constexpr (DERIV || DERIV2)
1421 {
1422 NekDouble tmp2 = tmp / xdiff;
1423 numer2 += tmp2 * pval;
1424 numer3 += tmp2;
1425
1426 if constexpr (DERIV2)
1427 {
1428 NekDouble tmp3 = tmp2 / xdiff;
1429 numer4 += tmp3 * pval;
1430 numer5 += tmp3;
1431 }
1432 }
1433 }
1434
1435 if constexpr (DERIV || DERIV2)
1436 {
1437 NekDouble denomdenom = denom * denom;
1438 NekDouble numer1numer3 = numer1 * numer3;
1439
1440 deriv = (numer2 * denom - numer1numer3) / (denomdenom);
1441
1442 if constexpr (DERIV2)
1443 {
1444 deriv2 = (2.0 * numer4 / denom) -
1445 (2.0 * numer5 * numer1) / (denomdenom) -
1446 (2.0 * numer2 * numer3) / (denomdenom) +
1447 (2.0 * numer3 * numer1numer3) / (denomdenom * denom);
1448 }
1449 }
1450
1451 return numer1 / denom;
1452 }
1453
1454 /**
1455 * @brief This function evaluates the basis function mode @p mode at
1456 * a point @p coords of the domain in direction @dir.
1457 *
1458 * @param coord The coordinate inside the standard region.
1459 * @param mode The mode number to be evaluated of #m_base[dir]
1460 * @param dir The direction of interpolation.
1461 *
1462 * @return The value of the basis function @p mode at @p coords in
1463 * direction @p dir.
1464 */
1465 template <int DIR>
1466 inline NekDouble BaryEvaluateBasis(const NekDouble &coord, const int &mode)
1467 {
1468 const int nquad = m_base[DIR]->GetNumPoints();
1469 return BaryEvaluate<DIR>(coord,
1470 &(m_base[DIR]->GetBdata())[0] + nquad * mode);
1471 }
1472
1473 /**
1474 * @brief Helper function to pass an unused value by reference into
1475 * BaryEvaluate.
1476 *
1477 * @param coord The coordinate of the single point.
1478 * @param physvals The polynomial stored at each quadrature point.
1479 * @tparam DIR The direction of evaluation.
1480 * @tparam DERIV Bool to find derivative.
1481 *
1482 * @return The value of @p physvals at @p coord in direction @p dir.
1483 */
1484 template <int DIR, bool DERIV = false, bool DERIV2 = false>
1485 inline NekDouble BaryEvaluate(const NekDouble &coord,
1486 const NekDouble *physvals)
1487 {
1488 NekDouble unusedValue = 0.0;
1489 return BaryEvaluate<DIR, DERIV, DERIV2>(coord, physvals, unusedValue,
1490 unusedValue);
1491 }
1492
1493 template <int DIR, bool DERIV = false, bool DERIV2 = false>
1494 inline NekDouble BaryEvaluate(const NekDouble &coord,
1495 const NekDouble *physvals, NekDouble &deriv)
1496 {
1497 NekDouble unusedValue = 0.0;
1498 return BaryEvaluate<DIR, DERIV, DERIV2>(coord, physvals, deriv,
1499 unusedValue);
1500 }
1501
1502private:
1503 // Virtual functions
1504 STD_REGIONS_EXPORT virtual int v_GetNverts() const = 0;
1505 STD_REGIONS_EXPORT virtual int v_GetNtraces() const = 0;
1506
1507 STD_REGIONS_EXPORT virtual int v_NumBndryCoeffs() const = 0;
1509
1510 STD_REGIONS_EXPORT virtual int v_GetTraceNcoeffs(const int i) const = 0;
1511 STD_REGIONS_EXPORT virtual int v_GetTraceIntNcoeffs(const int i) const = 0;
1512 STD_REGIONS_EXPORT virtual int v_GetTraceNumPoints(const int i) const = 0;
1513
1515 const int i, const int k, bool UseGLL = false) const;
1516
1518 const int i, const int j) const;
1519
1521 const;
1522
1524 const = 0;
1525
1526 STD_REGIONS_EXPORT virtual std::shared_ptr<StdExpansion> v_GetStdExp()
1527 const;
1528
1529 STD_REGIONS_EXPORT virtual std::shared_ptr<StdExpansion> v_GetLinStdExp(
1530 void) const;
1531
1533
1535
1537
1539 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1540 [[maybe_unused]] Array<OneD, NekDouble> &outarray){};
1541
1543 const Array<OneD, const NekDouble> &inarray,
1544 Array<OneD, NekDouble> &outarray) = 0;
1545
1546 /**
1547 * @brief Transform a given function from physical quadrature space
1548 * to coefficient space.
1549 * @see StdExpansion::FwdTrans
1550 */
1552 const Array<OneD, const NekDouble> &inarray,
1553 Array<OneD, NekDouble> &outarray) = 0;
1554
1555 /**
1556 * @brief Calculates the inner product of a given function \a f
1557 * with the different modes of the expansion
1558 */
1560 const Array<OneD, const NekDouble> &inarray,
1561 Array<OneD, NekDouble> &outarray) = 0;
1562
1564 [[maybe_unused]] const Array<OneD, const NekDouble> &base,
1565 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1566 [[maybe_unused]] Array<OneD, NekDouble> &outarray,
1567 [[maybe_unused]] int coll_check)
1568 {
1569 NEKERROR(ErrorUtil::efatal, "StdExpansion::v_IProductWRTBase has no "
1570 "(and should have no) implementation");
1571 }
1572
1574 const int dir, const Array<OneD, const NekDouble> &inarray,
1575 Array<OneD, NekDouble> &outarray);
1576
1578 const Array<OneD, const NekDouble> &direction,
1579 const Array<OneD, const NekDouble> &inarray,
1580 Array<OneD, NekDouble> &outarray);
1581
1583 const Array<OneD, const NekDouble> &inarray,
1584 Array<OneD, NekDouble> &outarray);
1585
1587 const Array<OneD, const NekDouble> &inarray);
1588
1589 STD_REGIONS_EXPORT virtual void v_PhysDeriv(
1590 const Array<OneD, const NekDouble> &inarray,
1592 Array<OneD, NekDouble> &out_d3);
1593
1594 STD_REGIONS_EXPORT virtual void v_PhysDeriv_s(
1595 const Array<OneD, const NekDouble> &inarray,
1596 Array<OneD, NekDouble> &out_ds);
1597
1598 STD_REGIONS_EXPORT virtual void v_PhysDeriv_n(
1599 const Array<OneD, const NekDouble> &inarray,
1600 Array<OneD, NekDouble> &out_dn);
1601
1602 STD_REGIONS_EXPORT virtual void v_PhysDeriv(
1603 const int dir, const Array<OneD, const NekDouble> &inarray,
1604 Array<OneD, NekDouble> &out_d0);
1605
1607 const Array<OneD, const NekDouble> &inarray,
1608 const Array<OneD, const NekDouble> &direction,
1609 Array<OneD, NekDouble> &outarray);
1610
1612 const Array<OneD, const NekDouble> &inarray,
1614 Array<OneD, NekDouble> &out_d3);
1615
1617 const int dir, const Array<OneD, const NekDouble> &inarray,
1618 Array<OneD, NekDouble> &outarray);
1619
1621 const Array<OneD, const NekDouble> &coords,
1622 const Array<OneD, const NekDouble> &physvals);
1623
1626 const Array<OneD, const NekDouble> &physvals);
1627
1629 const Array<OneD, NekDouble> &coord,
1630 const Array<OneD, const NekDouble> &inarray,
1631 std::array<NekDouble, 3> &firstOrderDerivs);
1632
1634 const Array<OneD, NekDouble> &coord,
1635 const Array<OneD, const NekDouble> &inarray,
1636 std::array<NekDouble, 3> &firstOrderDerivs,
1637 std::array<NekDouble, 6> &secondOrderDerivs);
1638
1640 const Array<OneD, const NekDouble> &coords, int mode);
1641
1644
1647
1648 STD_REGIONS_EXPORT virtual void v_PhysInterp(
1649 std::shared_ptr<StdExpansion> FromExp,
1650 const Array<OneD, const NekDouble> &fromData,
1651 Array<OneD, NekDouble> &toData);
1652
1654 virtual void v_FillMode(const int mode, Array<OneD, NekDouble> &outarray);
1655
1657 const StdMatrixKey &mkey);
1658
1660 const StdMatrixKey &mkey);
1661
1662 STD_REGIONS_EXPORT virtual void v_GetCoords(
1664 Array<OneD, NekDouble> &coords_2);
1665
1666 STD_REGIONS_EXPORT virtual void v_GetCoord(
1667 const Array<OneD, const NekDouble> &Lcoord,
1668 Array<OneD, NekDouble> &coord);
1669
1670 STD_REGIONS_EXPORT virtual int v_GetCoordim() const;
1671
1673 Array<OneD, unsigned int> &outarray);
1674
1676 Array<OneD, unsigned int> &outarray);
1677
1678 STD_REGIONS_EXPORT virtual int v_GetVertexMap(int localVertexId,
1679 bool useCoeffPacking = false);
1680
1682 const int tid, Array<OneD, unsigned int> &maparray,
1683 Array<OneD, int> &signarray, Orientation traceOrient = eForwards,
1684 int P = -1, int Q = -1);
1685
1687 const unsigned int traceid, Array<OneD, unsigned int> &maparray);
1688
1690 const unsigned int tid, Array<OneD, unsigned int> &maparray,
1691 Array<OneD, int> &signarray, Orientation traceOrient = eForwards,
1692 int P = -1, int Q = -1);
1693
1695 const int eid, Array<OneD, unsigned int> &maparray,
1696 Array<OneD, int> &signarray, const Orientation traceOrient = eForwards);
1697
1699 const int fid, int &numModes0, int &numModes1,
1701
1703 const int vertex, const Array<OneD, const NekDouble> &inarray,
1704 NekDouble &outarray);
1705
1707 const Array<OneD, const NekDouble> &inarray,
1708 Array<OneD, NekDouble> &outarray);
1709
1711 const Array<OneD, const NekDouble> &inarray,
1712 Array<OneD, NekDouble> &outarray);
1713
1715 const Array<OneD, const NekDouble> &inarray,
1716 Array<OneD, NekDouble> &outarray, bool multiplybyweights = true);
1717
1719 const int dir, const Array<OneD, const NekDouble> &inarray,
1720 Array<OneD, NekDouble> &outarray);
1721
1723 const Array<OneD, const NekDouble> &direction,
1724 const Array<OneD, const NekDouble> &inarray,
1725 Array<OneD, NekDouble> &outarray);
1726
1728 const Array<OneD, const NekDouble> &inarray,
1729 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1730
1732 const Array<OneD, const NekDouble> &inarray,
1733 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1734
1736 Array<OneD, NekDouble> &array, const StdMatrixKey &mkey);
1737
1739 Array<OneD, NekDouble> &array, const NekDouble alpha,
1740 const NekDouble exponent, const NekDouble cutoff);
1741
1743 int numMin, const Array<OneD, const NekDouble> &inarray,
1744 Array<OneD, NekDouble> &outarray);
1745
1747 const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
1748 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1749
1751 const int i, const Array<OneD, const NekDouble> &inarray,
1752 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1753
1755 const Array<OneD, const NekDouble> &inarray,
1756 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1757
1759 const Array<OneD, const NekDouble> &inarray,
1760 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1761
1763 const Array<OneD, const NekDouble> &inarray,
1764 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1765
1767 const Array<OneD, const NekDouble> &inarray,
1768 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1769 bool addDiffusionTerm = true);
1770
1772 const Array<OneD, const NekDouble> &inarray,
1773 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1774
1776 const Array<OneD, const NekDouble> &inarray,
1777 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1778
1780 const Array<OneD, const NekDouble> &inarray,
1782
1784 const Array<OneD, const NekDouble> &inarray,
1785 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1786
1788 const DNekScalMatSharedPtr &m_transformationmatrix);
1789
1791 Array<OneD, int> &conn, bool standard = true);
1792};
1793
1794typedef std::shared_ptr<StdExpansion> StdExpansionSharedPtr;
1795typedef std::vector<StdExpansionSharedPtr> StdExpansionVector;
1796
1797/**
1798 * This function is a wrapper around the virtual function
1799 * \a v_FwdTrans()
1800 *
1801 * Given a function evaluated at the quadrature points, this
1802 * function calculates the expansion coefficients such that the
1803 * resulting expansion approximates the original function.
1804 *
1805 * The calculation of the expansion coefficients is done using a
1806 * Galerkin projection. This is equivalent to the operation:
1807 * \f[ \mathbf{\hat{u}} = \mathbf{M}^{-1} \mathbf{I}\f]
1808 * where
1809 * - \f$\mathbf{M}[p][q]= \int\phi_p(\mathbf{\xi})\phi_q(
1810 * \mathbf{\xi}) d\mathbf{\xi}\f$ is the Mass matrix
1811 * - \f$\mathbf{I}[p] = \int\phi_p(\mathbf{\xi}) u(\mathbf{\xi})
1812 * d\mathbf{\xi}\f$
1813 *
1814 * This function takes the array \a inarray as the values of the
1815 * function evaluated at the quadrature points
1816 * (i.e. \f$\mathbf{u}\f$),
1817 * and stores the resulting coefficients \f$\mathbf{\hat{u}}\f$
1818 * in the \a outarray
1819 *
1820 * @param inarray array of the function discretely evaluated at the
1821 * quadrature points
1822 *
1823 * @param outarray array of the function coefficieints
1824 */
1826 Array<OneD, NekDouble> &outarray)
1827{
1828 v_FwdTrans(inarray, outarray);
1829}
1830
1831} // namespace Nektar::StdRegions
1832
1833#endif // STANDARDDEXPANSION_H
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
Definition: ErrorUtil.hpp:265
#define STD_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:45
Defines a specification for a set of points.
Definition: Points.h:50
The base class for all shapes.
Definition: StdExpansion.h:65
void PhysDeriv(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:866
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:678
virtual void v_LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void NodalToModal(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:400
virtual int v_GetVertexMap(int localVertexId, bool useCoeffPacking=false)
virtual void v_LocCollapsedToLocCoord(const Array< OneD, const NekDouble > &eta, Array< OneD, NekDouble > &xi)
virtual ~StdExpansion()
Destructor.
virtual void v_PhysDeriv_n(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_dn)
const LibUtilities::BasisSharedPtr & GetBasis(int dir) const
This function gets the shared point to basis in the dir direction.
Definition: StdExpansion.h:112
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.
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
Definition: StdExpansion.h:124
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.
Definition: StdExpansion.h:134
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.
Definition: StdExpansion.h:500
virtual NekDouble v_StdPhysEvaluate(const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals)
const LibUtilities::PointsKey GetNodalPointsKey() const
This function returns the type of expansion Nodal point type if defined.
Definition: StdExpansion.h:342
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 PhysDeriv_s(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_ds)
Definition: StdExpansion.h:872
void WeakDirectionalDerivMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:810
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 DropLocStaticCondMatrix(const LocalRegions::MatrixKey &mkey)
Definition: StdExpansion.h:656
std::shared_ptr< StdExpansion > GetStdExp() const
Definition: StdExpansion.h:375
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, const Array< OneD, const NekDouble > &Fz, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:635
int GetTraceNumPoints(const int i) const
This function returns the number of quadrature points belonging to the i-th trace.
Definition: StdExpansion.h:281
void GetElmtTraceToTraceMap(const unsigned int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards, int P=-1, int Q=-1)
Definition: StdExpansion.h:708
void LaplacianMatrixOp_MatFree_GenericImpl(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
Definition: StdExpansion.h:156
virtual void v_IProductWRTDirectionalDerivBase_SumFac(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual int v_GetNverts() const =0
LibUtilities::PointsKey GetTracePointsKey(const int i, int k=-1) const
This function returns the basis key belonging to the i-th trace.
Definition: StdExpansion.h:320
void MassLevelCurvatureMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:817
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)
Definition: StdExpansion.h:612
void LaplacianMatrixOp(const int k1, const int k2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:794
NekDouble BaryEvaluate(const NekDouble &coord, const NekDouble *physvals, NekDouble &deriv)
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &base, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int coll_check)
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)
const LibUtilities::PointsKeyVector GetPointsKeys() const
virtual void v_NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
int GetTraceIntNcoeffs(const int i) const
Definition: StdExpansion.h:266
void LocCoordToLocCollapsed(const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta)
Convert local cartesian coordinate xi into local collapsed coordinates eta.
virtual void v_GetSimplexEquiSpacedConnectivity(Array< OneD, int > &conn, bool standard=true)
void GetSimplexEquiSpacedConnectivity(Array< OneD, int > &conn, bool standard=true)
This function provides the connectivity of local simplices (triangles or tets) to connect the equispa...
DNekBlkMatSharedPtr GetStdStaticCondMatrix(const StdMatrixKey &mkey)
Definition: StdExpansion.h:617
const Array< OneD, const NekDouble > & GetPoints(const int dir) const
This function returns a pointer to the array containing the quadrature points in dir direction.
Definition: StdExpansion.h:232
virtual void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdMatrixKey &mkey)
virtual std::shared_ptr< StdExpansion > v_GetLinStdExp(void) const
void WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:802
int EvalBasisNumModesMax(void) const
This function returns the maximum number of expansion modes over all local directions.
Definition: StdExpansion.h:181
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.
void PhysDirectionalDeriv(const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &direction, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:884
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 FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:446
void MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:761
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
int CalcNumberOfCoefficients(const std::vector< unsigned int > &nummodes, int &modes_offset)
Definition: StdExpansion.h:662
void GetCoord(const Array< OneD, const NekDouble > &Lcoord, Array< OneD, NekDouble > &coord)
given the coordinates of a point of the element in the local collapsed coordinate system,...
Definition: StdExpansion.h:606
virtual void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void StdPhysDeriv(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:899
virtual void v_HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void PhysDeriv_n(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_dn)
Definition: StdExpansion.h:878
virtual void v_WeakDirectionalDerivMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
const Array< OneD, const LibUtilities::BasisSharedPtr > & GetBase() const
This function gets the shared point to basis.
Definition: StdExpansion.h:100
void BwdTrans_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
DNekScalBlkMatSharedPtr GetLocStaticCondMatrix(const LocalRegions::MatrixKey &mkey)
Definition: StdExpansion.h:650
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)
void SetElmtId(const int id)
Set the element id of this expansion when used in a list by returning value of m_elmt_id.
Definition: StdExpansion.h:574
virtual int v_NumDGBndryCoeffs() const =0
void IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
Definition: StdExpansion.h:688
void GetTraceCoeffMap(const unsigned int traceid, Array< OneD, unsigned int > &maparray)
Definition: StdExpansion.h:702
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:622
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)
Definition: StdExpansion.h:824
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)
std::shared_ptr< StdExpansion > GetLinStdExp(void) const
Definition: StdExpansion.h:380
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...
Definition: StdExpansion.h:537
virtual bool v_IsBoundaryInteriorExpansion() const
int GetNtraces() const
Returns the number of trace elements connected to this element.
Definition: StdExpansion.h:354
virtual void v_MultiplyByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
int GetNverts() const
This function returns the number of vertices of the expansion domain.
Definition: StdExpansion.h:246
virtual int v_NumBndryCoeffs() const =0
void LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:768
NekDouble BaryEvaluate(const NekDouble &coord, const NekDouble *physvals, NekDouble &deriv, NekDouble &deriv2)
This function performs the barycentric interpolation of the polynomial stored in coord at a point phy...
virtual int v_GetShapeDimension() const =0
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)
void NormVectorIProductWRTBase(const Array< OneD, const Array< OneD, NekDouble > > &Fvec, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:643
void GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2=NullNekDouble1DArray, Array< OneD, NekDouble > &coords_3=NullNekDouble1DArray)
this function returns the physical coordinates of the quadrature points of the expansion
Definition: StdExpansion.h:588
void IProductWRTDirectionalDerivBase(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:557
virtual void v_MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
int GetElmtId()
Get the element id of this expansion when used in a list by returning value of m_elmt_id.
Definition: StdExpansion.h:567
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
NekDouble PhysEvaluate(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals)
This function evaluates the expansion at a single (arbitrary) point of the domain.
Definition: StdExpansion.h:928
void GetTraceToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards, int P=-1, int Q=-1)
Definition: StdExpansion.h:693
void IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:550
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.
Definition: StdExpansion.h:370
virtual void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual int v_GetTraceNumPoints(const int i) const =0
virtual void v_IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual DNekMatSharedPtr v_GenMatrix(const StdMatrixKey &mkey)
NekDouble BaryEvaluate(const NekDouble &coord, const NekDouble *physvals)
Helper function to pass an unused value by reference into BaryEvaluate.
void GetInteriorMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:683
void BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Backward transformation from coefficient space to physical space.
Definition: StdExpansion.h:433
void PhysInterp(std::shared_ptr< StdExpansion > fromExp, const Array< OneD, const NekDouble > &fromData, Array< OneD, NekDouble > &toData)
interpolate from one set of quadrature points available from FromExp to the set of quadrature points ...
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdMatrixKey &mkey)
void GetTraceInteriorToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, const Orientation traceOrient=eForwards)
Definition: StdExpansion.h:717
int GetTraceNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th trace.
Definition: StdExpansion.h:261
DNekMatSharedPtr GenMatrix(const StdMatrixKey &mkey)
Definition: StdExpansion.h:853
virtual void v_NodalToModal(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_BwdTrans_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
NekDouble PhysEvaluateBasis(const Array< OneD, const NekDouble > &coords, int mode)
This function evaluates the basis function mode mode at a point coords of the domain.
virtual void v_GetTraceNumModes(const int fid, int &numModes0, int &numModes1, Orientation traceOrient=eDir1FwdDir1_Dir2FwdDir2)
virtual void v_PhysDeriv_s(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_ds)
virtual void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void ExponentialFilter(Array< OneD, NekDouble > &array, const NekDouble alpha, const NekDouble exponent, const NekDouble cutoff)
Definition: StdExpansion.h:788
int GetNumBases() const
This function returns the number of 1D bases used in the expansion.
Definition: StdExpansion.h:91
DNekMatSharedPtr BuildInverseTransformationMatrix(const DNekScalMatSharedPtr &m_transformationmatrix)
void GetTraceNumModes(const int tid, int &numModes0, int &numModes1, const Orientation traceOrient=eDir1FwdDir1_Dir2FwdDir2)
Definition: StdExpansion.h:725
std::shared_ptr< T > as()
LibUtilities::PointsType GetPointsType(const int dir) const
This function returns the type of quadrature points used in the dir direction.
Definition: StdExpansion.h:205
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Forward transformation from physical space to coefficient space.
virtual void v_GetBoundaryMap(Array< OneD, unsigned int > &outarray)
void GenStdMatBwdDeriv(const int dir, DNekMatSharedPtr &mat)
virtual int v_GetNtraces() const =0
void ReduceOrderCoeffs(int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:775
virtual void v_MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
LibUtilities::NekManager< StdMatrixKey, DNekBlkMat, StdMatrixKey::opLess > m_stdStaticCondMatrixManager
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)
Definition: StdExpansion.h:831
int GetNumPoints(const int dir) const
This function returns the number of quadrature points in the dir direction.
Definition: StdExpansion.h:218
void IProductWRTDirectionalDerivBase_SumFac(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true)
void MultiplyByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:732
virtual void v_LocCoordToLocCollapsed(const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta)
virtual LibUtilities::ShapeType v_DetShapeType() const =0
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 StdPhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
Definition: StdExpansion.h:891
const LibUtilities::BasisKey GetTraceBasisKey(const int i, int k=-1, bool UseGLL=false) const
This function returns the basis key belonging to the i-th trace.
Definition: StdExpansion.h:301
void MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:738
void LocCollapsedToLocCoord(const Array< OneD, const NekDouble > &eta, Array< OneD, NekDouble > &xi)
Convert local collapsed coordinates eta into local cartesian coordinate xi.
NekDouble PhysEvaluate(const Array< OneD, NekDouble > &coord, const Array< OneD, const NekDouble > &inarray, std::array< NekDouble, 3 > &firstOrderDerivs, std::array< NekDouble, 6 > &secondOrderDerivs)
Definition: StdExpansion.h:953
virtual void v_PhysInterp(std::shared_ptr< StdExpansion > FromExp, const Array< OneD, const NekDouble > &fromData, Array< OneD, NekDouble > &toData)
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)
Definition: StdExpansion.h:846
NekDouble PhysEvaluate(const Array< OneD, DNekMatSharedPtr > &I, const Array< OneD, const NekDouble > &physvals)
This function evaluates the expansion at a single (arbitrary) point of the domain.
Definition: StdExpansion.h:983
virtual void v_ReduceOrderCoeffs(int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)=0
Transform a given function from physical quadrature space to coefficient space.
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 int v_GetTraceIntNcoeffs(const int i) const =0
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 IProductWRTBase(const Array< OneD, const NekDouble > &base, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int coll_check)
Definition: StdExpansion.h:543
virtual NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray)
Integrates the specified function over the domain.
NekDouble BaryEvaluateBasis(const NekDouble &coord, const int &mode)
void SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdMatrixKey &mkey)
Definition: StdExpansion.h:782
virtual std::shared_ptr< StdExpansion > v_GetStdExp() const
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
LibUtilities::NekManager< StdMatrixKey, DNekMat, StdMatrixKey::opLess > m_stdMatrixManager
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:169
virtual LibUtilities::PointsKey v_GetTracePointsKey(const int i, const int j) const
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
Definition: StdExpansion.h:858
Array< OneD, LibUtilities::BasisSharedPtr > m_base
void LaplacianMatrixOp_MatFree_Kernel(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp)
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_IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true)
DNekMatSharedPtr CreateStdMatrix(const StdMatrixKey &mkey)
virtual void v_IProductWRTDirectionalDerivBase(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual int v_GetTraceNcoeffs(const int i) const =0
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, const Array< OneD, NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:628
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_GenStdMatBwdDeriv(const int dir, DNekMatSharedPtr &mat)
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)
NekDouble StdPhysEvaluate(const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals)
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 PhysEvaluate(const Array< OneD, NekDouble > &coord, const Array< OneD, const NekDouble > &inarray, std::array< NekDouble, 3 > &firstOrderDerivs)
This function evaluates the first derivative of the expansion at a single (arbitrary) point of the do...
Definition: StdExpansion.h:945
NekDouble Integral(const Array< OneD, const NekDouble > &inarray)
This function integrates the specified function over the domain.
Definition: StdExpansion.h:482
std::shared_ptr< Basis > BasisSharedPtr
static const BasisKey NullBasisKey(eNoBasisType, 0, NullPointsKey)
Defines a null basis with no type or points.
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:231
@ P
Monomial polynomials .
Definition: BasisType.h:62
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::vector< StdExpansionSharedPtr > StdExpansionVector
std::vector< double > z(NPUPPER)
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:77
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:79
static Array< OneD, NekDouble > NullNekDouble1DArray
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75
double NekDouble
T Dot(int n, const T *w, const T *x)
dot product
Definition: Vmath.hpp:761
scalarT< T > abs(scalarT< T > in)
Definition: scalar.hpp:289