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

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

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

Public Member Functions

 ~PhysDeriv_SumFac_Hex () 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

Array< TwoD, const NekDoublem_derivFac
 
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
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_Hex (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 (Hex)

Definition at line 1197 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

◆ ~PhysDeriv_SumFac_Hex()

Nektar::Collections::PhysDeriv_SumFac_Hex::~PhysDeriv_SumFac_Hex ( )
finaldefault

◆ PhysDeriv_SumFac_Hex()

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

Definition at line 1356 of file PhysDeriv.cpp.

1359 : Operator(pCollExp, pGeomData, factors), PhysDeriv_Helper(),
1360 m_nquad0(m_stdExp->GetNumPoints(0)),
1361 m_nquad1(m_stdExp->GetNumPoints(1)),
1362 m_nquad2(m_stdExp->GetNumPoints(2))
1363 {
1364 m_coordim = pCollExp[0]->GetCoordim();
1365
1366 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
1367
1368 m_Deriv0 = &((m_stdExp->GetBasis(0)->GetD())->GetPtr())[0];
1369 m_Deriv1 = &((m_stdExp->GetBasis(1)->GetD())->GetPtr())[0];
1370 m_Deriv2 = &((m_stdExp->GetBasis(2)->GetD())->GetPtr())[0];
1371
1373 }
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:1346
StdRegions::ConstFactorMap factors

References m_coordim, m_Deriv0, m_Deriv1, m_Deriv2, m_derivFac, m_nquad0, m_nquad1, m_nquad2, 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_Hex::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 1205 of file PhysDeriv.cpp.

1210 {
1211 int nPhys = m_stdExp->GetTotPoints();
1212 int ntot = m_numElmt * nPhys;
1213 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
1214 Array<OneD, Array<OneD, NekDouble>> Diff(3);
1215 Array<OneD, Array<OneD, NekDouble>> out(3);
1216 out[0] = output0;
1217 out[1] = output1;
1218 out[2] = output2;
1219
1220 for (int i = 0; i < 3; ++i)
1221 {
1222 Diff[i] = wsp + i * ntot;
1223 }
1224
1226 m_nquad0, 1.0, m_Deriv0, m_nquad0, &input[0], m_nquad0, 0.0,
1227 &Diff[0][0], m_nquad0);
1228
1229 for (int i = 0; i < m_numElmt; ++i)
1230 {
1231 for (int j = 0; j < m_nquad2; ++j)
1232 {
1233 Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
1234 &input[i * nPhys + j * m_nquad0 * m_nquad1],
1235 m_nquad0, m_Deriv1, m_nquad1, 0.0,
1236 &Diff[1][i * nPhys + j * m_nquad0 * m_nquad1],
1237 m_nquad0);
1238 }
1239
1240 Blas::Dgemm('N', 'T', m_nquad0 * m_nquad1, m_nquad2, m_nquad2, 1.0,
1241 &input[i * nPhys], m_nquad0 * m_nquad1, m_Deriv2,
1242 m_nquad2, 0.0, &Diff[2][i * nPhys],
1243 m_nquad0 * m_nquad1);
1244 }
1245
1246 // calculate full derivative
1247 if (m_isDeformed)
1248 {
1249 for (int i = 0; i < m_coordim; ++i)
1250 {
1251 Vmath::Vmul(ntot, m_derivFac[i * 3], 1, Diff[0], 1, out[i], 1);
1252 for (int j = 1; j < 3; ++j)
1253 {
1254 Vmath::Vvtvp(ntot, m_derivFac[i * 3 + j], 1, Diff[j], 1,
1255 out[i], 1, out[i], 1);
1256 }
1257 }
1258 }
1259 else
1260 {
1261 Array<OneD, NekDouble> t;
1262 for (int e = 0; e < m_numElmt; ++e)
1263 {
1264 for (int i = 0; i < m_coordim; ++i)
1265 {
1266 Vmath::Smul(m_nqe, m_derivFac[i * 3][e],
1267 Diff[0] + e * m_nqe, 1, t = out[i] + e * m_nqe,
1268 1);
1269
1270 for (int j = 1; j < 3; ++j)
1271 {
1272 Vmath::Svtvp(m_nqe, m_derivFac[i * 3 + j][e],
1273 Diff[j] + e * m_nqe, 1, out[i] + e * m_nqe,
1274 1, t = out[i] + e * m_nqe, 1);
1275 }
1276 }
1277 }
1278 }
1279 }
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 Blas::Dgemm(), m_coordim, m_Deriv0, m_Deriv1, m_Deriv2, m_derivFac, Nektar::Collections::Operator::m_isDeformed, Nektar::Collections::Operator::m_nqe, m_nquad0, m_nquad1, m_nquad2, Nektar::Collections::Operator::m_numElmt, Nektar::Collections::Operator::m_stdExp, Vmath::Smul(), Vmath::Svtvp(), Vmath::Vmul(), and Vmath::Vvtvp().

