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 405 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 528 of file PhysDeriv.cpp.

531 : Operator(pCollExp, pGeomData, factors), PhysDeriv_Helper()
532 {
533 int nqtot = pCollExp[0]->GetTotPoints();
534 m_dim = pCollExp[0]->GetShapeDimension();
535 m_coordim = pCollExp[0]->GetCoordim();
536
537 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
538 m_wspSize = 3 * nqtot * m_numElmt;
539 }
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:523
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 413 of file PhysDeriv.cpp.

418 {
419 int nPhys = m_stdExp->GetTotPoints();
420 int ntot = m_numElmt * nPhys;
421 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
422 Array<OneD, Array<OneD, NekDouble>> Diff(3);
423 Array<OneD, Array<OneD, NekDouble>> out(3);
424 out[0] = output0;
425 out[1] = output1;
426 out[2] = output2;
427
428 for (int i = 0; i < m_dim; ++i)
429 {
430 Diff[i] = wsp + i * ntot;
431 }
432
433 // calculate local derivatives
434 for (int i = 0; i < m_numElmt; ++i)
435 {
436 m_stdExp->PhysDeriv(input + i * nPhys, tmp0 = Diff[0] + i * nPhys,
437 tmp1 = Diff[1] + i * nPhys,
438 tmp2 = Diff[2] + i * nPhys);
439 }
440
441 // calculate full derivative
442 if (m_isDeformed)
443 {
444 for (int i = 0; i < m_coordim; ++i)
445 {
446 Vmath::Vmul(ntot, m_derivFac[i * m_dim], 1, Diff[0], 1, out[i],
447 1);
448 for (int j = 1; j < m_dim; ++j)
449 {
450 Vmath::Vvtvp(ntot, m_derivFac[i * m_dim + j], 1, Diff[j], 1,
451 out[i], 1, out[i], 1);
452 }
453 }
454 }
455 else
456 {
457 Array<OneD, NekDouble> t;
458 for (int e = 0; e < m_numElmt; ++e)
459 {
460 for (int i = 0; i < m_coordim; ++i)
461 {
463 Diff[0] + e * m_nqe, 1, t = out[i] + e * m_nqe,
464 1);
465 for (int j = 1; j < m_dim; ++j)
466 {
467 Vmath::Svtvp(m_nqe, m_derivFac[i * m_dim + j][e],
468 Diff[j] + e * m_nqe, 1, out[i] + e * m_nqe,
469 1, t = out[i] + e * m_nqe, 1);
470 }
471 }
472 }
473 }
474 }
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 476 of file PhysDeriv.cpp.

479 {
480 int nPhys = m_stdExp->GetTotPoints();
481 int ntot = m_numElmt * nPhys;
482 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
483 Array<OneD, Array<OneD, NekDouble>> Diff(3);
484
485 for (int i = 0; i < m_dim; ++i)
486 {
487 Diff[i] = wsp + i * ntot;
488 }
489
490 // calculate local derivatives
491 for (int i = 0; i < m_numElmt; ++i)
492 {
493 m_stdExp->PhysDeriv(input + i * nPhys, tmp0 = Diff[0] + i * nPhys,
494 tmp1 = Diff[1] + i * nPhys,
495 tmp2 = Diff[2] + i * nPhys);
496 }
497
498 Vmath::Zero(ntot, output, 1);
499 if (m_isDeformed)
500 {
501 for (int j = 0; j < m_dim; ++j)
502 {
503 Vmath::Vvtvp(ntot, m_derivFac[dir * m_dim + j], 1, Diff[j], 1,
504 output, 1, output, 1);
505 }
506 }
507 else
508 {
509 Array<OneD, NekDouble> t;
510 for (int e = 0; e < m_numElmt; ++e)
511 {
512 for (int j = 0; j < m_dim; ++j)
513 {
514 Vmath::Svtvp(m_nqe, m_derivFac[dir * m_dim + j][e],
515 Diff[j] + e * m_nqe, 1, output + e * m_nqe, 1,
516 t = output + e * m_nqe, 1);
517 }
518 }
519 }
520 }
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 525 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 523 of file PhysDeriv.cpp.

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

◆ m_dim

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

Definition at line 524 of file PhysDeriv.cpp.

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