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

Inner product operator using operator using matrix free operators. More...

Inheritance diagram for Nektar::Collections::IProductWRTDerivBase_MatrixFree:
[legend]

Public Member Functions

 ~IProductWRTDerivBase_MatrixFree () final=default
 
void operator() (const Array< OneD, const NekDouble > &entry0, Array< OneD, NekDouble > &entry1, Array< OneD, NekDouble > &entry2, Array< OneD, NekDouble > &entry3, 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

 IProductWRTDerivBase_MatrixFree (vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
 
- Private Member Functions inherited from Nektar::Collections::MatrixFreeMultiInOneOut
 MatrixFreeMultiInOneOut (const unsigned int coordim, const unsigned int nIn, const unsigned int nOut, const unsigned int nCollSize)
 Constructor. More...
 
- Private Member Functions inherited from Nektar::Collections::IProductWRTDerivBase_Helper
 IProductWRTDerivBase_Helper ()
 

Private Attributes

std::shared_ptr< MatrixFree::IProductWRTDerivBase > m_oper
 
- Private Attributes inherited from Nektar::Collections::MatrixFreeMultiInOneOut
unsigned short m_coordim
 coordinates dimension More...
 
Array< OneD, Array< OneD, NekDouble > > m_input
 padded input/output vectors More...
 
Array< OneD, NekDoublem_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 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

Inner product operator using operator using matrix free operators.

Definition at line 279 of file IProductWRTDerivBase.cpp.

Constructor & Destructor Documentation

◆ ~IProductWRTDerivBase_MatrixFree()

Nektar::Collections::IProductWRTDerivBase_MatrixFree::~IProductWRTDerivBase_MatrixFree ( )
finaldefault

◆ IProductWRTDerivBase_MatrixFree()

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

Definition at line 374 of file IProductWRTDerivBase.cpp.

377 : Operator(pCollExp, pGeomData, factors),
378 MatrixFreeMultiInOneOut(pCollExp[0]->GetCoordim(),
379 pCollExp[0]->GetStdExp()->GetTotPoints(),
380 pCollExp[0]->GetStdExp()->GetNcoeffs(),
381 pCollExp.size()),
383 {
384 // Check if deformed
385 const auto dim = pCollExp[0]->GetStdExp()->GetShapeDimension();
386
387 // Basis vector
388 std::vector<LibUtilities::BasisSharedPtr> basis(dim);
389 for (unsigned int i = 0; i < dim; ++i)
390 {
391 basis[i] = pCollExp[0]->GetBasis(i);
392 }
393
394 // Get shape type
395 auto shapeType = pCollExp[0]->GetStdExp()->DetShapeType();
396
397 // Generate operator string and create operator.
398 std::string op_string = "IProductWRTDerivBase";
399 op_string += MatrixFree::GetOpstring(shapeType, m_isDeformed);
401 op_string, basis, m_nElmtPad);
402
403 // Set Jacobian
404 oper->SetJac(pGeomData->GetJacInterLeave(pCollExp, m_nElmtPad));
405
406 // Set derivative factors
407 oper->SetDF(pGeomData->GetDerivFactorsInterLeave(pCollExp, m_nElmtPad));
408
409 m_oper =
410 std::dynamic_pointer_cast<MatrixFree::IProductWRTDerivBase>(oper);
411 ASSERTL0(m_oper, "Failed to cast pointer.");
412 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
std::shared_ptr< MatrixFree::IProductWRTDerivBase > m_oper
unsigned int m_nElmtPad
size after padding
MatrixFreeMultiInOneOut(const unsigned int coordim, const unsigned int nIn, const unsigned int nOut, const unsigned int nCollSize)
Constructor.
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition: Operator.cpp:66
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::Operator::m_isDeformed, Nektar::Collections::MatrixFreeBase::m_nElmtPad, and m_oper.

Member Function Documentation

◆ CheckFactors()

void Nektar::Collections::IProductWRTDerivBase_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 365 of file IProductWRTDerivBase.cpp.

367 {
368 ASSERTL0(false, "Not valid for this operator.");
369 }

References ASSERTL0.

◆ operator()() [1/2]

void Nektar::Collections::IProductWRTDerivBase_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 288 of file IProductWRTDerivBase.cpp.

293 {
294 Array<OneD, NekDouble> output;
295
296 if (m_isPadded)
297 {
298 // copy into padded vector
299 switch (m_coordim)
300 {
301 case 1:
302 output = entry1;
303 Vmath::Vcopy(m_nIn, entry0, 1, m_input[0], 1);
304 break;
305 case 2:
306 output = entry2;
307 Vmath::Vcopy(m_nIn, entry0, 1, m_input[0], 1);
308 Vmath::Vcopy(m_nIn, entry1, 1, m_input[1], 1);
309 break;
310 case 3:
311 output = entry3;
312 Vmath::Vcopy(m_nIn, entry0, 1, m_input[0], 1);
313 Vmath::Vcopy(m_nIn, entry1, 1, m_input[1], 1);
314 Vmath::Vcopy(m_nIn, entry2, 1, m_input[2], 1);
315 break;
316 default:
317 NEKERROR(ErrorUtil::efatal, "m_coordim value not valid");
318 break;
319 }
320
321 // call op
322 (*m_oper)(m_input, m_output);
323 // copy out of padded vector
324 Vmath::Vcopy(m_nOut, m_output, 1, output, 1);
325 }
326 else
327 {
328 Array<OneD, Array<OneD, NekDouble>> input{m_coordim};
329
330 // copy into padded vector
331 switch (m_coordim)
332 {
333 case 1:
334 output = entry1;
335 input[0] = entry0;
336 break;
337 case 2:
338 output = entry2;
339 input[0] = entry0;
340 input[1] = entry1;
341 break;
342 case 3:
343 output = entry3;
344 input[0] = entry0;
345 input[1] = entry1;
346 input[2] = entry2;
347 break;
348 default:
349 NEKERROR(ErrorUtil::efatal, "coordim not valid");
350 break;
351 }
352
353 (*m_oper)(input, output);
354 }
355 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
unsigned short m_coordim
coordinates dimension
Array< OneD, 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::MatrixFreeMultiInOneOut::m_coordim, Nektar::Collections::MatrixFreeMultiInOneOut::m_input, Nektar::Collections::MatrixFreeBase::m_isPadded, Nektar::Collections::MatrixFreeBase::m_nIn, Nektar::Collections::MatrixFreeBase::m_nOut, Nektar::Collections::MatrixFreeMultiInOneOut::m_output, NEKERROR, and Vmath::Vcopy().

◆ operator()() [2/2]

void Nektar::Collections::IProductWRTDerivBase_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 357 of file IProductWRTDerivBase.cpp.

361 {
362 NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
363 }

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

Member Data Documentation

◆ m_oper

std::shared_ptr<MatrixFree::IProductWRTDerivBase> Nektar::Collections::IProductWRTDerivBase_MatrixFree::m_oper
private

Definition at line 372 of file IProductWRTDerivBase.cpp.

Referenced by IProductWRTDerivBase_MatrixFree().