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