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

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

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

Public Member Functions

 ~PhysDeriv_SumFac_Prism () 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
 
- 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_Prism (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 (Prism)

Definition at line 1661 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

◆ ~PhysDeriv_SumFac_Prism()

Nektar::Collections::PhysDeriv_SumFac_Prism::~PhysDeriv_SumFac_Prism ( )
finaldefault

◆ PhysDeriv_SumFac_Prism()

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

Definition at line 1848 of file PhysDeriv.cpp.

1851 : Operator(pCollExp, pGeomData, factors), PhysDeriv_Helper(),
1852 m_nquad0(m_stdExp->GetNumPoints(0)),
1853 m_nquad1(m_stdExp->GetNumPoints(1)),
1854 m_nquad2(m_stdExp->GetNumPoints(2))
1855 {
1856 m_coordim = pCollExp[0]->GetCoordim();
1857
1858 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
1859
1860 const Array<OneD, const NekDouble> &z0 = m_stdExp->GetBasis(0)->GetZ();
1861 const Array<OneD, const NekDouble> &z2 = m_stdExp->GetBasis(2)->GetZ();
1862 m_fac0 = Array<OneD, NekDouble>(m_nquad0 * m_nquad1 * m_nquad2);
1863 m_fac1 = Array<OneD, NekDouble>(m_nquad0 * m_nquad1 * m_nquad2);
1864 for (int i = 0; i < m_nquad0; ++i)
1865 {
1866 for (int j = 0; j < m_nquad1; ++j)
1867 {
1868 for (int k = 0; k < m_nquad2; ++k)
1869 {
1870 m_fac0[i + j * m_nquad0 + k * m_nquad0 * m_nquad1] =
1871 2.0 / (1 - z2[k]);
1872 m_fac1[i + j * m_nquad0 + k * m_nquad0 * m_nquad1] =
1873 0.5 * (1 + z0[i]);
1874 }
1875 }
1876 }
1877
1878 m_Deriv0 = &((m_stdExp->GetBasis(0)->GetD())->GetPtr())[0];
1879 m_Deriv1 = &((m_stdExp->GetBasis(1)->GetD())->GetPtr())[0];
1880 m_Deriv2 = &((m_stdExp->GetBasis(2)->GetD())->GetPtr())[0];
1881
1883 }
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:1836
StdRegions::ConstFactorMap factors

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

1674 {
1675 int nPhys = m_stdExp->GetTotPoints();
1676 int ntot = m_numElmt * nPhys;
1677 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
1678 Array<OneD, Array<OneD, NekDouble>> Diff(3);
1679 Array<OneD, Array<OneD, NekDouble>> out(3);
1680 out[0] = output0;
1681 out[1] = output1;
1682 out[2] = output2;
1683
1684 for (int i = 0; i < 3; ++i)
1685 {
1686 Diff[i] = wsp + i * ntot;
1687 }
1688
1689 // dEta0
1691 m_nquad0, 1.0, m_Deriv0, m_nquad0, &input[0], m_nquad0, 0.0,
1692 &Diff[0][0], m_nquad0);
1693
1694 int cnt = 0;
1695 for (int i = 0; i < m_numElmt; ++i)
1696 {
1697 // dEta 1
1698 for (int j = 0; j < m_nquad2; ++j)
1699 {
1700 Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
1701 &input[i * nPhys + j * m_nquad0 * m_nquad1],
1702 m_nquad0, m_Deriv1, m_nquad1, 0.0,
1703 &Diff[1][i * nPhys + j * m_nquad0 * m_nquad1],
1704 m_nquad0);
1705 }
1706
1707 // dEta 2
1708 Blas::Dgemm('N', 'T', m_nquad0 * m_nquad1, m_nquad2, m_nquad2, 1.0,
1709 &input[i * nPhys], m_nquad0 * m_nquad1, m_Deriv2,
1710 m_nquad2, 0.0, &Diff[2][i * nPhys],
1711 m_nquad0 * m_nquad1);
1712
1713 // dxi0 = 2/(1-eta_2) d Eta_0
1714 Vmath::Vmul(nPhys, &m_fac0[0], 1, Diff[0].get() + cnt, 1,
1715 Diff[0].get() + cnt, 1);
1716
1717 // dxi2 = (1+eta0)/(1-eta_2) d Eta_0 + d/dEta2;
1718 Vmath::Vvtvp(nPhys, &m_fac1[0], 1, Diff[0].get() + cnt, 1,
1719 Diff[2].get() + cnt, 1, Diff[2].get() + cnt, 1);
1720 cnt += nPhys;
1721 }
1722
1723 // calculate full derivative
1724 if (m_isDeformed)
1725 {
1726 for (int i = 0; i < m_coordim; ++i)
1727 {
1728 Vmath::Vmul(ntot, m_derivFac[i * 3], 1, Diff[0], 1, out[i], 1);
1729 for (int j = 1; j < 3; ++j)
1730 {
1731 Vmath::Vvtvp(ntot, m_derivFac[i * 3 + j], 1, Diff[j], 1,
1732 out[i], 1, out[i], 1);
1733 }
1734 }
1735 }
1736 else
1737 {
1738 Array<OneD, NekDouble> t;
1739 for (int e = 0; e < m_numElmt; ++e)
1740 {
1741 for (int i = 0; i < m_coordim; ++i)
1742 {
1743 Vmath::Smul(m_nqe, m_derivFac[i * 3][e],
1744 Diff[0] + e * m_nqe, 1, t = out[i] + e * m_nqe,
1745 1);
1746
1747 for (int j = 1; j < 3; ++j)
1748 {
1749 Vmath::Svtvp(m_nqe, m_derivFac[i * 3 + j][e],
1750 Diff[j] + e * m_nqe, 1, out[i] + e * m_nqe,
1751 1, t = out[i] + e * m_nqe, 1);
1752 }
1753 }
1754 }
1755 }
1756 }
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, 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_Prism::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 1758 of file PhysDeriv.cpp.

