Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Nektar::Collections::PhysDeriv_SumFac_Prism Class Reference

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

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

Public Member Functions

virtual ~PhysDeriv_SumFac_Prism ()
 
virtual void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output0, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
 Perform operation. More...
 
virtual void operator() (int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
 
- Public Member Functions inherited from Nektar::Collections::Operator
 Operator (std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, boost::shared_ptr< CoalescedGeomData > GeomData)
 Constructor. More...
 
virtual COLLECTIONS_EXPORT ~Operator ()
 
int GetWspSize ()
 Get the size of the required workspace. More...
 

Protected Attributes

Array< TwoD, const NekDoublem_derivFac
 
int m_dim
 
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
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 
unsigned int m_wspSize
 

Private Member Functions

 PhysDeriv_SumFac_Prism (vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
 

Detailed Description

Phys deriv operator using sum-factorisation (Prism)

Definition at line 1338 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

virtual Nektar::Collections::PhysDeriv_SumFac_Prism::~PhysDeriv_SumFac_Prism ( )
inlinevirtual

Definition at line 1343 of file PhysDeriv.cpp.

1344  {
1345  }
Nektar::Collections::PhysDeriv_SumFac_Prism::PhysDeriv_SumFac_Prism ( vector< StdRegions::StdExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData 
)
inlineprivate

Definition at line 1487 of file PhysDeriv.cpp.

1490  : Operator(pCollExp, pGeomData),
1491  m_nquad0 (m_stdExp->GetNumPoints(0)),
1492  m_nquad1 (m_stdExp->GetNumPoints(1)),
1493  m_nquad2 (m_stdExp->GetNumPoints(2))
1494  {
1495  LibUtilities::PointsKeyVector PtsKey = m_stdExp->GetPointsKeys();
1496 
1497  m_dim = PtsKey.size();
1498  m_coordim = m_stdExp->GetCoordim();
1499 
1500  m_derivFac = pGeomData->GetDerivFactors(pCollExp);
1501 
1502  const Array<OneD, const NekDouble>& z0
1503  = m_stdExp->GetBasis(0)->GetZ();
1504  const Array<OneD, const NekDouble>& z2
1505  = m_stdExp->GetBasis(2)->GetZ();
1506  m_fac0 = Array<OneD, NekDouble>(m_nquad0*m_nquad1*m_nquad2);
1507  m_fac1 = Array<OneD, NekDouble>(m_nquad0*m_nquad1*m_nquad2);
1508  for (int i = 0; i < m_nquad0; ++i)
1509  {
1510  for(int j = 0; j < m_nquad1; ++j)
1511  {
1512  for(int k = 0; k < m_nquad2; ++k)
1513  {
1514  m_fac0[i+j*m_nquad0 + k*m_nquad0*m_nquad1] =
1515  2.0/(1-z2[k]);
1516  m_fac1[i+j*m_nquad0 + k*m_nquad0*m_nquad1] =
1517  0.5*(1+z0[i]);
1518  }
1519  }
1520  }
1521 
1522 
1523 
1524  m_Deriv0 = &((m_stdExp->GetBasis(0)->GetD())->GetPtr())[0];
1525  m_Deriv1 = &((m_stdExp->GetBasis(1)->GetD())->GetPtr())[0];
1526  m_Deriv2 = &((m_stdExp->GetBasis(2)->GetD())->GetPtr())[0];
1527 
1528  m_wspSize = 3*m_nquad0*m_nquad1*m_nquad2*m_numElmt;
1529  }
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, boost::shared_ptr< CoalescedGeomData > GeomData)
Constructor.
Definition: Operator.h:112
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:242
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:1474
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146

Member Function Documentation

virtual 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 
)
inlinevirtual

Perform operation.

Implements Nektar::Collections::Operator.

Definition at line 1347 of file PhysDeriv.cpp.

References Vmath::Vmul(), and Vmath::Vvtvp().

