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

Backward transform operator using sum-factorisation (Pyr) More...

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

Public Member Functions

virtual ~BwdTrans_SumFac_Pyr ()
 
virtual void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, 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, std::shared_ptr< CoalescedGeomData > GeomData)
 Constructor. More...
 
virtual COLLECTIONS_EXPORT ~Operator ()
 
int GetWspSize ()
 Get the size of the required workspace. More...
 

Protected Attributes

const int m_nquad0
 
const int m_nquad1
 
const int m_nquad2
 
const int m_nmodes0
 
const int m_nmodes1
 
const int m_nmodes2
 
Array< OneD, const NekDoublem_base0
 
Array< OneD, const NekDoublem_base1
 
Array< OneD, const NekDoublem_base2
 
bool m_sortTopVertex
 
- Protected Attributes inherited from Nektar::Collections::Operator
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 
unsigned int m_wspSize
 

Private Member Functions

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

Detailed Description

Backward transform operator using sum-factorisation (Pyr)

Definition at line 1050 of file BwdTrans.cpp.

Constructor & Destructor Documentation

◆ ~BwdTrans_SumFac_Pyr()

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

Definition at line 1055 of file BwdTrans.cpp.

1056  {
1057  }

◆ BwdTrans_SumFac_Pyr()

Nektar::Collections::BwdTrans_SumFac_Pyr::BwdTrans_SumFac_Pyr ( vector< StdRegions::StdExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData 
)
inlineprivate

Definition at line 1177 of file BwdTrans.cpp.

References Nektar::StdRegions::eBwdTrans, Nektar::LibUtilities::eModified_A, Nektar::LibUtilities::ePyramid, Nektar::Collections::eSumFac, and Nektar::Collections::GetOperatorFactory().

1180  : Operator (pCollExp, pGeomData),
1181  m_nquad0 (m_stdExp->GetNumPoints(0)),
1182  m_nquad1 (m_stdExp->GetNumPoints(1)),
1183  m_nquad2 (m_stdExp->GetNumPoints(2)),
1184  m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
1185  m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
1186  m_nmodes2 (m_stdExp->GetBasisNumModes(2)),
1187  m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
1188  m_base1 (m_stdExp->GetBasis(1)->GetBdata()),
1189  m_base2 (m_stdExp->GetBasis(2)->GetBdata())
1190  {
1192 
1193  if(m_stdExp->GetBasis(0)->GetBasisType()
1195  {
1196  m_sortTopVertex = true;
1197  }
1198  else
1199  {
1200  m_sortTopVertex = false;
1201  }
1202 
1203  }
Array< OneD, const NekDouble > m_base1
Definition: BwdTrans.cpp:1172
Array< OneD, const NekDouble > m_base2
Definition: BwdTrans.cpp:1173
Principle Modified Functions .
Definition: BasisType.h:48
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData)
Constructor.
Definition: Operator.h:113
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:148
Array< OneD, const NekDouble > m_base0
Definition: BwdTrans.cpp:1171

Member Function Documentation

◆ operator()() [1/2]

virtual void Nektar::Collections::BwdTrans_SumFac_Pyr::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 1059 of file BwdTrans.cpp.

References ASSERTL1, Blas::Daxpy(), Blas::Dgemm(), and Vmath::Zero().

