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_SumFac_Hex Class Reference

Phys deriv operator using sum-factorisation (Hex) More...

Inheritance diagram for Nektar::Collections::PhysDeriv_SumFac_Hex:
Inheritance graph
[legend]
Collaboration diagram for Nektar::Collections::PhysDeriv_SumFac_Hex:
Collaboration graph
[legend]

Public Member Functions

virtual ~PhysDeriv_SumFac_Hex ()
 
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
 
const int m_nquad0
 
const int m_nquad1
 
const int m_nquad2
 
NekDoublem_Deriv0
 
NekDoublem_Deriv1
 
NekDoublem_Deriv2
 
- Protected Attributes inherited from Nektar::Collections::Operator
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 
unsigned int m_wspSize
 

Private Member Functions

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

Detailed Description

Phys deriv operator using sum-factorisation (Hex)

Definition at line 918 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

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

Definition at line 923 of file PhysDeriv.cpp.

924  {
925  }
Nektar::Collections::PhysDeriv_SumFac_Hex::PhysDeriv_SumFac_Hex ( vector< StdRegions::StdExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData 
)
inlineprivate

Definition at line 1041 of file PhysDeriv.cpp.

1044  : Operator(pCollExp, pGeomData),
1045  m_nquad0 (m_stdExp->GetNumPoints(0)),
1046  m_nquad1 (m_stdExp->GetNumPoints(1)),
1047  m_nquad2 (m_stdExp->GetNumPoints(2))
1048  {
1049  LibUtilities::PointsKeyVector PtsKey = m_stdExp->GetPointsKeys();
1050 
1051  m_dim = PtsKey.size();
1052  m_coordim = m_stdExp->GetCoordim();
1053 
1054  m_derivFac = pGeomData->GetDerivFactors(pCollExp);
1055 
1056  m_Deriv0 = &((m_stdExp->GetBasis(0)->GetD())->GetPtr())[0];
1057  m_Deriv1 = &((m_stdExp->GetBasis(1)->GetD())->GetPtr())[0];
1058  m_Deriv2 = &((m_stdExp->GetBasis(2)->GetD())->GetPtr())[0];
1059 
1061  }
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:1030
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146

Member Function Documentation

virtual void Nektar::Collections::PhysDeriv_SumFac_Hex::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 927 of file PhysDeriv.cpp.

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

933  {
934  int nPhys = m_stdExp->GetTotPoints();
935  int ntot = m_numElmt*nPhys;
936  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
937  Array<OneD, Array<OneD, NekDouble> > Diff(3);
938  Array<OneD, Array<OneD, NekDouble> > out(3);
939  out[0] = output0; out[1] = output1; out[2] = output2;
940 
941  for(int i = 0; i < m_dim; ++i)
942  {
943  Diff[i] = wsp + i*ntot;
944  }
945 
946  Blas::Dgemm('N','N', m_nquad0,m_nquad1*m_nquad2*m_numElmt,
947  m_nquad0,1.0, m_Deriv0,m_nquad0,&input[0],
948  m_nquad0,0.0,&Diff[0][0],m_nquad0);
949 
950  for(int i = 0; i < m_numElmt; ++i)
951  {
952  for (int j = 0; j < m_nquad2; ++j)
953  {
954  Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1,
955  1.0, &input[i*nPhys+j*m_nquad0*m_nquad1],
956  m_nquad0, m_Deriv1, m_nquad1, 0.0,
957  &Diff[1][i*nPhys+j*m_nquad0*m_nquad1],
958  m_nquad0);
959  }
960 
961  Blas::Dgemm('N','T',m_nquad0*m_nquad1,m_nquad2,m_nquad2,
962  1.0, &input[i*nPhys],m_nquad0*m_nquad1,
963  m_Deriv2,m_nquad2, 0.0,&Diff[2][i*nPhys],
964  m_nquad0*m_nquad1);
965  }
966 
967  // calculate full derivative
968  for(int i = 0; i < m_coordim; ++i)
969  {
970  Vmath::Vmul(ntot,m_derivFac[i*m_dim],1,Diff[0],1,out[i],1);
971  for(int j = 1; j < m_dim; ++j)
972  {
973  Vmath::Vvtvp (ntot, m_derivFac[i*m_dim+j], 1,
974  Diff[j], 1,
975  out[i], 1,
976  out[i], 1);
977  }
978  }
979  }
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
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:1030
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_SumFac_Hex::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 981 of file PhysDeriv.cpp.

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

986  {
987  int nPhys = m_stdExp->GetTotPoints();
988  int ntot = m_numElmt*nPhys;
989  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
990  Array<OneD, Array<OneD, NekDouble> > Diff(3);
991 
992  for(int i = 0; i < m_dim; ++i)
993  {
994  Diff[i] = wsp + i*ntot;
995  }
996 
997  Blas::Dgemm('N','N', m_nquad0,m_nquad1*m_nquad2*m_numElmt,
998  m_nquad0,1.0, m_Deriv0,m_nquad0,&input[0],
999  m_nquad0,0.0,&Diff[0][0],m_nquad0);
1000 
1001  for(int i = 0; i < m_numElmt; ++i)
1002  {
1003  for (int j = 0; j < m_nquad2; ++j)
1004  {
1005  Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1,
1006  1.0, &input[i*nPhys+j*m_nquad0*m_nquad1],
1007  m_nquad0, m_Deriv1, m_nquad1, 0.0,
1008  &Diff[1][i*nPhys+j*m_nquad0*m_nquad1],
1009  m_nquad0);
1010  }
1011 
1012  Blas::Dgemm('N','T',m_nquad0*m_nquad1,m_nquad2,m_nquad2,
1013  1.0, &input[i*nPhys],m_nquad0*m_nquad1,
1014  m_Deriv2,m_nquad2, 0.0,&Diff[2][i*nPhys],
1015  m_nquad0*m_nquad1);
1016  }
1017 
1018  // calculate full derivative
1019  Vmath::Vmul(ntot,m_derivFac[dir*m_dim],1,Diff[0],1,output,1);
1020  for(int j = 1; j < m_dim; ++j)
1021  {
1022  Vmath::Vvtvp (ntot, m_derivFac[dir*m_dim+j], 1,
1023  Diff[j], 1,
1024  output, 1,
1025  output, 1);
1026  }
1027  }
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
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:1030
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_SumFac_Hex::m_coordim
protected

Definition at line 1032 of file PhysDeriv.cpp.

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Hex::m_Deriv0
protected

Definition at line 1036 of file PhysDeriv.cpp.

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Hex::m_Deriv1
protected

Definition at line 1037 of file PhysDeriv.cpp.

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Hex::m_Deriv2
protected

Definition at line 1038 of file PhysDeriv.cpp.

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

Definition at line 1030 of file PhysDeriv.cpp.

int Nektar::Collections::PhysDeriv_SumFac_Hex::m_dim
protected

Definition at line 1031 of file PhysDeriv.cpp.

const int Nektar::Collections::PhysDeriv_SumFac_Hex::m_nquad0
protected

Definition at line 1033 of file PhysDeriv.cpp.

const int Nektar::Collections::PhysDeriv_SumFac_Hex::m_nquad1
protected

Definition at line 1034 of file PhysDeriv.cpp.

const int Nektar::Collections::PhysDeriv_SumFac_Hex::m_nquad2
protected

Definition at line 1035 of file PhysDeriv.cpp.