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=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. More...
 
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< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
 Constructor. More...
 
virtual ~Operator ()=default
 
virtual COLLECTIONS_EXPORT void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output0, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp=NullNekDouble1DArray)=0
 Perform operation. More...
 
virtual COLLECTIONS_EXPORT void operator() (int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp=NullNekDouble1DArray)=0
 
virtual COLLECTIONS_EXPORT void UpdateFactors (StdRegions::FactorMap factors)
 Update the supplied factor map. More...
 
virtual COLLECTIONS_EXPORT void UpdateVarcoeffs (StdRegions::VarCoeffMap &varcoeffs)
 Update the supplied variable coefficients. More...
 
unsigned int GetWspSize ()
 Get the size of the required workspace. More...
 
unsigned int GetNumElmt ()
 Get number of elements. More...
 
StdRegions::StdExpansionSharedPtr GetExpSharedPtr ()
 Get expansion pointer. More...
 
unsigned int GetInputSize (bool defaultIn=true)
 
unsigned int GetOutputSize (bool defaultOut=true)
 

Private Member Functions

 PhysDeriv_MatrixFree (vector< StdRegions::StdExpansionSharedPtr > 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 More...
 
unsigned int m_nElmtPad
 size after padding More...
 
unsigned int m_nIn
 actural size of input array More...
 
unsigned int m_nOut
 actural size of output array More...
 

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 More...
 
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 More...
 
unsigned int m_outputSize
 number of modes or quadrature points that are taken as output from an operator More...
 
unsigned int m_inputSizeOther
 Number of modes or quadrature points, opposite to m_inputSize. More...
 
unsigned int m_outputSizeOther
 Number of modes or quadrature points, opposite to m_outputSize. More...
 

Detailed Description

Phys deriv operator using matrix free operators.

Definition at line 269 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< StdRegions::StdExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData,
StdRegions::FactorMap  factors 
)
inlineprivate

Definition at line 322 of file PhysDeriv.cpp.

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

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::Collections::GetOperatorFactory(), 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 278 of file PhysDeriv.cpp.

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

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

312 {
313 (*m_oper)(input, m_output);
314 Vmath::Vcopy(m_nOut, m_output[dir], 1, output, 1);
315 }
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 319 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 318 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 320 of file PhysDeriv.cpp.

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