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

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

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

Public Member Functions

 ~PhysDeriv_IterPerExp () final
 
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
 
virtual void CheckFactors (StdRegions::FactorMap factors, int coll_phys_offset)
 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 COLLECTIONS_EXPORT ~Operator ()
 
unsigned int GetWspSize ()
 Get the size of the required workspace. More...
 
unsigned int GetNumElmt ()
 Get expansion pointer. More...
 
StdRegions::StdExpansionSharedPtr GetExpSharedPtr ()
 Get expansion pointer. More...
 

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
 
unsigned int m_nqe
 
unsigned int m_wspSize
 

Private Member Functions

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

Detailed Description

Phys deriv operator using element-wise operation.

Definition at line 445 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

◆ ~PhysDeriv_IterPerExp()

Nektar::Collections::PhysDeriv_IterPerExp::~PhysDeriv_IterPerExp ( )
inlinefinal

Definition at line 450 of file PhysDeriv.cpp.

451  {
452  }

◆ PhysDeriv_IterPerExp()

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

Definition at line 583 of file PhysDeriv.cpp.

587  : Operator(pCollExp, pGeomData, factors)
588  {
589  int nqtot = 1;
590  LibUtilities::PointsKeyVector PtsKey = m_stdExp->GetPointsKeys();
591  m_dim = PtsKey.size();
592  m_coordim = pCollExp[0]->GetCoordim();
593 
594  for(int i = 0; i < m_dim; ++i)
595  {
596  nqtot *= PtsKey[i].GetNumPoints();
597  }
598  m_derivFac = pGeomData->GetDerivFactors(pCollExp);
599  m_wspSize = 3*nqtot*m_numElmt;
600  }
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:167
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition: Operator.cpp:41
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:578
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:246

Member Function Documentation

◆ CheckFactors()

virtual void Nektar::Collections::PhysDeriv_IterPerExp::CheckFactors ( StdRegions::FactorMap  factors,
int  coll_phys_offset 
)
inlinevirtual

Check the validity of the supplied factor map.

Implements Nektar::Collections::Operator.

Definition at line 570 of file PhysDeriv.cpp.

572  {
573  boost::ignore_unused(factors, coll_phys_offset);
574  ASSERTL0(false, "Not valid for this operator.");
575  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216

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

459  {
460 
461  int nPhys = m_stdExp->GetTotPoints();
462  int ntot = m_numElmt*nPhys;
463  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
464  Array<OneD, Array<OneD, NekDouble> > Diff(3);
465  Array<OneD, Array<OneD, NekDouble> > out(3);
466  out[0] = output0; out[1] = output1; out[2] = output2;
467 
468  for(int i = 0; i < m_dim; ++i)
469  {
470  Diff[i] = wsp + i*ntot;
471  }
472 
473  // calculate local derivatives
474  for (int i = 0; i < m_numElmt; ++i)
475  {
476  m_stdExp->PhysDeriv(input + i*nPhys,
477  tmp0 = Diff[0] + i*nPhys,
478  tmp1 = Diff[1] + i*nPhys,
479  tmp2 = Diff[2] + i*nPhys);
480  }
481 
482  // calculate full derivative
483  if(m_isDeformed)
484  {
485  for(int i = 0; i < m_coordim; ++i)
486  {
487  Vmath::Vmul(ntot,m_derivFac[i*m_dim],1,Diff[0],1,out[i],1);
488  for(int j = 1; j < m_dim; ++j)
489  {
490  Vmath::Vvtvp (ntot, m_derivFac[i*m_dim+j], 1,
491  Diff[j], 1,
492  out[i], 1,
493  out[i], 1);
494  }
495  }
496  }
497  else
498  {
499  Array<OneD, NekDouble> t;
500  for(int e = 0; e < m_numElmt; ++e)
501  {
502  for(int i = 0; i < m_coordim; ++i)
503  {
505  Diff[0] + e*m_nqe,1,
506  t = out[i] + e*m_nqe,1);
507  for(int j = 1; j < m_dim; ++j)
508  {
510  Diff[j] + e*m_nqe, 1,
511  out[i] + e*m_nqe, 1,
512  t = out[i] + e*m_nqe, 1);
513  }
514  }
515  }
516  }
517  }
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.cpp:192
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.cpp:565
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.cpp:513
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.cpp:225

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

523  {
524  int nPhys = m_stdExp->GetTotPoints();
525  int ntot = m_numElmt*nPhys;
526  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
527  Array<OneD, Array<OneD, NekDouble> > Diff(3);
528 
529  for(int i = 0; i < m_dim; ++i)
530  {
531  Diff[i] = wsp + i*ntot;
532  }
533 
534  // calculate local derivatives
535  for (int i = 0; i < m_numElmt; ++i)
536  {
537  m_stdExp->PhysDeriv(input + i*nPhys,
538  tmp0 = Diff[0] + i*nPhys,
539  tmp1 = Diff[1] + i*nPhys,
540  tmp2 = Diff[2] + i*nPhys);
541  }
542 
543  Vmath::Zero(ntot,output,1);
544  if(m_isDeformed)
545  {
546  for(int j = 0; j < m_dim; ++j)
547  {
548  Vmath::Vvtvp (ntot, m_derivFac[dir*m_dim+j], 1,
549  Diff[j], 1,
550  output, 1,
551  output, 1);
552  }
553  }
554  else
555  {
556  Array<OneD, NekDouble> t;
557  for(int e = 0; e < m_numElmt; ++e)
558  {
559  for(int j = 0; j < m_dim; ++j)
560  {
561  Vmath::Svtvp (m_nqe, m_derivFac[dir*m_dim+j][e],
562  Diff[j] + e*m_nqe, 1,
563  output + e*m_nqe, 1,
564  t = output + e*m_nqe, 1);
565  }
566  }
567  }
568  }
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:436

References Vmath::Svtvp(), Vmath::Vvtvp(), and Vmath::Zero().

Member Data Documentation

◆ m_coordim

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

Definition at line 580 of file PhysDeriv.cpp.

◆ m_derivFac

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

Definition at line 578 of file PhysDeriv.cpp.

◆ m_dim

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

Definition at line 579 of file PhysDeriv.cpp.