Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Nektar::Collections::PhysDeriv_SumFac_Tri Class Referencefinal

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

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

Public Member Functions

 ~PhysDeriv_SumFac_Tri () 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.
 
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< LocalRegions::ExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
 Constructor.
 
virtual ~Operator ()=default
 
virtual COLLECTIONS_EXPORT void UpdateFactors (StdRegions::FactorMap factors)
 Update the supplied factor map.
 
virtual COLLECTIONS_EXPORT void UpdateVarcoeffs (StdRegions::VarCoeffMap &varcoeffs)
 Update the supplied variable coefficients.
 
unsigned int GetWspSize ()
 Get the size of the required workspace.
 
unsigned int GetNumElmt ()
 Get number of elements.
 
StdRegions::StdExpansionSharedPtr GetExpSharedPtr ()
 Get expansion pointer.
 
unsigned int GetInputSize (void)
 
unsigned int GetOutputSize (void)
 
unsigned int GetPhysSize (void)
 
unsigned int GetCoeffSize (void)
 

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
bool m_isDeformed
 
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 number of elements that the operator is applied on
 
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
 
unsigned int m_outputSize
 number of modes or quadrature points that are taken as output from an operator
 

Private Member Functions

 PhysDeriv_SumFac_Tri (vector< LocalRegions::ExpansionSharedPtr > 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 (Tri)

Definition at line 991 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

◆ ~PhysDeriv_SumFac_Tri()

Nektar::Collections::PhysDeriv_SumFac_Tri::~PhysDeriv_SumFac_Tri ( )
finaldefault

◆ PhysDeriv_SumFac_Tri()

Nektar::Collections::PhysDeriv_SumFac_Tri::PhysDeriv_SumFac_Tri ( vector< LocalRegions::ExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData,
StdRegions::FactorMap  factors 
)
inlineprivate

Definition at line 1148 of file PhysDeriv.cpp.

1151 : Operator(pCollExp, pGeomData, factors), PhysDeriv_Helper(),
1152 m_nquad0(m_stdExp->GetNumPoints(0)),
1153 m_nquad1(m_stdExp->GetNumPoints(1))
1154 {
1155 m_coordim = pCollExp[0]->GetCoordim();
1156
1157 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
1158
1159 const Array<OneD, const NekDouble> &z0 = m_stdExp->GetBasis(0)->GetZ();
1160 const Array<OneD, const NekDouble> &z1 = m_stdExp->GetBasis(1)->GetZ();
1161 m_fac0 = Array<OneD, NekDouble>(m_nquad0 * m_nquad1);
1162 // set up geometric factor: 0.5*(1+z0)
1163 for (int i = 0; i < m_nquad0; ++i)
1164 {
1165 for (int j = 0; j < m_nquad1; ++j)
1166 {
1167 m_fac0[i + j * m_nquad0] = 0.5 * (1 + z0[i]);
1168 }
1169 }
1170
1171 m_fac1 = Array<OneD, NekDouble>(m_nquad0 * m_nquad1);
1172 // set up geometric factor: 2/(1-z1)
1173 for (int i = 0; i < m_nquad0; ++i)
1174 {
1175 for (int j = 0; j < m_nquad1; ++j)
1176 {
1177 m_fac1[i + j * m_nquad0] = 2.0 / (1 - z1[j]);
1178 }
1179 }
1180
1181 m_Deriv0 = &((m_stdExp->GetBasis(0)->GetD())->GetPtr())[0];
1182 m_Deriv1 = &((m_stdExp->GetBasis(1)->GetD())->GetPtr())[0];
1184 }
StdRegions::StdExpansionSharedPtr m_stdExp
Definition Operator.h:230
unsigned int m_numElmt
number of elements that the operator is applied on
Definition Operator.h:232
Operator(std::vector< LocalRegions::ExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition Operator.cpp:66
Array< TwoD, const NekDouble > m_derivFac

References m_coordim, m_Deriv0, m_Deriv1, m_derivFac, m_fac0, m_fac1, 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_Tri::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 999 of file PhysDeriv.cpp.

1004 {
1005 const int nqtot = m_nquad0 * m_nquad1;
1006 const int nqcol = nqtot * m_numElmt;
1007
1008 ASSERTL1(wsp.size() == m_wspSize, "Incorrect workspace size");
1009 ASSERTL1(input.size() >= nqcol, "Incorrect input size");
1010
1011 Array<OneD, NekDouble> diff0(nqcol, wsp);
1012 Array<OneD, NekDouble> diff1(nqcol, wsp + nqcol);
1013
1014 // Tensor Product Derivative
1015 Blas::Dgemm('N', 'N', m_nquad0, m_nquad1 * m_numElmt, m_nquad0, 1.0,
1016 m_Deriv0, m_nquad0, input.data(), m_nquad0, 0.0,
1017 diff0.data(), m_nquad0);
1018
1019 int cnt = 0;
1020 for (int i = 0; i < m_numElmt; ++i, cnt += nqtot)
1021 {
1022 // scale diff0 by geometric factor: 2/(1-z1)
1023 Vmath::Vmul(nqtot, &m_fac1[0], 1, diff0.data() + cnt, 1,
1024 diff0.data() + cnt, 1);
1025
1026 Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
1027 input.data() + cnt, m_nquad0, m_Deriv1, m_nquad1, 0.0,
1028 diff1.data() + cnt, m_nquad0);
1029
1030 // add to diff1 by diff0 scaled by: (1_z0)/(1-z1)
1031 Vmath::Vvtvp(nqtot, m_fac0.data(), 1, diff0.data() + cnt, 1,
1032 diff1.data() + cnt, 1, diff1.data() + cnt, 1);
1033 }
1034
1035 if (m_isDeformed)
1036 {
1037 Vmath::Vmul(nqcol, m_derivFac[0], 1, diff0, 1, output0, 1);
1038 Vmath::Vvtvp(nqcol, m_derivFac[1], 1, diff1, 1, output0, 1, output0,
1039 1);
1040 Vmath::Vmul(nqcol, m_derivFac[2], 1, diff0, 1, output1, 1);
1041 Vmath::Vvtvp(nqcol, m_derivFac[3], 1, diff1, 1, output1, 1, output1,
1042 1);
1043
1044 if (m_coordim == 3)
1045 {
1046 Vmath::Vmul(nqcol, m_derivFac[4], 1, diff0, 1, output2, 1);
1047 Vmath::Vvtvp(nqcol, m_derivFac[5], 1, diff1, 1, output2, 1,
1048 output2, 1);
1049 }
1050 }
1051 else
1052 {
1053 Array<OneD, NekDouble> t;
1054 for (int e = 0; e < m_numElmt; ++e)
1055 {
1056 Vmath::Smul(m_nqe, m_derivFac[0][e], diff0 + e * m_nqe, 1,
1057 t = output0 + e * m_nqe, 1);
1058 Vmath::Svtvp(m_nqe, m_derivFac[1][e], diff1 + e * m_nqe, 1,
1059 output0 + e * m_nqe, 1, t = output0 + e * m_nqe,
1060 1);
1061
1062 Vmath::Smul(m_nqe, m_derivFac[2][e], diff0 + e * m_nqe, 1,
1063 t = output1 + e * m_nqe, 1);
1064 Vmath::Svtvp(m_nqe, m_derivFac[3][e], diff1 + e * m_nqe, 1,
1065 output1 + e * m_nqe, 1, t = output1 + e * m_nqe,
1066 1);
1067 }
1068
1069 if (m_coordim == 3)
1070 {
1071 for (int e = 0; e < m_numElmt; ++e)
1072 {
1073 Vmath::Smul(m_nqe, m_derivFac[4][e], diff0 + e * m_nqe, 1,
1074 t = output2 + e * m_nqe, 1);
1075 Vmath::Svtvp(m_nqe, m_derivFac[5][e], diff1 + e * m_nqe, 1,
1076 output2 + e * m_nqe, 1,
1077 t = output2 + e * m_nqe, 1);
1078 }
1079 }
1080 }
1081 }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
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:324
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, m_fac0, m_fac1, 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_Tri::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 1083 of file PhysDeriv.cpp.

1086 {
1087 const int nqtot = m_nquad0 * m_nquad1;
1088 const int nqcol = nqtot * m_numElmt;
1089
1090 ASSERTL1(wsp.size() == m_wspSize, "Incorrect workspace size");
1091 ASSERTL1(input.size() >= nqcol, "Incorrect input size");
1092
1093 Array<OneD, NekDouble> diff0(nqcol, wsp);
1094 Array<OneD, NekDouble> diff1(nqcol, wsp + nqcol);
1095
1096 // Tensor Product Derivative
1097 Blas::Dgemm('N', 'N', m_nquad0, m_nquad1 * m_numElmt, m_nquad0, 1.0,
1098 m_Deriv0, m_nquad0, input.data(), m_nquad0, 0.0,
1099 diff0.data(), m_nquad0);
1100
1101 int cnt = 0;
1102 for (int i = 0; i < m_numElmt; ++i, cnt += nqtot)
1103 {
1104 // scale diff0 by geometric factor: 2/(1-z1)
1105 Vmath::Vmul(nqtot, &m_fac1[0], 1, diff0.data() + cnt, 1,
1106 diff0.data() + cnt, 1);
1107
1108 Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
1109 input.data() + cnt, m_nquad0, m_Deriv1, m_nquad1, 0.0,
1110 diff1.data() + cnt, m_nquad0);
1111
1112 // add to diff1 by diff0 scaled by: (1_z0)/(1-z1)
1113 Vmath::Vvtvp(nqtot, m_fac0.data(), 1, diff0.data() + cnt, 1,
1114 diff1.data() + cnt, 1, diff1.data() + cnt, 1);
1115 }
1116
1117 if (m_isDeformed)
1118 {
1119 Vmath::Vmul(nqcol, m_derivFac[2 * dir], 1, diff0, 1, output, 1);
1120 Vmath::Vvtvp(nqcol, m_derivFac[2 * dir + 1], 1, diff1, 1, output, 1,
1121 output, 1);
1122 }
1123 else
1124 {
1125 Array<OneD, NekDouble> t;
1126 for (int e = 0; e < m_numElmt; ++e)
1127 {
1128 Vmath::Smul(m_nqe, m_derivFac[2 * dir][e], diff0 + e * m_nqe, 1,
1129 t = output + e * m_nqe, 1);
1130 Vmath::Svtvp(m_nqe, m_derivFac[2 * dir + 1][e],
1131 diff1 + e * m_nqe, 1, output + e * m_nqe, 1,
1132 t = output + e * m_nqe, 1);
1133 }
1134 }
1135 }

References ASSERTL1, Blas::Dgemm(), m_Deriv0, m_Deriv1, m_derivFac, m_fac0, m_fac1, 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_Tri::m_coordim
protected

Definition at line 1138 of file PhysDeriv.cpp.

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

◆ m_Deriv0

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

Definition at line 1142 of file PhysDeriv.cpp.

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

◆ m_Deriv1

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

Definition at line 1143 of file PhysDeriv.cpp.

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

◆ m_derivFac

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

Definition at line 1141 of file PhysDeriv.cpp.

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

◆ m_fac0

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

Definition at line 1144 of file PhysDeriv.cpp.

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

◆ m_fac1

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

Definition at line 1145 of file PhysDeriv.cpp.

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

◆ m_nquad0

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

Definition at line 1139 of file PhysDeriv.cpp.

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

◆ m_nquad1

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

Definition at line 1140 of file PhysDeriv.cpp.

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