Nektar++
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Nektar::Collections::IProductWRTDerivBase_IterPerExp Class Referencefinal

Inner product WRT deriv base operator using element-wise operation. More...

Inheritance diagram for Nektar::Collections::IProductWRTDerivBase_IterPerExp:
[legend]

Public Member Functions

 ~IProductWRTDerivBase_IterPerExp () final=default
 
void operator() (const Array< OneD, const NekDouble > &entry0, Array< OneD, NekDouble > &entry1, Array< OneD, NekDouble > &entry2, Array< OneD, NekDouble > &entry3, Array< OneD, NekDouble > &wsp) final
 Perform operation. More...
 
void operator() (int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp) final
 
- Public Member Functions inherited from Nektar::Collections::Operator
 Operator (std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
 Constructor. More...
 
virtual ~Operator ()=default
 
virtual COLLECTIONS_EXPORT void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output0, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp=NullNekDouble1DArray)=0
 Perform operation. More...
 
virtual COLLECTIONS_EXPORT void operator() (int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp=NullNekDouble1DArray)=0
 
virtual COLLECTIONS_EXPORT void UpdateFactors (StdRegions::FactorMap factors)
 Update the supplied factor map. More...
 
virtual COLLECTIONS_EXPORT void UpdateVarcoeffs (StdRegions::VarCoeffMap &varcoeffs)
 Update the supplied variable coefficients. More...
 
unsigned int GetWspSize ()
 Get the size of the required workspace. More...
 
unsigned int GetNumElmt ()
 Get number of elements. More...
 
StdRegions::StdExpansionSharedPtr GetExpSharedPtr ()
 Get expansion pointer. More...
 
unsigned int GetInputSize (bool defaultIn=true)
 
unsigned int GetOutputSize (bool defaultOut=true)
 

Protected Attributes

Array< TwoD, const NekDoublem_derivFac
 
Array< OneD, const NekDoublem_jac
 
int m_dim
 
int m_coordim
 
- Protected Attributes inherited from Nektar::Collections::Operator
bool m_isDeformed
 
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 number of elements that the operator is applied on More...
 
unsigned int m_nqe
 
unsigned int m_wspSize
 
unsigned int m_inputSize
 number of modes or quadrature points that are passed as input to an operator More...
 
unsigned int m_outputSize
 number of modes or quadrature points that are taken as output from an operator More...
 
unsigned int m_inputSizeOther
 Number of modes or quadrature points, opposite to m_inputSize. More...
 
unsigned int m_outputSizeOther
 Number of modes or quadrature points, opposite to m_outputSize. More...
 