1065  {
1066  boost::ignore_unused(output1, output2);
1067 
1068  ASSERTL1(wsp.num_elements() == m_wspSize,
1069  "Incorrect workspace size");
1070 
1071  // Assign second half of workspace for 2nd DGEMM operation.
1072  int totmodes = m_stdExp->GetNcoeffs();
1073 
1074  Array<OneD, NekDouble> wsp2
1076 
1077  Vmath::Zero(m_nmodes0*m_nmodes1*m_nquad2*m_numElmt, wsp, 1);
1078  int i = 0;
1079  int j = 0;
1080  int mode = 0;
1081  int mode1 = 0;
1082  int cnt = 0;
1083  for (i = 0; i < m_nmodes0; ++i)
1084  {
1085  for (j = 0; j < m_nmodes1; ++j, ++cnt)
1086  {
1087  int ijmax = max(i,j);
1088  Blas::Dgemm('N', 'N', m_nquad2, m_numElmt, m_nmodes2-ijmax,
1089  1.0, m_base2.get()+mode*m_nquad2, m_nquad2,
1090  input.get()+mode1, totmodes, 0.0,
1091  wsp.get() + cnt*m_nquad2*m_numElmt, m_nquad2);
1092  mode += m_nmodes2-ijmax;
1093  mode1 += m_nmodes2-ijmax;
1094  }
1095 
1096  //increment mode in case order1!=order2
1097  for(j = m_nmodes1; j < m_nmodes2-i; ++j)
1098  {
1099  int ijmax = max(i,j);
1100  mode += m_nmodes2-ijmax;
1101  }
1102  }
1103 
1104  // vertex mode - currently (1+c)/2 x (1-b)/2 x (1-a)/2
1105  // component is evaluated
1106  if(m_sortTopVertex)
1107  {
1108  for(i = 0; i < m_numElmt; ++i)
1109  {
1110  // top singular vertex
1111  // (1+c)/2 x (1+b)/2 x (1-a)/2 component
1112  Blas::Daxpy(m_nquad2, input[1+i*totmodes],
1113  m_base2.get() + m_nquad2, 1,
1114  &wsp[m_nquad2*m_numElmt] + i*m_nquad2, 1);
1115 
1116  // top singular vertex
1117  // (1+c)/2 x (1-b)/2 x (1+a)/2 component
1118  Blas::Daxpy(m_nquad2, input[1+i*totmodes],
1119  m_base2.get() + m_nquad2, 1,
1120  &wsp[m_nmodes1*m_nquad2*m_numElmt]
1121  + i*m_nquad2, 1);
1122 
1123  // top singular vertex
1124  // (1+c)/2 x (1+b)/2 x (1+a)/2 component
1125  Blas::Daxpy(m_nquad2, input[1+i*totmodes],
1126  m_base2.get() + m_nquad2, 1,
1127  &wsp[(m_nmodes1+1)*m_nquad2*m_numElmt]
1128  + i*m_nquad2, 1);
1129 
1130  }
1131  }
1132 
1133  // Perform summation over '1' direction
1134  mode = 0;
1135  for(i = 0; i < m_nmodes0; ++i)
1136  {
1137  Blas::Dgemm('N', 'T', m_nquad1, m_nquad2*m_numElmt, m_nmodes1,
1138  1.0, m_base1.get(), m_nquad1,
1139  wsp.get() + mode*m_nquad2*m_numElmt,
1140  m_nquad2*m_numElmt,
1141  0.0, wsp2.get() + i*m_nquad1*m_nquad2*m_numElmt,
1142  m_nquad1);
1143  mode += m_nmodes1;
1144  }
1145 
1146  // Perform summation over '0' direction
1147  Blas::Dgemm('N', 'T', m_nquad0, m_nquad1*m_nquad2*m_numElmt,
1148  m_nmodes0, 1.0, m_base0.get(), m_nquad0,
1149  wsp2.get(), m_nquad1*m_nquad2*m_numElmt,
1150  0.0, output.get(), m_nquad0);
1151  }
Array< OneD, const NekDouble > m_base1
Definition: BwdTrans.cpp:1172
Array< OneD, const NekDouble > m_base2
Definition: BwdTrans.cpp:1173
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 A[m x n], B[n x k], C[m x k].
Definition: Blas.hpp:213
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:148
Array< OneD, const NekDouble > m_base0
Definition: BwdTrans.cpp:1171
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:376
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
static void Daxpy(const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: y = alpha x plus y.
Definition: Blas.hpp:110

◆ operator()() [2/2]

virtual void Nektar::Collections::BwdTrans_SumFac_Pyr::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 1153 of file BwdTrans.cpp.

References ASSERTL0.

1158  {
1159  boost::ignore_unused(dir, input, output, wsp);
1160  ASSERTL0(false, "Not valid for this operator.");
1161  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216

Member Data Documentation

◆ m_base0

Array<OneD, const NekDouble> Nektar::Collections::BwdTrans_SumFac_Pyr::m_base0
protected

Definition at line 1171 of file BwdTrans.cpp.

◆ m_base1

Array<OneD, const NekDouble> Nektar::Collections::BwdTrans_SumFac_Pyr::m_base1
protected

Definition at line 1172 of file BwdTrans.cpp.

◆ m_base2

Array<OneD, const NekDouble> Nektar::Collections::BwdTrans_SumFac_Pyr::m_base2
protected

Definition at line 1173 of file BwdTrans.cpp.

◆ m_nmodes0

const int Nektar::Collections::BwdTrans_SumFac_Pyr::m_nmodes0
protected

Definition at line 1168 of file BwdTrans.cpp.

◆ m_nmodes1

const int Nektar::Collections::BwdTrans_SumFac_Pyr::m_nmodes1
protected

Definition at line 1169 of file BwdTrans.cpp.

◆ m_nmodes2

const int Nektar::Collections::BwdTrans_SumFac_Pyr::m_nmodes2
protected

Definition at line 1170 of file BwdTrans.cpp.

◆ m_nquad0

const int Nektar::Collections::BwdTrans_SumFac_Pyr::m_nquad0
protected

Definition at line 1165 of file BwdTrans.cpp.

◆ m_nquad1

const int Nektar::Collections::BwdTrans_SumFac_Pyr::m_nquad1
protected

Definition at line 1166 of file BwdTrans.cpp.

◆ m_nquad2

const int Nektar::Collections::BwdTrans_SumFac_Pyr::m_nquad2
protected

Definition at line 1167 of file BwdTrans.cpp.

◆ m_sortTopVertex

bool Nektar::Collections::BwdTrans_SumFac_Pyr::m_sortTopVertex
protected

Definition at line 1174 of file BwdTrans.cpp.