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
 
void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output0, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp) override final
 Perform operation. More...
 
void operator() (int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp) override final
 
virtual 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 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 429 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

◆ ~PhysDeriv_IterPerExp()

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

Definition at line 434 of file PhysDeriv.cpp.

435  {
436  }

◆ 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)
565  {
566  int nqtot = 1;
567  LibUtilities::PointsKeyVector PtsKey = m_stdExp->GetPointsKeys();
568  m_dim = PtsKey.size();
569  m_coordim = pCollExp[0]->GetCoordim();
570 
571  for (int i = 0; i < m_dim; ++i)
572  {
573  nqtot *= PtsKey[i].GetNumPoints();
574  }
575  m_derivFac = pGeomData->GetDerivFactors(pCollExp);
576  m_wspSize = 3 * nqtot * m_numElmt;
577  }
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:165
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition: Operator.cpp:43
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:556
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:250

Member Function Documentation

◆ CheckFactors()

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

550  {
551  boost::ignore_unused(factors, coll_phys_offset);
552  ASSERTL0(false, "Not valid for this operator.");
553  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215

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

Perform operation.

Implements Nektar::Collections::Operator.

Definition at line 438 of file PhysDeriv.cpp.

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

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

Implements Nektar::Collections::Operator.

Definition at line 502 of file PhysDeriv.cpp.

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

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

◆ m_derivFac

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

Definition at line 556 of file PhysDeriv.cpp.

◆ m_dim

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

Definition at line 557 of file PhysDeriv.cpp.