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
 
- 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

 IProductWRTDerivBase_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 Member Functions inherited from Nektar::Collections::IProductWRTDerivBase_Helper
 IProductWRTDerivBase_Helper ()
 

Private Attributes

std::shared_ptr< MatrixFree::IProductWRTDerivBase > m_oper
 
int m_coordim
 
- 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 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

Inner product operator using operator using matrix free operators.

Definition at line 273 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 329 of file IProductWRTDerivBase.cpp.

332 : Operator(pCollExp, pGeomData, factors),
333 MatrixFreeBase(pCollExp[0]->GetStdExp()->GetTotPoints(),
334 pCollExp[0]->GetStdExp()->GetNcoeffs(),
335 pCollExp.size()),
337 {
338 const auto dim = pCollExp[0]->GetStdExp()->GetShapeDimension();
339 m_coordim = pCollExp[0]->GetCoordim();
340
341 // Basis vector
342 std::vector<LibUtilities::BasisSharedPtr> basis(dim);
343 for (unsigned int i = 0; i < dim; ++i)
344 {
345 basis[i] = pCollExp[0]->GetBasis(i);
346 }
347
348 // Get shape type
349 auto shapeType = pCollExp[0]->GetStdExp()->DetShapeType();
350
351 // Generate operator string and create operator.
352 std::string op_string = "IProductWRTDerivBase";
353 op_string += MatrixFree::GetOpstring(shapeType, m_isDeformed);
355 op_string, basis, pCollExp.size());
356
357 // set up required copies for operations
358 oper->SetUpBdata(basis);
359 oper->SetUpDBdata(basis);
360 oper->SetUpZW(basis);
361
362 // Set Jacobian
363 oper->SetJac(pGeomData->GetJacInterLeave(pCollExp, m_nElmtPad));
364
365 // Set derivative factors
366 oper->SetDF(pGeomData->GetDerivFactorsInterLeave(pCollExp, m_nElmtPad));
367
368 m_oper =
369 std::dynamic_pointer_cast<MatrixFree::IProductWRTDerivBase>(oper);
370 ASSERTL0(m_oper, "Failed to cast pointer.");
371 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
std::shared_ptr< MatrixFree::IProductWRTDerivBase > m_oper
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
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::Operator::m_isDeformed, Nektar::Collections::MatrixFreeBase::m_nElmtPad, and m_oper.

Member Function Documentation

◆ 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 282 of file IProductWRTDerivBase.cpp.

287 {
288 Array<OneD, NekDouble> output;
289 Array<OneD, Array<OneD, NekDouble>> input(m_coordim);
290
291 // copy into padded vector
292 switch (m_coordim)
293 {
294 case 1:
295 input[0] = entry0;
296 output = entry1;
297 break;
298 case 2:
299 input[0] = entry0;
300 input[1] = entry1;
301 output = entry2;
302 break;
303 case 3:
304 input[0] = entry0;
305 input[1] = entry1;
306 input[2] = entry2;
307 output = entry3;
308 break;
309 default:
310 NEKERROR(ErrorUtil::efatal, "coordim not valid");
311 break;
312 }
313
314 (*m_oper)(input, output);
315 }
#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::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 317 of file IProductWRTDerivBase.cpp.

321 {
322 NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
323 }

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

Member Data Documentation

◆ m_coordim

int Nektar::Collections::IProductWRTDerivBase_MatrixFree::m_coordim
private

Definition at line 327 of file IProductWRTDerivBase.cpp.

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

◆ m_oper

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

Definition at line 326 of file IProductWRTDerivBase.cpp.

Referenced by IProductWRTDerivBase_MatrixFree().