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 
50 namespace Nektar
51 {
52 namespace LocalRegions
53 {
54 class MatrixKey;
55 class Expansion;
56 } // namespace LocalRegions
57 } // namespace Nektar
58 
59 namespace Nektar
60 {
61 namespace 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  */
70 class StdExpansion : public std::enable_shared_from_this<StdExpansion>
71 {
72 public:
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 
388  int GetShapeDimension() const
389  {
390  return v_GetShapeDimension();
391  }
392 
394  {
396  }
397 
399  {
400  return v_IsNodalNonTensorialExp();
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  */
604  Array<OneD, NekDouble> &coord)
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,
691  Array<OneD, unsigned int> &maparray,
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,
700  Array<OneD, unsigned int> &maparray)
701  {
702  v_GetTraceCoeffMap(traceid, maparray);
703  }
704 
705  void GetElmtTraceToTraceMap(const unsigned int tid,
706  Array<OneD, unsigned int> &maparray,
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 
714  void GetTraceInteriorToElementMap(const int tid,
715  Array<OneD, unsigned int> &maparray,
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 
752  CreateGeneralMatrix(const StdMatrixKey &mkey);
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  const Array<OneD, const NekDouble> &inarray,
823  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
824  bool addDiffusionTerm = true)
825  {
826  v_LinearAdvectionDiffusionReactionMatrixOp(inarray, outarray, mkey,
827  addDiffusionTerm);
828  }
829 
830  /**
831  * @param inarray Input array @f$ \mathbf{u} @f$.
832  * @param outarray Output array @f$ \boldsymbol{\nabla^2u}
833  * + \lambda \boldsymbol{u} @f$.
834  * @param mkey
835  */
837  Array<OneD, NekDouble> &outarray,
838  const StdMatrixKey &mkey)
839  {
840  v_HelmholtzMatrixOp(inarray, outarray, mkey);
841  }
842 
844  {
845  return v_GenMatrix(mkey);
846  }
847 
849  Array<OneD, NekDouble> &out_d0,
852  {
853  v_PhysDeriv(inarray, out_d0, out_d1, out_d2);
854  }
855 
856  void PhysDeriv(const int dir, const Array<OneD, const NekDouble> &inarray,
857  Array<OneD, NekDouble> &outarray)
858  {
859  v_PhysDeriv(dir, inarray, outarray);
860  }
861 
863  Array<OneD, NekDouble> &out_ds)
864  {
865  v_PhysDeriv_s(inarray, out_ds);
866  }
867 
869  Array<OneD, NekDouble> &out_dn)
870  {
871  v_PhysDeriv_n(inarray, out_dn);
872  }
873 
875  const Array<OneD, const NekDouble> &direction,
876  Array<OneD, NekDouble> &outarray)
877  {
878  v_PhysDirectionalDeriv(inarray, direction, outarray);
879  }
880 
882  Array<OneD, NekDouble> &out_d0,
885  {
886  v_StdPhysDeriv(inarray, out_d0, out_d1, out_d2);
887  }
888 
889  void StdPhysDeriv(const int dir,
890  const Array<OneD, const NekDouble> &inarray,
891  Array<OneD, NekDouble> &outarray)
892  {
893  v_StdPhysDeriv(dir, inarray, outarray);
894  }
895 
896  /** \brief This function evaluates the expansion at a single
897  * (arbitrary) point of the domain
898  *
899  * This function is a wrapper around the virtual function
900  * \a v_PhysEvaluate()
901  *
902  * Based on the value of the expansion at the quadrature
903  * points provided in \a physvals, this function
904  * calculates the value of the expansion at an arbitrary
905  * single points (with coordinates \f$ \mathbf{x_c}\f$
906  * given by the pointer \a coords). This operation,
907  * equivalent to \f[ u(\mathbf{x_c}) = \sum_p
908  * \phi_p(\mathbf{x_c}) \hat{u}_p \f] is evaluated using
909  * Lagrangian interpolants through the quadrature points:
910  * \f[ u(\mathbf{x_c}) = \sum_p h_p(\mathbf{x_c}) u_p\f]
911  *
912  * \param coords the coordinates of the single point
913  * \param physvals the interpolated field at the quadrature points
914  *
915  * \return returns the value of the expansion at the
916  * single point
917  */
919  const Array<OneD, const NekDouble> &physvals)
920  {
921  return v_PhysEvaluate(coords, physvals);
922  }
923 
924  /** \brief This function evaluates the first derivative of the expansion
925  * at a single (arbitrary) point of the domain
926  *
927  * This function is a wrapper around the virtual function
928  * \a v_PhysEvaluate()
929 
930  * Based on the value of the expansion at the quadrature
931  * points provided in \a physvals, this function
932  * calculates the value of the expansion at a set of points
933  * given in \a coords
934  */
936  const Array<OneD, const NekDouble> &inarray,
937  std::array<NekDouble, 3> &firstOrderDerivs)
938 
939  {
940  return v_PhysEvaluate(coord, inarray, firstOrderDerivs);
941  }
942 
944  const Array<OneD, const NekDouble> &inarray,
945  std::array<NekDouble, 3> &firstOrderDerivs,
946  std::array<NekDouble, 6> &secondOrderDerivs)
947 
948  {
949  return v_PhysEvaluate(coord, inarray, firstOrderDerivs,
950  secondOrderDerivs);
951  }
952 
953  /** \brief This function evaluates the expansion at a single
954  * (arbitrary) point of the domain
955  *
956  * This function is a wrapper around the virtual function
957  * \a v_PhysEvaluate()
958  *
959  * Based on the value of the expansion at the quadrature
960  * points provided in \a physvals, this function
961  * calculates the value of the expansion at an arbitrary
962  * single points associated with the interpolation
963  * matrices provided in \f$ I \f$.
964  *
965  * \param I an Array of lagrange interpolantes evaluated
966  * at the coordinate and going through the local physical
967  * quadrature
968  * \param physvals the interpolated field at the quadrature points
969  *
970  * \return returns the value of the expansion at the
971  * single point
972  */
974  const Array<OneD, const NekDouble> &physvals)
975  {
976  return v_PhysEvaluate(I, physvals);
977  }
978 
979  /**
980  * @brief This function evaluates the basis function mode @p mode at a
981  * point @p coords of the domain.
982  *
983  * This function uses barycentric interpolation with the tensor
984  * product separation of the basis function to improve performance.
985  *
986  * @param coord The coordinate inside the standard region.
987  * @param mode The mode number to be evaluated.
988  *
989  * @return The value of the basis function @p mode at @p coords.
990  */
992  int mode)
993  {
994  return v_PhysEvaluateBasis(coords, mode);
995  }
996 
997  /**
998  * \brief Convert local cartesian coordinate \a xi into local
999  * collapsed coordinates \a eta
1000  **/
1003  {
1004  v_LocCoordToLocCollapsed(xi, eta);
1005  }
1006 
1007  /**
1008  * \brief Convert local collapsed coordinates \a eta into local
1009  * cartesian coordinate \a xi
1010  **/
1013  {
1014  v_LocCollapsedToLocCoord(eta, xi);
1015  }
1016 
1018  const std::vector<unsigned int> &nummodes, int &modes_offset);
1019 
1021  const Array<OneD, const NekDouble> &Fx,
1022  Array<OneD, NekDouble> &outarray);
1023 
1025  const Array<OneD, const NekDouble> &Fx,
1026  const Array<OneD, const NekDouble> &Fy,
1027  Array<OneD, NekDouble> &outarray);
1028 
1030  const Array<OneD, const NekDouble> &Fx,
1031  const Array<OneD, const NekDouble> &Fy,
1032  const Array<OneD, const NekDouble> &Fz,
1033  Array<OneD, NekDouble> &outarray);
1034 
1036  const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
1037  Array<OneD, NekDouble> &outarray);
1038 
1040  const LocalRegions::MatrixKey &mkey);
1041 
1043  const LocalRegions::MatrixKey &mkey);
1044 
1045  /** \brief Function to evaluate the discrete \f$ L_\infty\f$
1046  * error \f$ |\epsilon|_\infty = \max |u - u_{exact}|\f$ where \f$
1047  * u_{exact}\f$ is given by the array \a sol.
1048  *
1049  * This function takes the physical value space array \a m_phys as
1050  * approximate solution
1051  *
1052  * \param sol array of solution function at physical quadrature
1053  * points
1054  * \return returns the \f$ L_\infty \f$ error as a NekDouble.
1055  */
1057  Linf(const Array<OneD, const NekDouble> &phys,
1059 
1060  /** \brief Function to evaluate the discrete \f$ L_2\f$ error,
1061  * \f$ | \epsilon |_{2} = \left [ \int^1_{-1} [u - u_{exact}]^2
1062  * dx \right]^{1/2} d\xi_1 \f$ where \f$ u_{exact}\f$ is given by
1063  * the array \a sol.
1064  *
1065  * This function takes the physical value space array \a m_phys as
1066  * approximate solution
1067  *
1068  * \param sol array of solution function at physical quadrature
1069  * points
1070  * \return returns the \f$ L_2 \f$ error as a double.
1071  */
1073  L2(const Array<OneD, const NekDouble> &phys,
1075 
1076  /** \brief Function to evaluate the discrete \f$ H^1\f$
1077  * error, \f$ | \epsilon |^1_{2} = \left [ \int^1_{-1} [u -
1078  * u_{exact}]^2 + \nabla(u - u_{exact})\cdot\nabla(u -
1079  * u_{exact})\cdot dx \right]^{1/2} d\xi_1 \f$ where \f$
1080  * u_{exact}\f$ is given by the array \a sol.
1081  *
1082  * This function takes the physical value space array
1083  * \a m_phys as approximate solution
1084  *
1085  * \param sol array of solution function at physical quadrature
1086  * points
1087  * \return returns the \f$ H_1 \f$ error as a double.
1088  */
1090  H1(const Array<OneD, const NekDouble> &phys,
1092 
1093  // I/O routines
1095  {
1097  p.reserve(m_base.size());
1098  for (size_t i = 0; i < m_base.size(); ++i)
1099  {
1100  p.push_back(m_base[i]->GetPointsKey());
1101  }
1102  return p;
1103  }
1104 
1106  const DNekScalMatSharedPtr &m_transformationmatrix)
1107  {
1108  return v_BuildInverseTransformationMatrix(m_transformationmatrix);
1109  }
1110 
1111  /** \brief This function performs an interpolation from
1112  * the physical space points provided at input into an
1113  * array of equispaced points which are not the collapsed
1114  * coordinate. So for a tetrahedron you will only get a
1115  * tetrahedral number of values.
1116  *
1117  * This is primarily used for output purposes to get a
1118  * better distribution of points more suitable for most
1119  * postprocessing
1120  */
1122  const Array<OneD, const NekDouble> &inarray,
1123  Array<OneD, NekDouble> &outarray, int npset = -1);
1124 
1125  /** \brief This function provides the connectivity of
1126  * local simplices (triangles or tets) to connect the
1127  * equispaced data points provided by
1128  * PhysInterpToSimplexEquiSpaced
1129  *
1130  * This is a virtual call to the function
1131  * \a v_GetSimplexEquiSpaceConnectivity
1132  */
1134  Array<OneD, int> &conn, bool standard = true)
1135  {
1136  v_GetSimplexEquiSpacedConnectivity(conn, standard);
1137  }
1138 
1139  /** \brief This function performs a
1140  * projection/interpolation from the equispaced points
1141  * sometimes used in post-processing onto the coefficient
1142  * space
1143  *
1144  * This is primarily used for output purposes to use a
1145  * more even distribution of points more suitable for alot of
1146  * postprocessing
1147  */
1149  const Array<OneD, const NekDouble> &inarray,
1150  Array<OneD, NekDouble> &outarray);
1151 
1152  template <class T> std::shared_ptr<T> as()
1153  {
1154  return std::dynamic_pointer_cast<T>(shared_from_this());
1155  }
1156 
1158  Array<OneD, NekDouble> &outarray,
1159  bool multiplybyweights = true)
1160  {
1161  v_IProductWRTBase_SumFac(inarray, outarray, multiplybyweights);
1162  }
1163 
1165  DNekMatSharedPtr &mat)
1166  {
1167  v_GenStdMatBwdDeriv(dir, mat);
1168  }
1169 
1170 protected:
1172  m_base; /**< Bases needed for the expansion */
1174  int m_ncoeffs; /**< Total number of coefficients used in the expansion */
1175 
1180 
1182  {
1183  return v_CreateStdMatrix(mkey);
1184  }
1185 
1186  /** \brief Create the static condensation of a matrix when
1187  using a boundary interior decomposition
1188 
1189  If a matrix system can be represented by
1190  \f$ Mat = \left [ \begin{array}{cc}
1191  A & B \\
1192  C & D \end{array} \right ] \f$
1193  This routine creates a matrix containing the statically
1194  condense system of the form
1195  \f$ Mat = \left [ \begin{array}{cc}
1196  A - B D^{-1} C & B D^{-1} \\
1197  D^{-1} C & D^{-1} \end{array} \right ] \f$
1198  **/
1201 
1203  Array<OneD, NekDouble> &outarray)
1204  {
1205  v_BwdTrans_SumFac(inarray, outarray);
1206  }
1207 
1209  const int dir, const Array<OneD, const NekDouble> &inarray,
1210  Array<OneD, NekDouble> &outarray)
1211  {
1212  v_IProductWRTDerivBase_SumFac(dir, inarray, outarray);
1213  }
1214 
1216  const Array<OneD, const NekDouble> &direction,
1217  const Array<OneD, const NekDouble> &inarray,
1218  Array<OneD, NekDouble> &outarray)
1219  {
1220  v_IProductWRTDirectionalDerivBase_SumFac(direction, inarray, outarray);
1221  }
1222 
1223  // The term _MatFree denotes that the action of the
1224  // MatrixOperation is done withouth actually using the
1225  // matrix (which then needs to be stored/calculated).
1226  // Although this does not strictly mean that no matrix
1227  // operations are involved in the evaluation of the
1228  // operation, we use this term in the same context used as
1229  // in the following paper: R. C. Kirby, M. G. Knepley,
1230  // A. Logg, and L. R. Scott, "Optimizing the evaluation of
1231  // finite element matrices," SISC 27:741-758 (2005)
1233  const Array<OneD, const NekDouble> &inarray,
1234  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1235 
1237  const Array<OneD, const NekDouble> &inarray,
1238  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1239 
1241  Array<OneD, NekDouble> &outarray,
1242  const StdMatrixKey &mkey)
1243  {
1244  v_LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
1245  }
1246 
1248  const Array<OneD, const NekDouble> &inarray,
1250  {
1251  v_LaplacianMatrixOp_MatFree_Kernel(inarray, outarray, wsp);
1252  }
1253 
1255  const Array<OneD, const NekDouble> &inarray,
1256  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1257 
1259  const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
1260  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1261 
1263  const int i, const Array<OneD, const NekDouble> &inarray,
1264  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1265 
1267  const Array<OneD, const NekDouble> &inarray,
1268  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1269 
1271  const Array<OneD, const NekDouble> &inarray,
1272  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1273 
1275  const Array<OneD, const NekDouble> &inarray,
1276  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1277  bool addDiffusionTerm = true);
1278 
1280  Array<OneD, NekDouble> &outarray,
1281  const StdMatrixKey &mkey)
1282  {
1283  v_HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
1284  }
1285 
1287  const Array<OneD, const NekDouble> &inarray,
1288  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1289 
1292  Array<OneD, NekDouble> &outarray);
1293 
1296 
1298  const Array<OneD, const NekDouble> &Lcoord,
1299  const Array<OneD, const NekDouble> &physvals);
1300 
1301  STD_REGIONS_EXPORT virtual void v_GenStdMatBwdDeriv(const int dir,
1302  DNekMatSharedPtr &mat)
1303  {
1304  boost::ignore_unused(dir, mat);
1305  NEKERROR(ErrorUtil::efatal, "not defined");
1306  }
1307 
1309  const Array<OneD, const NekDouble> &inarray,
1310  Array<OneD, NekDouble> &outarray);
1311 
1312  /**
1313  * @brief This function performs the barycentric interpolation of
1314  * the polynomial stored in @p coord at a point @p physvals using
1315  * barycentric interpolation weights in direction @tparam DIR.
1316  * It can also perform the barycentric interpolation of the
1317  * derivative of the polynomial if @tparam DERIV is set to true,
1318  * which outputs in to @param deriv.
1319  *
1320  * This method is intended to be used a helper function for
1321  * StdExpansion::PhysEvaluate and its elemental instances, so that
1322  * the calling method should provide @p coord for x, y and z
1323  * sequentially and the appropriate @p physvals and @p weights for
1324  * that particular direction.
1325  *
1326  * @param coord The coordinate of the single point.
1327  * @param physvals The polynomial stored at each quadrature point.
1328  * @param deriv The value of the derivative.
1329  * @param deriv The value of the 2nd derivative.
1330  * @tparam DIR The direction of evaluation.
1331  * @tparam DERIV Bool to find derivative.
1332  *
1333  * @return The value of @p physvals at @p coord in direction @p dir.
1334  */
1335  template <int DIR, bool DERIV = false, bool DERIV2 = false>
1336  inline NekDouble BaryEvaluate(const NekDouble &coord,
1337  const NekDouble *physvals, NekDouble &deriv,
1338  NekDouble &deriv2)
1339  {
1340  NekDouble numer1 = 0.0, numer2 = 0.0, numer3 = 0.0, numer4 = 0.0,
1341  numer5 = 0.0, denom = 0.0;
1342 
1343  ASSERTL2(DIR < m_base.size(),
1344  "Direction should be less than shape dimension.");
1345 
1346  const Array<OneD, const NekDouble> &z = m_base[DIR]->GetZ();
1347  const Array<OneD, const NekDouble> &bw = m_base[DIR]->GetBaryWeights();
1348 
1349  const size_t nquad = z.size();
1350 
1351  for (size_t i = 0; i < nquad; ++i)
1352  {
1353  NekDouble xdiff = z[i] - coord;
1354  NekDouble pval = physvals[i];
1355 
1356  /*
1357  * (in this specific case) you actually
1358  * want to do the comparison exactly
1359  * (believe it or not!) See chapter 7 of
1360  * the paper here:
1361  *https://people.maths.ox.ac.uk/trefethen/barycentric.pdf
1362  */
1363  if ((!DERIV && xdiff == 0.0) ||
1364  ((DERIV || DERIV2) && std::abs(xdiff) < 1e-15))
1365  {
1366 
1367  if (DERIV2)
1368  {
1369  DNekMatSharedPtr D0 = m_base[DIR]->GetD();
1370 
1371  // take ith row of z and multiply with physvals
1372  Array<OneD, NekDouble> tmp(nquad);
1373  for (int kk = 0; kk < nquad; kk++)
1374  {
1375  tmp[kk] = Vmath::Dot(nquad, &(D0->GetPtr())[kk], nquad,
1376  &physvals[0], 1);
1377  }
1378 
1379  deriv2 = Vmath::Dot(nquad, &(D0->GetPtr())[i], nquad,
1380  &tmp[0], 1);
1381  deriv = tmp[i];
1382  }
1383  else if (DERIV)
1384  {
1385  DNekMatSharedPtr D0 = m_base[DIR]->GetD();
1386 
1387  // take ith row of z and multiply with physvals
1388  deriv = Vmath::Dot(z.size(), &(D0->GetPtr())[i], z.size(),
1389  &physvals[0], 1);
1390  }
1391 
1392  return pval;
1393  }
1394 
1395  NekDouble tmp = bw[i] / xdiff;
1396  numer1 += tmp * pval;
1397  denom += tmp;
1398 
1399  if (DERIV || DERIV2)
1400  {
1401  NekDouble tmp2 = tmp / xdiff;
1402  numer2 += tmp2 * pval;
1403  numer3 += tmp2;
1404 
1405  if (DERIV2)
1406  {
1407  NekDouble tmp3 = tmp2 / xdiff;
1408  numer4 += tmp3 * pval;
1409  numer5 += tmp3;
1410  }
1411  }
1412  }
1413 
1414  if (DERIV || DERIV2)
1415  {
1416  NekDouble denomdenom = denom * denom;
1417  NekDouble numer1numer3 = numer1 * numer3;
1418 
1419  deriv = (numer2 * denom - numer1numer3) / (denomdenom);
1420 
1421  if (DERIV2)
1422  {
1423  deriv2 = (2.0 * numer4 / denom) -
1424  (2.0 * numer5 * numer1) / (denomdenom) -
1425  (2.0 * numer2 * numer3) / (denomdenom) +
1426  (2.0 * numer3 * numer1numer3) / (denomdenom * denom);
1427  }
1428  }
1429 
1430  return numer1 / denom;
1431  }
1432 
1433  /**
1434  * @brief This function evaluates the basis function mode @p mode at
1435  * a point @p coords of the domain in direction @dir.
1436  *
1437  * @param coord The coordinate inside the standard region.
1438  * @param mode The mode number to be evaluated of #m_base[dir]
1439  * @param dir The direction of interpolation.
1440  *
1441  * @return The value of the basis function @p mode at @p coords in
1442  * direction @p dir.
1443  */
1444  template <int DIR>
1445  inline NekDouble BaryEvaluateBasis(const NekDouble &coord, const int &mode)
1446  {
1447  const int nquad = m_base[DIR]->GetNumPoints();
1448  return BaryEvaluate<DIR>(coord,
1449  &(m_base[DIR]->GetBdata())[0] + nquad * mode);
1450  }
1451 
1452  /**
1453  * @brief Helper function to pass an unused value by reference into
1454  * BaryEvaluate.
1455  *
1456  * @param coord The coordinate of the single point.
1457  * @param physvals The polynomial stored at each quadrature point.
1458  * @tparam DIR The direction of evaluation.
1459  * @tparam DERIV Bool to find derivative.
1460  *
1461  * @return The value of @p physvals at @p coord in direction @p dir.
1462  */
1463  template <int DIR, bool DERIV = false, bool DERIV2 = false>
1464  inline NekDouble BaryEvaluate(const NekDouble &coord,
1465  const NekDouble *physvals)
1466  {
1467  NekDouble unusedValue = 0.0;
1468  return BaryEvaluate<DIR, DERIV, DERIV2>(coord, physvals, unusedValue,
1469  unusedValue);
1470  }
1471 
1472  template <int DIR, bool DERIV = false, bool DERIV2 = false>
1473  inline NekDouble BaryEvaluate(const NekDouble &coord,
1474  const NekDouble *physvals, NekDouble &deriv)
1475  {
1476  NekDouble unusedValue = 0.0;
1477  return BaryEvaluate<DIR, DERIV, DERIV2>(coord, physvals, deriv,
1478  unusedValue);
1479  }
1480 
1481 private:
1482  // Virtual functions
1483  STD_REGIONS_EXPORT virtual int v_GetNverts() const = 0;
1484  STD_REGIONS_EXPORT virtual int v_GetNtraces() const = 0;
1485 
1486  STD_REGIONS_EXPORT virtual int v_NumBndryCoeffs() const = 0;
1487  STD_REGIONS_EXPORT virtual int v_NumDGBndryCoeffs() const = 0;
1488 
1489  STD_REGIONS_EXPORT virtual int v_GetTraceNcoeffs(const int i) const = 0;
1490  STD_REGIONS_EXPORT virtual int v_GetTraceIntNcoeffs(const int i) const = 0;
1491  STD_REGIONS_EXPORT virtual int v_GetTraceNumPoints(const int i) const = 0;
1492 
1494  const int i, const int k) const;
1495 
1497  const int i, const int j) const;
1498 
1500  const;
1501 
1503  const = 0;
1504 
1505  STD_REGIONS_EXPORT virtual std::shared_ptr<StdExpansion> v_GetStdExp()
1506  const;
1507 
1508  STD_REGIONS_EXPORT virtual std::shared_ptr<StdExpansion> v_GetLinStdExp(
1509  void) const;
1510 
1511  STD_REGIONS_EXPORT virtual int v_GetShapeDimension() const = 0;
1512 
1514 
1516 
1518  const Array<OneD, const NekDouble> &inarray,
1519  Array<OneD, NekDouble> &outarray) = 0;
1520 
1521  /**
1522  * @brief Transform a given function from physical quadrature space
1523  * to coefficient space.
1524  * @see StdExpansion::FwdTrans
1525  */
1527  const Array<OneD, const NekDouble> &inarray,
1528  Array<OneD, NekDouble> &outarray) = 0;
1529 
1530  /**
1531  * @brief Calculates the inner product of a given function \a f
1532  * with the different modes of the expansion
1533  */
1535  const Array<OneD, const NekDouble> &inarray,
1536  Array<OneD, NekDouble> &outarray) = 0;
1537 
1539  const Array<OneD, const NekDouble> &base,
1540  const Array<OneD, const NekDouble> &inarray,
1541  Array<OneD, NekDouble> &outarray, int coll_check)
1542  {
1543  boost::ignore_unused(base, inarray, outarray, coll_check);
1544  NEKERROR(ErrorUtil::efatal, "StdExpansion::v_IProductWRTBase has no "
1545  "(and should have no) implementation");
1546  }
1547 
1549  const int dir, const Array<OneD, const NekDouble> &inarray,
1550  Array<OneD, NekDouble> &outarray);
1551 
1553  const Array<OneD, const NekDouble> &direction,
1554  const Array<OneD, const NekDouble> &inarray,
1555  Array<OneD, NekDouble> &outarray);
1556 
1558  const Array<OneD, const NekDouble> &inarray,
1559  Array<OneD, NekDouble> &outarray);
1560 
1562  const Array<OneD, const NekDouble> &inarray);
1563 
1564  STD_REGIONS_EXPORT virtual void v_PhysDeriv(
1565  const Array<OneD, const NekDouble> &inarray,
1567  Array<OneD, NekDouble> &out_d3);
1568 
1569  STD_REGIONS_EXPORT virtual void v_PhysDeriv_s(
1570  const Array<OneD, const NekDouble> &inarray,
1571  Array<OneD, NekDouble> &out_ds);
1572 
1573  STD_REGIONS_EXPORT virtual void v_PhysDeriv_n(
1574  const Array<OneD, const NekDouble> &inarray,
1575  Array<OneD, NekDouble> &out_dn);
1576 
1577  STD_REGIONS_EXPORT virtual void v_PhysDeriv(
1578  const int dir, const Array<OneD, const NekDouble> &inarray,
1579  Array<OneD, NekDouble> &out_d0);
1580 
1582  const Array<OneD, const NekDouble> &inarray,
1583  const Array<OneD, const NekDouble> &direction,
1584  Array<OneD, NekDouble> &outarray);
1585 
1586  STD_REGIONS_EXPORT virtual void v_StdPhysDeriv(
1587  const Array<OneD, const NekDouble> &inarray,
1589  Array<OneD, NekDouble> &out_d3);
1590 
1591  STD_REGIONS_EXPORT virtual void v_StdPhysDeriv(
1592  const int dir, const Array<OneD, const NekDouble> &inarray,
1593  Array<OneD, NekDouble> &outarray);
1594 
1596  const Array<OneD, const NekDouble> &coords,
1597  const Array<OneD, const NekDouble> &physvals);
1598 
1601  const Array<OneD, const NekDouble> &physvals);
1602 
1604  const Array<OneD, NekDouble> &coord,
1605  const Array<OneD, const NekDouble> &inarray,
1606  std::array<NekDouble, 3> &firstOrderDerivs);
1607 
1609  const Array<OneD, NekDouble> &coord,
1610  const Array<OneD, const NekDouble> &inarray,
1611  std::array<NekDouble, 3> &firstOrderDerivs,
1612  std::array<NekDouble, 6> &secondOrderDerivs);
1613 
1615  const Array<OneD, const NekDouble> &coords, int mode);
1616 
1619 
1622 
1623  STD_REGIONS_EXPORT virtual void v_FillMode(
1624  const int mode, Array<OneD, NekDouble> &outarray);
1625 
1627  const StdMatrixKey &mkey);
1628 
1630  const StdMatrixKey &mkey);
1631 
1632  STD_REGIONS_EXPORT virtual void v_GetCoords(
1633  Array<OneD, NekDouble> &coords_0, Array<OneD, NekDouble> &coords_1,
1634  Array<OneD, NekDouble> &coords_2);
1635 
1636  STD_REGIONS_EXPORT virtual void v_GetCoord(
1637  const Array<OneD, const NekDouble> &Lcoord,
1638  Array<OneD, NekDouble> &coord);
1639 
1640  STD_REGIONS_EXPORT virtual int v_GetCoordim() const;
1641 
1642  STD_REGIONS_EXPORT virtual void v_GetBoundaryMap(
1643  Array<OneD, unsigned int> &outarray);
1644 
1645  STD_REGIONS_EXPORT virtual void v_GetInteriorMap(
1646  Array<OneD, unsigned int> &outarray);
1647 
1648  STD_REGIONS_EXPORT virtual int v_GetVertexMap(int localVertexId,
1649  bool useCoeffPacking = false);
1650 
1652  const int tid, Array<OneD, unsigned int> &maparray,
1653  Array<OneD, int> &signarray, Orientation traceOrient = eForwards,
1654  int P = -1, int Q = -1);
1655 
1657  const unsigned int traceid, Array<OneD, unsigned int> &maparray);
1658 
1660  const unsigned int tid, Array<OneD, unsigned int> &maparray,
1661  Array<OneD, int> &signarray, Orientation traceOrient = eForwards,
1662  int P = -1, int Q = -1);
1663 
1665  const int eid, Array<OneD, unsigned int> &maparray,
1666  Array<OneD, int> &signarray, const Orientation traceOrient = eForwards);
1667 
1669  const int fid, int &numModes0, int &numModes1,
1670  Orientation traceOrient = eDir1FwdDir1_Dir2FwdDir2);
1671 
1673  const int vertex, const Array<OneD, const NekDouble> &inarray,
1674  NekDouble &outarray);
1675 
1677  const Array<OneD, const NekDouble> &inarray,
1678  Array<OneD, NekDouble> &outarray);
1679 
1681  const Array<OneD, const NekDouble> &inarray,
1682  Array<OneD, NekDouble> &outarray);
1683 
1685  const Array<OneD, const NekDouble> &inarray,
1686  Array<OneD, NekDouble> &outarray, bool multiplybyweights = true);
1687 
1689  const int dir, const Array<OneD, const NekDouble> &inarray,
1690  Array<OneD, NekDouble> &outarray);
1691 
1693  const Array<OneD, const NekDouble> &direction,
1694  const Array<OneD, const NekDouble> &inarray,
1695  Array<OneD, NekDouble> &outarray);
1696 
1697  STD_REGIONS_EXPORT virtual void v_MassMatrixOp(
1698  const Array<OneD, const NekDouble> &inarray,
1699  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1700 
1702  const Array<OneD, const NekDouble> &inarray,
1703  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1704 
1706  Array<OneD, NekDouble> &array, const StdMatrixKey &mkey);
1707 
1709  Array<OneD, NekDouble> &array, const NekDouble alpha,
1710  const NekDouble exponent, const NekDouble cutoff);
1711 
1713  int numMin, const Array<OneD, const NekDouble> &inarray,
1714  Array<OneD, NekDouble> &outarray);
1715 
1717  const int k1, const int k2, const Array<OneD, const NekDouble> &inarray,
1718  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1719 
1721  const int i, const Array<OneD, const NekDouble> &inarray,
1722  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1723 
1725  const Array<OneD, const NekDouble> &inarray,
1726  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1727 
1729  const Array<OneD, const NekDouble> &inarray,
1730  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1731 
1733  const Array<OneD, const NekDouble> &inarray,
1734  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey,
1735  bool addDiffusionTerm = true);
1736 
1738  const Array<OneD, const NekDouble> &inarray,
1739  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1740 
1742  const Array<OneD, const NekDouble> &inarray,
1743  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1744 
1746  const Array<OneD, const NekDouble> &inarray,
1748 
1750  const Array<OneD, const NekDouble> &inarray,
1751  Array<OneD, NekDouble> &outarray, const StdMatrixKey &mkey);
1752 
1754  const DNekScalMatSharedPtr &m_transformationmatrix);
1755 
1757  Array<OneD, int> &conn, bool standard = true);
1758 };
1759 
1760 typedef std::shared_ptr<StdExpansion> StdExpansionSharedPtr;
1761 typedef std::vector<StdExpansionSharedPtr> StdExpansionVector;
1762 
1763 /**
1764  * This function is a wrapper around the virtual function
1765  * \a v_FwdTrans()
1766  *
1767  * Given a function evaluated at the quadrature points, this
1768  * function calculates the expansion coefficients such that the
1769  * resulting expansion approximates the original function.
1770  *
1771  * The calculation of the expansion coefficients is done using a
1772  * Galerkin projection. This is equivalent to the operation:
1773  * \f[ \mathbf{\hat{u}} = \mathbf{M}^{-1} \mathbf{I}\f]
1774  * where
1775  * - \f$\mathbf{M}[p][q]= \int\phi_p(\mathbf{\xi})\phi_q(
1776  * \mathbf{\xi}) d\mathbf{\xi}\f$ is the Mass matrix
1777  * - \f$\mathbf{I}[p] = \int\phi_p(\mathbf{\xi}) u(\mathbf{\xi})
1778  * d\mathbf{\xi}\f$
1779  *
1780  * This function takes the array \a inarray as the values of the
1781  * function evaluated at the quadrature points
1782  * (i.e. \f$\mathbf{u}\f$),
1783  * and stores the resulting coefficients \f$\mathbf{\hat{u}}\f$
1784  * in the \a outarray
1785  *
1786  * @param inarray array of the function discretely evaluated at the
1787  * quadrature points
1788  *
1789  * @param outarray array of the function coefficieints
1790  */
1792  Array<OneD, NekDouble> &outarray)
1793 {
1794  v_FwdTrans(inarray, outarray);
1795 }
1796 
1797 } // namespace StdRegions
1798 } // namespace Nektar
1799 
1800 #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:50
Defines a specification for a set of points.
Definition: Points.h:59
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:856
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)
std::shared_ptr< StdExpansion > GetStdExp() const
Definition: StdExpansion.h:378
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)
const LibUtilities::BasisSharedPtr & GetBasis(int dir) const
This function gets the shared point to basis in the dir direction.
Definition: StdExpansion.h:118
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:862
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
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
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:874
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:889
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:868
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
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)
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
std::shared_ptr< T > as()
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 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:918
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:843
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:991
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
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:821
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:881
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:943
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:836
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:973
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:848
Array< OneD, LibUtilities::BasisSharedPtr > m_base
void LaplacianMatrixOp_MatFree_Kernel(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp)
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_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 Array< OneD, NekDouble >> &Fvec, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:640
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, const Array< OneD, NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:625
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)
std::shared_ptr< StdExpansion > GetLinStdExp(void) const
Definition: StdExpansion.h:383
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:935
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:250
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::vector< StdExpansionSharedPtr > StdExpansionVector
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:1100
scalarT< T > abs(scalarT< T > in)
Definition: scalar.hpp:298