Nektar++
Loading...
Searching...
No Matches
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
68
70{
71 // constructor
74
75 friend bool operator<(const StdFacKey &lhs, const StdFacKey &rhs)
76 {
77 if (lhs.m_stdFacType < rhs.m_stdFacType)
78 {
79 return true;
80 }
81
82 if (lhs.m_stdFacType > rhs.m_stdFacType)
83 {
84 return false;
85 }
86
87 return (lhs.m_basisKey < rhs.m_basisKey);
88 }
89
90 friend std::ostream &operator<<(std::ostream &os, const StdFacKey &rhs)
91 {
92 os << "Failed to fine a Create StdFac method for factor "
93 << rhs.m_stdFacType << std::endl;
94
95 return os;
96 }
97
100};
101
102/** \brief The base class for all shapes
103 *
104 * This is the lowest level basic class for all shapes and so
105 * contains the definition of common data and common routine to all
106 * elements
107 */
108class StdExpansion : public std::enable_shared_from_this<StdExpansion>
109{
110public:
111 /** \brief Default Constructor */
113
114 /** \brief Constructor */
116 const int numcoeffs, const int numbases,
120
121 /** \brief Copy Constructor */
123
124 /** \brief Destructor */
126
127 // Standard Expansion Routines Applicable Regardless of Region
128
129 /** \brief This function returns the number of 1D bases used in
130 * the expansion
131 *
132 * \return returns the number of 1D bases used in the expansion,
133 * which is equal to number dimension of the expansion
134 */
135 inline int GetNumBases() const
136 {
137 return m_base.size();
138 }
139
140 /** \brief This function gets the shared point to basis
141 *
142 * \return returns the shared pointer to the bases
143 */
145 const
146 {
147 return (m_base);
148 }
149
150 /** \brief This function gets the shared point to basis in
151 * the \a dir direction
152 *
153 * \return returns the shared pointer to the basis in
154 * directin \a dir
155 */
156 inline const LibUtilities::BasisSharedPtr &GetBasis(int dir) const
157 {
158 ASSERTL1(dir < m_base.size(), "dir is larger than number of bases");
159 return (m_base[dir]);
160 }
161
162 /** \brief This function returns the total number of coefficients
163 * used in the expansion
164 *
165 * \return returns the total number of coefficients (which is
166 * equivalent to the total number of modes) used in the expansion
167 */
168 inline int GetNcoeffs(void) const
169 {
170 return (m_ncoeffs);
171 }
172
173 /** \brief This function returns the total number of quadrature
174 * points used in the element
175 *
176 * \return returns the total number of quadrature points
177 */
178 inline int GetTotPoints() const
179 {
180 int nqtot = 1;
181
182 for (size_t i = 0; i < m_base.size(); ++i)
183 {
184 nqtot *= m_base[i]->GetNumPoints();
185 }
186
187 return nqtot;
188 }
189
190 /** \brief This function returns the type of basis used in the \a dir
191 * direction
192 *
193 * The different types of bases implemented in the code are defined
194 * in the LibUtilities::BasisType enumeration list. As a result, the
195 * function will return one of the types of this enumeration list.
196 *
197 * \param dir the direction
198 * \return returns the type of basis used in the \a dir direction
199 */
200 inline LibUtilities::BasisType GetBasisType(const int dir) const
201 {
202 ASSERTL1(dir < m_base.size(), "dir is larger than m_numbases");
203 return (m_base[dir]->GetBasisType());
204 }
205
206 /** \brief This function returns the number of expansion modes
207 * in the \a dir direction
208 *
209 * \param dir the direction
210 * \return returns the number of expansion modes in the \a dir
211 * direction
212 */
213 inline int GetBasisNumModes(const int dir) const
214 {
215 ASSERTL1(dir < m_base.size(), "dir is larger than m_numbases");
216 return (m_base[dir]->GetNumModes());
217 }
218
219 /** \brief This function returns the maximum number of
220 * expansion modes over all local directions
221 *
222 * \return returns the maximum number of expansion modes
223 * over all local directions
224 */
225 inline int EvalBasisNumModesMax(void) const
226 {
227 int returnval = 0;
228
229 for (size_t i = 0; i < m_base.size(); ++i)
230 {
231 returnval = std::max(returnval, m_base[i]->GetNumModes());
232 }
233
234 return returnval;
235 }
236
237 /** \brief This function returns the type of quadrature points used
238 * in the \a dir direction
239 *
240 * The different types of quadrature points implemented in the code
241 * are defined in the LibUtilities::PointsType enumeration list.
242 * As a result, the function will return one of the types of this
243 * enumeration list.
244 *
245 * \param dir the direction
246 * \return returns the type of quadrature points used in the \a dir
247 * direction
248 */
249 inline LibUtilities::PointsType GetPointsType(const int dir) const
250 {
251 ASSERTL1(dir < m_base.size(), "dir is larger than m_numbases");
252 return (m_base[dir]->GetPointsType());
253 }
254
255 /** \brief This function returns the number of quadrature points
256 * in the \a dir direction
257 *
258 * \param dir the direction
259 * \return returns the number of quadrature points in the \a dir
260 * direction
261 */
262 inline int GetNumPoints(const int dir) const
263 {
264 ASSERTL1(dir < m_base.size() || dir == 0,
265 "dir is larger than m_numbases");
266 return (m_base.size() > 0 ? m_base[dir]->GetNumPoints() : 1);
267 }
268
269 /** \brief This function returns a pointer to the array containing
270 * the quadrature points in \a dir direction
271 *
272 * \param dir the direction
273 * \return returns a pointer to the array containing
274 * the quadrature points in \a dir direction
275 */
276 inline const Array<OneD, const NekDouble> &GetPoints(const int dir) const
277 {
278 return m_base[dir]->GetZ();
279 }
280
281 // Wrappers around virtual Functions
282 /** \brief This function returns the number of vertices of the
283 * expansion domain
284 *
285 * This function is a wrapper around the virtual function
286 * \a v_GetNverts()
287 *
288 * \return returns the number of vertices of the expansion domain
289 */
290 int GetNverts() const
291 {
292 return v_GetNverts();
293 }
294
295 /** \brief This function returns the number of expansion coefficients
296 * belonging to the \a i-th trace
297 *
298 * This function is a wrapper around the virtual function
299 * \a v_GetTraceNcoeffs()
300 *
301 * \param i specifies which trace
302 * \return returns the number of expansion coefficients belonging to
303 * the \a i-th trace
304 */
305 int GetTraceNcoeffs(const int i) const
306 {
307 return v_GetTraceNcoeffs(i);
308 }
309
310 int GetTraceIntNcoeffs(const int i) const
311 {
312 return v_GetTraceIntNcoeffs(i);
313 }
314
315 /** \brief This function returns the number of quadrature points
316 * belonging to the \a i-th trace
317 *
318 * This function is a wrapper around the virtual function
319 * \a v_GetTraceNumPoints()
320 *
321 * \param i specifies which trace id
322 * \return returns the number of quadrature points belonging to
323 * the \a i-th trace
324 */
325 int GetTraceNumPoints(const int i) const
326 {
327 return v_GetTraceNumPoints(i);
328 }
329
330 /** \brief This function returns the basis key belonging
331 * to the \a i-th trace
332 *
333 * This function is a wrapper around the virtual function
334 * \a v_GetTraceBasisKey()
335 *
336 * \param i specifies which trace id
337 * \param k is the direction of the basis key for 2D traces
338 * \param UseGll use GLL quadrature points in Trace Expansion (defaulted to
339 * false)
340 *
341 * \return returns the number of Basis key of the ith
342 * trace in the k th direction (when trace is a 2D
343 * object)
344 */
345 const LibUtilities::BasisKey GetTraceBasisKey(const int i, int k = -1,
346 bool UseGLL = false) const
347 {
348 return v_GetTraceBasisKey(i, k, UseGLL);
349 }
350
351 /** \brief This function returns the basis key belonging
352 * to the \a i-th trace
353 *
354 * This function is a wrapper around the virtual function
355 * \a v_GetTracePointsKey()
356 *
357 * \param i specifies which trace id
358 * \param k is the direction of the basis key for 2D traces
359 *
360 * \return returns the number of Points key of the ith
361 * trace in the k th direction (when trace is a 2D
362 * object)
363 */
364 LibUtilities::PointsKey GetTracePointsKey(const int i, int k = -1) const
365 {
366 return v_GetTracePointsKey(i, k);
367 }
368
369 int NumBndryCoeffs(void) const
370 {
371 return v_NumBndryCoeffs();
372 }
373
374 int NumDGBndryCoeffs(void) const
375 {
376 return v_NumDGBndryCoeffs();
377 }
378
379 /** \brief This function returns the type of expansion
380 * Nodal point type if defined
381 *
382 * This function is a wrapper around the virtual function
383 * \a v_GetNodalPointsKey()
384 *
385 */
387 {
388 return v_GetNodalPointsKey();
389 };
390
391 /**
392 * @brief Returns the number of trace elements connected to this
393 * element.
394 *
395 * For example, a quadrilateral has four edges, so this function
396 * would return 4.
397 */
398 int GetNtraces() const
399 {
400 return v_GetNtraces();
401 }
402
403 /** \brief This function returns the shape of the expansion domain
404 *
405 * This function is a wrapper around the virtual function
406 * \a v_DetShapeType()
407 *
408 * The different shape types implemented in the code are defined
409 * in the ::ShapeType enumeration list. As a result, the
410 * function will return one of the types of this enumeration list.
411 *
412 * \return returns the shape of the expansion domain
413 */
415 {
416 return v_DetShapeType();
417 }
418
420 {
421 return v_GetShapeDimension();
422 }
423
425 {
427 }
428
430 {
432 }
433
435 Array<OneD, NekDouble> &outarray)
436 {
437 v_NodalToModal(inarray, outarray);
438 }
439
440 /** \brief This function performs the Backward transformation from
441 * coefficient space to physical space
442 *
443 * This function is a wrapper around the virtual function
444 * \a v_BwdTrans()
445 *
446 * Based on the expansion coefficients, this function evaluates the
447 * expansion at the quadrature points. This is equivalent to the
448 * operation \f[ u(\xi_{1i}) =
449 * \sum_{p=0}^{P-1} \hat{u}_p \phi_p(\xi_{1i}) \f] which can be
450 * evaluated as \f$ {\bf u} = {\bf B}^T {\bf \hat{u}} \f$ with
451 * \f${\bf B}[i][j] = \phi_i(\xi_{j})\f$
452 *
453 * This function requires that the coefficient array
454 * \f$\mathbf{\hat{u}}\f$ provided as \a inarray.
455 *
456 * The resulting array
457 * \f$\mathbf{u}[m]=u(\mathbf{\xi}_m)\f$ containing the
458 * expansion evaluated at the quadrature points, is stored
459 * in the \a outarray.
460 *
461 * \param inarray contains the values of the expansion
462 * coefficients (input of the function)
463 *
464 * \param outarray contains the values of the expansion evaluated
465 * at the quadrature points (output of the function)
466 */
468 Array<OneD, NekDouble> &outarray)
469 {
470 v_BwdTrans(inarray, outarray);
471 }
472
473 /**
474 * This function is a wrapper around the virtual function
475 * \a v_FwdTrans()
476 *
477 * Given a function evaluated at the quadrature points, this
478 * function calculates the expansion coefficients such that the
479 * resulting expansion approximates the original function.
480 *
481 * The calculation of the expansion coefficients is done using a
482 * Galerkin projection. This is equivalent to the operation:
483 * \f[ \mathbf{\hat{u}} = \mathbf{M}^{-1} \mathbf{I}\f]
484 * where
485 * - \f$\mathbf{M}[p][q]= \int\phi_p(\mathbf{\xi})\phi_q(
486 * \mathbf{\xi}) d\mathbf{\xi}\f$ is the Mass matrix
487 * - \f$\mathbf{I}[p] = \int\phi_p(\mathbf{\xi}) u(\mathbf{\xi})
488 * d\mathbf{\xi}\f$
489 *
490 * This function takes the array \a inarray as the values of the
491 * function evaluated at the quadrature points
492 * (i.e. \f$\mathbf{u}\f$),
493 * and stores the resulting coefficients \f$\mathbf{\hat{u}}\f$
494 * in the \a outarray
495 *
496 * @param inarray array of the function discretely evaluated at the
497 * quadrature points
498 *
499 * @param outarray array of the function coefficieints
500 */
501 inline void FwdTrans(const Array<OneD, const NekDouble> &inarray,
502 Array<OneD, NekDouble> &outarray)
503 {
504 v_FwdTrans(inarray, outarray);
505 }
506
508 Array<OneD, NekDouble> &outarray)
509 {
510 v_FwdTransBndConstrained(inarray, outarray);
511 }
512
513 /** \brief This function integrates the specified function over the
514 * domain
515 *
516 * Based on the values of the function evaluated at the quadrature
517 * points (which are stored in \a inarray), this function calculates
518 * the integral of this function over the domain. This is
519 * equivalent to the numerical evaluation of the operation
520 * \f[ I=\int u(\mathbf{\xi})d \mathbf{\xi}\f]
521 *
522 * \param inarray values of the function to be integrated evaluated
523 * at the quadrature points (i.e.
524 * \a inarray[m]=\f$u(\mathbf{\xi}_m)\f$)
525 * \return returns the value of the calculated integral
526 *
527 * Inputs:\n
528
529 - \a inarray: definition of function to be returned at quadrature point
530 of expansion.
531
532 Outputs:\n
533
534 - returns \f$\int^1_{-1}\int^1_{-1} u(\xi_1, \xi_2) J[i,j] d
535 \xi_1 d \xi_2 \f$ where \f$inarray[i,j] =
536 u(\xi_{1i},\xi_{2j}) \f$ and \f$ J[i,j] \f$ is the
537 Jacobian evaluated at the quadrature point.
538 *
539 */
541 {
542 const int nqtot = GetTotPoints();
544 v_MultiplyByQuadratureMetric(inarray, tmp);
545 return Vmath::Vsum(nqtot, tmp, 1);
546 }
547
548 /** \brief This function fills the array \a outarray with the
549 * \a mode-th mode of the expansion
550 *
551 * This function is a wrapper around the virtual function
552 * \a v_FillMode()
553 *
554 * The requested mode is evaluated at the quadrature points
555 *
556 * \param mode the mode that should be filled
557 * \param outarray contains the values of the \a mode-th mode of the
558 * expansion evaluated at the quadrature points (output of the
559 * function)
560 */
561 void FillMode(const int mode, Array<OneD, NekDouble> &outarray)
562 {
563 v_FillMode(mode, outarray);
564 }
565
566 /** \brief this function calculates the inner product of a given
567 * function \a f with the different modes of the expansion
568 *
569 * This function is a wrapper around the virtual function
570 * \a v_IProductWRTBase()
571 *
572 * This is equivalent to the numerical evaluation of
573 * \f[ I[p] = \int \phi_p(\mathbf{x}) f(\mathbf{x}) d\mathbf{x}\f]
574 * \f$ \begin{array}{rcl} I_{pq} = (\phi_q \phi_q, u) & = &
575 \sum_{i=0}^{nq_0} \sum_{j=0}^{nq_1} \phi_p(\xi_{0,i})
576 \phi_q(\xi_{1,j}) w^0_i w^1_j u(\xi_{0,i} \xi_{1,j})
577 J_{i,j}\\ & = & \sum_{i=0}^{nq_0} \phi_p(\xi_{0,i})
578 \sum_{j=0}^{nq_1} \phi_q(\xi_{1,j}) \tilde{u}_{i,j}
579 J_{i,j} \end{array} \f$
580
581 where
582
583 \f$ \tilde{u}_{i,j} = w^0_i w^1_j u(\xi_{0,i},\xi_{1,j}) \f$
584
585 which can be implemented as
586
587 \f$ f_{qi} = \sum_{j=0}^{nq_1} \phi_q(\xi_{1,j}) \tilde{u}_{i,j} =
588 {\bf B_1 U} \f$
589 \f$ I_{pq} = \sum_{i=0}^{nq_0} \phi_p(\xi_{0,i}) f_{qi} =
590 {\bf B_0 F} \f$
591 *
592 * \param inarray contains the values of the function \a f
593 * evaluated at the quadrature points
594 * \param outarray contains the values of the inner product of \a f
595 * with the different modes, i.e. \f$ outarray[p] = I[p]\f$
596 * (output of the function)
597 */
599 Array<OneD, NekDouble> &outarray)
600 {
601 v_IProductWRTBase(inarray, outarray);
602 }
603
604 void IProductWRTDerivBase(const int dir,
605 const Array<OneD, const NekDouble> &inarray,
606 Array<OneD, NekDouble> &outarray)
607 {
608 v_IProductWRTDerivBase(dir, inarray, outarray);
609 }
610
612 const Array<OneD, const NekDouble> &direction,
613 const Array<OneD, const NekDouble> &inarray,
614 Array<OneD, NekDouble> &outarray)
615 {
616 v_IProductWRTDirectionalDerivBase(direction, inarray, outarray);
617 }
618
619 /// \brief Get the element id of this expansion when used
620 /// in a list by returning value of #m_elmt_id
621 inline int GetElmtId()
622 {
623 return m_elmt_id;
624 }
625
626 /// \brief Set the element id of this expansion when used
627 /// in a list by returning value of #m_elmt_id
628 inline void SetElmtId(const int id)
629 {
630 m_elmt_id = id;
631 }
632
633 /** \brief this function returns the physical coordinates of the
634 * quadrature points of the expansion
635 *
636 * This function is a wrapper around the virtual function
637 * \a v_GetCoords()
638 *
639 * \param coords an array containing the coordinates of the
640 * quadrature points (output of the function)
641 */
645 {
646 v_GetCoords(coords_1, coords_2, coords_3);
647 }
648
649 /*
650 * This function is a wrapper around the original GetCoords function however
651 * enables a return value of type array.
652 *
653 * Returns a three-dimensional array with coordinates of each DoF of the
654 * expansion.
655 */
657 {
659 for (int i = 0; i < GetCoordim(); i++)
660 {
662 }
663
664 v_GetCoords(coords[0], coords[1], coords[2]);
665
666 return coords;
667 }
668
669 /** \brief given the coordinates of a point of the element in the
670 * local collapsed coordinate system, this function calculates the
671 * physical coordinates of the point
672 *
673 * This function is a wrapper around the virtual function
674 * \a v_GetCoord()
675 *
676 * \param Lcoords the coordinates in the local collapsed
677 * coordinate system
678 * \param coords the physical coordinates (output of the function)
679 */
682 {
683 v_GetCoord(Lcoord, coord);
684 }
685
687 {
688 return m_stdMatrixManager[mkey];
689 }
690
695
697 {
698 return *(m_stdFacManager[mkey]);
699 }
700
706
708 const Array<OneD, NekDouble> &Fy,
709 Array<OneD, NekDouble> &outarray)
710 {
711 v_NormVectorIProductWRTBase(Fx, Fy, outarray);
712 }
713
721
723 const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
724 Array<OneD, NekDouble> &outarray)
725 {
726 v_NormVectorIProductWRTBase(Fvec, outarray);
727 }
728
734
740
741 int CalcNumberOfCoefficients(const std::vector<unsigned int> &nummodes,
742 int &modes_offset)
743 {
744 return v_CalcNumberOfCoefficients(nummodes, modes_offset);
745 }
746
747 // virtual functions related to LocalRegions
750 const Array<OneD, const NekDouble> &physvals)
751 {
752 return v_StdPhysEvaluate(Lcoord, physvals);
753 }
754
756 {
757 return v_GetCoordim();
758 }
759
761 {
762 v_GetBoundaryMap(outarray);
763 }
764
766 {
767 v_GetInteriorMap(outarray);
768 }
769
770 int GetVertexMap(const int localVertexId, bool useCoeffPacking = false)
771 {
772 return v_GetVertexMap(localVertexId, useCoeffPacking);
773 }
774
775 void GetTraceToElementMap(const int tid,
777 Array<OneD, int> &signarray,
778 Orientation traceOrient = eForwards, int P = -1,
779 int Q = -1)
780 {
781 v_GetTraceToElementMap(tid, maparray, signarray, traceOrient, P, Q);
782 }
783
784 void GetTraceCoeffMap(const unsigned int traceid,
786 {
787 v_GetTraceCoeffMap(traceid, maparray);
788 }
789
790 void GetElmtTraceToTraceMap(const unsigned int tid,
792 Array<OneD, int> &signarray,
793 Orientation traceOrient = eForwards, int P = -1,
794 int Q = -1)
795 {
796 v_GetElmtTraceToTraceMap(tid, maparray, signarray, traceOrient, P, Q);
797 }
798
801 Array<OneD, int> &signarray,
802 const Orientation traceOrient = eForwards)
803 {
804 v_GetTraceInteriorToElementMap(tid, maparray, signarray, traceOrient);
805 }
806
808 const int tid, int &numModes0, int &numModes1,
809 const Orientation traceOrient = eDir1FwdDir1_Dir2FwdDir2)
810 {
811 v_GetTraceNumModes(tid, numModes0, numModes1, traceOrient);
812 }
813
815 Array<OneD, NekDouble> &outarray)
816 {
817 v_MultiplyByQuadratureMetric(inarray, outarray);
818 }
819
821 const Array<OneD, const NekDouble> &inarray,
822 Array<OneD, NekDouble> &outarray)
823 {
824 v_MultiplyByStdQuadratureMetric(inarray, outarray);
825 }
826
827 // Matrix Routines
828
829 /** \brief this function generates the mass matrix
830 * \f$\mathbf{M}[i][j] =
831 * \int \phi_i(\mathbf{x}) \phi_j(\mathbf{x}) d\mathbf{x}\f$
832 *
833 * \return returns the mass matrix
834 */
835
838
840 const Array<OneD, const NekDouble> &inarray,
841 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
842
844 Array<OneD, NekDouble> &outarray,
845 const StdMatrixKey &mkey)
846 {
847 v_MassMatrixOp(inarray, outarray, mkey);
848 }
849
851 Array<OneD, NekDouble> &outarray,
852 const StdMatrixKey &mkey)
853 {
854 v_LaplacianMatrixOp(inarray, outarray, mkey);
855 }
856
857 void ReduceOrderCoeffs(int numMin,
858 const Array<OneD, const NekDouble> &inarray,
859 Array<OneD, NekDouble> &outarray)
860 {
861 v_ReduceOrderCoeffs(numMin, inarray, outarray);
862 }
863
865 const StdMatrixKey &mkey)
866 {
867 v_SVVLaplacianFilter(array, mkey);
868 }
869
871 const NekDouble exponent, const NekDouble cutoff)
872 {
873 v_ExponentialFilter(array, alpha, exponent, cutoff);
874 }
875
876 void LaplacianMatrixOp(const int k1, const int k2,
877 const Array<OneD, const NekDouble> &inarray,
878 Array<OneD, NekDouble> &outarray,
879 const StdMatrixKey &mkey)
880 {
881 v_LaplacianMatrixOp(k1, k2, inarray, outarray, mkey);
882 }
883
884 void WeakDerivMatrixOp(const int i,
885 const Array<OneD, const NekDouble> &inarray,
886 Array<OneD, NekDouble> &outarray,
887 const StdMatrixKey &mkey)
888 {
889 v_WeakDerivMatrixOp(i, inarray, outarray, mkey);
890 }
891
893 const Array<OneD, const NekDouble> &inarray,
894 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey)
895 {
896 v_WeakDirectionalDerivMatrixOp(inarray, outarray, mkey);
897 }
898
900 Array<OneD, NekDouble> &outarray,
901 const StdMatrixKey &mkey)
902 {
903 v_MassLevelCurvatureMatrixOp(inarray, outarray, mkey);
904 }
905
907 Array<OneD, NekDouble> &outarray,
908 const StdMatrixKey &mkey)
909 {
910 v_LinearAdvectionMatrixOp(inarray, outarray, mkey);
911 }
912
914 const Array<OneD, const NekDouble> &inarray,
915 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
916 bool addDiffusionTerm = true)
917 {
918 v_LinearAdvectionDiffusionReactionMatrixOp(inarray, outarray, mkey,
919 addDiffusionTerm);
920 }
921
922 /**
923 * @param inarray Input array @f$ \mathbf{u} @f$.
924 * @param outarray Output array @f$ \boldsymbol{\nabla^2u}
925 * + \lambda \boldsymbol{u} @f$.
926 * @param mkey
927 */
929 Array<OneD, NekDouble> &outarray,
930 const StdMatrixKey &mkey)
931 {
932 v_HelmholtzMatrixOp(inarray, outarray, mkey);
933 }
934
936 {
937 return v_GenMatrix(mkey);
938 }
939
944 {
945 v_PhysDeriv(inarray, out_d0, out_d1, out_d2);
946 }
947
948 void PhysDeriv(const int dir, const Array<OneD, const NekDouble> &inarray,
949 Array<OneD, NekDouble> &outarray)
950 {
951 v_PhysDeriv(dir, inarray, outarray);
952 }
953
955 const Array<OneD, const NekDouble> &direction,
956 Array<OneD, NekDouble> &outarray)
957 {
958 v_PhysDirectionalDeriv(inarray, direction, outarray);
959 }
960
965 {
966 v_StdPhysDeriv(inarray, out_d0, out_d1, out_d2);
967 }
968
969 /** \brief This function evaluates the expansion at a single
970 * (arbitrary) point of the domain
971 *
972 * This function is a wrapper around the virtual function
973 * \a v_PhysEvaluate()
974 *
975 * Based on the value of the expansion at the quadrature
976 * points provided in \a physvals, this function
977 * calculates the value of the expansion at an arbitrary
978 * single points (with coordinates \f$ \mathbf{x_c}\f$
979 * given by the pointer \a coords). This operation,
980 * equivalent to \f[ u(\mathbf{x_c}) = \sum_p
981 * \phi_p(\mathbf{x_c}) \hat{u}_p \f] is evaluated using
982 * Lagrangian interpolants through the quadrature points:
983 * \f[ u(\mathbf{x_c}) = \sum_p h_p(\mathbf{x_c}) u_p\f]
984 *
985 * \param coords the coordinates of the single point
986 * \param physvals the interpolated field at the quadrature points
987 *
988 * \return returns the value of the expansion at the
989 * single point
990 */
992 const Array<OneD, const NekDouble> &physvals)
993 {
994 return v_PhysEvaluate(coords, physvals);
995 }
996
997 /** \brief This function evaluates the first derivative of the expansion
998 * at a single (arbitrary) point of the domain
999 *
1000 * This function is a wrapper around the virtual function
1001 * \a v_PhysEvaluate()
1002
1003 * Based on the value of the expansion at the quadrature
1004 * points provided in \a physvals, this function
1005 * calculates the value of the expansion at a set of points
1006 * given in \a coords
1007 */
1009 const Array<OneD, const NekDouble> &inarray,
1010 std::array<NekDouble, 3> &firstOrderDerivs)
1011
1012 {
1013 return v_PhysEvalFirstDeriv(coord, inarray, firstOrderDerivs);
1014 }
1015
1017 const Array<OneD, const NekDouble> &inarray,
1018 std::array<NekDouble, 3> &firstOrderDerivs,
1019 std::array<NekDouble, 6> &secondOrderDerivs)
1020
1021 {
1022 return v_PhysEvalFirstSecondDeriv(coord, inarray, firstOrderDerivs,
1023 secondOrderDerivs);
1024 }
1025
1026 /** \brief This function evaluates the expansion at a single
1027 * (arbitrary) point of the domain
1028 *
1029 * This function is a wrapper around the virtual function
1030 * \a v_PhysEvaluate()
1031 *
1032 * Based on the value of the expansion at the quadrature
1033 * points provided in \a physvals, this function
1034 * calculates the value of the expansion at an arbitrary
1035 * single points associated with the interpolation
1036 * matrices provided in \f$ I \f$.
1037 *
1038 * \param I an Array of lagrange interpolantes evaluated
1039 * at the coordinate and going through the local physical
1040 * quadrature
1041 * \param physvals the interpolated field at the quadrature points
1042 *
1043 * \return returns the value of the expansion at the
1044 * single point
1045 */
1047 const Array<OneD, const NekDouble> &physvals)
1048 {
1049 return v_PhysEvaluateInterp(I, physvals);
1050 }
1051
1052 /**
1053 * @brief This function evaluates the basis function mode @p mode at a
1054 * point @p coords of the domain.
1055 *
1056 * This function uses barycentric interpolation with the tensor
1057 * product separation of the basis function to improve performance.
1058 *
1059 * @param coord The coordinate inside the standard region.
1060 * @param mode The mode number to be evaluated.
1061 *
1062 * @return The value of the basis function @p mode at @p coords.
1063 */
1065 int mode)
1066 {
1067 return v_PhysEvaluateBasis(coords, mode);
1068 }
1069
1071 Array<OneD, int> &idmap, const int nq0,
1072 const int nq1, bool Forwards = true)
1073 {
1074 v_ReOrientTracePhysMap(orient, idmap, nq0, nq1, Forwards);
1075 }
1076
1077 /**
1078 * \brief Convert local cartesian coordinate \a xi into local
1079 * collapsed coordinates \a eta
1080 **/
1086
1087 /**
1088 * \brief Convert local collapsed coordinates \a eta into local
1089 * cartesian coordinate \a xi
1090 **/
1096
1097 /** \brief interpolate from one set of quadrature points available from
1098 * FromExp to the set of quadrature points in the current expansion. If the
1099 * points are the same this routine will just copy the data
1100 **/
1101 void PhysInterp(std::shared_ptr<StdExpansion> fromExp,
1102 const Array<OneD, const NekDouble> &fromData,
1103 Array<OneD, NekDouble> &toData, bool Transpose = false)
1104 {
1105 v_PhysInterp(fromExp, fromData, toData, Transpose);
1106 }
1107
1109 const std::vector<unsigned int> &nummodes, int &modes_offset);
1110
1113 Array<OneD, NekDouble> &outarray);
1114
1118 Array<OneD, NekDouble> &outarray);
1119
1124 Array<OneD, NekDouble> &outarray);
1125
1127 const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
1128 Array<OneD, NekDouble> &outarray);
1129
1131 const LocalRegions::MatrixKey &mkey);
1132
1134 const LocalRegions::MatrixKey &mkey);
1135
1136 /** \brief Function to evaluate the discrete \f$ L_\infty\f$
1137 * error \f$ |\epsilon|_\infty = \max |u - u_{exact}|\f$ where \f$
1138 * u_{exact}\f$ is given by the array \a sol.
1139 *
1140 * This function takes the physical value space array \a m_phys as
1141 * approximate solution
1142 *
1143 * \param sol array of solution function at physical quadrature
1144 * points
1145 * \return returns the \f$ L_\infty \f$ error as a NekDouble.
1146 */
1150
1151 /** \brief Function to evaluate the discrete \f$ L_2\f$ error,
1152 * \f$ | \epsilon |_{2} = \left [ \int^1_{-1} [u - u_{exact}]^2
1153 * dx \right]^{1/2} d\xi_1 \f$ where \f$ u_{exact}\f$ is given by
1154 * the array \a sol.
1155 *
1156 * This function takes the physical value space array \a m_phys as
1157 * approximate solution
1158 *
1159 * \param sol array of solution function at physical quadrature
1160 * points
1161 * \return returns the \f$ L_2 \f$ error as a double.
1162 */
1164 L2(const Array<OneD, const NekDouble> &phys,
1166
1167 /** \brief Function to evaluate the discrete \f$ H^1\f$
1168 * error, \f$ | \epsilon |^1_{2} = \left [ \int^1_{-1} [u -
1169 * u_{exact}]^2 + \nabla(u - u_{exact})\cdot\nabla(u -
1170 * u_{exact})\cdot dx \right]^{1/2} d\xi_1 \f$ where \f$
1171 * u_{exact}\f$ is given by the array \a sol.
1172 *
1173 * This function takes the physical value space array
1174 * \a m_phys as approximate solution
1175 *
1176 * \param sol array of solution function at physical quadrature
1177 * points
1178 * \return returns the \f$ H_1 \f$ error as a double.
1179 */
1181 H1(const Array<OneD, const NekDouble> &phys,
1183
1184 // I/O routines
1186 {
1188 p.reserve(m_base.size());
1189 for (size_t i = 0; i < m_base.size(); ++i)
1190 {
1191 p.push_back(m_base[i]->GetPointsKey());
1192 }
1193 return p;
1194 }
1195
1197 const DNekScalMatSharedPtr &m_transformationmatrix)
1198 {
1199 return v_BuildInverseTransformationMatrix(m_transformationmatrix);
1200 }
1201
1202 /** \brief This function performs an interpolation from
1203 * the physical space points provided at input into an
1204 * array of equispaced points which are not the collapsed
1205 * coordinate. So for a tetrahedron you will only get a
1206 * tetrahedral number of values.
1207 *
1208 * This is primarily used for output purposes to get a
1209 * better distribution of points more suitable for most
1210 * postprocessing
1211 */
1213 const Array<OneD, const NekDouble> &inarray,
1214 Array<OneD, NekDouble> &outarray, int npset = -1);
1215
1217 const Array<OneD, const NekDouble> &inarray,
1218 Array<OneD, NekDouble> &outarray, int npset = -1);
1219
1221 Array<OneD, NekDouble> &outarray, int npset,
1222 MatrixType distrib);
1223
1224 /** \brief This function provides the connectivity of
1225 * local simplices (triangles or tets) to connect the
1226 * equispaced data points provided by
1227 * PhysInterpToSimplexEquiSpaced
1228 *
1229 * This is a virtual call to the function
1230 * \a v_GetSimplexEquiSpaceConnectivity
1231 */
1233 Array<OneD, int> &conn, bool standard = true)
1234 {
1235 v_GetSimplexEquiSpacedConnectivity(conn, standard);
1236 }
1237
1238 /** \brief This function performs a
1239 * projection/interpolation from the equispaced points
1240 * sometimes used in post-processing onto the coefficient
1241 * space
1242 *
1243 * This is primarily used for output purposes to use a
1244 * more even distribution of points more suitable for alot of
1245 * postprocessing
1246 */
1248 const Array<OneD, const NekDouble> &inarray,
1249 Array<OneD, NekDouble> &outarray);
1250
1252 const int nequi, const Array<OneD, const NekDouble> &inarray,
1253 Array<OneD, NekDouble> &outarray);
1254
1255 template <class T> std::shared_ptr<T> as()
1256 {
1257 return std::dynamic_pointer_cast<T>(shared_from_this());
1258 }
1259
1261 DNekMatSharedPtr &mat)
1262 {
1263 v_GenStdMatBwdDeriv(dir, mat);
1264 }
1265
1266protected:
1268 m_base; /**< Bases needed for the expansion */
1270 int m_ncoeffs; /**< Total number of coefficients used in the expansion */
1271
1272 /* ---------------------------------------------------------------------*/
1273 /* The following information is related caching regularly used */
1274 /* data in when applying the Operator (vec_t=scalar) code in StdRegions */
1275 std::vector<Array<OneD, const NekDouble>> m_weights;
1276 /* ---------------------------------------------------------------------*/
1277
1284
1286 {
1287 return v_CreateStdMatrix(mkey);
1288 }
1289
1290 std::shared_ptr<Array<OneD, const NekDouble>> CreateStdFac(
1291 const StdFacKey &mkey);
1292
1293 /** \brief Create the static condensation of a matrix when
1294 using a boundary interior decomposition
1295
1296 If a matrix system can be represented by
1297 \f$ Mat = \left [ \begin{array}{cc}
1298 A & B \\
1299 C & D \end{array} \right ] \f$
1300 This routine creates a matrix containing the statically
1301 condense system of the form
1302 \f$ Mat = \left [ \begin{array}{cc}
1303 A - B D^{-1} C & B D^{-1} \\
1304 D^{-1} C & D^{-1} \end{array} \right ] \f$
1305 **/
1308
1309 // The term _MatFree denotes that the action of the
1310 // MatrixOperation is done withouth actually using the
1311 // matrix (which then needs to be stored/calculated).
1312 // Although this does not strictly mean that no matrix
1313 // operations are involved in the evaluation of the
1314 // operation, we use this term in the same context used as
1315 // in the following paper: R. C. Kirby, M. G. Knepley,
1316 // A. Logg, and L. R. Scott, "Optimizing the evaluation of
1317 // finite element matrices," SISC 27:741-758 (2005)
1319 const Array<OneD, const NekDouble> &inarray,
1320 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1321
1323 const Array<OneD, const NekDouble> &inarray,
1324 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1325
1327 Array<OneD, NekDouble> &outarray,
1328 const StdMatrixKey &mkey)
1329 {
1330 v_LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
1331 }
1332
1339
1341 const Array<OneD, const NekDouble> &inarray,
1342 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1343
1345 const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
1346 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1347
1349 const int i, const Array<OneD, const NekDouble> &inarray,
1350 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1351
1353 const Array<OneD, const NekDouble> &inarray,
1354 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1355
1357 const Array<OneD, const NekDouble> &inarray,
1358 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1359
1361 const Array<OneD, const NekDouble> &inarray,
1362 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1363
1365 const Array<OneD, const NekDouble> &inarray,
1366 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1367 bool addDiffusionTerm = true);
1368
1370 Array<OneD, NekDouble> &outarray,
1371 const StdMatrixKey &mkey)
1372 {
1373 v_HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
1374 }
1375
1377 const Array<OneD, const NekDouble> &inarray,
1378 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1379
1382 Array<OneD, NekDouble> &outarray);
1383
1385 const Array<OneD, const NekDouble> &Lcoord,
1386 const Array<OneD, const NekDouble> &physvals);
1387
1389 [[maybe_unused]] const int dir, [[maybe_unused]] DNekMatSharedPtr &mat)
1390 {
1391 NEKERROR(ErrorUtil::efatal, "not defined");
1392 }
1393
1395 const Array<OneD, const NekDouble> &inarray,
1396 Array<OneD, NekDouble> &outarray);
1397
1398 /**
1399 * @brief This function performs the barycentric interpolation of
1400 * the polynomial stored in @p coord at a point @p physvals using
1401 * barycentric interpolation weights in direction @tparam DIR.
1402 * It can also perform the barycentric interpolation of the
1403 * derivative of the polynomial if @tparam DERIV is set to true,
1404 * which outputs in to @param deriv.
1405 *
1406 * This method is intended to be used a helper function for
1407 * StdExpansion::PhysEvaluate and its elemental instances, so that
1408 * the calling method should provide @p coord for x, y and z
1409 * sequentially and the appropriate @p physvals and @p weights for
1410 * that particular direction.
1411 *
1412 * @param coord The coordinate of the single point.
1413 * @param physvals The polynomial stored at each quadrature point.
1414 * @param deriv The value of the derivative.
1415 * @param deriv The value of the 2nd derivative.
1416 * @tparam DIR The direction of evaluation.
1417 * @tparam DERIV Bool to find derivative.
1418 *
1419 * @return The value of @p physvals at @p coord in direction @p dir.
1420 */
1421 template <int DIR, bool DERIV = false, bool DERIV2 = false>
1422 inline NekDouble BaryEvaluate(const NekDouble &coord,
1423 const NekDouble *physvals, NekDouble &deriv,
1424 NekDouble &deriv2)
1425 {
1426 NekDouble numer1 = 0.0, numer2 = 0.0, numer3 = 0.0, numer4 = 0.0,
1427 numer5 = 0.0, denom = 0.0;
1428
1429 ASSERTL2(DIR < m_base.size(),
1430 "Direction should be less than shape dimension.");
1431
1432 const Array<OneD, const NekDouble> &z = m_base[DIR]->GetZ();
1433 const Array<OneD, const NekDouble> &bw = m_base[DIR]->GetBaryWeights();
1434
1435 const size_t nquad = z.size();
1436
1437 for (size_t i = 0; i < nquad; ++i)
1438 {
1439 NekDouble xdiff = z[i] - coord;
1440 NekDouble pval = physvals[i];
1441
1442 /*
1443 * (in this specific case) you actually
1444 * want to do the comparison exactly
1445 * (believe it or not!) See chapter 7 of
1446 * the paper here:
1447 *https://people.maths.ox.ac.uk/trefethen/barycentric.pdf
1448 */
1449 if ((!DERIV && xdiff == 0.0) ||
1450 ((DERIV || DERIV2) && std::abs(xdiff) < 1e-15))
1451 {
1452
1453 if constexpr (DERIV2)
1454 {
1455 DNekMatSharedPtr D0 = m_base[DIR]->GetD();
1456
1457 // take ith row of z and multiply with physvals
1458 Array<OneD, NekDouble> tmp(nquad);
1459 for (int kk = 0; kk < nquad; kk++)
1460 {
1461 tmp[kk] = Vmath::Dot(nquad, &(D0->GetPtr())[kk], nquad,
1462 &physvals[0], 1);
1463 }
1464
1465 deriv2 = Vmath::Dot(nquad, &(D0->GetPtr())[i], nquad,
1466 &tmp[0], 1);
1467 deriv = tmp[i];
1468 }
1469 else if constexpr (DERIV)
1470 {
1471 DNekMatSharedPtr D0 = m_base[DIR]->GetD();
1472
1473 // take ith row of z and multiply with physvals
1474 deriv = Vmath::Dot(z.size(), &(D0->GetPtr())[i], z.size(),
1475 &physvals[0], 1);
1476 }
1477
1478 return pval;
1479 }
1480
1481 NekDouble tmp = bw[i] / xdiff;
1482 numer1 += tmp * pval;
1483 denom += tmp;
1484
1485 if constexpr (DERIV || DERIV2)
1486 {
1487 NekDouble tmp2 = tmp / xdiff;
1488 numer2 += tmp2 * pval;
1489 numer3 += tmp2;
1490
1491 if constexpr (DERIV2)
1492 {
1493 NekDouble tmp3 = tmp2 / xdiff;
1494 numer4 += tmp3 * pval;
1495 numer5 += tmp3;
1496 }
1497 }
1498 }
1499
1500 if constexpr (DERIV || DERIV2)
1501 {
1502 NekDouble denomdenom = denom * denom;
1503 NekDouble numer1numer3 = numer1 * numer3;
1504
1505 deriv = (numer2 * denom - numer1numer3) / (denomdenom);
1506
1507 if constexpr (DERIV2)
1508 {
1509 deriv2 = (2.0 * numer4 / denom) -
1510 (2.0 * numer5 * numer1) / (denomdenom) -
1511 (2.0 * numer2 * numer3) / (denomdenom) +
1512 (2.0 * numer3 * numer1numer3) / (denomdenom * denom);
1513 }
1514 }
1515
1516 return numer1 / denom;
1517 }
1518
1519 /**
1520 * @brief This function evaluates the basis function mode @p mode at
1521 * a point @p coords of the domain in direction @dir.
1522 *
1523 * @param coord The coordinate inside the standard region.
1524 * @param mode The mode number to be evaluated of #m_base[dir]
1525 * @param dir The direction of interpolation.
1526 *
1527 * @return The value of the basis function @p mode at @p coords in
1528 * direction @p dir.
1529 */
1530 template <int DIR>
1531 inline NekDouble BaryEvaluateBasis(const NekDouble &coord, const int &mode)
1532 {
1533 const int nquad = m_base[DIR]->GetNumPoints();
1534 return BaryEvaluate<DIR>(coord,
1535 &(m_base[DIR]->GetBdata())[0] + nquad * mode);
1536 }
1537
1538 /**
1539 * @brief Helper function to pass an unused value by reference into
1540 * BaryEvaluate.
1541 *
1542 * @param coord The coordinate of the single point.
1543 * @param physvals The polynomial stored at each quadrature point.
1544 * @tparam DIR The direction of evaluation.
1545 * @tparam DERIV Bool to find derivative.
1546 *
1547 * @return The value of @p physvals at @p coord in direction @p dir.
1548 */
1549 template <int DIR, bool DERIV = false, bool DERIV2 = false>
1550 inline NekDouble BaryEvaluate(const NekDouble &coord,
1551 const NekDouble *physvals)
1552 {
1553 NekDouble unusedValue = 0.0;
1554 return BaryEvaluate<DIR, DERIV, DERIV2>(coord, physvals, unusedValue,
1555 unusedValue);
1556 }
1557
1558 template <int DIR, bool DERIV = false, bool DERIV2 = false>
1559 inline NekDouble BaryEvaluate(const NekDouble &coord,
1560 const NekDouble *physvals, NekDouble &deriv)
1561 {
1562 NekDouble unusedValue = 0.0;
1563 return BaryEvaluate<DIR, DERIV, DERIV2>(coord, physvals, deriv,
1564 unusedValue);
1565 }
1566
1567 // Virtual functions
1568 STD_REGIONS_EXPORT virtual int v_GetNverts() const = 0;
1569 STD_REGIONS_EXPORT virtual int v_GetNtraces() const = 0;
1570
1571 STD_REGIONS_EXPORT virtual int v_NumBndryCoeffs() const = 0;
1573
1574 STD_REGIONS_EXPORT virtual int v_GetTraceNcoeffs(const int i) const = 0;
1575 STD_REGIONS_EXPORT virtual int v_GetTraceIntNcoeffs(const int i) const = 0;
1576 STD_REGIONS_EXPORT virtual int v_GetTraceNumPoints(const int i) const = 0;
1577
1579 const int i, const int k, bool UseGLL = false) const;
1580
1582 const int i, const int j) const;
1583
1585 const;
1586
1588 const = 0;
1589
1591
1592 STD_REGIONS_EXPORT virtual bool v_IsCollocatedBasis() const = 0;
1593
1595
1597
1599 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
1600 [[maybe_unused]] Array<OneD, NekDouble> &outarray) {};
1601
1603 const Array<OneD, const NekDouble> &inarray,
1604 Array<OneD, NekDouble> &outarray) = 0;
1605
1606 /**
1607 * @brief Transform a given function from physical quadrature space
1608 * to coefficient space.
1609 * @see StdExpansion::FwdTrans
1610 */
1611 STD_REGIONS_EXPORT virtual void v_FwdTrans(
1612 const Array<OneD, const NekDouble> &inarray,
1613 Array<OneD, NekDouble> &outarray);
1614
1615 /**
1616 * @brief Calculates the inner product of a given function \a f
1617 * with the different modes of the expansion
1618 */
1620 const Array<OneD, const NekDouble> &inarray,
1621 Array<OneD, NekDouble> &outarray) = 0;
1622
1624 const int dir, const Array<OneD, const NekDouble> &inarray,
1625 Array<OneD, NekDouble> &outarray);
1626
1628 const Array<OneD, const NekDouble> &direction,
1629 const Array<OneD, const NekDouble> &inarray,
1630 Array<OneD, NekDouble> &outarray);
1631
1633 const Array<OneD, const NekDouble> &inarray,
1634 Array<OneD, NekDouble> &outarray);
1635
1636 STD_REGIONS_EXPORT virtual void v_PhysDeriv(
1637 const Array<OneD, const NekDouble> &inarray,
1639 Array<OneD, NekDouble> &out_d3);
1640
1641 STD_REGIONS_EXPORT virtual void v_PhysDeriv(
1642 const int dir, const Array<OneD, const NekDouble> &inarray,
1643 Array<OneD, NekDouble> &out_d0);
1644
1646 const Array<OneD, const NekDouble> &inarray,
1647 const Array<OneD, const NekDouble> &direction,
1648 Array<OneD, NekDouble> &outarray);
1649
1651 const Array<OneD, const NekDouble> &inarray,
1653 Array<OneD, NekDouble> &out_d3);
1654
1656 const Array<OneD, const NekDouble> &coords,
1657 const Array<OneD, const NekDouble> &physvals);
1658
1661 const Array<OneD, const NekDouble> &physvals);
1662
1664 const Array<OneD, NekDouble> &coord,
1665 const Array<OneD, const NekDouble> &inarray,
1666 std::array<NekDouble, 3> &firstOrderDerivs);
1667
1669 const Array<OneD, NekDouble> &coord,
1670 const Array<OneD, const NekDouble> &inarray,
1671 std::array<NekDouble, 3> &firstOrderDerivs,
1672 std::array<NekDouble, 6> &secondOrderDerivs);
1673
1675 const Array<OneD, const NekDouble> &coords, int mode);
1676
1679
1682
1683 STD_REGIONS_EXPORT virtual void v_PhysInterp(
1684 std::shared_ptr<StdExpansion> FromExp,
1685 const Array<OneD, const NekDouble> &fromData,
1686 Array<OneD, NekDouble> &toData, bool Transpose);
1687
1689 virtual void v_FillMode(const int mode, Array<OneD, NekDouble> &outarray);
1690
1692 const StdMatrixKey &mkey);
1693
1695 const StdMatrixKey &mkey);
1696
1697 STD_REGIONS_EXPORT virtual void v_GetCoords(
1699 Array<OneD, NekDouble> &coords_2);
1700
1701 STD_REGIONS_EXPORT virtual void v_GetCoord(
1702 const Array<OneD, const NekDouble> &Lcoord,
1703 Array<OneD, NekDouble> &coord);
1704
1705 STD_REGIONS_EXPORT virtual int v_GetCoordim() const;
1706
1708 Array<OneD, unsigned int> &outarray);
1709
1711 Array<OneD, unsigned int> &outarray);
1712
1713 STD_REGIONS_EXPORT virtual int v_GetVertexMap(int localVertexId,
1714 bool useCoeffPacking = false);
1715
1717 const int tid, Array<OneD, unsigned int> &maparray,
1718 Array<OneD, int> &signarray, Orientation traceOrient = eForwards,
1719 int P = -1, int Q = -1);
1720
1722 const unsigned int traceid, Array<OneD, unsigned int> &maparray);
1723
1725 const unsigned int tid, Array<OneD, unsigned int> &maparray,
1726 Array<OneD, int> &signarray, Orientation traceOrient = eForwards,
1727 int P = -1, int Q = -1);
1728
1730 const int eid, Array<OneD, unsigned int> &maparray,
1731 Array<OneD, int> &signarray, const Orientation traceOrient = eForwards);
1732
1734 const int fid, int &numModes0, int &numModes1,
1736
1738 const int vertex, const Array<OneD, const NekDouble> &inarray,
1739 NekDouble &outarray);
1740
1742 const Array<OneD, const NekDouble> &inarray,
1743 Array<OneD, NekDouble> &outarray);
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 Array<OneD, NekDouble> &array, const StdMatrixKey &mkey);
1755
1757 Array<OneD, NekDouble> &array, const NekDouble alpha,
1758 const NekDouble exponent, const NekDouble cutoff);
1759
1761 int numMin, const Array<OneD, const NekDouble> &inarray,
1762 Array<OneD, NekDouble> &outarray);
1763
1765 const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
1766 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1767
1769 const int i, const Array<OneD, const NekDouble> &inarray,
1770 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1771
1773 const Array<OneD, const NekDouble> &inarray,
1774 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1775
1777 const Array<OneD, const NekDouble> &inarray,
1778 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1779
1781 const Array<OneD, const NekDouble> &inarray,
1782 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1783
1785 const Array<OneD, const NekDouble> &inarray,
1786 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1787 bool addDiffusionTerm = true);
1788
1790 const Array<OneD, const NekDouble> &inarray,
1791 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1792
1794 const Array<OneD, const NekDouble> &inarray,
1795 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1796
1798 const Array<OneD, const NekDouble> &inarray,
1800
1802 const Array<OneD, const NekDouble> &inarray,
1803 Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1804
1806 const DNekScalMatSharedPtr &m_transformationmatrix);
1807
1809 Array<OneD, int> &conn, bool standard = true);
1810
1812 [[maybe_unused]] const StdRegions::Orientation orient,
1813 [[maybe_unused]] Array<OneD, int> &idmap, const int nq0,
1814 [[maybe_unused]] const int nq1, bool Forwards);
1815};
1816
1817typedef std::shared_ptr<StdExpansion> StdExpansionSharedPtr;
1818typedef std::vector<StdExpansionSharedPtr> StdExpansionVector;
1819
1820} // namespace Nektar::StdRegions
1821
1822#endif // STANDARDDEXPANSION_H
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
#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.
void PhysDeriv(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
virtual void v_LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void NodalToModal(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual int v_GetVertexMap(int localVertexId, bool useCoeffPacking=false)
std::shared_ptr< Array< OneD, const NekDouble > > CreateStdFac(const StdFacKey &mkey)
virtual void v_LocCollapsedToLocCoord(const Array< OneD, const NekDouble > &eta, Array< OneD, NekDouble > &xi)
virtual ~StdExpansion()
Destructor.
const LibUtilities::BasisSharedPtr & GetBasis(int dir) const
This function gets the shared point to basis in the dir direction.
virtual void v_PhysDirectionalDeriv(const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &direction, Array< OneD, NekDouble > &outarray)
Physical derivative along a direction vector.
StdExpansion()
Default Constructor.
void EquiSpacedToPhys(const int nequi, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
virtual void v_GetTraceToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards, int P=-1, int Q=-1)
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
virtual void v_GetCoord(const Array< OneD, const NekDouble > &Lcoord, Array< OneD, NekDouble > &coord)
void GeneralMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void FillMode(const int mode, Array< OneD, NekDouble > &outarray)
This function fills the array outarray with the mode-th mode of the expansion.
virtual NekDouble v_StdPhysEvaluate(const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals)
const LibUtilities::PointsKey GetNodalPointsKey() const
This function returns the type of expansion Nodal point type if defined.
void PhysInterpToSimplexEquiSpaced(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int npset=-1)
This function performs an interpolation from the physical space points provided at input into an arra...
void WeakDirectionalDerivMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void WeakDerivMatrixOp_MatFree(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
DNekBlkMatSharedPtr CreateStdStaticCondMatrix(const StdMatrixKey &mkey)
Create the static condensation of a matrix when using a boundary interior decomposition.
void DropLocStaticCondMatrix(const LocalRegions::MatrixKey &mkey)
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, const Array< OneD, const NekDouble > &Fz, Array< OneD, NekDouble > &outarray)
int GetTraceNumPoints(const int i) const
This function returns the number of quadrature points belonging to the i-th trace.
void GetElmtTraceToTraceMap(const unsigned int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards, int P=-1, int Q=-1)
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.
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.
void MassLevelCurvatureMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_0, Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2)
void ReOrientTracePhysMap(const StdRegions::Orientation orient, Array< OneD, int > &idmap, const int nq0, const int nq1, bool Forwards=true)
void LinearAdvectionDiffusionReactionMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey, bool addDiffusionTerm=true)
DNekMatSharedPtr GetStdMatrix(const StdMatrixKey &mkey)
void LaplacianMatrixOp(const int k1, const int k2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
NekDouble BaryEvaluate(const NekDouble &coord, const NekDouble *physvals, NekDouble &deriv)
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
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)
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.
virtual void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdMatrixKey &mkey)
void WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
int EvalBasisNumModesMax(void) const
This function returns the maximum number of expansion modes over all local directions.
virtual void v_GetInteriorMap(Array< OneD, unsigned int > &outarray)
virtual void v_SetCoeffsToOrientation(StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
NekDouble Linf(const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &sol=NullNekDouble1DArray)
Function to evaluate the discrete error where is given by the array sol.
void PhysDirectionalDeriv(const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &direction, Array< OneD, NekDouble > &outarray)
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)
void MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
int CalcNumberOfCoefficients(const std::vector< unsigned int > &nummodes, int &modes_offset)
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,...
virtual void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual bool v_IsCollocatedBasis() const =0
Array< OneD, Array< OneD, NekDouble > > GetCoords()
virtual void v_HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_WeakDirectionalDerivMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
const Array< OneD, const LibUtilities::BasisSharedPtr > & GetBase() const
This function gets the shared point to basis.
DNekScalBlkMatSharedPtr GetLocStaticCondMatrix(const LocalRegions::MatrixKey &mkey)
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals)
virtual DNekMatSharedPtr v_BuildInverseTransformationMatrix(const DNekScalMatSharedPtr &m_transformationmatrix)
NekDouble L2(const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &sol=NullNekDouble1DArray)
Function to evaluate the discrete error, where is given by the array sol.
virtual void v_GetVertexPhysVals(const int vertex, const Array< OneD, const NekDouble > &inarray, NekDouble &outarray)
void SetElmtId(const int id)
Set the element id of this expansion when used in a list by returning value of m_elmt_id.
virtual int v_NumDGBndryCoeffs() const =0
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
void GetTraceCoeffMap(const unsigned int traceid, Array< OneD, unsigned int > &maparray)
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Transform a given function from physical quadrature space to coefficient space.
virtual NekDouble v_PhysEvaluateInterp(const Array< OneD, DNekMatSharedPtr > &I, const Array< OneD, const NekDouble > &physvals)
void LinearAdvectionMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
DNekMatSharedPtr CreateGeneralMatrix(const StdMatrixKey &mkey)
this function generates the mass matrix
virtual void v_MassLevelCurvatureMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void PhysInterpToGLL(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int npset=-1)
virtual void v_GetTraceCoeffMap(const unsigned int traceid, Array< OneD, unsigned int > &maparray)
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
this function calculates the inner product of a given function f with the different modes of the expa...
virtual bool v_IsBoundaryInteriorExpansion() const
int GetNtraces() const
Returns the number of trace elements connected to this element.
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.
virtual int v_NumBndryCoeffs() const =0
void LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
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)
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
void IProductWRTDirectionalDerivBase(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
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.
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.
void GetTraceToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards, int P=-1, int Q=-1)
void IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void MassLevelCurvatureMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
virtual void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual int v_GetTraceNumPoints(const int i) const =0
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)
void BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Backward transformation from coefficient space to physical space.
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdMatrixKey &mkey)
void GetTraceInteriorToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, const Orientation traceOrient=eForwards)
int GetTraceNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th trace.
DNekMatSharedPtr GenMatrix(const StdMatrixKey &mkey)
virtual void v_NodalToModal(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_ReOrientTracePhysMap(const StdRegions::Orientation orient, Array< OneD, int > &idmap, const int nq0, const int nq1, bool Forwards)
virtual void v_GetTraceNumModes(const int fid, int &numModes0, int &numModes1, Orientation traceOrient=eDir1FwdDir1_Dir2FwdDir2)
virtual void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void ExponentialFilter(Array< OneD, NekDouble > &array, const NekDouble alpha, const NekDouble exponent, const NekDouble cutoff)
int GetNumBases() const
This function returns the number of 1D bases used in the expansion.
DNekMatSharedPtr BuildInverseTransformationMatrix(const DNekScalMatSharedPtr &m_transformationmatrix)
virtual void v_PhysInterp(std::shared_ptr< StdExpansion > FromExp, const Array< OneD, const NekDouble > &fromData, Array< OneD, NekDouble > &toData, bool Transpose)
void GetTraceNumModes(const int tid, int &numModes0, int &numModes1, const Orientation traceOrient=eDir1FwdDir1_Dir2FwdDir2)
LibUtilities::PointsType GetPointsType(const int dir) const
This function returns the type of quadrature points used in the dir direction.
LibUtilities::NekManager< StdFacKey, Array< OneD, const NekDouble > > m_stdFacManager
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
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)
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)
int GetNumPoints(const int dir) const
This function returns the number of quadrature points in the dir direction.
void MultiplyByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
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)
Array< OneD, const NekDouble > GetStdFac(const StdFacKey &mkey)
virtual void v_GetTraceInteriorToElementMap(const int eid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, const Orientation traceOrient=eForwards)
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)=0
Calculates the inner product of a given function f with the different modes of the expansion.
void PhysInterpToPoints(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int npset, MatrixType distrib)
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)
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.
void MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
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)
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)
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.
virtual void v_ReduceOrderCoeffs(int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_DropLocStaticCondMatrix(const LocalRegions::MatrixKey &mkey)
void WeakDirectionalDerivMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual 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)
NekDouble BaryEvaluateBasis(const NekDouble &coord, const int &mode)
void SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdMatrixKey &mkey)
void HelmholtzMatrixOp_MatFree_GenericImpl(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)=0
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.
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)
Array< OneD, LibUtilities::BasisSharedPtr > m_base
std::vector< Array< OneD, const NekDouble > > m_weights
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)
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)
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)
void PhysInterp(std::shared_ptr< StdExpansion > fromExp, const Array< OneD, const NekDouble > &fromData, Array< OneD, NekDouble > &toData, bool Transpose=false)
interpolate from one set of quadrature points available from FromExp to the set of quadrature points ...
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...
NekDouble Integral(const Array< OneD, const NekDouble > &inarray)
This function integrates the specified function over the domain.
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:313
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::vector< StdExpansionSharedPtr > StdExpansionVector
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
static Array< OneD, NekDouble > NullNekDouble1DArray
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
std::shared_ptr< DNekMat > DNekMatSharedPtr
T Vsum(int n, const T *x, const int incx)
Subtract return sum(x)
Definition Vmath.hpp:608
T Dot(int n, const T *w, const T *x)
dot product
Definition Vmath.hpp:761
friend std::ostream & operator<<(std::ostream &os, const StdFacKey &rhs)
friend bool operator<(const StdFacKey &lhs, const StdFacKey &rhs)
StdFacKey(StdFacType type, LibUtilities::BasisKey bKey)
LibUtilities::BasisKey m_basisKey