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

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

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

Public Member Functions

virtual ~PhysDeriv_SumFac_Tri ()
 
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

int m_coordim
 
const int m_nquad0
 
const int m_nquad1
 
Array< TwoD, const NekDoublem_derivFac
 
NekDoublem_Deriv0
 
NekDoublem_Deriv1
 
Array< OneD, NekDoublem_fac0
 
Array< OneD, NekDoublem_fac1
 
- Protected Attributes inherited from Nektar::Collections::Operator
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 
unsigned int m_wspSize
 

Private Member Functions

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

Detailed Description

Phys deriv operator using sum-factorisation (Tri)

Definition at line 736 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

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

Definition at line 741 of file PhysDeriv.cpp.

742  {
743  }
Nektar::Collections::PhysDeriv_SumFac_Tri::PhysDeriv_SumFac_Tri ( vector< StdRegions::StdExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData 
)
inlineprivate

Definition at line 860 of file PhysDeriv.cpp.

863  : Operator (pCollExp, pGeomData),
864  m_nquad0 (m_stdExp->GetNumPoints(0)),
865  m_nquad1 (m_stdExp->GetNumPoints(1))
866  {
867  LibUtilities::PointsKeyVector PtsKey = m_stdExp->GetPointsKeys();
868  m_coordim = m_stdExp->GetCoordim();
869 
870  m_derivFac = pGeomData->GetDerivFactors(pCollExp);
871 
872  const Array<OneD, const NekDouble>& z0
873  = m_stdExp->GetBasis(0)->GetZ();
874  const Array<OneD, const NekDouble>& z1
875  = m_stdExp->GetBasis(1)->GetZ();
876  m_fac0 = Array<OneD, NekDouble>(m_nquad0*m_nquad1);
877  // set up geometric factor: 0.5*(1+z0)
878  for (int i = 0; i < m_nquad0; ++i)
879  {
880  for(int j = 0; j < m_nquad1; ++j)
881  {
882  m_fac0[i+j*m_nquad0] = 0.5*(1+z0[i]);
883  }
884  }
885 
886  m_fac1 = Array<OneD, NekDouble>(m_nquad0*m_nquad1);
887  // set up geometric factor: 2/(1-z1)
888  for (int i = 0; i < m_nquad0; ++i)
889  {
890  for(int j = 0; j < m_nquad1; ++j)
891  {
892  m_fac1[i+j*m_nquad0] = 2.0/(1-z1[j]);
893  }
894  }
895 
896 
897  m_Deriv0 = &((m_stdExp->GetBasis(0)->GetD())->GetPtr())[0];
898  m_Deriv1 = &((m_stdExp->GetBasis(1)->GetD())->GetPtr())[0];
899  m_wspSize = 2 * m_nquad0*m_nquad1*m_numElmt;
900  }
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:853
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146

Member Function Documentation

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

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

751  {
752  const int nqtot = m_nquad0 * m_nquad1;
753  const int nqcol = nqtot*m_numElmt;
754 
755  ASSERTL1(wsp.num_elements() == m_wspSize,
756  "Incorrect workspace size");
757  ASSERTL1(input.num_elements() >= nqcol,
758  "Incorrect input size");
759 
760  Array<OneD, NekDouble> diff0(nqcol, wsp );
761  Array<OneD, NekDouble> diff1(nqcol, wsp + nqcol);
762 
763  // Tensor Product Derivative
764  Blas::Dgemm('N', 'N', m_nquad0, m_nquad1*m_numElmt,
765  m_nquad0, 1.0, m_Deriv0, m_nquad0,
766  input.get(), m_nquad0, 0.0,
767  diff0.get(), m_nquad0);
768 
769  int cnt = 0;
770  for (int i = 0; i < m_numElmt; ++i, cnt += nqtot)
771  {
772  // scale diff0 by geometric factor: 2/(1-z1)
773  Vmath::Vmul(nqtot,&m_fac1[0],1,diff0.get()+cnt,1,
774  diff0.get()+cnt,1);
775 
776  Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
777  input.get() + cnt, m_nquad0,
778  m_Deriv1, m_nquad1, 0.0,
779  diff1.get() + cnt, m_nquad0);
780 
781  // add to diff1 by diff0 scaled by: (1_z0)/(1-z1)
782  Vmath::Vvtvp(nqtot,m_fac0.get(),1,diff0.get()+cnt,1,
783  diff1.get()+cnt,1,diff1.get()+cnt,1);
784  }
785 
786 
787  Vmath::Vmul (nqcol, m_derivFac[0], 1, diff0, 1, output0, 1);
788  Vmath::Vvtvp (nqcol, m_derivFac[1], 1, diff1, 1,
789  output0, 1, output0, 1);
790  Vmath::Vmul (nqcol, m_derivFac[2], 1, diff0, 1, output1, 1);
791  Vmath::Vvtvp (nqcol, m_derivFac[3], 1, diff1, 1,
792  output1, 1, output1, 1);
793 
794  if (m_coordim == 3)
795  {
796  Vmath::Vmul (nqcol, m_derivFac[4], 1, diff0, 1,
797  output2, 1);
798  Vmath::Vvtvp (nqcol, m_derivFac[5], 1, diff1, 1,
799  output2, 1, output2, 1);
800  }
801  }
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:853
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
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_Tri::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 803 of file PhysDeriv.cpp.

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