Private Member Functions

 IProductWRTDerivBase_IterPerExp (vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
 
- Private Member Functions inherited from Nektar::Collections::IProductWRTDerivBase_Helper
 IProductWRTDerivBase_Helper ()
 

Detailed Description

Inner product WRT deriv base operator using element-wise operation.

Definition at line 408 of file IProductWRTDerivBase.cpp.

Constructor & Destructor Documentation

◆ ~IProductWRTDerivBase_IterPerExp()

Nektar::Collections::IProductWRTDerivBase_IterPerExp::~IProductWRTDerivBase_IterPerExp ( )
finaldefault

◆ IProductWRTDerivBase_IterPerExp()

Nektar::Collections::IProductWRTDerivBase_IterPerExp::IProductWRTDerivBase_IterPerExp ( vector< StdRegions::StdExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData,
StdRegions::FactorMap  factors 
)
inlineprivate

Definition at line 529 of file IProductWRTDerivBase.cpp.

532 : Operator(pCollExp, pGeomData, factors), IProductWRTDerivBase_Helper()
533 {
534 m_dim = pCollExp[0]->GetShapeDimension();
535 m_coordim = pCollExp[0]->GetCoordim();
536
537 m_nqe = m_stdExp->GetTotPoints();
538
539 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
540 m_jac = pGeomData->GetJac(pCollExp);
542 }
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:217
unsigned int m_numElmt
number of elements that the operator is applied on
Definition: Operator.h:219
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition: Operator.cpp:66
StdRegions::ConstFactorMap factors

References m_coordim, m_derivFac, m_dim, m_jac, Nektar::Collections::Operator::m_nqe, Nektar::Collections::Operator::m_numElmt, Nektar::Collections::Operator::m_stdExp, and Nektar::Collections::Operator::m_wspSize.

Member Function Documentation

◆ operator()() [1/2]

void Nektar::Collections::IProductWRTDerivBase_IterPerExp::operator() ( const Array< OneD, const NekDouble > &  input,
Array< OneD, NekDouble > &  output0,
Array< OneD, NekDouble > &  output1,
Array< OneD, NekDouble > &  output2,
Array< OneD, NekDouble > &  wsp 
)
inlinefinalvirtual

Perform operation.

Implements Nektar::Collections::Operator.

Definition at line 416 of file IProductWRTDerivBase.cpp.

421 {
422 unsigned int nPhys = m_stdExp->GetTotPoints();
423 unsigned int ntot = m_numElmt * nPhys;
424 unsigned int nmodes = m_stdExp->GetNcoeffs();
425 unsigned int nmax = max(ntot, m_numElmt * nmodes);
426 Array<OneD, Array<OneD, const NekDouble>> in(3);
427 Array<OneD, NekDouble> output, tmp1;
428 Array<OneD, Array<OneD, NekDouble>> tmp(3);
429
430 in[0] = entry0;
431 in[1] = entry1;
432 in[2] = entry2;
433
434 output = (m_coordim == 3) ? entry3 : (m_coordim == 2) ? entry2 : entry1;
435
436 for (int i = 0; i < m_dim; ++i)
437 {
438 tmp[i] = wsp + i * nmax;
439 }
440
441 // calculate Iproduct WRT Std Deriv
442 // first component
443 if (m_isDeformed)
444 {
445 // calculate dx/dxi in[0] + dy/dxi in[2] + dz/dxi in[3]
446 for (int i = 0; i < m_dim; ++i)
447 {
448 Vmath::Vmul(ntot, m_derivFac[i], 1, in[0], 1, tmp[i], 1);
449 for (int j = 1; j < m_coordim; ++j)
450 {
451 Vmath::Vvtvp(ntot, m_derivFac[i + j * m_dim], 1, in[j], 1,
452 tmp[i], 1, tmp[i], 1);
453 }
454 }
455
456 Vmath::Vmul(ntot, m_jac, 1, tmp[0], 1, tmp[0], 1);
457 }
458 else
459 {
460 Array<OneD, NekDouble> t;
461 for (int e = 0; e < m_numElmt; ++e)
462 {
463 // calculate dx/dxi in[0] + dy/dxi in[1] + dz/dxi in[2]
464 for (int i = 0; i < m_dim; ++i)
465 {
466 Vmath::Smul(m_nqe, m_derivFac[i][e], in[0] + e * m_nqe, 1,
467 t = tmp[i] + e * m_nqe, 1);
468 for (int j = 1; j < m_coordim; ++j)
469 {
470 Vmath::Svtvp(m_nqe, m_derivFac[i + j * m_dim][e],
471 in[j] + e * m_nqe, 1, tmp[i] + e * m_nqe,
472 1, t = tmp[i] + e * m_nqe, 1);
473 }
474 }
475
476 Vmath::Smul(m_nqe, m_jac[e], tmp[0] + e * m_nqe, 1,
477 t = tmp[0] + e * m_nqe, 1);
478 }
479 }
480
481 for (int n = 0; n < m_numElmt; ++n)
482 {
483 m_stdExp->IProductWRTDerivBase(0, tmp[0] + n * nPhys,
484 tmp1 = output + n * nmodes);
485 }
486
487 // other components
488 for (int i = 1; i < m_dim; ++i)
489 {
490 // multiply by Jacobian
491 if (m_isDeformed)
492 {
493 Vmath::Vmul(ntot, m_jac, 1, tmp[i], 1, tmp[i], 1);
494 }
495 else
496 {
497 Array<OneD, NekDouble> t;
498 for (int e = 0; e < m_numElmt; ++e)
499 {
500 Vmath::Smul(m_nqe, m_jac[e], tmp[i] + e * m_nqe, 1,
501 t = tmp[i] + e * m_nqe, 1);
502 }
503 }
504
505 for (int n = 0; n < m_numElmt; ++n)
506 {
507 m_stdExp->IProductWRTDerivBase(i, tmp[i] + n * nPhys, tmp[0]);
508 Vmath::Vadd(nmodes, tmp[0], 1, output + n * nmodes, 1,
509 tmp1 = output + n * nmodes, 1);
510 }
511 }
512 }
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.
Definition: Vmath.hpp:72
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.
Definition: Vmath.hpp:396
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.hpp:366
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.hpp:180
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.hpp:100

References m_coordim, m_derivFac, m_dim, Nektar::Collections::Operator::m_isDeformed, m_jac, Nektar::Collections::Operator::m_nqe, Nektar::Collections::Operator::m_numElmt, Nektar::Collections::Operator::m_stdExp, Vmath::Smul(), Vmath::Svtvp(), Vmath::Vadd(), Vmath::Vmul(), and Vmath::Vvtvp().

◆ operator()() [2/2]

void Nektar::Collections::IProductWRTDerivBase_IterPerExp::operator() ( int  dir,
const Array< OneD, const NekDouble > &  input,
Array< OneD, NekDouble > &  output,
Array< OneD, NekDouble > &  wsp 
)
inlinefinalvirtual

Implements Nektar::Collections::Operator.

Definition at line 514 of file IProductWRTDerivBase.cpp.

518 {
519 NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
520 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202

References Nektar::ErrorUtil::efatal, and NEKERROR.

Member Data Documentation

◆ m_coordim

int Nektar::Collections::IProductWRTDerivBase_IterPerExp::m_coordim
protected

Definition at line 526 of file IProductWRTDerivBase.cpp.

Referenced by IProductWRTDerivBase_IterPerExp(), and operator()().

◆ m_derivFac

Array<TwoD, const NekDouble> Nektar::Collections::IProductWRTDerivBase_IterPerExp::m_derivFac
protected

Definition at line 523 of file IProductWRTDerivBase.cpp.

Referenced by IProductWRTDerivBase_IterPerExp(), and operator()().

◆ m_dim

int Nektar::Collections::IProductWRTDerivBase_IterPerExp::m_dim
protected

Definition at line 525 of file IProductWRTDerivBase.cpp.

Referenced by IProductWRTDerivBase_IterPerExp(), and operator()().

◆ m_jac

Array<OneD, const NekDouble> Nektar::Collections::IProductWRTDerivBase_IterPerExp::m_jac
protected

Definition at line 524 of file IProductWRTDerivBase.cpp.

Referenced by IProductWRTDerivBase_IterPerExp(), and operator()().