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 *
295 * \return returns the number of Basis key of the ith
296 * trace in the k th direction (when trace is a 2D
297 * object)
298 */
299 const LibUtilities::BasisKey GetTraceBasisKey(const int i, int k = -1) const
300 {
301 return v_GetTraceBasisKey(i, k);
302 }
303
304 /** \brief This function returns the basis key belonging
305 * to the \a i-th trace
306 *
307 * This function is a wrapper around the virtual function
308 * \a v_GetTracePointsKey()
309 *
310 * \param i specifies which trace id
311 * \param k is the direction of the basis key for 2D traces
312 *
313 * \return returns the number of Points key of the ith
314 * trace in the k th direction (when trace is a 2D
315 * object)
316 */
317 LibUtilities::PointsKey GetTracePointsKey(const int i, int k = -1) const
318 {
319 return v_GetTracePointsKey(i, k);
320 }
321
322 int NumBndryCoeffs(void) const
323 {
324 return v_NumBndryCoeffs();
325 }
326
327 int NumDGBndryCoeffs(void) const
328 {
329 return v_NumDGBndryCoeffs();
330 }
331
332 /** \brief This function returns the type of expansion
333 * Nodal point type if defined
334 *
335 * This function is a wrapper around the virtual function
336 * \a v_GetNodalPointsKey()
337 *
338 */
340 {
341 return v_GetNodalPointsKey();
342 };
343
344 /**
345 * @brief Returns the number of trace elements connected to this
346 * element.
347 *
348 * For example, a quadrilateral has four edges, so this function
349 * would return 4.
350 */
351 int GetNtraces() const
352 {
353 return v_GetNtraces();
354 }
355
356 /** \brief This function returns the shape of the expansion domain
357 *
358 * This function is a wrapper around the virtual function
359 * \a v_DetShapeType()
360 *
361 * The different shape types implemented in the code are defined
362 * in the ::ShapeType enumeration list. As a result, the
363 * function will return one of the types of this enumeration list.
364 *
365 * \return returns the shape of the expansion domain
366 */
368 {
369 return v_DetShapeType();
370 }
371
372 std::shared_ptr<StdExpansion> GetStdExp() const
373 {
374 return v_GetStdExp();
375 }
376
377 std::shared_ptr<StdExpansion> GetLinStdExp(void) const
378 {
379 return v_GetLinStdExp();
380 }
381
383 {
384 return v_GetShapeDimension();
385 }
386
388 {
390 }
391
393 {
395 }
396
397 /** \brief This function performs the Backward transformation from
398 * coefficient space to physical space
399 *
400 * This function is a wrapper around the virtual function
401 * \a v_BwdTrans()
402 *
403 * Based on the expansion coefficients, this function evaluates the
404 * expansion at the quadrature points. This is equivalent to the
405 * operation \f[ u(\xi_{1i}) =
406 * \sum_{p=0}^{P-1} \hat{u}_p \phi_p(\xi_{1i}) \f] which can be
407 * evaluated as \f$ {\bf u} = {\bf B}^T {\bf \hat{u}} \f$ with
408 * \f${\bf B}[i][j] = \phi_i(\xi_{j})\f$
409 *
410 * This function requires that the coefficient array
411 * \f$\mathbf{\hat{u}}\f$ provided as \a inarray.
412 *
413 * The resulting array
414 * \f$\mathbf{u}[m]=u(\mathbf{\xi}_m)\f$ containing the
415 * expansion evaluated at the quadrature points, is stored
416 * in the \a outarray.
417 *
418 * \param inarray contains the values of the expansion
419 * coefficients (input of the function)
420 *
421 * \param outarray contains the values of the expansion evaluated
422 * at the quadrature points (output of the function)
423 */
425 Array<OneD, NekDouble> &outarray)
426 {
427 v_BwdTrans(inarray, outarray);
428 }
429
430 /**
431 * @brief This function performs the Forward transformation from
432 * physical space to coefficient space.
433 */
434 inline void FwdTrans(const Array<OneD, const NekDouble> &inarray,
435 Array<OneD, NekDouble> &outarray);
436
438 Array<OneD, NekDouble> &outarray)
439 {
440 v_FwdTransBndConstrained(inarray, outarray);
441 }
442
443 /** \brief This function integrates the specified function over the
444 * domain
445 *
446 * This function is a wrapper around the virtual function
447 * \a v_Integral()
448 *
449 * Based on the values of the function evaluated at the quadrature
450 * points (which are stored in \a inarray), this function calculates
451 * the integral of this function over the domain. This is
452 * equivalent to the numerical evaluation of the operation
453 * \f[ I=\int u(\mathbf{\xi})d \mathbf{\xi}\f]
454 *
455 * \param inarray values of the function to be integrated evaluated
456 * at the quadrature points (i.e.
457 * \a inarray[m]=\f$u(\mathbf{\xi}_m)\f$)
458 * \return returns the value of the calculated integral
459 *
460 * Inputs:\n
461
462 - \a inarray: definition of function to be returned at quadrature point
463 of expansion.
464
465 Outputs:\n
466
467 - returns \f$\int^1_{-1}\int^1_{-1} u(\xi_1, \xi_2) J[i,j] d
468 \xi_1 d \xi_2 \f$ where \f$inarray[i,j] =
469 u(\xi_{1i},\xi_{2j}) \f$ and \f$ J[i,j] \f$ is the
470 Jacobian evaluated at the quadrature point.
471 *
472 */
474 {
475 return v_Integral(inarray);
476 }
477
478 /** \brief This function fills the array \a outarray with the
479 * \a mode-th mode of the expansion
480 *
481 * This function is a wrapper around the virtual function
482 * \a v_FillMode()
483 *
484 * The requested mode is evaluated at the quadrature points
485 *
486 * \param mode the mode that should be filled
487 * \param outarray contains the values of the \a mode-th mode of the
488 * expansion evaluated at the quadrature points (output of the
489 * function)
490 */
491 void FillMode(const int mode, Array<OneD, NekDouble> &outarray)
492 {
493 v_FillMode(mode, outarray);
494 }
495
496 /** \brief this function calculates the inner product of a given
497 * function \a f with the different modes of the expansion
498 *
499 * This function is a wrapper around the virtual function
500 * \a v_IProductWRTBase()
501 *
502 * This is equivalent to the numerical evaluation of
503 * \f[ I[p] = \int \phi_p(\mathbf{x}) f(\mathbf{x}) d\mathbf{x}\f]
504 * \f$ \begin{array}{rcl} I_{pq} = (\phi_q \phi_q, u) & = &
505 \sum_{i=0}^{nq_0} \sum_{j=0}^{nq_1} \phi_p(\xi_{0,i})
506 \phi_q(\xi_{1,j}) w^0_i w^1_j u(\xi_{0,i} \xi_{1,j})
507 J_{i,j}\\ & = & \sum_{i=0}^{nq_0} \phi_p(\xi_{0,i})
508 \sum_{j=0}^{nq_1} \phi_q(\xi_{1,j}) \tilde{u}_{i,j}
509 J_{i,j} \end{array} \f$
510
511 where
512
513 \f$ \tilde{u}_{i,j} = w^0_i w^1_j u(\xi_{0,i},\xi_{1,j}) \f$
514
515 which can be implemented as
516
517 \f$ f_{qi} = \sum_{j=0}^{nq_1} \phi_q(\xi_{1,j}) \tilde{u}_{i,j} =
518 {\bf B_1 U} \f$
519 \f$ I_{pq} = \sum_{i=0}^{nq_0} \phi_p(\xi_{0,i}) f_{qi} =
520 {\bf B_0 F} \f$
521 *
522 * \param inarray contains the values of the function \a f
523 * evaluated at the quadrature points
524 * \param outarray contains the values of the inner product of \a f
525 * with the different modes, i.e. \f$ outarray[p] = I[p]\f$
526 * (output of the function)
527 */
529 Array<OneD, NekDouble> &outarray)
530 {
531 v_IProductWRTBase(inarray, outarray);
532 }
533
535 const Array<OneD, const NekDouble> &inarray,
536 Array<OneD, NekDouble> &outarray, int coll_check)
537 {
538 v_IProductWRTBase(base, inarray, outarray, coll_check);
539 }
540
541 void IProductWRTDerivBase(const int dir,
542 const Array<OneD, const NekDouble> &inarray,
543 Array<OneD, NekDouble> &outarray)
544 {
545 v_IProductWRTDerivBase(dir, inarray, outarray);
546 }
547
549 const Array<OneD, const NekDouble> &direction,
550 const Array<OneD, const NekDouble> &inarray,
551 Array<OneD, NekDouble> &outarray)
552 {
553 v_IProductWRTDirectionalDerivBase(direction, inarray, outarray);
554 }
555
556 /// \brief Get the element id of this expansion when used
557 /// in a list by returning value of #m_elmt_id
558 inline int GetElmtId()
559 {
560 return m_elmt_id;
561 }
562
563 /// \brief Set the element id of this expansion when used
564 /// in a list by returning value of #m_elmt_id
565 inline void SetElmtId(const int id)
566 {
567 m_elmt_id = id;
568 }
569
570 /** \brief this function returns the physical coordinates of the
571 * quadrature points of the expansion
572 *
573 * This function is a wrapper around the virtual function
574 * \a v_GetCoords()
575 *
576 * \param coords an array containing the coordinates of the
577 * quadrature points (output of the function)
578 */
582 {
583 v_GetCoords(coords_1, coords_2, coords_3);
584 }
585
586 /** \brief given the coordinates of a point of the element in the
587 * local collapsed coordinate system, this function calculates the
588 * physical coordinates of the point
589 *
590 * This function is a wrapper around the virtual function
591 * \a v_GetCoord()
592 *
593 * \param Lcoords the coordinates in the local collapsed
594 * coordinate system
595 * \param coords the physical coordinates (output of the function)
596 */
599 {
600 v_GetCoord(Lcoord, coord);
601 }
602
604 {
605 return m_stdMatrixManager[mkey];
606 }
607
609 {
610 return m_stdStaticCondMatrixManager[mkey];
611 }
612
614 Array<OneD, NekDouble> &outarray)
615 {
616 v_NormVectorIProductWRTBase(Fx, outarray);
617 }
618
620 const Array<OneD, NekDouble> &Fy,
621 Array<OneD, NekDouble> &outarray)
622 {
623 v_NormVectorIProductWRTBase(Fx, Fy, outarray);
624 }
625
629 Array<OneD, NekDouble> &outarray)
630 {
631 v_NormVectorIProductWRTBase(Fx, Fy, Fz, outarray);
632 }
633
635 const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
636 Array<OneD, NekDouble> &outarray)
637 {
638 v_NormVectorIProductWRTBase(Fvec, outarray);
639 }
640
642 const LocalRegions::MatrixKey &mkey)
643 {
644 return v_GetLocStaticCondMatrix(mkey);
645 }
646
648 const LocalRegions::MatrixKey &mkey)
649 {
650 return v_DropLocStaticCondMatrix(mkey);
651 }
652
653 int CalcNumberOfCoefficients(const std::vector<unsigned int> &nummodes,
654 int &modes_offset)
655 {
656 return v_CalcNumberOfCoefficients(nummodes, modes_offset);
657 }
658
659 // virtual functions related to LocalRegions
662 const Array<OneD, const NekDouble> &physvals);
663
665 {
666 return v_GetCoordim();
667 }
668
670 {
671 v_GetBoundaryMap(outarray);
672 }
673
675 {
676 v_GetInteriorMap(outarray);
677 }
678
679 int GetVertexMap(const int localVertexId, bool useCoeffPacking = false)
680 {
681 return v_GetVertexMap(localVertexId, useCoeffPacking);
682 }
683
684 void GetTraceToElementMap(const int tid,
686 Array<OneD, int> &signarray,
687 Orientation traceOrient = eForwards, int P = -1,
688 int Q = -1)
689 {
690 v_GetTraceToElementMap(tid, maparray, signarray, traceOrient, P, Q);
691 }
692
693 void GetTraceCoeffMap(const unsigned int traceid,
695 {
696 v_GetTraceCoeffMap(traceid, maparray);
697 }
698
699 void GetElmtTraceToTraceMap(const unsigned int tid,
701 Array<OneD, int> &signarray,
702 Orientation traceOrient = eForwards, int P = -1,
703 int Q = -1)
704 {
705 v_GetElmtTraceToTraceMap(tid, maparray, signarray, traceOrient, P, Q);
706 }
707
710 Array<OneD, int> &signarray,
711 const Orientation traceOrient = eForwards)
712 {
713 v_GetTraceInteriorToElementMap(tid, maparray, signarray, traceOrient);
714 }
715
717 const int tid, int &numModes0, int &numModes1,
718 const Orientation traceOrient = eDir1FwdDir1_Dir2FwdDir2)
719 {
720 v_GetTraceNumModes(tid, numModes0, numModes1, traceOrient);
721 }
722
724 Array<OneD, NekDouble> &outarray)
725 {
726 v_MultiplyByQuadratureMetric(inarray, outarray);
727 }
728
730 const Array<OneD, const NekDouble> &inarray,
731 Array<OneD, NekDouble> &outarray)
732 {
733 v_MultiplyByStdQuadratureMetric(inarray, outarray);
734 }
735
736 // Matrix Routines
737
738 /** \brief this function generates the mass matrix
739 * \f$\mathbf{M}[i][j] =
740 * \int \phi_i(\mathbf{x}) \phi_j(\mathbf{x}) d\mathbf{x}\f$
741 *
742 * \return returns the mass matrix
743 */
744
747
749 const Array<OneD, const NekDouble> &inarray,
750 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
751
753 Array<OneD, NekDouble> &outarray,
754 const StdMatrixKey &mkey)
755 {
756 v_MassMatrixOp(inarray, outarray, mkey);
757 }
758
760 Array<OneD, NekDouble> &outarray,
761 const StdMatrixKey &mkey)
762 {
763 v_LaplacianMatrixOp(inarray, outarray, mkey);
764 }
765
766 void ReduceOrderCoeffs(int numMin,
767 const Array<OneD, const NekDouble> &inarray,
768 Array<OneD, NekDouble> &outarray)
769 {
770 v_ReduceOrderCoeffs(numMin, inarray, outarray);
771 }
772
774 const StdMatrixKey &mkey)
775 {
776 v_SVVLaplacianFilter(array, mkey);
777 }
778
780 const NekDouble exponent, const NekDouble cutoff)
781 {
782 v_ExponentialFilter(array, alpha, exponent, cutoff);
783 }
784
785 void LaplacianMatrixOp(const int k1, const int k2,
786 const Array<OneD, const NekDouble> &inarray,
787 Array<OneD, NekDouble> &outarray,
788 const StdMatrixKey &mkey)
789 {
790 v_LaplacianMatrixOp(k1, k2, inarray, outarray, mkey);
791 }
792
793 void WeakDerivMatrixOp(const int i,
794 const Array<OneD, const NekDouble> &inarray,
795 Array<OneD, NekDouble> &outarray,
796 const StdMatrixKey &mkey)
797 {
798 v_WeakDerivMatrixOp(i, inarray, outarray, mkey);
799 }
800
802 const Array<OneD, const NekDouble> &inarray,
803 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
804 {
805 v_WeakDirectionalDerivMatrixOp(inarray, outarray, mkey);
806 }
807
809 Array<OneD, NekDouble> &outarray,
810 const StdMatrixKey &mkey)
811 {
812 v_MassLevelCurvatureMatrixOp(inarray, outarray, mkey);
813 }
814
816 Array<OneD, NekDouble> &outarray,
817 const StdMatrixKey &mkey)
818 {
819 v_LinearAdvectionMatrixOp(inarray, outarray, mkey);
820 }
821
823 const Array<OneD, const NekDouble> &inarray,
824 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
825 bool addDiffusionTerm = true)
826 {
827 v_LinearAdvectionDiffusionReactionMatrixOp(inarray, outarray, mkey,
828 addDiffusionTerm);
829 }
830
831 /**
832 * @param inarray Input array @f$ \mathbf{u} @f$.
833 * @param outarray Output array @f$ \boldsymbol{\nabla^2u}
834 * + \lambda \boldsymbol{u} @f$.
835 * @param mkey
836 */
838 Array<OneD, NekDouble> &outarray,
839 const StdMatrixKey &mkey)
840 {
841 v_HelmholtzMatrixOp(inarray, outarray, mkey);
842 }
843
845 {
846 return v_GenMatrix(mkey);
847 }
848
853 {
854 v_PhysDeriv(inarray, out_d0, out_d1, out_d2);
855 }
856
857 void PhysDeriv(const int dir, const Array<OneD, const NekDouble> &inarray,
858 Array<OneD, NekDouble> &outarray)
859 {
860 v_PhysDeriv(dir, inarray, outarray);
861 }
862
865 {
866 v_PhysDeriv_s(inarray, out_ds);
867 }
868
871 {
872 v_PhysDeriv_n(inarray, out_dn);
873 }
874
876 const Array<OneD, const NekDouble> &direction,
877 Array<OneD, NekDouble> &outarray)
878 {
879 v_PhysDirectionalDeriv(inarray, direction, outarray);
880 }
881
886 {
887 v_StdPhysDeriv(inarray, out_d0, out_d1, out_d2);
888 }
889
890 void StdPhysDeriv(const int dir,
891 const Array<OneD, const NekDouble> &inarray,
892 Array<OneD, NekDouble> &outarray)
893 {
894 v_StdPhysDeriv(dir, inarray, outarray);
895 }
896
897 /** \brief This function evaluates the expansion at a single
898 * (arbitrary) point of the domain
899 *
900 * This function is a wrapper around the virtual function
901 * \a v_PhysEvaluate()
902 *
903 * Based on the value of the expansion at the quadrature
904 * points provided in \a physvals, this function
905 * calculates the value of the expansion at an arbitrary
906 * single points (with coordinates \f$ \mathbf{x_c}\f$
907 * given by the pointer \a coords). This operation,
908 * equivalent to \f[ u(\mathbf{x_c}) = \sum_p
909 * \phi_p(\mathbf{x_c}) \hat{u}_p \f] is evaluated using
910 * Lagrangian interpolants through the quadrature points:
911 * \f[ u(\mathbf{x_c}) = \sum_p h_p(\mathbf{x_c}) u_p\f]
912 *
913 * \param coords the coordinates of the single point
914 * \param physvals the interpolated field at the quadrature points
915 *
916 * \return returns the value of the expansion at the
917 * single point
918 */
920 const Array<OneD, const NekDouble> &physvals)
921 {
922 return v_PhysEvaluate(coords, physvals);
923 }
924
925 /** \brief This function evaluates the first derivative of the expansion
926 * at a single (arbitrary) point of the domain
927 *
928 * This function is a wrapper around the virtual function
929 * \a v_PhysEvaluate()
930
931 * Based on the value of the expansion at the quadrature
932 * points provided in \a physvals, this function
933 * calculates the value of the expansion at a set of points
934 * given in \a coords
935 */
937 const Array<OneD, const NekDouble> &inarray,
938 std::array<NekDouble, 3> &firstOrderDerivs)
939
940 {
941 return v_PhysEvaluate(coord, inarray, firstOrderDerivs);
942 }
943
945 const Array<OneD, const NekDouble> &inarray,
946 std::array<NekDouble, 3> &firstOrderDerivs,
947 std::array<NekDouble, 6> &secondOrderDerivs)
948
949 {
950 return v_PhysEvaluate(coord, inarray, firstOrderDerivs,
951 secondOrderDerivs);
952 }
953
954 /** \brief This function evaluates the expansion at a single
955 * (arbitrary) point of the domain
956 *
957 * This function is a wrapper around the virtual function
958 * \a v_PhysEvaluate()
959 *
960 * Based on the value of the expansion at the quadrature
961 * points provided in \a physvals, this function
962 * calculates the value of the expansion at an arbitrary
963 * single points associated with the interpolation
964 * matrices provided in \f$ I \f$.
965 *
966 * \param I an Array of lagrange interpolantes evaluated
967 * at the coordinate and going through the local physical
968 * quadrature
969 * \param physvals the interpolated field at the quadrature points
970 *
971 * \return returns the value of the expansion at the
972 * single point
973 */
975 const Array<OneD, const NekDouble> &physvals)
976 {
977 return v_PhysEvaluate(I, physvals);
978 }
979
980 /**
981 * @brief This function evaluates the basis function mode @p mode at a
982 * point @p coords of the domain.
983 *
984 * This function uses barycentric interpolation with the tensor
985 * product separation of the basis function to improve performance.
986 *
987 * @param coord The coordinate inside the standard region.
988 * @param mode The mode number to be evaluated.
989 *
990 * @return The value of the basis function @p mode at @p coords.
991 */
993 int mode)
994 {
995 return v_PhysEvaluateBasis(coords, mode);
996 }
997
998 /**
999 * \brief Convert local cartesian coordinate \a xi into local
1000 * collapsed coordinates \a eta
1001 **/
1004 {
1005 v_LocCoordToLocCollapsed(xi, eta);
1006 }
1007
1008 /**
1009 * \brief Convert local collapsed coordinates \a eta into local
1010 * cartesian coordinate \a xi
1011 **/
1014 {
1015 v_LocCollapsedToLocCoord(eta, xi);
1016 }
1017
1019 const std::vector<unsigned int> &nummodes, int &modes_offset);
1020
1023 Array<OneD, NekDouble> &outarray);
1024
1028 Array<OneD, NekDouble> &outarray);
1029
1034 Array<OneD, NekDouble> &outarray);
1035
1037 const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
1038 Array<OneD, NekDouble> &outarray);
1039
1041 const LocalRegions::MatrixKey &mkey);
1042
1044 const LocalRegions::MatrixKey &mkey);
1045
1046 /** \brief Function to evaluate the discrete \f$ L_\infty\f$
1047 * error \f$ |\epsilon|_\infty = \max |u - u_{exact}|\f$ where \f$
1048 * u_{exact}\f$ is given by the array \a sol.
1049 *
1050 * This function takes the physical value space array \a m_phys as
1051 * approximate solution
1052 *
1053 * \param sol array of solution function at physical quadrature
1054 * points
1055 * \return returns the \f$ L_\infty \f$ error as a NekDouble.
1056 */
1060
1061 /** \brief Function to evaluate the discrete \f$ L_2\f$ error,
1062 * \f$ | \epsilon |_{2} = \left [ \int^1_{-1} [u - u_{exact}]^2
1063 * dx \right]^{1/2} d\xi_1 \f$ where \f$ u_{exact}\f$ is given by
1064 * the array \a sol.
1065 *
1066 * This function takes the physical value space array \a m_phys as
1067 * approximate solution
1068 *
1069 * \param sol array of solution function at physical quadrature
1070 * points
1071 * \return returns the \f$ L_2 \f$ error as a double.
1072 */
1074 L2(const Array<OneD, const NekDouble> &phys,
1076
1077 /** \brief Function to evaluate the discrete \f$ H^1\f$
1078 * error, \f$ | \epsilon |^1_{2} = \left [ \int^1_{-1} [u -
1079 * u_{exact}]^2 + \nabla(u - u_{exact})\cdot\nabla(u -
1080 * u_{exact})\cdot dx \right]^{1/2} d\xi_1 \f$ where \f$
1081 * u_{exact}\f$ is given by the array \a sol.
1082 *
1083 * This function takes the physical value space array
1084 * \a m_phys as approximate solution
1085 *
1086 * \param sol array of solution function at physical quadrature
1087 * points
1088 * \return returns the \f$ H_1 \f$ error as a double.
1089 */
1091 H1(const Array<OneD, const NekDouble> &phys,
1093
1094 // I/O routines
1096 {
1098 p.reserve(m_base.size());
1099 for (size_t i = 0; i < m_base.size(); ++i)
1100 {
1101 p.push_back(m_base[i]->GetPointsKey());
1102 }
1103 return p;
1104 }
1105
1107 const DNekScalMatSharedPtr &m_transformationmatrix)
1108 {
1109 return v_BuildInverseTransformationMatrix(m_transformationmatrix);
1110 }
1111
1112 /** \brief This function performs an interpolation from
1113 * the physical space points provided at input into an
1114 * array of equispaced points which are not the collapsed
1115 * coordinate. So for a tetrahedron you will only get a
1116 * tetrahedral number of values.
1117 *
1118 * This is primarily used for output purposes to get a
1119 * better distribution of points more suitable for most
1120 * postprocessing
1121 */
1123 const Array<OneD, const NekDouble> &inarray,
1124 Array<OneD, NekDouble> &outarray, int npset = -1);
1125
1126 /** \brief This function provides the connectivity of
1127 * local simplices (triangles or tets) to connect the
1128 * equispaced data points provided by
1129 * PhysInterpToSimplexEquiSpaced
1130 *
1131 * This is a virtual call to the function
1132 * \a v_GetSimplexEquiSpaceConnectivity
1133 */
1135 Array<OneD, int> &conn, bool standard = true)
1136 {
1137 v_GetSimplexEquiSpacedConnectivity(conn, standard);
1138 }
1139
1140 /** \brief This function performs a
1141 * projection/interpolation from the equispaced points
1142 * sometimes used in post-processing onto the coefficient
1143 * space
1144 *
1145 * This is primarily used for output purposes to use a
1146 * more even distribution of points more suitable for alot of
1147 * postprocessing
1148 */
1150 const Array<OneD, const NekDouble> &inarray,
1151 Array<OneD, NekDouble> &outarray);
1152
1153 template <class T> std::shared_ptr<T> as()
1154 {
1155 return std::dynamic_pointer_cast<T>(shared_from_this());
1156 }
1157
1159 Array<OneD, NekDouble> &outarray,
1160 bool multiplybyweights = true)
1161 {
1162 v_IProductWRTBase_SumFac(inarray, outarray, multiplybyweights);
1163 }
1164
1166 DNekMatSharedPtr &mat)
1167 {
1168 v_GenStdMatBwdDeriv(dir, mat);
1169 }
1170
1171protected:
1173 m_base; /**< Bases needed for the expansion */
1175 int m_ncoeffs; /**< Total number of coefficients used in the expansion */
1176
1181
1183 {
1184 return v_CreateStdMatrix(mkey);
1185 }
1186
1187 /** \brief Create the static condensation of a matrix when
1188 using a boundary interior decomposition
1189
1190 If a matrix system can be represented by
1191 \f$ Mat = \left [ \begin{array}{cc}
1192 A & B \\
1193 C & D \end{array} \right ] \f$
1194 This routine creates a matrix containing the statically
1195 condense system of the form
1196 \f$ Mat = \left [ \begin{array}{cc}
1197 A - B D^{-1} C & B D^{-1} \\
1198 D^{-1} C & D^{-1} \end{array} \right ] \f$
1199 **/
1202
1204 Array<OneD, NekDouble> &outarray)
1205 {
1206 v_BwdTrans_SumFac(inarray, outarray);
1207 }
1208
1210 const int dir, const Array<OneD, const NekDouble> &inarray,
1211 Array<OneD, NekDouble> &outarray)
1212 {
1213 v_IProductWRTDerivBase_SumFac(dir, inarray, outarray);
1214 }
1215
1217 const Array<OneD, const NekDouble> &direction,
1218 const Array<OneD, const NekDouble> &inarray,
1219 Array<OneD, NekDouble> &outarray)
1220 {
1221 v_IProductWRTDirectionalDerivBase_SumFac(direction, inarray, outarray);
1222 }
1223
1224 // The term _MatFree denotes that the action of the
1225 // MatrixOperation is done withouth actually using the
1226 // matrix (which then needs to be stored/calculated).
1227 // Although this does not strictly mean that no matrix
1228 // operations are involved in the evaluation of the
1229 // operation, we use this term in the same context used as
1230 // in the following paper: R. C. Kirby, M. G. Knepley,
1231 // A. Logg, and L. R. Scott, "Optimizing the evaluation of
1232 // finite element matrices," SISC 27:741-758 (2005)
1234 const Array<OneD, const NekDouble> &inarray,
1235 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1236
1238 const Array<OneD, const NekDouble> &inarray,
1239 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1240
1242 Array<OneD, NekDouble> &outarray,
1243 const StdMatrixKey &mkey)
1244 {
1245 v_LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
1246 }
1247
1249 const Array<OneD, const NekDouble> &inarray,
1251 {
1252 v_LaplacianMatrixOp_MatFree_Kernel(inarray, outarray, wsp);
1253 }
1254
1256 const Array<OneD, const NekDouble> &inarray,
1257 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1258
1260 const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
1261 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1262
1264 const int i, const Array<OneD, const NekDouble> &inarray,
1265 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1266
1268 const Array<OneD, const NekDouble> &inarray,
1269 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1270
1272 const Array<OneD, const NekDouble> &inarray,
1273 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1274
1276 const Array<OneD, const NekDouble> &inarray,
1277 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1278
1280 const Array<OneD, const NekDouble> &inarray,
1281 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1282 bool addDiffusionTerm = true);
1283
1285 Array<OneD, NekDouble> &outarray,
1286 const StdMatrixKey &mkey)
1287 {
1288 v_HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
1289 }
1290
1292 const Array<OneD, const NekDouble> &inarray,
1293 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1294
1297 Array<OneD, NekDouble> &outarray);
1298
1301
1303 const Array<OneD, const NekDouble> &Lcoord,
1304 const Array<OneD, const NekDouble> &physvals);
1305
1307 [[maybe_unused]] const int dir, [[maybe_unused]] DNekMatSharedPtr &mat)
1308 {
1309 NEKERROR(ErrorUtil::efatal, "not defined");
1310 }
1311
1313 const Array<OneD, const NekDouble> &inarray,
1314 Array<OneD, NekDouble> &outarray);
1315
1316 /**
1317 * @brief This function performs the barycentric interpolation of
1318 * the polynomial stored in @p coord at a point @p physvals using
1319 * barycentric interpolation weights in direction @tparam DIR.
1320 * It can also perform the barycentric interpolation of the
1321 * derivative of the polynomial if @tparam DERIV is set to true,
1322 * which outputs in to @param deriv.
1323 *
1324 * This method is intended to be used a helper function for
1325 * StdExpansion::PhysEvaluate and its elemental instances, so that
1326 * the calling method should provide @p coord for x, y and z
1327 * sequentially and the appropriate @p physvals and @p weights for
1328 * that particular direction.
1329 *
1330 * @param coord The coordinate of the single point.
1331 * @param physvals The polynomial stored at each quadrature point.
1332 * @param deriv The value of the derivative.
1333 * @param deriv The value of the 2nd derivative.
1334 * @tparam DIR The direction of evaluation.
1335 * @tparam DERIV Bool to find derivative.
1336 *
1337 * @return The value of @p physvals at @p coord in direction @p dir.
1338 */
1339 template <int DIR, bool DERIV = false, bool DERIV2 = false>
1340 inline NekDouble BaryEvaluate(const NekDouble &coord,
1341 const NekDouble *physvals, NekDouble &deriv,
1342 NekDouble &deriv2)
1343 {
1344 NekDouble numer1 = 0.0, numer2 = 0.0, numer3 = 0.0, numer4 = 0.0,
1345 numer5 = 0.0, denom = 0.0;
1346
1347 ASSERTL2(DIR < m_base.size(),
1348 "Direction should be less than shape dimension.");
1349
1350 const Array<OneD, const NekDouble> &z = m_base[DIR]->GetZ();
1351 const Array<OneD, const NekDouble> &bw = m_base[DIR]->GetBaryWeights();
1352
1353 const size_t nquad = z.size();
1354
1355 for (size_t i = 0; i < nquad; ++i)
1356 {
1357 NekDouble xdiff = z[i] - coord;
1358 NekDouble pval = physvals[i];
1359
1360 /*
1361 * (in this specific case) you actually
1362 * want to do the comparison exactly
1363 * (believe it or not!) See chapter 7 of
1364 * the paper here:
1365 *https://people.maths.ox.ac.uk/trefethen/barycentric.pdf
1366 */
1367 if ((!DERIV && xdiff == 0.0) ||
1368 ((DERIV || DERIV2) && std::abs(xdiff) < 1e-15))
1369 {
1370
1371 if constexpr (DERIV2)
1372 {
1373 DNekMatSharedPtr D0 = m_base[DIR]->GetD();
1374
1375 // take ith row of z and multiply with physvals
1376 Array<OneD, NekDouble> tmp(nquad);
1377 for (int kk = 0; kk < nquad; kk++)
1378 {
1379 tmp[kk] = Vmath::Dot(nquad, &(D0->GetPtr())[kk], nquad,
1380 &physvals[0], 1);
1381 }
1382
1383 deriv2 = Vmath::Dot(nquad, &(D0->GetPtr())[i], nquad,
1384 &tmp[0], 1);
1385 deriv = tmp[i];
1386 }
1387 else if constexpr (DERIV)
1388 {
1389 DNekMatSharedPtr D0 = m_base[DIR]->GetD();
1390
1391 // take ith row of z and multiply with physvals
1392 deriv = Vmath::Dot(z.size(), &(D0->GetPtr())[i], z.size(),
1393 &physvals[0], 1);
1394 }
1395
1396 return pval;
1397 }
1398
1399 NekDouble tmp = bw[i] / xdiff;
1400 numer1 += tmp * pval;
1401 denom += tmp;
1402
1403 if constexpr (DERIV || DERIV2)
1404 {
1405 NekDouble tmp2 = tmp / xdiff;
1406 numer2 += tmp2 * pval;
1407 numer3 += tmp2;
1408
1409 if constexpr (DERIV2)
1410 {
1411 NekDouble tmp3 = tmp2 / xdiff;
1412 numer4 += tmp3 * pval;
1413 numer5 += tmp3;
1414 }
1415 }
1416 }
1417
1418 if constexpr (DERIV || DERIV2)
1419 {
1420 NekDouble denomdenom = denom * denom;
1421 NekDouble numer1numer3 = numer1 * numer3;
1422
1423 deriv = (numer2 * denom - numer1numer3) / (denomdenom);
1424
1425 if constexpr (DERIV2)
1426 {
1427 deriv2 = (2.0 * numer4 / denom) -
1428 (2.0 * numer5 * numer1) / (denomdenom) -
1429 (2.0 * numer2 * numer3) / (denomdenom) +
1430 (2.0 * numer3 * numer1numer3) / (denomdenom * denom);
1431 }
1432 }
1433
1434 return numer1 / denom;
1435 }
1436
1437 /**
1438 * @brief This function evaluates the basis function mode @p mode at
1439 * a point @p coords of the domain in direction @dir.
1440 *
1441 * @param coord The coordinate inside the standard region.
1442 * @param mode The mode number to be evaluated of #m_base[dir]
1443 * @param dir The direction of interpolation.
1444 *
1445 * @return The value of the basis function @p mode at @p coords in
1446 * direction @p dir.
1447 */
1448 template <int DIR>
1449 inline NekDouble BaryEvaluateBasis(const NekDouble &coord, const int &mode)
1450 {
1451 const int nquad = m_base[DIR]->GetNumPoints();
1452 return BaryEvaluate<DIR>(coord,
1453 &(m_base[DIR]->GetBdata())[0] + nquad * mode);
1454 }
1455
1456 /**
1457 * @brief Helper function to pass an unused value by reference into
1458 * BaryEvaluate.
1459 *
1460 * @param coord The coordinate of the single point.
1461 * @param physvals The polynomial stored at each quadrature point.
1462 * @tparam DIR The direction of evaluation.
1463 * @tparam DERIV Bool to find derivative.
1464 *
1465 * @return The value of @p physvals at @p coord in direction @p dir.
1466 */
1467 template <int DIR, bool DERIV = false, bool DERIV2 = false>
1468 inline NekDouble BaryEvaluate(const NekDouble &coord,
1469 const NekDouble *physvals)
1470 {
1471 NekDouble unusedValue = 0.0;
1472 return BaryEvaluate<DIR, DERIV, DERIV2>(coord, physvals, unusedValue,
1473 unusedValue);
1474 }
1475
1476 template <int DIR, bool DERIV = false, bool DERIV2 = false>
1477 inline NekDouble BaryEvaluate(const NekDouble &coord,
1478 const NekDouble *physvals, NekDouble &deriv)
1479 {
1480 NekDouble unusedValue = 0.0;
1481 return BaryEvaluate<DIR, DERIV, DERIV2>(coord, physvals, deriv,
1482 unusedValue);
1483 }
1484
1485private:
1486 // Virtual functions
1487 STD_REGIONS_EXPORT virtual int v_GetNverts() const = 0;
1488 STD_REGIONS_EXPORT virtual int v_GetNtraces() const = 0;
1489
1490 STD_REGIONS_EXPORT virtual int v_NumBndryCoeffs() const = 0;
1492
1493 STD_REGIONS_EXPORT virtual int v_GetTraceNcoeffs(const int i) const = 0;
1494 STD_REGIONS_EXPORT virtual int v_GetTraceIntNcoeffs(const int i) const = 0;
1495 STD_REGIONS_EXPORT virtual int v_GetTraceNumPoints(const int i) const = 0;
1496
1498 const int i, const int k) const;
1499
1501 const int i, const int j) const;
1502
1504 const;
1505
1507 const = 0;
1508
1509 STD_REGIONS_EXPORT virtual std::shared_ptr<StdExpansion> v_GetStdExp()
1510 const;
1511
1512 STD_REGIONS_EXPORT virtual std::shared_ptr<StdExpansion> v_GetLinStdExp(
1513 void) const;
1514
1516
1518
1520
1522 const Array<OneD, const NekDouble> &inarray,
1523 Array<OneD, NekDouble> &outarray) = 0;
1524
1525 /**
1526 * @brief Transform a given function from physical quadrature space
1527 * to coefficient space.
1528 * @see StdExpansion::FwdTrans
1529 */
1531 const Array<OneD, const NekDouble> &inarray,
1532 Array<OneD, NekDouble> &outarray) = 0;
1533
1534 /**
1535 * @brief Calculates the inner product of a given function \a f
1536 * with the different modes of the expansion
1537 */
1539 const Array<OneD, const NekDouble> &inarray,
1540 Array<OneD, NekDouble> &outarray) = 0;
1541
1543 [[maybe_unused]] const Array<OneD, const NekDouble> &base,
1544 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1545 [[maybe_unused]] Array<OneD, NekDouble> &outarray,
1546 [[maybe_unused]] int coll_check)
1547 {
1548 NEKERROR(ErrorUtil::efatal, "StdExpansion::v_IProductWRTBase has no "
1549 "(and should have no) implementation");
1550 }
1551
1553 const int dir, const Array<OneD, const NekDouble> &inarray,
1554 Array<OneD, NekDouble> &outarray);
1555
1557 const Array<OneD, const NekDouble> &direction,
1558 const Array<OneD, const NekDouble> &inarray,
1559 Array<OneD, NekDouble> &outarray);
1560
1562 const Array<OneD, const NekDouble> &inarray,
1563 Array<OneD, NekDouble> &outarray);
1564
1566 const Array<OneD, const NekDouble> &inarray);
1567
1568 STD_REGIONS_EXPORT virtual void v_PhysDeriv(
1569 const Array<OneD, const NekDouble> &inarray,
1571 Array<OneD, NekDouble> &out_d3);
1572
1573 STD_REGIONS_EXPORT virtual void v_PhysDeriv_s(
1574 const Array<OneD, const NekDouble> &inarray,
1575 Array<OneD, NekDouble> &out_ds);
1576
1577 STD_REGIONS_EXPORT virtual void v_PhysDeriv_n(
1578 const Array<OneD, const NekDouble> &inarray,
1579 Array<OneD, NekDouble> &out_dn);
1580
1581 STD_REGIONS_EXPORT virtual void v_PhysDeriv(
1582 const int dir, const Array<OneD, const NekDouble> &inarray,
1583 Array<OneD, NekDouble> &out_d0);
1584
1586 const Array<OneD, const NekDouble> &inarray,
1587 const Array<OneD, const NekDouble> &direction,
1588 Array<OneD, NekDouble> &outarray);
1589
1591 const Array<OneD, const NekDouble> &inarray,
1593 Array<OneD, NekDouble> &out_d3);
1594
1596 const int dir, const Array<OneD, const NekDouble> &inarray,
1597 Array<OneD, NekDouble> &outarray);
1598
1600 const Array<OneD, const NekDouble> &coords,
1601 const Array<OneD, const NekDouble> &physvals);
1602
1605 const Array<OneD, const NekDouble> &physvals);
1606
1608 const Array<OneD, NekDouble> &coord,
1609 const Array<OneD, const NekDouble> &inarray,
1610 std::array<NekDouble, 3> &firstOrderDerivs);
1611
1613 const Array<OneD, NekDouble> &coord,
1614 const Array<OneD, const NekDouble> &inarray,
1615 std::array<NekDouble, 3> &firstOrderDerivs,
1616 std::array<NekDouble, 6> &secondOrderDerivs);
1617
1619 const Array<OneD, const NekDouble> &coords, int mode);
1620
1623
1626
1627 STD_REGIONS_EXPORT virtual void v_FillMode(
1628 const int mode, Array<OneD, NekDouble> &outarray);
1629
1631 const StdMatrixKey &mkey);
1632
1634 const StdMatrixKey &mkey);
1635
1636 STD_REGIONS_EXPORT virtual void v_GetCoords(
1638 Array<OneD, NekDouble> &coords_2);
1639
1640 STD_REGIONS_EXPORT virtual void v_GetCoord(
1641 const Array<OneD, const NekDouble> &Lcoord,
1642 Array<OneD, NekDouble> &coord);
1643
1644 STD_REGIONS_EXPORT virtual int v_GetCoordim() const;
1645
1647 Array<OneD, unsigned int> &outarray);
1648
1650 Array<OneD, unsigned int> &outarray);
1651
1652 STD_REGIONS_EXPORT virtual int v_GetVertexMap(int localVertexId,
1653 bool useCoeffPacking = false);
1654
1656 const int tid, Array<OneD, unsigned int> &maparray,
1657 Array<OneD, int> &signarray, Orientation traceOrient = eForwards,
1658 int P = -1, int Q = -1);
1659
1661 const unsigned int traceid, Array<OneD, unsigned int> &maparray);
1662
1664 const unsigned int tid, Array<OneD, unsigned int> &maparray,
1665 Array<OneD, int> &signarray, Orientation traceOrient = eForwards,
1666 int P = -1, int Q = -1);
1667
1669 const int eid, Array<OneD, unsigned int> &maparray,
1670 Array<OneD, int> &signarray, const Orientation traceOrient = eForwards);
1671
1673 const int fid, int &numModes0, int &numModes1,
1675
1677 const int vertex, const Array<OneD, const NekDouble> &inarray,
1678 NekDouble &outarray);
1679
1681 const Array<OneD, const NekDouble> &inarray,
1682 Array<OneD, NekDouble> &outarray);
1683
1685 const Array<OneD, const NekDouble> &inarray,
1686 Array<OneD, NekDouble> &outarray);
1687
1689 const Array<OneD, const NekDouble> &inarray,
1690 Array<OneD, NekDouble> &outarray, bool multiplybyweights = true);
1691
1693 const int dir, const Array<OneD, const NekDouble> &inarray,
1694 Array<OneD, NekDouble> &outarray);
1695
1697 const Array<OneD, const NekDouble> &direction,
1698 const Array<OneD, const NekDouble> &inarray,
1699 Array<OneD, NekDouble> &outarray);
1700
1702 const Array<OneD, const NekDouble> &inarray,
1703 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1704
1706 const Array<OneD, const NekDouble> &inarray,
1707 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1708
1710 Array<OneD, NekDouble> &array, const StdMatrixKey &mkey);
1711
1713 Array<OneD, NekDouble> &array, const NekDouble alpha,
1714 const NekDouble exponent, const NekDouble cutoff);
1715
1717 int numMin, const Array<OneD, const NekDouble> &inarray,
1718 Array<OneD, NekDouble> &outarray);
1719
1721 const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
1722 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1723
1725 const int i, const Array<OneD, const NekDouble> &inarray,
1726 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1727
1729 const Array<OneD, const NekDouble> &inarray,
1730 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1731
1733 const Array<OneD, const NekDouble> &inarray,
1734 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1735
1737 const Array<OneD, const NekDouble> &inarray,
1738 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1739
1741 const Array<OneD, const NekDouble> &inarray,
1742 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1743 bool addDiffusionTerm = true);
1744
1746 const Array<OneD, const NekDouble> &inarray,
1747 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1748
1750 const Array<OneD, const NekDouble> &inarray,
1751 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1752
1754 const Array<OneD, const NekDouble> &inarray,
1756
1758 const Array<OneD, const NekDouble> &inarray,
1759 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1760
1762 const DNekScalMatSharedPtr &m_transformationmatrix);
1763
1765 Array<OneD, int> &conn, bool standard = true);
1766};
1767
1768typedef std::shared_ptr<StdExpansion> StdExpansionSharedPtr;
1769typedef std::vector<StdExpansionSharedPtr> StdExpansionVector;
1770
1771/**
1772 * This function is a wrapper around the virtual function
1773 * \a v_FwdTrans()
1774 *
1775 * Given a function evaluated at the quadrature points, this
1776 * function calculates the expansion coefficients such that the
1777 * resulting expansion approximates the original function.
1778 *
1779 * The calculation of the expansion coefficients is done using a
1780 * Galerkin projection. This is equivalent to the operation:
1781 * \f[ \mathbf{\hat{u}} = \mathbf{M}^{-1} \mathbf{I}\f]
1782 * where
1783 * - \f$\mathbf{M}[p][q]= \int\phi_p(\mathbf{\xi})\phi_q(
1784 * \mathbf{\xi}) d\mathbf{\xi}\f$ is the Mass matrix
1785 * - \f$\mathbf{I}[p] = \int\phi_p(\mathbf{\xi}) u(\mathbf{\xi})
1786 * d\mathbf{\xi}\f$
1787 *
1788 * This function takes the array \a inarray as the values of the
1789 * function evaluated at the quadrature points
1790 * (i.e. \f$\mathbf{u}\f$),
1791 * and stores the resulting coefficients \f$\mathbf{\hat{u}}\f$
1792 * in the \a outarray
1793 *
1794 * @param inarray array of the function discretely evaluated at the
1795 * quadrature points
1796 *
1797 * @param outarray array of the function coefficieints
1798 */
1800 Array<OneD, NekDouble> &outarray)
1801{
1802 v_FwdTrans(inarray, outarray);
1803}
1804
1805} // namespace Nektar::StdRegions
1806
1807#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:857
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:669
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)
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:491
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:339
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:863
void WeakDirectionalDerivMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:801
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:647
std::shared_ptr< StdExpansion > GetStdExp() const
Definition: StdExpansion.h:372
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:626
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:699
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:317
void MassLevelCurvatureMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:808
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:603
void LaplacianMatrixOp(const int k1, const int k2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:785
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:608
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:793
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:875
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:437
void MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:752
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:653
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:597
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:890
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:869
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:641
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:565
const LibUtilities::BasisKey GetTraceBasisKey(const int i, int k=-1) const
This function returns the basis key belonging to the i-th trace.
Definition: StdExpansion.h:299
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:679
void GetTraceCoeffMap(const unsigned int traceid, Array< OneD, unsigned int > &maparray)
Definition: StdExpansion.h:693
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:613
void LinearAdvectionMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:815
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:377
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:528
virtual bool v_IsBoundaryInteriorExpansion() const
int GetNtraces() const
Returns the number of trace elements connected to this element.
Definition: StdExpansion.h:351
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:759
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:634
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:579
void IProductWRTDirectionalDerivBase(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:548
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:558
virtual void v_ExponentialFilter(Array< OneD, NekDouble > &array, const NekDouble alpha, const NekDouble exponent, const NekDouble cutoff)
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:919
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:684
void IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:541
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:367
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:674
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:424
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:708
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:844
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.
Definition: StdExpansion.h:992
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:779
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:716
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:766
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:822
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:723
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:882
void MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:729
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:944
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:837
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:974
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:534
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:773
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:849
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 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:619
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 const LibUtilities::BasisKey v_GetTraceBasisKey(const int i, const int k) const
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:936
NekDouble Integral(const Array< OneD, const NekDouble > &inarray)
This function integrates the specified function over the domain.
Definition: StdExpansion.h:473
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:298