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

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

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

Public Member Functions

 ~IProductWRTBase_MatrixFree () final=default
 
void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, 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

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

Private Attributes

std::shared_ptr< MatrixFree::IProduct > m_oper
 
- Private Attributes inherited from Nektar::Collections::MatrixFreeOneInOneOut
Array< OneD, NekDoublem_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 Member Functions inherited from Nektar::Collections::IProductWRTBase_Helper
 IProductWRTBase_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

Inner product operator using operator using matrix free operators.

Definition at line 183 of file IProductWRTBase.cpp.

Constructor & Destructor Documentation

◆ ~IProductWRTBase_MatrixFree()

Nektar::Collections::IProductWRTBase_MatrixFree::~IProductWRTBase_MatrixFree ( )
finaldefault

◆ IProductWRTBase_MatrixFree()

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

Definition at line 230 of file IProductWRTBase.cpp.

233 : Operator(pCollExp, pGeomData, factors), IProductWRTBase_Helper(),
234 MatrixFreeOneInOneOut(pCollExp[0]->GetStdExp()->GetTotPoints(),
235 pCollExp[0]->GetStdExp()->GetNcoeffs(),
236 pCollExp.size())
237 {
238 // Basis vector
239 const auto dim = pCollExp[0]->GetStdExp()->GetShapeDimension();
240 std::vector<LibUtilities::BasisSharedPtr> basis(dim);
241 for (unsigned int i = 0; i < dim; ++i)
242 {
243 basis[i] = pCollExp[0]->GetBasis(i);
244 }
245
246 // Get shape type
247 auto shapeType = pCollExp[0]->GetStdExp()->DetShapeType();
248
249 // Generate operator string and create operator.
250 std::string op_string = "IProduct";
251 op_string += MatrixFree::GetOpstring(shapeType, m_isDeformed);
253 op_string, basis, m_nElmtPad);
254
255 // Set Jacobian
256 oper->SetJac(pGeomData->GetJacInterLeave(pCollExp, m_nElmtPad));
257
258 m_oper = std::dynamic_pointer_cast<MatrixFree::IProduct>(oper);
259 ASSERTL0(m_oper, "Failed to cast pointer.");
260 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
std::shared_ptr< MatrixFree::IProduct > m_oper
unsigned int m_nElmtPad
size after padding
MatrixFreeOneInOneOut(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::IProductWRTBase_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 221 of file IProductWRTBase.cpp.

223 {
224 ASSERTL0(false, "Not valid for this operator.");
225 }

References ASSERTL0.

◆ operator()() [1/2]

void Nektar::Collections::IProductWRTBase_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 192 of file IProductWRTBase.cpp.

197 {
198 if (m_isPadded)
199 {
200 // copy into padded vector
201 Vmath::Vcopy(m_nIn, input, 1, m_input, 1);
202 // call op
203 (*m_oper)(m_input, m_output);
204 // copy out of padded vector
205 Vmath::Vcopy(m_nOut, m_output, 1, output, 1);
206 }
207 else
208 {
209 (*m_oper)(input, output);
210 }
211 }
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::Collections::MatrixFreeOneInOneOut::m_input, Nektar::Collections::MatrixFreeBase::m_isPadded, Nektar::Collections::MatrixFreeBase::m_nIn, Nektar::Collections::MatrixFreeBase::m_nOut, Nektar::Collections::MatrixFreeOneInOneOut::m_output, and Vmath::Vcopy().

◆ operator()() [2/2]

void Nektar::Collections::IProductWRTBase_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 213 of file IProductWRTBase.cpp.

217 {
218 NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
219 }
#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, and NEKERROR.

Member Data Documentation

◆ m_oper

std::shared_ptr<MatrixFree::IProduct> Nektar::Collections::IProductWRTBase_MatrixFree::m_oper
private

Definition at line 228 of file IProductWRTBase.cpp.

Referenced by IProductWRTBase_MatrixFree().