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

Constructor & Destructor Documentation

◆ Collection()

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

Definition at line 48 of file Collection.cpp.

50  : m_collExp(pCollExp), m_impTypes(impTypes)
51 {
52  // Initialise geometry data.
54 }
std::vector< StdRegions::StdExpansionSharedPtr > m_collExp
Definition: Collection.h:106
CoalescedGeomDataSharedPtr m_geomData
Definition: Collection.h:103
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 116 of file Collection.h.

119 {
120  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
121  (*m_ops[op])(inarray, output, NullNekDouble1DArray, NullNekDouble1DArray,
122  wsp);
123 }
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:102
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 128 of file Collection.h.

131 {
132  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
133  (*m_ops[op])(inarray, output0, output1, NullNekDouble1DArray, wsp);
134 }

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

143 {
144  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
145  (*m_ops[op])(inarray, output0, output1, output2, wsp);
146 }

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

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

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

97  {
98  return m_geomData;
99  }

References m_geomData.

◆ GetOpSharedPtr()

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

Definition at line 91 of file Collection.h.

92  {
93  return m_ops[op];
94  }

References m_ops.

◆ HasOperator()

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

Definition at line 159 of file Collection.h.

160 {
161  return (m_ops.find(op) != m_ops.end());
162 }

References m_ops.

Referenced by Initialise().

◆ Initialise()

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

Definition at line 63 of file Collection.cpp.

65 {
66  if (!HasOperator(opType))
67  {
68  auto it = m_impTypes.find(opType);
69 
70  if (it != m_impTypes.end())
71  {
72  ImplementationType impType = it->second;
73  OperatorKey opKey(m_collExp[0]->DetShapeType(), opType, impType,
74  m_collExp[0]->IsNodalNonTensorialExp());
75 
76  stringstream ss;
77  ss << opKey;
78  ASSERTL0(GetOperatorFactory().ModuleExists(opKey),
79  "Requested unknown operator " + ss.str());
80 
82  opKey, m_collExp, m_geomData, factors);
83  }
84  else
85  {
86  WARNINGL2(false,
87  "Failed to determine implmentation to initialise "
88  "collection operator: " +
89  std::string(Collections::OperatorTypeMap[opType]));
90  }
91  }
92 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
#define WARNINGL2(condition, msg)
Definition: ErrorUtil.hpp:273
bool HasOperator(const OperatorType &op)
Definition: Collection.h:159
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:144
const char *const OperatorTypeMap[]
Definition: Operator.h:76
std::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
Definition: Operator.h:177
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
Definition: Operator.cpp:117

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

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

Member Data Documentation

◆ m_collExp

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

Definition at line 106 of file Collection.h.

Referenced by Initialise().

◆ m_geomData

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

Definition at line 103 of file Collection.h.

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

◆ m_impTypes

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

Definition at line 107 of file Collection.h.

Referenced by Initialise().

◆ m_ops

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

Definition at line 102 of file Collection.h.

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