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

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

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

Public Member Functions

 ~PhysDeriv_SumFac_Tet () 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
 
Array< OneD, NekDoublem_fac0
 
Array< OneD, NekDoublem_fac1
 
Array< OneD, NekDoublem_fac2
 
Array< OneD, NekDoublem_fac3
 
- 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_Tet (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 (Tet)

Definition at line 1385 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

◆ ~PhysDeriv_SumFac_Tet()

Nektar::Collections::PhysDeriv_SumFac_Tet::~PhysDeriv_SumFac_Tet ( )
finaldefault

◆ PhysDeriv_SumFac_Tet()

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

Definition at line 1604 of file PhysDeriv.cpp.

1607 : Operator(pCollExp, pGeomData, factors), PhysDeriv_Helper(),
1608 m_nquad0(m_stdExp->GetNumPoints(0)),
1609 m_nquad1(m_stdExp->GetNumPoints(1)),
1610 m_nquad2(m_stdExp->GetNumPoints(2))
1611 {
1612 m_coordim = pCollExp[0]->GetCoordim();
1613
1614 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
1615
1616 m_Deriv0 = &((m_stdExp->GetBasis(0)->GetD())->GetPtr())[0];
1617 m_Deriv1 = &((m_stdExp->GetBasis(1)->GetD())->GetPtr())[0];
1618 m_Deriv2 = &((m_stdExp->GetBasis(2)->GetD())->GetPtr())[0];
1619
1621
1622 const Array<OneD, const NekDouble> &z0 = m_stdExp->GetBasis(0)->GetZ();
1623 const Array<OneD, const NekDouble> &z1 = m_stdExp->GetBasis(1)->GetZ();
1624 const Array<OneD, const NekDouble> &z2 = m_stdExp->GetBasis(2)->GetZ();
1625
1626 m_fac0 = Array<OneD, NekDouble>(m_nquad0 * m_nquad1 * m_nquad2);
1627 m_fac1 = Array<OneD, NekDouble>(m_nquad0 * m_nquad1 * m_nquad2);
1628 m_fac2 = Array<OneD, NekDouble>(m_nquad0 * m_nquad1 * m_nquad2);
1629 m_fac3 = Array<OneD, NekDouble>(m_nquad0 * m_nquad1 * m_nquad2);
1630
1631 // calculate 2.0/((1-eta_1)(1-eta_2))
1632 for (int i = 0; i < m_nquad0; ++i)
1633 {
1634 for (int j = 0; j < m_nquad1; ++j)
1635 {
1636 for (int k = 0; k < m_nquad2; ++k)
1637 {
1638 m_fac0[i + j * m_nquad0 + k * m_nquad0 * m_nquad1] =
1639 4.0 / ((1 - z1[j]) * (1 - z2[k]));
1640 m_fac1[i + j * m_nquad0 + k * m_nquad0 * m_nquad1] =
1641 2.0 * (1 + z0[i]) / ((1 - z1[j]) * (1 - z2[k]));
1642 m_fac2[i + j * m_nquad0 + k * m_nquad0 * m_nquad1] =
1643 2.0 / (1 - z2[k]);
1644 m_fac3[i + j * m_nquad0 + k * m_nquad0 * m_nquad1] =
1645 (1 + z1[j]) / (1 - z2[k]);
1646 }
1647 }
1648 }
1649 }
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:1590
StdRegions::ConstFactorMap factors

References m_coordim, m_Deriv0, m_Deriv1, m_Deriv2, m_derivFac, m_fac0, m_fac1, m_fac2, m_fac3, 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_Tet::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 1393 of file PhysDeriv.cpp.

1398 {
1399 int nPhys = m_stdExp->GetTotPoints();
1400 int ntot = m_numElmt * nPhys;
1401 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
1402 Array<OneD, Array<OneD, NekDouble>> Diff(3);
1403 Array<OneD, Array<OneD, NekDouble>> out(3);
1404 out[0] = output0;
1405 out[1] = output1;
1406 out[2] = output2;
1407
1408 for (int i = 0; i < 3; ++i)
1409 {
1410 Diff[i] = wsp + i * ntot;
1411 }
1412
1413 // dEta0
1415 m_nquad0, 1.0, m_Deriv0, m_nquad0, &input[0], m_nquad0, 0.0,
1416 &Diff[0][0], m_nquad0);
1417
1418 // dEta2
1419 for (int i = 0; i < m_numElmt; ++i)
1420 {
1421 Blas::Dgemm('N', 'T', m_nquad0 * m_nquad1, m_nquad2, m_nquad2, 1.0,
1422 &input[i * nPhys], m_nquad0 * m_nquad1, m_Deriv2,
1423 m_nquad2, 0.0, &Diff[2][i * nPhys],
1424 m_nquad0 * m_nquad1);
1425 }
1426
1427 for (int i = 0; i < m_numElmt; ++i)
1428 {
1429 // dEta1
1430 for (int j = 0; j < m_nquad2; ++j)
1431 {
1432 Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
1433 &input[i * nPhys + j * m_nquad0 * m_nquad1],
1434 m_nquad0, m_Deriv1, m_nquad1, 0.0,
1435 &Diff[1][i * nPhys + j * m_nquad0 * m_nquad1],
1436 m_nquad0);
1437 }
1438
1439 // dxi2 = (1 + eta_1)/(1 -eta_2)*dEta1 + dEta2
1440 Vmath::Vvtvp(nPhys, m_fac3.get(), 1, Diff[1].get() + i * nPhys, 1,
1441 Diff[2].get() + i * nPhys, 1,
1442 Diff[2].get() + i * nPhys, 1);
1443
1444 // dxi1 = 2/(1 - eta_2) dEta1
1445 Vmath::Vmul(nPhys, m_fac2.get(), 1, Diff[1].get() + i * nPhys, 1,
1446 Diff[1].get() + i * nPhys, 1);
1447
1448 // dxi1 = 2.0(1+eta_0)/((1-eta_1)(1-eta_2)) dEta0 + dxi1
1449 Vmath::Vvtvp(nPhys, m_fac1.get(), 1, Diff[0].get() + i * nPhys, 1,
1450 Diff[1].get() + i * nPhys, 1,
1451 Diff[1].get() + i * nPhys, 1);
1452
1453 // dxi2 = 2.0(1+eta_0)/((1-eta_1)(1-eta_2)) dEta0 + dxi2
1454 Vmath::Vvtvp(nPhys, m_fac1.get(), 1, Diff[0].get() + i * nPhys, 1,
1455 Diff[2].get() + i * nPhys, 1,
1456 Diff[2].get() + i * nPhys, 1);
1457
1458 // dxi0 = 4.0/((1-eta_1)(1-eta_2)) dEta0
1459 Vmath::Vmul(nPhys, m_fac0.get(), 1, Diff[0].get() + i * nPhys, 1,
1460 Diff[0].get() + i * nPhys, 1);
1461 }
1462
1463 // calculate full derivative
1464 if (m_isDeformed)
1465 {
1466 for (int i = 0; i < m_coordim; ++i)
1467 {
1468 Vmath::Vmul(ntot, m_derivFac[i * 3], 1, Diff[0], 1, out[i], 1);
1469 for (int j = 1; j < 3; ++j)
1470 {
1471 Vmath::Vvtvp(ntot, m_derivFac[i * 3 + j], 1, Diff[j], 1,
1472 out[i], 1, out[i], 1);
1473 }
1474 }
1475 }
1476 else
1477 {
1478 Array<OneD, NekDouble> t;
1479 for (int e = 0; e < m_numElmt; ++e)
1480 {
1481 for (int i = 0; i < m_coordim; ++i)
1482 {
1483 Vmath::Smul(m_nqe, m_derivFac[i * 3][e],
1484 Diff[0] + e * m_nqe, 1, t = out[i] + e * m_nqe,
1485 1);
1486 for (int j = 1; j < 3; ++j)
1487 {
1488 Vmath::Svtvp(m_nqe, m_derivFac[i * 3 + j][e],
1489 Diff[j] + e * m_nqe, 1, out[i] + e * m_nqe,
1490 1, t = out[i] + e * m_nqe, 1);
1491 }
1492 }
1493 }
1494 }
1495 }
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, m_fac0, m_fac1, m_fac2, m_fac3, 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_Tet::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 1497 of file PhysDeriv.cpp.

