72 int nquad0 =
m_base[0]->GetNumPoints();
73 int nquad1 =
m_base[1]->GetNumPoints();
75 if (outarray_d0.size() > 0)
78 if (inarray.data() == outarray_d0.data())
81 Vmath::Vcopy(nquad0 * nquad1, inarray.get(), 1, wsp.get(), 1);
83 &(D0->GetPtr())[0], nquad0, &wsp[0], nquad0, 0.0,
84 &outarray_d0[0], nquad0);
89 &(D0->GetPtr())[0], nquad0, &inarray[0], nquad0, 0.0,
90 &outarray_d0[0], nquad0);
94 if (outarray_d1.size() > 0)
97 if (inarray.data() == outarray_d1.data())
100 Vmath::Vcopy(nquad0 * nquad1, inarray.get(), 1, wsp.get(), 1);
101 Blas::Dgemm(
'N',
'T', nquad0, nquad1, nquad1, 1.0, &wsp[0], nquad0,
102 &(D1->GetPtr())[0], nquad1, 0.0, &outarray_d1[0],
107 Blas::Dgemm(
'N',
'T', nquad0, nquad1, nquad1, 1.0, &inarray[0],
108 nquad0, &(D1->GetPtr())[0], nquad1, 0.0,
109 &outarray_d1[0], nquad0);
126 const int nq0 =
m_base[0]->GetNumPoints();
127 const int nq1 =
m_base[1]->GetNumPoints();
130 for (
int i = 0; i < nq1; ++i)
132 wsp[i] = StdExpansion::BaryEvaluate<0>(coll[0], &physvals[0] + i * nq0);
135 return StdExpansion::BaryEvaluate<1>(coll[1], &wsp[0]);
144 int nq0 =
m_base[0]->GetNumPoints();
145 int nq1 =
m_base[1]->GetNumPoints();
149 for (i = 0; i < nq1; ++i)
152 Blas::Ddot(nq0, &(I[0]->GetPtr())[0], 1, &physvals[i * nq0], 1);
156 val =
Blas::Ddot(nq1, I[1]->GetPtr(), 1, wsp1, 1);
164 std::array<NekDouble, 3> &firstOrderDerivs)
166 boost::ignore_unused(coord, inarray, firstOrderDerivs);
180 int nquad0 =
m_base[0]->GetNumPoints();
181 int nquad1 =
m_base[1]->GetNumPoints();
185 for (i = 0; i < nquad1; ++i)
187 Vmath::Vmul(nquad0, &inarray[0] + i * nquad0, 1, w0.get(), 1,
188 &tmp[0] + i * nquad0, 1);
191 for (i = 0; i < nquad0; ++i)
193 Vmath::Vmul(nquad1, &tmp[0] + i, nquad0, w1.get(), 1, &tmp[0] + i,
206 bool doCheckCollDir0,
bool doCheckCollDir1)
209 doCheckCollDir0, doCheckCollDir1);
217 bool doCheckCollDir0,
bool doCheckCollDir1)
220 doCheckCollDir0, doCheckCollDir1);
225 ASSERTL1((dir == 0) || (dir == 1),
"Invalid direction.");
227 int nquad0 =
m_base[0]->GetNumPoints();
228 int nquad1 =
m_base[1]->GetNumPoints();
229 int nqtot = nquad0 * nquad1;
230 int nmodes0 =
m_base[0]->GetNumModes();
239 for (
int i = 0; i < nqtot; i++)
243 m_base[1]->GetBdata(), tmp1, tmp3,
249 (*mat)(j, i) = tmp3[j];
254 for (
int i = 0; i < nqtot; i++)
258 m_base[1]->GetDbdata(), tmp1, tmp3,
264 (*mat)(j, i) = tmp3[j];
286 int nquad0 =
m_base[0]->GetNumPoints();
287 int nquad1 =
m_base[1]->GetNumPoints();
288 int nqtot = nquad0 * nquad1;
289 int nmodes0 =
m_base[0]->GetNumModes();
290 int nmodes1 =
m_base[1]->GetNumModes();
292 max(max(max(nqtot,
m_ncoeffs), nquad1 * nmodes0), nquad0 * nmodes1);
301 if (!(
m_base[0]->Collocation() &&
m_base[1]->Collocation()))
333 int nquad0 =
m_base[0]->GetNumPoints();
334 int nquad1 =
m_base[1]->GetNumPoints();
335 int nqtot = nquad0 * nquad1;
336 int nmodes0 =
m_base[0]->GetNumModes();
337 int nmodes1 =
m_base[1]->GetNumModes();
339 max(max(max(nqtot,
m_ncoeffs), nquad1 * nmodes0), nquad0 * nmodes1);
350 if (!(
m_base[0]->Collocation() &&
m_base[1]->Collocation()))
386 boost::ignore_unused(traceid, maparray);
389 "This method must be defined at the individual shape level");
402 boost::ignore_unused(Q);
410 dir = (eid == 0) ? 0 : 1;
417 int numModes =
m_base[dir]->GetNumModes();
420 P = (
P == -1) ? numModes :
P;
423 if (maparray.size() !=
P)
429 for (i = 0; i <
P; ++i)
434 if (signarray.size() !=
P)
440 std::fill(signarray.get(), signarray.get() +
P, 1);
445 for (i = numModes; i <
P; ++i)
448 maparray[i] = maparray[0];
458 std::swap(maparray[0], maparray[1]);
460 for (i = 3; i < std::min(
P, numModes); i += 2)
468 ASSERTL1(
P == numModes,
"Different trace space edge dimension "
469 "and element edge dimension not currently "
470 "possible for GLL-Lagrange bases");
472 std::reverse(maparray.get(), maparray.get() +
P);
476 ASSERTL0(
false,
"Mapping not defined for this type of basis");
491 if (maparray.size() != map2.size())
496 for (
int i = 0; i < map2.size(); ++i)
498 maparray[i] = map1[map2[i]];
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
Describes the specification for a Basis.
virtual void v_GenStdMatBwdDeriv(const int dir, DNekMatSharedPtr &mat) override
virtual void v_IProductWRTBase_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1)=0
virtual ~StdExpansion2D() override
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray_d0, Array< OneD, NekDouble > &outarray_d1)
Calculate the 2D derivative in the local tensor/collapsed coordinate at the physical points.
virtual void v_HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
virtual void v_GetTraceToElementMap(const int eid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation edgeOrient=eForwards, int P=-1, int Q=-1) override
virtual void v_BwdTrans_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1)=0
NekDouble Integral(const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &w0, const Array< OneD, const NekDouble > &w1)
void BwdTrans_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0=true, bool doCheckCollDir1=true)
virtual void v_GetTraceCoeffMap(const unsigned int traceid, Array< OneD, unsigned int > &maparray) override
virtual void v_LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
void IProductWRTBase_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0=true, bool doCheckCollDir1=true)
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals) override
This function evaluates the expansion at a single (arbitrary) point of the domain.
virtual void v_GetElmtTraceToTraceMap(const unsigned int eid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation edgeOrient, int P, int Q) override
Determine the mapping to re-orientate the coefficients along the element trace (assumed to align with...
The base class for all shapes.
void LaplacianMatrixOp_MatFree_GenericImpl(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
void LocCoordToLocCollapsed(const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta)
Convert local cartesian coordinate xi into local collapsed coordinates eta.
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
void MultiplyByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void HelmholtzMatrixOp_MatFree_GenericImpl(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Array< OneD, LibUtilities::BasisSharedPtr > m_base
void LaplacianMatrixOp_MatFree_Kernel(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp)
NekDouble GetConstFactor(const ConstFactorType &factor) const
bool ConstFactorExists(const ConstFactorType &factor) const
static double Ddot(const int &n, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: output = .
static void Dgemm(const char &transa, const char &transb, const int &m, const int &n, const int &k, const double &alpha, const double *a, const int &lda, const double *b, const int &ldb, const double &beta, double *c, const int &ldc)
BLAS level 3: Matrix-matrix multiply C = A x B where op(A)[m x k], op(B)[k x n], C[m x n] DGEMM perfo...
@ eModified_B
Principle Modified Functions .
@ eGauss_Lagrange
Lagrange Polynomials using the Gauss points.
@ eGLL_Lagrange
Lagrange for SEM basis .
@ eModified_A
Principle Modified Functions .
static const NekDouble kNekZeroTol
The above copyright notice and this permission notice shall be included.
std::shared_ptr< DNekMat > DNekMatSharedPtr
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
T Vsum(int n, const T *x, const int incx)
Subtract return sum(x)
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)