1761 {
1762 int nPhys = m_stdExp->GetTotPoints();
1763 int ntot = m_numElmt * nPhys;
1764 Array<OneD, NekDouble> tmp0, tmp1, tmp2;
1765 Array<OneD, Array<OneD, NekDouble>> Diff(3);
1766
1767 for (int i = 0; i < 3; ++i)
1768 {
1769 Diff[i] = wsp + i * ntot;
1770 }
1771
1772 // dEta0
1774 m_nquad0, 1.0, m_Deriv0, m_nquad0, &input[0], m_nquad0, 0.0,
1775 &Diff[0][0], m_nquad0);
1776
1777 int cnt = 0;
1778 for (int i = 0; i < m_numElmt; ++i)
1779 {
1780 // dEta 1
1781 for (int j = 0; j < m_nquad2; ++j)
1782 {
1783 Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1, 1.0,
1784 &input[i * nPhys + j * m_nquad0 * m_nquad1],
1785 m_nquad0, m_Deriv1, m_nquad1, 0.0,
1786 &Diff[1][i * nPhys + j * m_nquad0 * m_nquad1],
1787 m_nquad0);
1788 }
1789
1790 // dEta 2
1791 Blas::Dgemm('N', 'T', m_nquad0 * m_nquad1, m_nquad2, m_nquad2, 1.0,
1792 &input[i * nPhys], m_nquad0 * m_nquad1, m_Deriv2,
1793 m_nquad2, 0.0, &Diff[2][i * nPhys],
1794 m_nquad0 * m_nquad1);
1795
1796 // dxi0 = 2/(1-eta_2) d Eta_0
1797 Vmath::Vmul(nPhys, &m_fac0[0], 1, Diff[0].get() + cnt, 1,
1798 Diff[0].get() + cnt, 1);
1799
1800 // dxi2 = (1+eta0)/(1-eta_2) d Eta_0 + d/dEta2;
1801 Vmath::Vvtvp(nPhys, &m_fac1[0], 1, Diff[0].get() + cnt, 1,
1802 Diff[2].get() + cnt, 1, Diff[2].get() + cnt, 1);
1803 cnt += nPhys;
1804 }
1805
1806 // calculate full derivative
1807 if (m_isDeformed)
1808 {
1809 // calculate full derivative
1810 Vmath::Vmul(ntot, m_derivFac[dir * 3], 1, Diff[0], 1, output, 1);
1811 for (int j = 1; j < 3; ++j)
1812 {
1813 Vmath::Vvtvp(ntot, m_derivFac[dir * 3 + j], 1, Diff[j], 1,
1814 output, 1, output, 1);
1815 }
1816 }
1817 else
1818 {
1819 Array<OneD, NekDouble> t;
1820 for (int e = 0; e < m_numElmt; ++e)
1821 {
1822 Vmath::Smul(m_nqe, m_derivFac[dir * 3][e], Diff[0] + e * m_nqe,
1823 1, t = output + e * m_nqe, 1);
1824
1825 for (int j = 1; j < 3; ++j)
1826 {
1827 Vmath::Svtvp(m_nqe, m_derivFac[dir * 3 + j][e],
1828 Diff[j] + e * m_nqe, 1, output + e * m_nqe, 1,
1829 t = output + e * m_nqe, 1);
1830 }
1831 }
1832 }
1833 }

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

Definition at line 1837 of file PhysDeriv.cpp.

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

◆ m_Deriv0

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Prism::m_Deriv0
protected

Definition at line 1841 of file PhysDeriv.cpp.

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

◆ m_Deriv1

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Prism::m_Deriv1
protected

Definition at line 1842 of file PhysDeriv.cpp.

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

◆ m_Deriv2

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Prism::m_Deriv2
protected

Definition at line 1843 of file PhysDeriv.cpp.

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

◆ m_derivFac

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

Definition at line 1836 of file PhysDeriv.cpp.

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

◆ m_fac0

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

Definition at line 1844 of file PhysDeriv.cpp.

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

◆ m_fac1

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

Definition at line 1845 of file PhysDeriv.cpp.

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

◆ m_nquad0

const int Nektar::Collections::PhysDeriv_SumFac_Prism::m_nquad0
protected

Definition at line 1838 of file PhysDeriv.cpp.

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

◆ m_nquad1

const int Nektar::Collections::PhysDeriv_SumFac_Prism::m_nquad1
protected

Definition at line 1839 of file PhysDeriv.cpp.

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

◆ m_nquad2

const int Nektar::Collections::PhysDeriv_SumFac_Prism::m_nquad2
protected

Definition at line 1840 of file PhysDeriv.cpp.

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