1500 {
1501 int nPhys = m_stdExp->GetTotPoints();
1502 int ntot = m_numElmt * nPhys;
1503 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
1504 Array<OneD, Array<OneD, NekDouble>> Diff(3);
1505
1506 for (int i = 0; i < 3; ++i)
1507 {
1508 Diff[i] = wsp + i * ntot;
1509 }
1510
1511 // dEta0
1513 m_nquad0, 1.0, m_Deriv0, m_nquad0, &input[0], m_nquad0, 0.0,
1514 &Diff[0][0], m_nquad0);
1515
1516 // dEta2
1517 for (int i = 0; i < m_numElmt; ++i)
1518 {
1519 Blas::Dgemm('N', 'T', m_nquad0 * m_nquad1, m_nquad2, m_nquad2, 1.0,
1520 &input[i * nPhys], m_nquad0 * m_nquad1, m_Deriv2,
1521 m_nquad2, 0.0, &Diff[2][i * nPhys],
1522 m_nquad0 * m_nquad1);
1523 }
1524
1525 for (int i = 0; i < m_numElmt; ++i)
1526 {
1527 // dEta1
1528 for (int j = 0; j < m_nquad2; ++j)
1529 {
1530 Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
1531 &input[i * nPhys + j * m_nquad0 * m_nquad1],
1532 m_nquad0, m_Deriv1, m_nquad1, 0.0,
1533 &Diff[1][i * nPhys + j * m_nquad0 * m_nquad1],
1534 m_nquad0);
1535 }
1536
1537 // dxi2 = (1 + eta_1)/(1 -eta_2)*dEta1 + dEta2
1538 Vmath::Vvtvp(nPhys, m_fac3.get(), 1, Diff[1].get() + i * nPhys, 1,
1539 Diff[2].get() + i * nPhys, 1,
1540 Diff[2].get() + i * nPhys, 1);
1541
1542 // dxi1 = 2/(1 - eta_2) dEta1
1543 Vmath::Vmul(nPhys, m_fac2.get(), 1, Diff[1].get() + i * nPhys, 1,
1544 Diff[1].get() + i * nPhys, 1);
1545
1546 // dxi1 = 2.0(1+eta_0)/((1-eta_1)(1-eta_2)) dEta0 + dxi1
1547 Vmath::Vvtvp(nPhys, m_fac1.get(), 1, Diff[0].get() + i * nPhys, 1,
1548 Diff[1].get() + i * nPhys, 1,
1549 Diff[1].get() + i * nPhys, 1);
1550
1551 // dxi2 = 2.0(1+eta_0)/((1-eta_1)(1-eta_2)) dEta0 + dxi2
1552 Vmath::Vvtvp(nPhys, m_fac1.get(), 1, Diff[0].get() + i * nPhys, 1,
1553 Diff[2].get() + i * nPhys, 1,
1554 Diff[2].get() + i * nPhys, 1);
1555
1556 // dxi0 = 4.0/((1-eta_1)(1-eta_2)) dEta0
1557 Vmath::Vmul(nPhys, m_fac0.get(), 1, Diff[0].get() + i * nPhys, 1,
1558 Diff[0].get() + i * nPhys, 1);
1559 }
1560
1561 // calculate full derivative
1562 if (m_isDeformed)
1563 {
1564 // calculate full derivative
1565 Vmath::Vmul(ntot, m_derivFac[dir * 3], 1, Diff[0], 1, output, 1);
1566 for (int j = 1; j < 3; ++j)
1567 {
1568 Vmath::Vvtvp(ntot, m_derivFac[dir * 3 + j], 1, Diff[j], 1,
1569 output, 1, output, 1);
1570 }
1571 }
1572 else
1573 {
1574 Array<OneD, NekDouble> t;
1575 for (int e = 0; e < m_numElmt; ++e)
1576 {
1577 Vmath::Smul(m_nqe, m_derivFac[dir * 3][e], Diff[0] + e * m_nqe,
1578 1, t = output + e * m_nqe, 1);
1579 for (int j = 1; j < 3; ++j)
1580 {
1581 Vmath::Svtvp(m_nqe, m_derivFac[dir * 3 + j][e],
1582 Diff[j] + e * m_nqe, 1, output + e * m_nqe, 1,
1583 t = output + e * m_nqe, 1);
1584 }
1585 }
1586 }
1587 }

