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

Phys deriv operator using element-wise operation. More...

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

Public Member Functions

 ~PhysDeriv_IterPerExp () final=default
 
void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output0, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, 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
 
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

 PhysDeriv_IterPerExp (vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Collections::PhysDeriv_Helper
 PhysDeriv_Helper ()
 

Detailed Description

Phys deriv operator using element-wise operation.

Definition at line 420 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

◆ ~PhysDeriv_IterPerExp()

Nektar::Collections::PhysDeriv_IterPerExp::~PhysDeriv_IterPerExp ( )
finaldefault

◆ PhysDeriv_IterPerExp()

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

Definition at line 543 of file PhysDeriv.cpp.

546 : Operator(pCollExp, pGeomData, factors), PhysDeriv_Helper()
547 {
548 int nqtot = pCollExp[0]->GetTotPoints();
549 m_dim = pCollExp[0]->GetShapeDimension();
550 m_coordim = pCollExp[0]->GetCoordim();
551
552 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
553 m_wspSize = 3 * nqtot * m_numElmt;
554 }
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
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:538
StdRegions::ConstFactorMap factors

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

Member Function Documentation

◆ operator()() [1/2]

void Nektar::Collections::PhysDeriv_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 428 of file PhysDeriv.cpp.

433 {
434 int nPhys = m_stdExp->GetTotPoints();
435 int ntot = m_numElmt * nPhys;
436 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
437 Array<OneD, Array<OneD, NekDouble>> Diff(3);
438 Array<OneD, Array<OneD, NekDouble>> out(3);
439 out[0] = output0;
440 out[1] = output1;
441 out[2] = output2;
442
443 for (int i = 0; i < m_dim; ++i)
444 {
445 Diff[i] = wsp + i * ntot;
446 }
447
448 // calculate local derivatives
449 for (int i = 0; i < m_numElmt; ++i)
450 {
451 m_stdExp->PhysDeriv(input + i * nPhys, tmp0 = Diff[0] + i * nPhys,
452 tmp1 = Diff[1] + i * nPhys,
453 tmp2 = Diff[2] + i * nPhys);
454 }
455
456 // calculate full derivative
457 if (m_isDeformed)
458 {
459 for (int i = 0; i < m_coordim; ++i)
460 {
461 Vmath::Vmul(ntot, m_derivFac[i * m_dim], 1, Diff[0], 1, out[i],
462 1);
463 for (int j = 1; j < m_dim; ++j)
464 {
465 Vmath::Vvtvp(ntot, m_derivFac[i * m_dim + j], 1, Diff[j], 1,
466 out[i], 1, out[i], 1);
467 }
468 }
469 }
470 else
471 {
472 Array<OneD, NekDouble> t;
473 for (int e = 0; e < m_numElmt; ++e)
474 {
475 for (int i = 0; i < m_coordim; ++i)
476 {
478 Diff[0] + e * m_nqe, 1, t = out[i] + e * m_nqe,
479 1);
480 for (int j = 1; j < m_dim; ++j)
481 {
482 Vmath::Svtvp(m_nqe, m_derivFac[i * m_dim + j][e],
483 Diff[j] + e * m_nqe, 1, out[i] + e * m_nqe,
484 1, t = out[i] + e * m_nqe, 1);
485 }
486 }
487 }
488 }
489 }
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:217
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 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, Nektar::Collections::Operator::m_nqe, Nektar::Collections::Operator::m_numElmt, Nektar::Collections::Operator::m_stdExp, Vmath::Smul(), Vmath::Svtvp(), Vmath::Vmul(), and Vmath::Vvtvp().

◆ operator()() [2/2]

void Nektar::Collections::PhysDeriv_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 491 of file PhysDeriv.cpp.

494 {
495 int nPhys = m_stdExp->GetTotPoints();
496 int ntot = m_numElmt * nPhys;
497 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
498 Array<OneD, Array<OneD, NekDouble>> Diff(3);
499
500 for (int i = 0; i < m_dim; ++i)
501 {
502 Diff[i] = wsp + i * ntot;
503 }
504
505 // calculate local derivatives
506 for (int i = 0; i < m_numElmt; ++i)
507 {
508 m_stdExp->PhysDeriv(input + i * nPhys, tmp0 = Diff[0] + i * nPhys,
509 tmp1 = Diff[1] + i * nPhys,
510 tmp2 = Diff[2] + i * nPhys);
511 }
512
513 Vmath::Zero(ntot, output, 1);
514 if (m_isDeformed)
515 {
516 for (int j = 0; j < m_dim; ++j)
517 {
518 Vmath::Vvtvp(ntot, m_derivFac[dir * m_dim + j], 1, Diff[j], 1,
519 output, 1, output, 1);
520 }
521 }
522 else
523 {
524 Array<OneD, NekDouble> t;
525 for (int e = 0; e < m_numElmt; ++e)
526 {
527 for (int j = 0; j < m_dim; ++j)
528 {
529 Vmath::Svtvp(m_nqe, m_derivFac[dir * m_dim + j][e],
530 Diff[j] + e * m_nqe, 1, output + e * m_nqe, 1,
531 t = output + e * m_nqe, 1);
532 }
533 }
534 }
535 }
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.hpp:273

References m_derivFac, m_dim, Nektar::Collections::Operator::m_isDeformed, Nektar::Collections::Operator::m_nqe, Nektar::Collections::Operator::m_numElmt, Nektar::Collections::Operator::m_stdExp, Vmath::Svtvp(), Vmath::Vvtvp(), and Vmath::Zero().

Member Data Documentation

◆ m_coordim

int Nektar::Collections::PhysDeriv_IterPerExp::m_coordim
protected

Definition at line 540 of file PhysDeriv.cpp.

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

◆ m_derivFac

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

Definition at line 538 of file PhysDeriv.cpp.

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

◆ m_dim

int Nektar::Collections::PhysDeriv_IterPerExp::m_dim
protected

Definition at line 539 of file PhysDeriv.cpp.

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