Nektar++
Loading...
Searching...
No Matches
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.
 
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< LocalRegions::ExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
 Constructor.
 
virtual ~Operator ()=default
 
virtual COLLECTIONS_EXPORT void UpdateFactors (StdRegions::FactorMap factors)
 Update the supplied factor map.
 
virtual COLLECTIONS_EXPORT void UpdateVarcoeffs (StdRegions::VarCoeffMap &varcoeffs)
 Update the supplied variable coefficients.
 
unsigned int GetWspSize ()
 Get the size of the required workspace.
 
unsigned int GetNumElmt ()
 Get number of elements.
 
StdRegions::StdExpansionSharedPtr GetExpSharedPtr ()
 Get expansion pointer.
 
unsigned int GetInputSize (void)
 
unsigned int GetOutputSize (void)
 
unsigned int GetPhysSize (void)
 
unsigned int GetCoeffSize (void)
 

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
 
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
 
unsigned int m_outputSize
 number of modes or quadrature points that are taken as output from an operator
 

Private Member Functions

 PhysDeriv_IterPerExp (vector< LocalRegions::ExpansionSharedPtr > 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 407 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< LocalRegions::ExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData,
StdRegions::FactorMap  factors 
)
inlineprivate

Definition at line 530 of file PhysDeriv.cpp.

533 : Operator(pCollExp, pGeomData, factors), PhysDeriv_Helper()
534 {
535 int nqtot = pCollExp[0]->GetTotPoints();
536 m_dim = pCollExp[0]->GetShapeDimension();
537 m_coordim = pCollExp[0]->GetCoordim();
538
539 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
540 m_wspSize = 3 * nqtot * m_numElmt;
541 }
unsigned int m_numElmt
number of elements that the operator is applied on
Definition Operator.h:232
Operator(std::vector< LocalRegions::ExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition Operator.cpp:66
Array< TwoD, const NekDouble > m_derivFac

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

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

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

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

◆ m_dim

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

Definition at line 526 of file PhysDeriv.cpp.

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