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 ()
 
int GetInputSize (const OperatorType &op)
 
int GetOutputSize (const OperatorType &op)
 

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 : m_collExp(pCollExp), m_impTypes(impTypes)
49{
50 // Initialise geometry data.
52}
std::vector< StdRegions::StdExpansionSharedPtr > m_collExp
Definition: Collection.h:114
CoalescedGeomDataSharedPtr m_geomData
Definition: Collection.h:111
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

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

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

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

162{
163 Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
164 (*m_ops[op])(dir, inarray, output, wsp);
165}

References m_ops.

◆ CheckFactors()

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

Definition at line 54 of file Collection.cpp.

57{
58 m_ops[opType]->CheckFactors(factors, coll_phys_offset);
59}
StdRegions::ConstFactorMap factors

References Nektar::VarcoeffHashingTest::factors, and m_ops.

◆ GetGeomSharedPtr()

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

Definition at line 94 of file Collection.h.

95 {
96 return m_geomData;
97 }

References m_geomData.

◆ GetInputSize()

int Nektar::Collections::Collection::GetInputSize ( const OperatorType op)
inline

Definition at line 99 of file Collection.h.

100 {
101 return m_ops[op]->GetInputSize();
102 }

References m_ops.

◆ GetOpSharedPtr()

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

Definition at line 89 of file Collection.h.

90 {
91 return m_ops[op];
92 }

References m_ops.

◆ GetOutputSize()

int Nektar::Collections::Collection::GetOutputSize ( const OperatorType op)
inline

Definition at line 104 of file Collection.h.

105 {
106 return m_ops[op]->GetOutputSize();
107 }

References m_ops.

◆ HasOperator()

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

Definition at line 167 of file Collection.h.

168{
169 return (m_ops.find(op) != m_ops.end());
170}

References m_ops.

Referenced by Initialise().

◆ Initialise()

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

Definition at line 61 of file Collection.cpp.

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

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

Referenced by Nektar::HexCollectionTests::BOOST_AUTO_TEST_CASE(), Nektar::PrismCollectionTests::BOOST_AUTO_TEST_CASE(), Nektar::PyrCollectionTests::BOOST_AUTO_TEST_CASE(), Nektar::QuadCollectionTests::BOOST_AUTO_TEST_CASE(), Nektar::SegCollectionTests::BOOST_AUTO_TEST_CASE(), Nektar::TetCollectionTests::BOOST_AUTO_TEST_CASE(), Nektar::TriCollectionTests::BOOST_AUTO_TEST_CASE(), and Nektar::Collections::CollectionOptimisation::SetWithTimings().

Member Data Documentation

◆ m_collExp

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

Definition at line 114 of file Collection.h.

Referenced by Initialise().

◆ m_geomData

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

Definition at line 111 of file Collection.h.

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

◆ m_impTypes

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

Definition at line 115 of file Collection.h.

Referenced by Initialise().

◆ m_ops

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