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

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

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...
 
- Protected Member Functions inherited from Nektar::Collections::PhysDeriv_Helper
 PhysDeriv_Helper ()
 

Detailed Description

Phys deriv operator using element-wise operation.

Definition at line 432 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 561 of file PhysDeriv.cpp.

564 : Operator(pCollExp, pGeomData, factors), PhysDeriv_Helper()
565 {
566 int nqtot = pCollExp[0]->GetTotPoints();
567 m_dim = pCollExp[0]->GetShapeDimension();
568 m_coordim = pCollExp[0]->GetCoordim();
569
570 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
571 m_wspSize = 3 * nqtot * m_numElmt;
572 }
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
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:556
StdRegions::ConstFactorMap factors

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

Member Function Documentation

◆ CheckFactors()

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

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

References ASSERTL0.

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

445 {
446 int nPhys = m_stdExp->GetTotPoints();
447 int ntot = m_numElmt * nPhys;
448 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
449 Array<OneD, Array<OneD, NekDouble>> Diff(3);
450 Array<OneD, Array<OneD, NekDouble>> out(3);
451 out[0] = output0;
452 out[1] = output1;
453 out[2] = output2;
454
455 for (int i = 0; i < m_dim; ++i)
456 {
457 Diff[i] = wsp + i * ntot;
458 }
459
460 // calculate local derivatives
461 for (int i = 0; i < m_numElmt; ++i)
462 {
463 m_stdExp->PhysDeriv(input + i * nPhys, tmp0 = Diff[0] + i * nPhys,
464 tmp1 = Diff[1] + i * nPhys,
465 tmp2 = Diff[2] + i * nPhys);
466 }
467
468 // calculate full derivative
469 if (m_isDeformed)
470 {
471 for (int i = 0; i < m_coordim; ++i)
472 {
473 Vmath::Vmul(ntot, m_derivFac[i * m_dim], 1, Diff[0], 1, out[i],
474 1);
475 for (int j = 1; j < m_dim; ++j)
476 {
477 Vmath::Vvtvp(ntot, m_derivFac[i * m_dim + j], 1, Diff[j], 1,
478 out[i], 1, out[i], 1);
479 }
480 }
481 }
482 else
483 {
484 Array<OneD, NekDouble> t;
485 for (int e = 0; e < m_numElmt; ++e)
486 {
487 for (int i = 0; i < m_coordim; ++i)
488 {
490 Diff[0] + e * m_nqe, 1, t = out[i] + e * m_nqe,
491 1);
492 for (int j = 1; j < m_dim; ++j)
493 {
494 Vmath::Svtvp(m_nqe, m_derivFac[i * m_dim + j][e],
495 Diff[j] + e * m_nqe, 1, out[i] + e * m_nqe,
496 1, t = out[i] + e * m_nqe, 1);
497 }
498 }
499 }
500 }
501 }
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:188
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 503 of file PhysDeriv.cpp.

506 {
507 int nPhys = m_stdExp->GetTotPoints();
508 int ntot = m_numElmt * nPhys;
509 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
510 Array<OneD, Array<OneD, NekDouble>> Diff(3);
511
512 for (int i = 0; i < m_dim; ++i)
513 {
514 Diff[i] = wsp + i * ntot;
515 }
516
517 // calculate local derivatives
518 for (int i = 0; i < m_numElmt; ++i)
519 {
520 m_stdExp->PhysDeriv(input + i * nPhys, tmp0 = Diff[0] + i * nPhys,
521 tmp1 = Diff[1] + i * nPhys,
522 tmp2 = Diff[2] + i * nPhys);
523 }
524
525 Vmath::Zero(ntot, output, 1);
526 if (m_isDeformed)
527 {
528 for (int j = 0; j < m_dim; ++j)
529 {
530 Vmath::Vvtvp(ntot, m_derivFac[dir * m_dim + j], 1, Diff[j], 1,
531 output, 1, output, 1);
532 }
533 }
534 else
535 {
536 Array<OneD, NekDouble> t;
537 for (int e = 0; e < m_numElmt; ++e)
538 {
539 for (int j = 0; j < m_dim; ++j)
540 {
541 Vmath::Svtvp(m_nqe, m_derivFac[dir * m_dim + j][e],
542 Diff[j] + e * m_nqe, 1, output + e * m_nqe, 1,
543 t = output + e * m_nqe, 1);
544 }
545 }
546 }
547 }
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 558 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 556 of file PhysDeriv.cpp.

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

◆ m_dim

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

Definition at line 557 of file PhysDeriv.cpp.

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