Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:
Inheritance graph
[legend]
Collaboration diagram for Nektar::Collections::PhysDeriv_IterPerExp:
Collaboration graph
[legend]

Public Member Functions

virtual ~PhysDeriv_IterPerExp ()
 
virtual void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output0, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
 Perform operation. More...
 
virtual void operator() (int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
 
- Public Member Functions inherited from Nektar::Collections::Operator
 Operator (std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, boost::shared_ptr< CoalescedGeomData > GeomData)
 Constructor. More...
 
virtual COLLECTIONS_EXPORT ~Operator ()
 
int GetWspSize ()
 Get the size of the required workspace. More...
 

Protected Attributes

Array< TwoD, const NekDoublem_derivFac
 
int m_dim
 
int m_coordim
 
- Protected Attributes inherited from Nektar::Collections::Operator
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 
unsigned int m_wspSize
 

Private Member Functions

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

Detailed Description

Phys deriv operator using element-wise operation.

Definition at line 229 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

virtual Nektar::Collections::PhysDeriv_IterPerExp::~PhysDeriv_IterPerExp ( )
inlinevirtual

Definition at line 234 of file PhysDeriv.cpp.

235  {
236  }
Nektar::Collections::PhysDeriv_IterPerExp::PhysDeriv_IterPerExp ( vector< StdRegions::StdExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData 
)
inlineprivate

Definition at line 322 of file PhysDeriv.cpp.

325  : Operator(pCollExp, pGeomData)
326  {
327  int nqtot = 1;
328  LibUtilities::PointsKeyVector PtsKey = m_stdExp->GetPointsKeys();
329  m_dim = PtsKey.size();
330  m_coordim = m_stdExp->GetCoordim();
331 
332  for(int i = 0; i < m_dim; ++i)
333  {
334  nqtot *= PtsKey[i].GetNumPoints();
335  }
336  m_derivFac = pGeomData->GetDerivFactors(pCollExp);
337  m_wspSize = 3*nqtot*m_numElmt;
338  }
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, boost::shared_ptr< CoalescedGeomData > GeomData)
Constructor.
Definition: Operator.h:112
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:242
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:317
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146

Member Function Documentation

virtual 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 
)
inlinevirtual

Perform operation.

Implements Nektar::Collections::Operator.

Definition at line 238 of file PhysDeriv.cpp.

References Vmath::Vmul(), and Vmath::Vvtvp().

244  {
245  int nPhys = m_stdExp->GetTotPoints();
246  int ntot = m_numElmt*nPhys;
247  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
248  Array<OneD, Array<OneD, NekDouble> > Diff(3);
249  Array<OneD, Array<OneD, NekDouble> > out(3);
250  out[0] = output0; out[1] = output1; out[2] = output2;
251 
252  for(int i = 0; i < m_dim; ++i)
253  {
254  Diff[i] = wsp + i*ntot;
255  }
256 
257  // calculate local derivatives
258  for (int i = 0; i < m_numElmt; ++i)
259  {
260  m_stdExp->PhysDeriv(input + i*nPhys,
261  tmp0 = Diff[0] + i*nPhys,
262  tmp1 = Diff[1] + i*nPhys,
263  tmp2 = Diff[2] + i*nPhys);
264  }
265 
266  // calculate full derivative
267  for(int i = 0; i < m_coordim; ++i)
268  {
269  Vmath::Vmul(ntot,m_derivFac[i*m_dim],1,Diff[0],1,out[i],1);
270  for(int j = 1; j < m_dim; ++j)
271  {
272  Vmath::Vvtvp (ntot, m_derivFac[i*m_dim+j], 1,
273  Diff[j], 1,
274  out[i], 1,
275  out[i], 1);
276  }
277  }
278  }
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:317
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:442
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146
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:183
virtual void Nektar::Collections::PhysDeriv_IterPerExp::operator() ( int  dir,
const Array< OneD, const NekDouble > &  input,
Array< OneD, NekDouble > &  output,
Array< OneD, NekDouble > &  wsp 
)
inlinevirtual

Implements Nektar::Collections::Operator.

Definition at line 280 of file PhysDeriv.cpp.

References Vmath::Vmul(), and Vmath::Vvtvp().

285  {
286  int nPhys = m_stdExp->GetTotPoints();
287  int ntot = m_numElmt*nPhys;
288  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
289  Array<OneD, Array<OneD, NekDouble> > Diff(3);
290 
291  for(int i = 0; i < m_dim; ++i)
292  {
293  Diff[i] = wsp + i*ntot;
294  }
295 
296  // calculate local derivatives
297  for (int i = 0; i < m_numElmt; ++i)
298  {
299  m_stdExp->PhysDeriv(input + i*nPhys,
300  tmp0 = Diff[0] + i*nPhys,
301  tmp1 = Diff[1] + i*nPhys,
302  tmp2 = Diff[2] + i*nPhys);
303  }
304 
305  // calculate full derivative
306  Vmath::Vmul(ntot,m_derivFac[dir*m_dim],1,Diff[0],1,output,1);
307  for(int j = 1; j < m_dim; ++j)
308  {
309  Vmath::Vvtvp (ntot, m_derivFac[dir*m_dim+j], 1,
310  Diff[j], 1,
311  output, 1,
312  output, 1);
313  }
314  }
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:317
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:442
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146
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:183

Member Data Documentation

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

Definition at line 319 of file PhysDeriv.cpp.

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

Definition at line 317 of file PhysDeriv.cpp.

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

Definition at line 318 of file PhysDeriv.cpp.