Nektar++
Loading...
Searching...
No Matches
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=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.
 
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< LocalRegions::ExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
 Constructor.
 
virtual ~Operator ()=default
 
virtual COLLECTIONS_EXPORT void UpdateFactors (StdRegions::FactorMap factors)
 Update the supplied factor map.
 
virtual COLLECTIONS_EXPORT void UpdateVarcoeffs (StdRegions::VarCoeffMap &varcoeffs)
 Update the supplied variable coefficients.
 
unsigned int GetWspSize ()
 Get the size of the required workspace.
 
unsigned int GetNumElmt ()
 Get number of elements.
 
StdRegions::StdExpansionSharedPtr GetExpSharedPtr ()
 Get expansion pointer.
 
unsigned int GetInputSize (void)
 
unsigned int GetOutputSize (void)
 
unsigned int GetPhysSize (void)
 
unsigned int GetCoeffSize (void)
 

Private Member Functions

 PhysDeriv_MatrixFree (vector< LocalRegions::ExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
 
- Private Member Functions inherited from Nektar::Collections::MatrixFreeBase
 MatrixFreeBase ()=default
 
 MatrixFreeBase (const unsigned int nIn, const unsigned int nOut, const unsigned int nCollSize)
 

Private Attributes

std::shared_ptr< MatrixFree::PhysDeriv > m_oper
 
int m_coordim
 
Array< OneD, Array< OneD, NekDouble > > m_output
 
- Private Attributes inherited from Nektar::Collections::MatrixFreeBase
bool m_isPadded {false}
 flag for padding
 
unsigned int m_nElmtPad
 size after padding
 
unsigned int m_nIn
 actural size of input array
 
unsigned int m_nOut
 actural size of output array
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Collections::PhysDeriv_Helper
 PhysDeriv_Helper ()
 
- 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
 
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
 
unsigned int m_outputSize
 number of modes or quadrature points that are taken as output from an operator
 

Detailed Description

Phys deriv operator using matrix free operators.

Definition at line 272 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

◆ ~PhysDeriv_MatrixFree()

Nektar::Collections::PhysDeriv_MatrixFree::~PhysDeriv_MatrixFree ( )
finaldefault

◆ PhysDeriv_MatrixFree()

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

Definition at line 325 of file PhysDeriv.cpp.

328 : Operator(pCollExp, pGeomData, factors), PhysDeriv_Helper(),
329 MatrixFreeBase(pCollExp[0]->GetTotPoints(),
330 pCollExp[0]->GetTotPoints(), pCollExp.size())
331 {
332 // Check if deformed
333 bool deformed{pGeomData->IsDeformed(pCollExp)};
334 const auto dim = pCollExp[0]->GetShapeDimension();
335
336 // only used operator(dir, in, out)
337 m_coordim = pCollExp[0]->GetCoordim();
338 int nOut = pCollExp[0]->GetTotPoints();
339 m_output = Array<OneD, Array<OneD, NekDouble>>(m_coordim);
340 m_output[0] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
341 if (m_coordim == 2)
342 {
343 m_output[1] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
344 }
345 else if (m_coordim == 3)
346 {
347 m_output[1] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
348 m_output[2] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
349 }
350
351 // Basis vector.
352 std::vector<LibUtilities::BasisSharedPtr> basis(dim);
353 for (unsigned int i = 0; i < dim; ++i)
354 {
355 basis[i] = pCollExp[0]->GetBasis(i);
356 }
357
358 // Get shape type
359 auto shapeType = pCollExp[0]->DetShapeType();
360
361 // Generate operator string and create operator.
362 std::string op_string = "PhysDeriv";
363 op_string += MatrixFree::GetOpstring(shapeType, deformed);
364 auto oper = MatrixFree::GetOperatorFactory().CreateInstance(
365 op_string, basis, pCollExp.size());
366
367 oper->SetUpZW(basis);
368 oper->SetUpD(basis);
369
370 // Set derivative factors
371 oper->SetDF(pGeomData->GetDerivFactorsInterLeave(pCollExp, m_nElmtPad));
372
373 m_oper = std::dynamic_pointer_cast<MatrixFree::PhysDeriv>(oper);
374 ASSERTL0(m_oper, "Failed to cast pointer.");
375 }
#define ASSERTL0(condition, msg)
unsigned int m_nElmtPad
size after padding
Operator(std::vector< LocalRegions::ExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition Operator.cpp:66
Array< OneD, Array< OneD, NekDouble > > m_output
std::shared_ptr< MatrixFree::PhysDeriv > m_oper

References ASSERTL0, m_coordim, Nektar::Collections::MatrixFreeBase::m_nElmtPad, m_oper, and m_output.

Member Function Documentation

◆ 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 281 of file PhysDeriv.cpp.

286 {
287 Array<OneD, Array<OneD, NekDouble>> output(m_coordim);
288 // currently using temporary local temporary space for output
289 // to allow for other operator call below which is
290 // directionally dependent
291 switch (m_coordim)
292 {
293 case 1:
294 output[0] = output0;
295 break;
296 case 2:
297 output[0] = output0;
298 output[1] = output1;
299 break;
300 case 3:
301 output[0] = output0;
302 output[1] = output1;
303 output[2] = output2;
304 break;
305 default:
306 NEKERROR(ErrorUtil::efatal, "Unknown coordinate dimension");
307 break;
308 }
309 (*m_oper)(input, output);
310 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...

References Nektar::ErrorUtil::efatal, m_coordim, and NEKERROR.

◆ 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 312 of file PhysDeriv.cpp.

315 {
316 (*m_oper)(input, m_output);
317 Vmath::Vcopy(m_nOut, m_output[dir], 1, output, 1);
318 }
unsigned int m_nOut
actural size of output array
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition Vmath.hpp:825

References Nektar::Collections::MatrixFreeBase::m_nOut, m_output, and Vmath::Vcopy().

Member Data Documentation

◆ m_coordim

int Nektar::Collections::PhysDeriv_MatrixFree::m_coordim
private

Definition at line 322 of file PhysDeriv.cpp.

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

◆ m_oper

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

Definition at line 321 of file PhysDeriv.cpp.

Referenced by PhysDeriv_MatrixFree().

◆ m_output

Array<OneD, Array<OneD, NekDouble> > Nektar::Collections::PhysDeriv_MatrixFree::m_output
private

Definition at line 323 of file PhysDeriv.cpp.

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