◆ operator()() [2/2]

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

1284 {
1285 int nPhys = m_stdExp->GetTotPoints();
1286 int ntot = m_numElmt * nPhys;
1287 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
1288 Array<OneD, Array<OneD, NekDouble>> Diff(3);
1289
1290 for (int i = 0; i < 3; ++i)
1291 {
1292 Diff[i] = wsp + i * ntot;
1293 }
1294
1296 m_nquad0, 1.0, m_Deriv0, m_nquad0, &input[0], m_nquad0, 0.0,
1297 &Diff[0][0], m_nquad0);
1298
1299 for (int i = 0; i < m_numElmt; ++i)
1300 {
1301 for (int j = 0; j < m_nquad2; ++j)
1302 {
1303 Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
1304 &input[i * nPhys + j * m_nquad0 * m_nquad1],
1305 m_nquad0, m_Deriv1, m_nquad1, 0.0,
1306 &Diff[1][i * nPhys + j * m_nquad0 * m_nquad1],
1307 m_nquad0);
1308 }
1309
1310 Blas::Dgemm('N', 'T', m_nquad0 * m_nquad1, m_nquad2, m_nquad2, 1.0,
1311 &input[i * nPhys], m_nquad0 * m_nquad1, m_Deriv2,
1312 m_nquad2, 0.0, &Diff[2][i * nPhys],
1313 m_nquad0 * m_nquad1);
1314 }
1315
1316 // calculate full derivative
1317 if (m_isDeformed)
1318 {
1319 // calculate full derivative
1320 Vmath::Vmul(ntot, m_derivFac[dir * 3], 1, Diff[0], 1, output, 1);
1321 for (int j = 1; j < 3; ++j)
1322 {
1323 Vmath::Vvtvp(ntot, m_derivFac[dir * 3 + j], 1, Diff[j], 1,
1324 output, 1, output, 1);
1325 }
1326 }
1327 else
1328 {
1329 Array<OneD, NekDouble> t;
1330 for (int e = 0; e < m_numElmt; ++e)
1331 {
1332 Vmath::Smul(m_nqe, m_derivFac[dir * 3][e], Diff[0] + e * m_nqe,
1333 1, t = output + e * m_nqe, 1);
1334
1335 for (int j = 1; j < 3; ++j)
1336 {
1337 Vmath::Svtvp(m_nqe, m_derivFac[dir * 3 + j][e],
1338 Diff[j] + e * m_nqe, 1, output + e * m_nqe, 1,
1339 t = output + e * m_nqe, 1);
1340 }
1341 }
1342 }
1343 }

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

Member Data Documentation

◆ m_coordim

int Nektar::Collections::PhysDeriv_SumFac_Hex::m_coordim
protected

Definition at line 1347 of file PhysDeriv.cpp.

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

◆ m_Deriv0

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

Definition at line 1351 of file PhysDeriv.cpp.

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

◆ m_Deriv1

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

Definition at line 1352 of file PhysDeriv.cpp.

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

◆ m_Deriv2

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

Definition at line 1353 of file PhysDeriv.cpp.

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

◆ m_derivFac

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

Definition at line 1346 of file PhysDeriv.cpp.

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

◆ m_nquad0

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

Definition at line 1348 of file PhysDeriv.cpp.

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

◆ m_nquad1

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

Definition at line 1349 of file PhysDeriv.cpp.

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

◆ m_nquad2

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

Definition at line 1350 of file PhysDeriv.cpp.

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