Nektar++
Public Member Functions | Protected Attributes | List of all members
Nektar::Collections::Collection Class Reference

Collection. More...

#include <Collection.h>

Public Member Functions

COLLECTIONS_EXPORT Collection (std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, OperatorImpMap &impTypes)
 
void ApplyOperator (const OperatorType &op, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &output)
 
void ApplyOperator (const OperatorType &op, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &output0, Array< OneD, NekDouble > &output1)
 
void ApplyOperator (const OperatorType &op, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &output0, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2)
 
void ApplyOperator (const OperatorType &op, int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &output)
 
bool HasOperator (const OperatorType &op)
 

Protected Attributes

StdRegions::StdExpansionSharedPtr m_stdExp
 
std::vector< SpatialDomains::GeometrySharedPtrm_geom
 
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHashm_ops
 
CoalescedGeomDataSharedPtr m_geomData
 

Detailed Description

Collection.

Definition at line 53 of file Collection.h.

Constructor & Destructor Documentation

◆ Collection()

Nektar::Collections::Collection::Collection ( std::vector< StdRegions::StdExpansionSharedPtr pCollExp,
OperatorImpMap impTypes 
)

Definition at line 46 of file Collection.cpp.

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::Collections::GetOperatorFactory(), and Nektar::Collections::SIZE_OperatorType.

49 {
50  // Initialise geometry data.
52 
53  // Loop over all operator types.
54  for (int i = 0; i < SIZE_OperatorType; ++i)
55  {
56  OperatorType opType = (OperatorType)i;
57  ImplementationType impType;
58 
59  auto it = impTypes.find(opType);
60  if (it != impTypes.end())
61  {
62  impType = it->second;
63  OperatorKey opKey(pCollExp[0]->DetShapeType(), opType, impType,
64  pCollExp[0]->IsNodalNonTensorialExp());
65 
66  stringstream ss;
67  ss << opKey;
68  ASSERTL0(GetOperatorFactory().ModuleExists(opKey),
69  "Requested unknown operator "+ss.str());
70 
72  opKey, pCollExp, m_geomData);
73  }
74  }
75 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
CoalescedGeomDataSharedPtr m_geomData
Definition: Collection.h:91
std::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
Definition: Operator.h:161
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:90
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:144
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
Definition: Operator.cpp:108

Member Function Documentation

◆ ApplyOperator() [1/4]

void Nektar::Collections::Collection::ApplyOperator ( const OperatorType op,
const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  output 
)
inline

Definition at line 102 of file Collection.h.

References m_ops, and Nektar::NullNekDouble1DArray.

106 {
107  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
108  (*m_ops[op])(inarray, output, NullNekDouble1DArray,
109  NullNekDouble1DArray, wsp);
110 }
static Array< OneD, NekDouble > NullNekDouble1DArray
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:90

◆ ApplyOperator() [2/4]

void Nektar::Collections::Collection::ApplyOperator ( const OperatorType op,
const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  output0,
Array< OneD, NekDouble > &  output1 
)
inline

Definition at line 116 of file Collection.h.

References m_ops, and Nektar::NullNekDouble1DArray.

121 {
122  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
123  (*m_ops[op])(inarray, output0, output1, NullNekDouble1DArray, wsp);
124 }
static Array< OneD, NekDouble > NullNekDouble1DArray
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:90

◆ ApplyOperator() [3/4]

void Nektar::Collections::Collection::ApplyOperator ( const OperatorType op,
const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  output0,
Array< OneD, NekDouble > &  output1,
Array< OneD, NekDouble > &  output2 
)
inline

Definition at line 130 of file Collection.h.

References m_ops.

136 {
137  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
138  (*m_ops[op])(inarray, output0, output1, output2, wsp);
139 }
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:90

◆ ApplyOperator() [4/4]

void Nektar::Collections::Collection::ApplyOperator ( const OperatorType op,
int  dir,
const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  output 
)
inline

Definition at line 144 of file Collection.h.

References m_ops.

149 {
150  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
151  (*m_ops[op])(dir, inarray, output, wsp);
152 }
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:90

◆ HasOperator()

bool Nektar::Collections::Collection::HasOperator ( const OperatorType op)
inline

Definition at line 154 of file Collection.h.

References m_ops.

155 {
156  return (m_ops.find(op) != m_ops.end());
157 }
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:90

Member Data Documentation

◆ m_geom

std::vector<SpatialDomains::GeometrySharedPtr> Nektar::Collections::Collection::m_geom
protected

Definition at line 89 of file Collection.h.

◆ m_geomData

CoalescedGeomDataSharedPtr Nektar::Collections::Collection::m_geomData
protected

Definition at line 91 of file Collection.h.

◆ m_ops

std::unordered_map<OperatorType, OperatorSharedPtr, EnumHash> Nektar::Collections::Collection::m_ops
protected

Definition at line 90 of file Collection.h.

Referenced by ApplyOperator(), and HasOperator().

◆ m_stdExp

StdRegions::StdExpansionSharedPtr Nektar::Collections::Collection::m_stdExp
protected

Definition at line 88 of file Collection.h.