1353  {
1354  int nPhys = m_stdExp->GetTotPoints();
1355  int ntot = m_numElmt*nPhys;
1356  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
1357  Array<OneD, Array<OneD, NekDouble> > Diff(3);
1358  Array<OneD, Array<OneD, NekDouble> > out(3);
1359  out[0] = output0; out[1] = output1; out[2] = output2;
1360 
1361  for(int i = 0; i < m_dim; ++i)
1362  {
1363  Diff[i] = wsp + i*ntot;
1364  }
1365 
1366  // dEta0
1367  Blas::Dgemm('N','N', m_nquad0,m_nquad1*m_nquad2*m_numElmt,
1368  m_nquad0,1.0, m_Deriv0,m_nquad0,&input[0],
1369  m_nquad0,0.0,&Diff[0][0],m_nquad0);
1370 
1371  int cnt = 0;
1372  for(int i = 0; i < m_numElmt; ++i)
1373  {
1374 
1375  // dEta 1
1376  for (int j = 0; j < m_nquad2; ++j)
1377  {
1378  Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1,
1379  1.0, &input[i*nPhys+j*m_nquad0*m_nquad1],
1380  m_nquad0, m_Deriv1, m_nquad1, 0.0,
1381  &Diff[1][i*nPhys+j*m_nquad0*m_nquad1],
1382  m_nquad0);
1383  }
1384 
1385  // dEta 2
1386  Blas::Dgemm('N','T',m_nquad0*m_nquad1,m_nquad2,m_nquad2,
1387  1.0, &input[i*nPhys],m_nquad0*m_nquad1,
1388  m_Deriv2,m_nquad2, 0.0,&Diff[2][i*nPhys],
1389  m_nquad0*m_nquad1);
1390 
1391  // dxi0 = 2/(1-eta_2) d Eta_0
1392  Vmath::Vmul(nPhys,&m_fac0[0],1,Diff[0].get()+cnt,1,
1393  Diff[0].get()+cnt,1);
1394 
1395  // dxi2 = (1+eta0)/(1-eta_2) d Eta_0 + d/dEta2;
1396  Vmath::Vvtvp(nPhys,&m_fac1[0],1,Diff[0].get()+cnt,1,
1397  Diff[2].get()+cnt,1,Diff[2].get()+cnt,1);
1398  cnt += nPhys;
1399  }
1400 
1401  // calculate full derivative
1402  for(int i = 0; i < m_coordim; ++i)
1403  {
1404  Vmath::Vmul(ntot,m_derivFac[i*m_dim],1,Diff[0],1,out[i],1);
1405  for(int j = 1; j < m_dim; ++j)
1406  {
1407  Vmath::Vvtvp (ntot, m_derivFac[i*m_dim+j], 1,
1408  Diff[j], 1, out[i], 1, out[i], 1);
1409  }
1410  }
1411  }
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.cpp:442
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:1474
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146
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.cpp:183
virtual void Nektar::Collections::PhysDeriv_SumFac_Prism::operator() ( int  dir,
const Array< OneD, const NekDouble > &  input,
Array< OneD, NekDouble > &  output,
Array< OneD, NekDouble > &  wsp 
)
inlinevirtual

Implements Nektar::Collections::Operator.

Definition at line 1413 of file PhysDeriv.cpp.

References Vmath::Vmul(), and Vmath::Vvtvp().

1418  {
1419  int nPhys = m_stdExp->GetTotPoints();
1420  int ntot = m_numElmt*nPhys;
1421  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
1422  Array<OneD, Array<OneD, NekDouble> > Diff(3);
1423 
1424  for(int i = 0; i < m_dim; ++i)
1425  {
1426  Diff[i] = wsp + i*ntot;
1427  }
1428 
1429  // dEta0
1430  Blas::Dgemm('N','N', m_nquad0,m_nquad1*m_nquad2*m_numElmt,
1431  m_nquad0,1.0, m_Deriv0,m_nquad0,&input[0],
1432  m_nquad0,0.0,&Diff[0][0],m_nquad0);
1433 
1434  int cnt = 0;
1435  for(int i = 0; i < m_numElmt; ++i)
1436  {
1437 
1438  // dEta 1
1439  for (int j = 0; j < m_nquad2; ++j)
1440  {
1441  Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1,
1442  1.0, &input[i*nPhys+j*m_nquad0*m_nquad1],
1443  m_nquad0, m_Deriv1, m_nquad1, 0.0,
1444  &Diff[1][i*nPhys+j*m_nquad0*m_nquad1],
1445  m_nquad0);
1446  }
1447 
1448  // dEta 2
1449  Blas::Dgemm('N','T',m_nquad0*m_nquad1,m_nquad2,m_nquad2,
1450  1.0, &input[i*nPhys],m_nquad0*m_nquad1,
1451  m_Deriv2,m_nquad2, 0.0,&Diff[2][i*nPhys],
1452  m_nquad0*m_nquad1);
1453 
1454  // dxi0 = 2/(1-eta_2) d Eta_0
1455  Vmath::Vmul(nPhys,&m_fac0[0],1,Diff[0].get()+cnt,1,
1456  Diff[0].get()+cnt,1);
1457 
1458  // dxi2 = (1+eta0)/(1-eta_2) d Eta_0 + d/dEta2;
1459  Vmath::Vvtvp(nPhys,&m_fac1[0],1,Diff[0].get()+cnt,1,
1460  Diff[2].get()+cnt,1,Diff[2].get()+cnt,1);
1461  cnt += nPhys;
1462  }
1463 
1464  // calculate full derivative
1465  Vmath::Vmul(ntot,m_derivFac[dir*m_dim],1,Diff[0],1,output,1);
1466  for(int j = 1; j < m_dim; ++j)
1467  {
1468  Vmath::Vvtvp (ntot, m_derivFac[dir*m_dim+j], 1,
1469  Diff[j], 1, output, 1, output, 1);
1470  }
1471  }
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.cpp:442
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:1474
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146
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.cpp:183

Member Data Documentation

int Nektar::Collections::PhysDeriv_SumFac_Prism::m_coordim
protected

Definition at line 1476 of file PhysDeriv.cpp.

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

Definition at line 1480 of file PhysDeriv.cpp.

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

Definition at line 1481 of file PhysDeriv.cpp.

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

Definition at line 1482 of file PhysDeriv.cpp.

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

Definition at line 1474 of file PhysDeriv.cpp.

int Nektar::Collections::PhysDeriv_SumFac_Prism::m_dim
protected

Definition at line 1475 of file PhysDeriv.cpp.

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

Definition at line 1483 of file PhysDeriv.cpp.

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

Definition at line 1484 of file PhysDeriv.cpp.

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

Definition at line 1477 of file PhysDeriv.cpp.

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

Definition at line 1478 of file PhysDeriv.cpp.

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

Definition at line 1479 of file PhysDeriv.cpp.