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
 
void CheckFactors (StdRegions::FactorMap factors, int coll_phys_offset) override
 Check the validity of the supplied factor map. More...
 
- 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 CheckFactors (StdRegions::FactorMap factors, int coll_phys_offset)=0
 Check the validity of the supplied factor map. 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 ()
 
unsigned int GetOutputSize ()
 

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...
 

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 ()
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Collections::Operator
virtual int v_GetInputSize ()
 This purely virtual function needs to be set-up for every operator inside Collections. It is responsible for returning the size of input collection, that the operator is applied on either in physical or coefficient space. More...
 
virtual int v_GetOutputSize ()
 This purely virtual function needs to be set-up for every operator inside Collections. It is responsible for returning the output size either in physical or coefficient space of an operator inside Collections. More...
 

Detailed Description

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

Definition at line 449 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 576 of file IProductWRTDerivBase.cpp.

579 : Operator(pCollExp, pGeomData, factors), IProductWRTDerivBase_Helper()
580 {
581 m_dim = pCollExp[0]->GetShapeDimension();
582 m_coordim = pCollExp[0]->GetCoordim();
583
584 m_nqe = m_stdExp->GetTotPoints();
585
586 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
587 m_jac = pGeomData->GetJac(pCollExp);
589 }
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:188
unsigned int m_numElmt
number of elements that the operator is applied on
Definition: Operator.h:190
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

◆ CheckFactors()

void Nektar::Collections::IProductWRTDerivBase_IterPerExp::CheckFactors ( StdRegions::FactorMap  factors,
int  coll_phys_offset 
)
inlineoverridevirtual

Check the validity of the supplied factor map.

Implements Nektar::Collections::Operator.

Definition at line 563 of file IProductWRTDerivBase.cpp.

565 {
566 ASSERTL0(false, "Not valid for this operator.");
567 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208

References ASSERTL0.

◆ 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 457 of file IProductWRTDerivBase.cpp.

462 {
463 unsigned int nPhys = m_stdExp->GetTotPoints();
464 unsigned int ntot = m_numElmt * nPhys;
465 unsigned int nmodes = m_stdExp->GetNcoeffs();
466 unsigned int nmax = max(ntot, m_numElmt * nmodes);
467 Array<OneD, Array<OneD, const NekDouble>> in(3);
468 Array<OneD, NekDouble> output, tmp1;
469 Array<OneD, Array<OneD, NekDouble>> tmp(3);
470
471 in[0] = entry0;
472 in[1] = entry1;
473 in[2] = entry2;
474
475 output = (m_coordim == 3) ? entry3 : (m_coordim == 2) ? entry2 : entry1;
476
477 for (int i = 0; i < m_dim; ++i)
478 {
479 tmp[i] = wsp + i * nmax;
480 }
481
482 // calculate Iproduct WRT Std Deriv
483 // first component
484 if (m_isDeformed)
485 {
486 // calculate dx/dxi in[0] + dy/dxi in[2] + dz/dxi in[3]
487 for (int i = 0; i < m_dim; ++i)
488 {
489 Vmath::Vmul(ntot, m_derivFac[i], 1, in[0], 1, tmp[i], 1);
490 for (int j = 1; j < m_coordim; ++j)
491 {
492 Vmath::Vvtvp(ntot, m_derivFac[i + j * m_dim], 1, in[j], 1,
493 tmp[i], 1, tmp[i], 1);
494 }
495 }
496
497 Vmath::Vmul(ntot, m_jac, 1, tmp[0], 1, tmp[0], 1);
498 }
499 else
500 {
501 Array<OneD, NekDouble> t;
502 for (int e = 0; e < m_numElmt; ++e)
503 {
504 // calculate dx/dxi in[0] + dy/dxi in[1] + dz/dxi in[2]
505 for (int i = 0; i < m_dim; ++i)
506 {
507 Vmath::Smul(m_nqe, m_derivFac[i][e], in[0] + e * m_nqe, 1,
508 t = tmp[i] + e * m_nqe, 1);
509 for (int j = 1; j < m_coordim; ++j)
510 {
511 Vmath::Svtvp(m_nqe, m_derivFac[i + j * m_dim][e],
512 in[j] + e * m_nqe, 1, tmp[i] + e * m_nqe,
513 1, t = tmp[i] + e * m_nqe, 1);
514 }
515 }
516
517 Vmath::Smul(m_nqe, m_jac[e], tmp[0] + e * m_nqe, 1,
518 t = tmp[0] + e * m_nqe, 1);
519 }
520 }
521
522 for (int n = 0; n < m_numElmt; ++n)
523 {
524 m_stdExp->IProductWRTDerivBase(0, tmp[0] + n * nPhys,
525 tmp1 = output + n * nmodes);
526 }
527
528 // other components
529 for (int i = 1; i < m_dim; ++i)
530 {
531 // multiply by Jacobian
532 if (m_isDeformed)
533 {
534 Vmath::Vmul(ntot, m_jac, 1, tmp[i], 1, tmp[i], 1);
535 }
536 else
537 {
538 Array<OneD, NekDouble> t;
539 for (int e = 0; e < m_numElmt; ++e)
540 {
541 Vmath::Smul(m_nqe, m_jac[e], tmp[i] + e * m_nqe, 1,
542 t = tmp[i] + e * m_nqe, 1);
543 }
544 }
545
546 for (int n = 0; n < m_numElmt; ++n)
547 {
548 m_stdExp->IProductWRTDerivBase(i, tmp[i] + n * nPhys, tmp[0]);
549 Vmath::Vadd(nmodes, tmp[0], 1, output + n * nmodes, 1,
550 tmp1 = output + n * nmodes, 1);
551 }
552 }
553 }
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 555 of file IProductWRTDerivBase.cpp.

559 {
560 NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
561 }
#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 573 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 570 of file IProductWRTDerivBase.cpp.

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

◆ m_dim

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

Definition at line 572 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 571 of file IProductWRTDerivBase.cpp.

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