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)
 
COLLECTIONS_EXPORT void CheckFactors (const OperatorType opType, StdRegions::FactorMap factors, int coll_phys_offset=0)
 
COLLECTIONS_EXPORT void Initialise (const OperatorType opType, StdRegions::FactorMap factors=StdRegions::NullFactorMap)
 
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)
 
OperatorSharedPtr GetOpSharedPtr (const OperatorType &op)
 
CoalescedGeomDataSharedPtr GetGeomSharedPtr ()
 

Protected Attributes

std::unordered_map< OperatorType, OperatorSharedPtr, EnumHashm_ops
 
CoalescedGeomDataSharedPtr m_geomData
 
std::vector< StdRegions::StdExpansionSharedPtrm_collExp
 
OperatorImpMap m_impTypes
 

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.

48  :
49  m_collExp(pCollExp),
50  m_impTypes(impTypes)
51 {
52  // Initialise geometry data.
54 }
std::vector< StdRegions::StdExpansionSharedPtr > m_collExp
Definition: Collection.h:110
CoalescedGeomDataSharedPtr m_geomData
Definition: Collection.h:108
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and m_geomData.

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 120 of file Collection.h.

124 {
125  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
126  (*m_ops[op])(inarray, output, NullNekDouble1DArray,
127  NullNekDouble1DArray, wsp);
128 }
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:107
static Array< OneD, NekDouble > NullNekDouble1DArray

References m_ops, and Nektar::NullNekDouble1DArray.

◆ 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 134 of file Collection.h.

139 {
140  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
141  (*m_ops[op])(inarray, output0, output1, NullNekDouble1DArray, wsp);
142 }

References m_ops, and Nektar::NullNekDouble1DArray.

◆ 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 148 of file Collection.h.

154 {
155  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
156  (*m_ops[op])(inarray, output0, output1, output2, wsp);
157 }

References m_ops.

◆ 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 162 of file Collection.h.

167 {
168  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
169  (*m_ops[op])(dir, inarray, output, wsp);
170 }

References m_ops.

◆ CheckFactors()

void Nektar::Collections::Collection::CheckFactors ( const OperatorType  opType,
StdRegions::FactorMap  factors,
int  coll_phys_offset = 0 
)

Definition at line 56 of file Collection.cpp.

59 {
60  m_ops[opType]->CheckFactors(factors, coll_phys_offset);
61 }

References m_ops.

◆ GetGeomSharedPtr()

CoalescedGeomDataSharedPtr Nektar::Collections::Collection::GetGeomSharedPtr ( )
inline

Definition at line 100 of file Collection.h.

101  {
102  return m_geomData;
103  }

References m_geomData.

◆ GetOpSharedPtr()

OperatorSharedPtr Nektar::Collections::Collection::GetOpSharedPtr ( const OperatorType op)
inline

Definition at line 95 of file Collection.h.

96  {
97  return m_ops[op];
98  }

References m_ops.

◆ HasOperator()

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

Definition at line 172 of file Collection.h.

173 {
174  return (m_ops.find(op) != m_ops.end());
175 }

References m_ops.

Referenced by Initialise().

◆ Initialise()

void Nektar::Collections::Collection::Initialise ( const OperatorType  opType,
StdRegions::FactorMap  factors = StdRegions::NullFactorMap 
)

Definition at line 64 of file Collection.cpp.

66 {
67  if(!HasOperator(opType))
68  {
69  auto it = m_impTypes.find(opType);
70 
71  if (it != m_impTypes.end())
72  {
73  ImplementationType impType = it->second;
74  OperatorKey opKey(m_collExp[0]->DetShapeType(), opType, impType,
75  m_collExp[0]->IsNodalNonTensorialExp());
76 
77  stringstream ss;
78  ss << opKey;
79  ASSERTL0(GetOperatorFactory().ModuleExists(opKey),
80  "Requested unknown operator "+ss.str());
81 
83  opKey, m_collExp, m_geomData, factors);
84  }
85  else
86  {
88  "Failed to determine implmentation to initialise "
89  "collection operator: " +
90  std::string(Collections::OperatorTypeMap[opType]));
91  }
92  }
93 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209
bool HasOperator(const OperatorType &op)
Definition: Collection.h:172
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:145
const char *const OperatorTypeMap[]
Definition: Operator.h:76
std::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
Definition: Operator.h:181
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
Definition: Operator.cpp:121

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::ErrorUtil::ewarning, Nektar::Collections::GetOperatorFactory(), HasOperator(), m_collExp, m_geomData, m_impTypes, m_ops, NEKERROR, and Nektar::Collections::OperatorTypeMap.

Referenced by Nektar::Collections::CollectionOptimisation::SetWithTimings().

Member Data Documentation

◆ m_collExp

std::vector<StdRegions::StdExpansionSharedPtr> Nektar::Collections::Collection::m_collExp
protected

Definition at line 110 of file Collection.h.

Referenced by Initialise().

◆ m_geomData

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

Definition at line 108 of file Collection.h.

Referenced by Collection(), GetGeomSharedPtr(), and Initialise().

◆ m_impTypes

OperatorImpMap Nektar::Collections::Collection::m_impTypes
protected

Definition at line 111 of file Collection.h.

Referenced by Initialise().

◆ m_ops

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

Definition at line 107 of file Collection.h.

Referenced by ApplyOperator(), CheckFactors(), GetOpSharedPtr(), HasOperator(), and Initialise().