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

341 : Operator(pCollExp, pGeomData, factors), PhysDeriv_Helper(),
342 MatrixFreeOneInMultiOut(pCollExp[0]->GetCoordim(),
343 pCollExp[0]->GetStdExp()->GetTotPoints(),
344 pCollExp[0]->GetStdExp()->GetTotPoints(),
345 pCollExp.size())
346 {
347 // Check if deformed
348 bool deformed{pGeomData->IsDeformed(pCollExp)};
349 const auto dim = pCollExp[0]->GetStdExp()->GetShapeDimension();
350
351 if (m_isPadded == false) // declare local space non-padded case
352 {
353 int nOut = pCollExp[0]->GetStdExp()->GetTotPoints();
354 m_output = Array<OneD, Array<OneD, NekDouble>>(m_coordim);
355 m_output[0] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
356 if (m_coordim == 2)
357 {
358 m_output[1] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
359 }
360 else if (m_coordim == 3)
361 {
362 m_output[1] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
363 m_output[2] = Array<OneD, NekDouble>{nOut * m_nElmtPad, 0.0};
364 }
365 }
366
367 // Basis vector.
368 std::vector<LibUtilities::BasisSharedPtr> basis(dim);
369 for (unsigned int i = 0; i < dim; ++i)
370 {
371 basis[i] = pCollExp[0]->GetBasis(i);
372 }
373
374 // Get shape type
375 auto shapeType = pCollExp[0]->GetStdExp()->DetShapeType();
376
377 // Generate operator string and create operator.
378 std::string op_string = "PhysDeriv";
379 op_string += MatrixFree::GetOpstring(shapeType, deformed);
381 op_string, basis, m_nElmtPad);
382
383 // Set derivative factors
384 oper->SetDF(pGeomData->GetDerivFactorsInterLeave(pCollExp, m_nElmtPad));
385
386 m_oper = std::dynamic_pointer_cast<MatrixFree::PhysDeriv>(oper);
387 ASSERTL0(m_oper, "Failed to cast pointer.");
388 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
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:66
std::shared_ptr< MatrixFree::PhysDeriv > m_oper
Definition: PhysDeriv.cpp:336
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(), Nektar::Collections::MatrixFreeOneInMultiOut::m_coordim, Nektar::Collections::MatrixFreeBase::m_isPadded, Nektar::Collections::MatrixFreeBase::m_nElmtPad, m_oper, and Nektar::Collections::MatrixFreeOneInMultiOut::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 if (m_isPadded)
285 {
286 // copy into padded vector
287 Vmath::Vcopy(m_nIn, input, 1, m_input, 1);
288 (*m_oper)(m_input, m_output);
289 }
290 else
291 {
292 (*m_oper)(input, m_output);
293 }
294
295 // currently using temporary local temporary space for output
296 // to allow for other operator call below which is
297 // directionally dependent
298 switch (m_coordim)
299 {
300 case 1:
301 Vmath::Vcopy(m_nOut, m_output[0], 1, output0, 1);
302 break;
303 case 2:
304 Vmath::Vcopy(m_nOut, m_output[0], 1, output0, 1);
305 Vmath::Vcopy(m_nOut, m_output[1], 1, output1, 1);
306 break;
307 case 3:
308 Vmath::Vcopy(m_nOut, m_output[0], 1, output0, 1);
309 Vmath::Vcopy(m_nOut, m_output[1], 1, output1, 1);
310 Vmath::Vcopy(m_nOut, m_output[2], 1, output2, 1);
311 break;
312 default:
313 NEKERROR(ErrorUtil::efatal, "Unknown coordinate dimension");
314 break;
315 }
316 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
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.hpp:825

References Nektar::ErrorUtil::efatal, Nektar::Collections::MatrixFreeOneInMultiOut::m_coordim, Nektar::Collections::MatrixFreeOneInMultiOut::m_input, Nektar::Collections::MatrixFreeBase::m_isPadded, Nektar::Collections::MatrixFreeBase::m_nIn, Nektar::Collections::MatrixFreeBase::m_nOut, Nektar::Collections::MatrixFreeOneInMultiOut::m_output, 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

Member Data Documentation

◆ m_oper

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

Definition at line 336 of file PhysDeriv.cpp.

Referenced by PhysDeriv_MatrixFree().