References Blas::Dgemm(), m_Deriv0, m_Deriv1, m_Deriv2, m_derivFac, m_fac0, m_fac1, m_fac2, m_fac3, 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_Tet::m_coordim
protected

Definition at line 1591 of file PhysDeriv.cpp.

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

◆ m_Deriv0

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Tet::m_Deriv0
protected

Definition at line 1595 of file PhysDeriv.cpp.

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

◆ m_Deriv1

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Tet::m_Deriv1
protected

Definition at line 1596 of file PhysDeriv.cpp.

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

◆ m_Deriv2

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Tet::m_Deriv2
protected

Definition at line 1597 of file PhysDeriv.cpp.

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

◆ m_derivFac

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

Definition at line 1590 of file PhysDeriv.cpp.

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

◆ m_fac0

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

Definition at line 1598 of file PhysDeriv.cpp.

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

◆ m_fac1

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

Definition at line 1599 of file PhysDeriv.cpp.

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

◆ m_fac2

Array<OneD, NekDouble> Nektar::Collections::PhysDeriv_SumFac_Tet::m_fac2
protected

Definition at line 1600 of file PhysDeriv.cpp.

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

◆ m_fac3

Array<OneD, NekDouble> Nektar::Collections::PhysDeriv_SumFac_Tet::m_fac3
protected

Definition at line 1601 of file PhysDeriv.cpp.

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

◆ m_nquad0

const int Nektar::Collections::PhysDeriv_SumFac_Tet::m_nquad0
protected

Definition at line 1592 of file PhysDeriv.cpp.

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

◆ m_nquad1

const int Nektar::Collections::PhysDeriv_SumFac_Tet::m_nquad1
protected

Definition at line 1593 of file PhysDeriv.cpp.

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

◆ m_nquad2

const int Nektar::Collections::PhysDeriv_SumFac_Tet::m_nquad2
protected

Definition at line 1594 of file PhysDeriv.cpp.

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