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

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

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

Public Member Functions

 ~PhysDeriv_SumFac_Quad () final=default
 
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
 
- 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 ~Operator ()=default
 
virtual COLLECTIONS_EXPORT void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output0, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp=NullNekDouble1DArray)=0
 Perform operation. More...
 
virtual COLLECTIONS_EXPORT void operator() (int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp=NullNekDouble1DArray)=0
 
virtual COLLECTIONS_EXPORT void UpdateFactors (StdRegions::FactorMap factors)
 Update the supplied factor map. More...
 
virtual COLLECTIONS_EXPORT void UpdateVarcoeffs (StdRegions::VarCoeffMap &varcoeffs)
 Update the supplied variable coefficients. More...
 
unsigned int GetWspSize ()
 Get the size of the required workspace. More...
 
unsigned int GetNumElmt ()
 Get number of elements. More...
 
StdRegions::StdExpansionSharedPtr GetExpSharedPtr ()
 Get expansion pointer. More...
 
unsigned int GetInputSize (bool defaultIn=true)
 
unsigned int GetOutputSize (bool defaultOut=true)
 

Protected Attributes

int m_coordim
 
const int m_nquad0
 
const int m_nquad1
 
Array< TwoD, const NekDoublem_derivFac
 
NekDoublem_Deriv0
 
NekDoublem_Deriv1
 
- Protected Attributes inherited from Nektar::Collections::Operator
bool m_isDeformed
 
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 number of elements that the operator is applied on More...
 
unsigned int m_nqe
 
unsigned int m_wspSize
 
unsigned int m_inputSize
 number of modes or quadrature points that are passed as input to an operator More...
 
unsigned int m_outputSize
 number of modes or quadrature points that are taken as output from an operator More...
 
unsigned int m_inputSizeOther
 Number of modes or quadrature points, opposite to m_inputSize. More...
 
unsigned int m_outputSizeOther
 Number of modes or quadrature points, opposite to m_outputSize. More...
 

Private Member Functions

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

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Collections::PhysDeriv_Helper
 PhysDeriv_Helper ()
 

Detailed Description

Phys deriv operator using sum-factorisation (Quad)

Definition at line 826 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

◆ ~PhysDeriv_SumFac_Quad()

Nektar::Collections::PhysDeriv_SumFac_Quad::~PhysDeriv_SumFac_Quad ( )
finaldefault

◆ PhysDeriv_SumFac_Quad()

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

Definition at line 963 of file PhysDeriv.cpp.

966 : Operator(pCollExp, pGeomData, factors), PhysDeriv_Helper(),
967 m_nquad0(m_stdExp->GetNumPoints(0)),
968 m_nquad1(m_stdExp->GetNumPoints(1))
969 {
970 m_coordim = pCollExp[0]->GetCoordim();
971
972 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
973
974 m_Deriv0 = &((m_stdExp->GetBasis(0)->GetD())->GetPtr())[0];
975 m_Deriv1 = &((m_stdExp->GetBasis(1)->GetD())->GetPtr())[0];
977 }
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:217
unsigned int m_numElmt
number of elements that the operator is applied on
Definition: Operator.h:219
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition: Operator.cpp:66
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:958
StdRegions::ConstFactorMap factors

References m_coordim, m_Deriv0, m_Deriv1, m_derivFac, m_nquad0, m_nquad1, Nektar::Collections::Operator::m_numElmt, Nektar::Collections::Operator::m_stdExp, and Nektar::Collections::Operator::m_wspSize.

Member Function Documentation

◆ operator()() [1/2]

void Nektar::Collections::PhysDeriv_SumFac_Quad::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 834 of file PhysDeriv.cpp.

839 {
840 const int nqtot = m_nquad0 * m_nquad1;
841 const int nqcol = nqtot * m_numElmt;
842
843 ASSERTL1(wsp.size() == m_wspSize, "Incorrect workspace size");
844 ASSERTL1(input.size() >= nqcol, "Incorrect input size");
845
846 Array<OneD, NekDouble> diff0(nqcol, wsp);
847 Array<OneD, NekDouble> diff1(nqcol, wsp + nqcol);
848
850 m_Deriv0, m_nquad0, input.get(), m_nquad0, 0.0, diff0.get(),
851 m_nquad0);
852
853 int cnt = 0;
854 for (int i = 0; i < m_numElmt; ++i, cnt += nqtot)
855 {
856 Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
857 input.get() + cnt, m_nquad0, m_Deriv1, m_nquad1, 0.0,
858 diff1.get() + cnt, m_nquad0);
859 }
860
861 if (m_isDeformed)
862 {
863 Vmath::Vmul(nqcol, m_derivFac[0], 1, diff0, 1, output0, 1);
864 Vmath::Vvtvp(nqcol, m_derivFac[1], 1, diff1, 1, output0, 1, output0,
865 1);
866 Vmath::Vmul(nqcol, m_derivFac[2], 1, diff0, 1, output1, 1);
867 Vmath::Vvtvp(nqcol, m_derivFac[3], 1, diff1, 1, output1, 1, output1,
868 1);
869
870 if (m_coordim == 3)
871 {
872 Vmath::Vmul(nqcol, m_derivFac[4], 1, diff0, 1, output2, 1);
873 Vmath::Vvtvp(nqcol, m_derivFac[5], 1, diff1, 1, output2, 1,
874 output2, 1);
875 }
876 }
877 else
878 {
879 Array<OneD, NekDouble> t;
880 for (int e = 0; e < m_numElmt; ++e)
881 {
882 Vmath::Smul(m_nqe, m_derivFac[0][e], diff0 + e * m_nqe, 1,
883 t = output0 + e * m_nqe, 1);
884 Vmath::Svtvp(m_nqe, m_derivFac[1][e], diff1 + e * m_nqe, 1,
885 output0 + e * m_nqe, 1, t = output0 + e * m_nqe,
886 1);
887
888 Vmath::Smul(m_nqe, m_derivFac[2][e], diff0 + e * m_nqe, 1,
889 t = output1 + e * m_nqe, 1);
890 Vmath::Svtvp(m_nqe, m_derivFac[3][e], diff1 + e * m_nqe, 1,
891 output1 + e * m_nqe, 1, t = output1 + e * m_nqe,
892 1);
893 }
894
895 if (m_coordim == 3)
896 {
897 for (int e = 0; e < m_numElmt; ++e)
898 {
899 Vmath::Smul(m_nqe, m_derivFac[4][e], diff0 + e * m_nqe, 1,
900 t = output2 + e * m_nqe, 1);
901 Vmath::Svtvp(m_nqe, m_derivFac[5][e], diff1 + e * m_nqe, 1,
902 output2 + e * m_nqe, 1,
903 t = output2 + e * m_nqe, 1);
904 }
905 }
906 }
907 }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
static void Dgemm(const char &transa, const char &transb, const int &m, const int &n, const int &k, const double &alpha, const double *a, const int &lda, const double *b, const int &ldb, const double &beta, double *c, const int &ldc)
BLAS level 3: Matrix-matrix multiply C = A x B where op(A)[m x k], op(B)[k x n], C[m x n] DGEMM perfo...
Definition: Blas.hpp:383
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.hpp:72
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.hpp:396
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.hpp:366
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.hpp:100

