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

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) override final
 Perform operation. More...
 
void operator() (int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp) override final
 
virtual void CheckFactors (StdRegions::FactorMap factors, int coll_phys_offset) override
 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 268 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

◆ ~PhysDeriv_MatrixFree()

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

Definition at line 273 of file PhysDeriv.cpp.

274  {
275  }

◆ PhysDeriv_MatrixFree()

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

Definition at line 347 of file PhysDeriv.cpp.

350  : Operator(pCollExp, pGeomData, factors),
351  MatrixFreeOneInMultiOut(pCollExp[0]->GetCoordim(),
352  pCollExp[0]->GetStdExp()->GetTotPoints(),
353  pCollExp[0]->GetStdExp()->GetTotPoints(),
354  pCollExp.size())
355  {
356  // Check if deformed
357  bool deformed{pGeomData->IsDeformed(pCollExp)};
358  const auto dim = pCollExp[0]->GetStdExp()->GetShapeDimension();
359 
360  if (m_isPadded == false) // declare local space non-padded case
361  {
362  int nOut = pCollExp[0]->GetStdExp()->GetTotPoints();
363  m_output = Array<OneD, Array<OneD, NekDouble>>(m_coordim);
364  m_output[0] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
365  if (m_coordim == 2)
366  {
367  m_output[1] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
368  }
369  else if (m_coordim == 3)
370  {
371  m_output[1] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
372  m_output[2] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
373  }
374  }
375 
376  // Basis vector.
377  std::vector<LibUtilities::BasisSharedPtr> basis(dim);
378  for (unsigned int i = 0; i < dim; ++i)
379  {
380  basis[i] = pCollExp[0]->GetBasis(i);
381  }
382 
383  // Get shape type
384  auto shapeType = pCollExp[0]->GetStdExp()->DetShapeType();
385 
386  // Generate operator string and create operator.
387  std::string op_string = "PhysDeriv";
388  op_string += MatrixFree::GetOpstring(shapeType, deformed);
390  op_string, basis, m_nElmtPad);
391 
392  // Set derivative factors
393  oper->SetDF(pGeomData->GetDerivFactorsInterLeave(pCollExp, m_nElmtPad));
394 
395  m_oper = std::dynamic_pointer_cast<MatrixFree::PhysDeriv>(oper);
396  ASSERTL0(m_oper, "Failed to cast pointer.");
397  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
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:43
std::shared_ptr< MatrixFree::PhysDeriv > m_oper
Definition: PhysDeriv.cpp:345
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:144
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
Definition: Operator.cpp:117

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), and Nektar::Collections::GetOperatorFactory().

Member Function Documentation

◆ CheckFactors()

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

Check the validity of the supplied factor map.

Implements Nektar::Collections::Operator.

Definition at line 337 of file PhysDeriv.cpp.

339  {
340  boost::ignore_unused(factors, coll_phys_offset);
341  ASSERTL0(false, "Not valid for this operator.");
342  }

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 
)
inlinefinaloverridevirtual

Perform operation.

Implements Nektar::Collections::Operator.

Definition at line 277 of file PhysDeriv.cpp.

282  {
283  boost::ignore_unused(wsp);
284 
285  if (m_isPadded)
286  {
287  // copy into padded vector
288  Vmath::Vcopy(m_nIn, input, 1, m_input, 1);
289  (*m_oper)(m_input, m_output);
290  }
291  else
292  {
293  (*m_oper)(input, m_output);
294  }
295 
296  // currently using temporary local temporary space for output
297  // to allow for other operator call below which is
298  // directionally dependent
299  switch (m_coordim)
300  {
301  case 1:
302  Vmath::Vcopy(m_nOut, m_output[0], 1, output0, 1);
303  break;
304  case 2:
305  Vmath::Vcopy(m_nOut, m_output[0], 1, output0, 1);
306  Vmath::Vcopy(m_nOut, m_output[1], 1, output1, 1);
307  break;
308  case 3:
309  Vmath::Vcopy(m_nOut, m_output[0], 1, output0, 1);
310  Vmath::Vcopy(m_nOut, m_output[1], 1, output1, 1);
311  Vmath::Vcopy(m_nOut, m_output[2], 1, output2, 1);
312  break;
313  default:
314  NEKERROR(ErrorUtil::efatal, "Unknown coordinate dimension");
315  break;
316  }
317  }
#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:1255

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 
)
inlinefinaloverridevirtual

Implements Nektar::Collections::Operator.

Definition at line 319 of file PhysDeriv.cpp.

322  {
323  boost::ignore_unused(wsp);
324  if (m_isPadded)
325  {
326  // copy into padded vector
327  Vmath::Vcopy(m_nIn, input, 1, m_input, 1);
328  (*m_oper)(m_input, m_output);
329  }
330  else
331  {
332  (*m_oper)(input, m_output);
333  }
334  Vmath::Vcopy(m_nOut, m_output[dir], 1, output, 1);
335  }

References Vmath::Vcopy().

Member Data Documentation

◆ m_oper

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

Definition at line 345 of file PhysDeriv.cpp.