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

Phys deriv operator using matrix free operators. More...

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

Public Member Functions

 ~PhysDeriv_MatrixFree () final
 
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
 
virtual void CheckFactors (StdRegions::FactorMap factors, int coll_phys_offset)
 Check the validity of the supplied factor map. More...
 
- 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 COLLECTIONS_EXPORT ~Operator ()
 
unsigned int GetWspSize ()
 Get the size of the required workspace. More...
 
unsigned int GetNumElmt ()
 Get expansion pointer. More...
 
StdRegions::StdExpansionSharedPtr GetExpSharedPtr ()
 Get expansion pointer. More...
 

Private Member Functions

 PhysDeriv_MatrixFree (vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
 
- Private Member Functions inherited from Nektar::Collections::MatrixFreeOneInMultiOut
 MatrixFreeOneInMultiOut (const unsigned int coordim, const unsigned int nIn, const unsigned int nOut, const unsigned int nCollSize)
 Constructor. More...
 

Private Attributes

std::shared_ptr< MatrixFree::PhysDeriv > m_oper
 
- Private Attributes inherited from Nektar::Collections::MatrixFreeOneInMultiOut
unsigned short m_coordim
 coordinates dimension More...
 
Array< OneD, NekDoublem_input
 padded input/output vectors More...
 
Array< OneD, Array< OneD, NekDouble > > m_output
 

Additional Inherited Members

- Protected Attributes inherited from Nektar::Collections::Operator
bool m_isDeformed
 
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 
unsigned int m_nqe
 
unsigned int m_wspSize
 

Detailed Description

Phys deriv operator using matrix free operators.

Definition at line 277 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

◆ ~PhysDeriv_MatrixFree()

Nektar::Collections::PhysDeriv_MatrixFree::~PhysDeriv_MatrixFree ( )
inlinefinal

Definition at line 282 of file PhysDeriv.cpp.

283  {
284  }

◆ PhysDeriv_MatrixFree()

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

Definition at line 359 of file PhysDeriv.cpp.

363  : Operator(pCollExp, pGeomData, factors),
364  MatrixFreeOneInMultiOut(pCollExp[0]->GetCoordim(),
365  pCollExp[0]->GetStdExp()->GetTotPoints(),
366  pCollExp[0]->GetStdExp()->GetTotPoints(),
367  pCollExp.size())
368  {
369  // Check if deformed
370  bool deformed{pGeomData->IsDeformed(pCollExp)};
371  const auto dim = pCollExp[0]->GetStdExp()->GetShapeDimension();
372 
373  if(m_isPadded == false) // declare local space non-padded case
374  {
375  int nOut = pCollExp[0]->GetStdExp()->GetTotPoints();
376  m_output = Array<OneD, Array<OneD, NekDouble>> (m_coordim);
377  m_output[0] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
378  if(m_coordim == 2)
379  {
380  m_output[1] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
381  }
382  else if (m_coordim == 3)
383  {
384  m_output[1] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
385  m_output[2] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
386  }
387  }
388 
389  // Basis vector.
390  std::vector<LibUtilities::BasisSharedPtr> basis(dim);
391  for (unsigned int i = 0; i < dim; ++i)
392  {
393  basis[i] = pCollExp[0]->GetBasis(i);
394  }
395 
396  // Get shape type
397  auto shapeType = pCollExp[0]->GetStdExp()->DetShapeType();
398 
399  // Generate operator string and create operator.
400  std::string op_string = "PhysDeriv";
401  op_string += MatrixFree::GetOpstring(shapeType, deformed);
402  auto oper = MatrixFree::GetOperatorFactory().
403  CreateInstance(op_string, basis, m_nElmtPad);
404 
405  // Set derivative factors
406  oper->SetDF(pGeomData->GetDerivFactorsInterLeave
407  (pCollExp,m_nElmtPad));
408 
409  m_oper = std::dynamic_pointer_cast<MatrixFree::PhysDeriv>(oper);
410  ASSERTL0(m_oper, "Failed to cast pointer.");
411 
412  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
unsigned int m_nElmtPad
size after padding
unsigned short m_coordim
coordinates dimension
MatrixFreeOneInMultiOut(const unsigned int coordim, const unsigned int nIn, const unsigned int nOut, const unsigned int nCollSize)
Constructor.
Array< OneD, Array< OneD, NekDouble > > m_output
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition: Operator.cpp:41
std::shared_ptr< MatrixFree::PhysDeriv > m_oper
Definition: PhysDeriv.cpp:357
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
Definition: Operator.cpp:121

References ASSERTL0, and Nektar::Collections::GetOperatorFactory().

Member Function Documentation

◆ CheckFactors()

virtual void Nektar::Collections::PhysDeriv_MatrixFree::CheckFactors ( StdRegions::FactorMap  factors,
int  coll_phys_offset 
)
inlinevirtual

Check the validity of the supplied factor map.

Implements Nektar::Collections::Operator.

Definition at line 349 of file PhysDeriv.cpp.

351  {
352  boost::ignore_unused(factors, coll_phys_offset);
353  ASSERTL0(false, "Not valid for this operator.");
354  }

References ASSERTL0.

◆ operator()() [1/2]

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

292  {
293  boost::ignore_unused(wsp);
294 
295  if (m_isPadded)
296  {
297  // copy into padded vector
298  Vmath::Vcopy(m_nIn, input, 1, m_input, 1);
299  (*m_oper)(m_input, m_output);
300  }
301  else
302  {
303  (*m_oper)(input, m_output);
304  }
305 
306  // currently using temporary local temporary space for output
307  // to allow for other operator call below which is
308  // directionally dependent
309  switch(m_coordim)
310  {
311  case 1:
312  Vmath::Vcopy(m_nOut, m_output[0], 1, output0, 1);
313  break;
314  case 2:
315  Vmath::Vcopy(m_nOut, m_output[0], 1, output0, 1);
316  Vmath::Vcopy(m_nOut, m_output[1], 1, output1, 1);
317  break;
318  case 3:
319  Vmath::Vcopy(m_nOut, m_output[0], 1, output0, 1);
320  Vmath::Vcopy(m_nOut, m_output[1], 1, output1, 1);
321  Vmath::Vcopy(m_nOut, m_output[2], 1, output2, 1);
322  break;
323  default:
325  "Unknown coordinate dimension");
326  break;
327  }
328  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209
Array< OneD, NekDouble > m_input
padded input/output vectors
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1199

References NEKERROR, and Vmath::Vcopy().

◆ operator()() [2/2]

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

334  {
335  boost::ignore_unused(wsp);
336  if (m_isPadded)
337  {
338  // copy into padded vector
339  Vmath::Vcopy(m_nIn, input, 1, m_input, 1);
340  (*m_oper)(m_input, m_output);
341  }
342  else
343  {
344  (*m_oper)(input, m_output);
345  }
346  Vmath::Vcopy(m_nOut, m_output[dir], 1, output, 1);
347  }

References Vmath::Vcopy().

Member Data Documentation

◆ m_oper

std::shared_ptr<MatrixFree::PhysDeriv> Nektar::Collections::PhysDeriv_MatrixFree::m_oper
private

Definition at line 357 of file PhysDeriv.cpp.