References ASSERTL1, Blas::Dgemm(), m_coordim, m_Deriv0, m_Deriv1, m_derivFac, Nektar::Collections::Operator::m_isDeformed, Nektar::Collections::Operator::m_nqe, m_nquad0, m_nquad1, Nektar::Collections::Operator::m_numElmt, Nektar::Collections::Operator::m_wspSize, Vmath::Smul(), Vmath::Svtvp(), Vmath::Vmul(), and Vmath::Vvtvp().

◆ operator()() [2/2]

void Nektar::Collections::PhysDeriv_SumFac_Quad::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 909 of file PhysDeriv.cpp.

912 {
913 const int nqtot = m_nquad0 * m_nquad1;
914 const int nqcol = nqtot * m_numElmt;
915
916 ASSERTL1(wsp.size() == m_wspSize, "Incorrect workspace size");
917 ASSERTL1(input.size() >= nqcol, "Incorrect input size");
918
919 Array<OneD, NekDouble> diff0(nqcol, wsp);
920 Array<OneD, NekDouble> diff1(nqcol, wsp + nqcol);
921
923 m_Deriv0, m_nquad0, input.get(), m_nquad0, 0.0, diff0.get(),
924 m_nquad0);
925
926 int cnt = 0;
927 for (int i = 0; i < m_numElmt; ++i, cnt += nqtot)
928 {
929 Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
930 input.get() + cnt, m_nquad0, m_Deriv1, m_nquad1, 0.0,
931 diff1.get() + cnt, m_nquad0);
932 }
933
934 if (m_isDeformed)
935 {
936 Vmath::Vmul(nqcol, m_derivFac[2 * dir], 1, diff0, 1, output, 1);
937 Vmath::Vvtvp(nqcol, m_derivFac[2 * dir + 1], 1, diff1, 1, output, 1,
938 output, 1);
939 }
940 else
941 {
942 Array<OneD, NekDouble> t;
943 for (int e = 0; e < m_numElmt; ++e)
944 {
945 Vmath::Smul(m_nqe, m_derivFac[2 * dir][e], diff0 + e * m_nqe, 1,
946 t = output + e * m_nqe, 1);
947 Vmath::Svtvp(m_nqe, m_derivFac[2 * dir + 1][e],
948 diff1 + e * m_nqe, 1, output + e * m_nqe, 1,
949 t = output + e * m_nqe, 1);
950 }
951 }
952 }

References ASSERTL1, Blas::Dgemm(), m_Deriv0, m_Deriv1, m_derivFac, Nektar::Collections::Operator::m_isDeformed, Nektar::Collections::Operator::m_nqe, m_nquad0, m_nquad1, Nektar::Collections::Operator::m_numElmt, Nektar::Collections::Operator::m_wspSize, Vmath::Smul(), Vmath::Svtvp(), Vmath::Vmul(), and Vmath::Vvtvp().

Member Data Documentation

◆ m_coordim

int Nektar::Collections::PhysDeriv_SumFac_Quad::m_coordim
protected

Definition at line 955 of file PhysDeriv.cpp.

Referenced by operator()(), and PhysDeriv_SumFac_Quad().

◆ m_Deriv0

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Quad::m_Deriv0
protected

Definition at line 959 of file PhysDeriv.cpp.

Referenced by operator()(), and PhysDeriv_SumFac_Quad().

◆ m_Deriv1

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Quad::m_Deriv1
protected

Definition at line 960 of file PhysDeriv.cpp.

Referenced by operator()(), and PhysDeriv_SumFac_Quad().

◆ m_derivFac

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

Definition at line 958 of file PhysDeriv.cpp.

Referenced by operator()(), and PhysDeriv_SumFac_Quad().

◆ m_nquad0

const int Nektar::Collections::PhysDeriv_SumFac_Quad::m_nquad0
protected

Definition at line 956 of file PhysDeriv.cpp.

Referenced by operator()(), and PhysDeriv_SumFac_Quad().

◆ m_nquad1

const int Nektar::Collections::PhysDeriv_SumFac_Quad::m_nquad1
protected

Definition at line 957 of file PhysDeriv.cpp.

Referenced by operator()(), and PhysDeriv_SumFac_Quad().