808  {
809  const int nqtot = m_nquad0 * m_nquad1;
810  const int nqcol = nqtot*m_numElmt;
811 
812  ASSERTL1(wsp.num_elements() == m_wspSize,
813  "Incorrect workspace size");
814  ASSERTL1(input.num_elements() >= nqcol,
815  "Incorrect input size");
816 
817  Array<OneD, NekDouble> diff0(nqcol, wsp );
818  Array<OneD, NekDouble> diff1(nqcol, wsp + nqcol);
819 
820  // Tensor Product Derivative
821  Blas::Dgemm('N', 'N', m_nquad0, m_nquad1*m_numElmt,
822  m_nquad0, 1.0, m_Deriv0, m_nquad0,
823  input.get(), m_nquad0, 0.0,
824  diff0.get(), m_nquad0);
825 
826  int cnt = 0;
827  for (int i = 0; i < m_numElmt; ++i, cnt += nqtot)
828  {
829  // scale diff0 by geometric factor: 2/(1-z1)
830  Vmath::Vmul(nqtot,&m_fac1[0],1,diff0.get()+cnt,1,
831  diff0.get()+cnt,1);
832 
833  Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
834  input.get() + cnt, m_nquad0,
835  m_Deriv1, m_nquad1, 0.0,
836  diff1.get() + cnt, m_nquad0);
837 
838  // add to diff1 by diff0 scaled by: (1_z0)/(1-z1)
839  Vmath::Vvtvp(nqtot,m_fac0.get(),1,diff0.get()+cnt,1,
840  diff1.get()+cnt,1,diff1.get()+cnt,1);
841  }
842 
843 
844  Vmath::Vmul (nqcol, m_derivFac[2*dir] , 1, diff0, 1, output, 1);
845  Vmath::Vvtvp (nqcol, m_derivFac[2*dir+1], 1, diff1, 1, output, 1,
846  output, 1);
847  }
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:853
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
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_Tri::m_coordim
protected

Definition at line 850 of file PhysDeriv.cpp.

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Tri::m_Deriv0
protected

Definition at line 854 of file PhysDeriv.cpp.

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Tri::m_Deriv1
protected

Definition at line 855 of file PhysDeriv.cpp.

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

Definition at line 853 of file PhysDeriv.cpp.

Array<OneD, NekDouble> Nektar::Collections::PhysDeriv_SumFac_Tri::m_fac0
protected

Definition at line 856 of file PhysDeriv.cpp.

Array<OneD, NekDouble> Nektar::Collections::PhysDeriv_SumFac_Tri::m_fac1
protected

Definition at line 857 of file PhysDeriv.cpp.

const int Nektar::Collections::PhysDeriv_SumFac_Tri::m_nquad0
protected

Definition at line 851 of file PhysDeriv.cpp.

const int Nektar::Collections::PhysDeriv_SumFac_Tri::m_nquad1
protected

Definition at line 852 of file PhysDeriv.cpp.