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
 
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 ~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 CheckFactors (StdRegions::FactorMap factors, int coll_phys_offset)=0
 Check the validity of the supplied factor map. 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 ()
 
unsigned int GetOutputSize ()
 

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::Operator
virtual int v_GetInputSize ()
 This purely virtual function needs to be set-up for every operator inside Collections. It is responsible for returning the size of input collection, that the operator is applied on either in physical or coefficient space. More...
 
virtual int v_GetOutputSize ()
 This purely virtual function needs to be set-up for every operator inside Collections. It is responsible for returning the output size either in physical or coefficient space of an operator inside Collections. More...
 
- 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...
 

Detailed Description

Phys deriv operator using matrix free operators.

Definition at line 275 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 350 of file PhysDeriv.cpp.

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

◆ CheckFactors()

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

343 {
344 ASSERTL0(false, "Not valid for this operator.");
345 }

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

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

Referenced by PhysDeriv_MatrixFree().