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 UpdateFactors (const OperatorType opType, StdRegions::FactorMap factors)
 Update the factor map in operator. More...
 
COLLECTIONS_EXPORT void UpdateVarcoeffs (const OperatorType opType, StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
 
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, bool defaultIn=true)
 
int GetOutputSize (const OperatorType &op, bool defaultOut=true)
 
int GetNumElmt (const OperatorType &op)
 Return the number of elements in collection attached to. More...
 

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:124
CoalescedGeomDataSharedPtr m_geomData
Definition: Collection.h:121
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 146 of file Collection.h.

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

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

161{
162 Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
163 (*m_ops[op])(inarray, output0, output1, output2, wsp);
164}

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

172{
173 Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
174 (*m_ops[op])(dir, inarray, output, wsp);
175}

References m_ops.

◆ GetGeomSharedPtr()

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

Definition at line 98 of file Collection.h.

99 {
100 return m_geomData;
101 }

References m_geomData.

◆ GetInputSize()

int Nektar::Collections::Collection::GetInputSize ( const OperatorType op,
bool  defaultIn = true 
)
inline

Definition at line 103 of file Collection.h.

104 {
105 return m_ops[op]->GetInputSize(defaultIn);
106 }

References m_ops.

◆ GetNumElmt()

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

Return the number of elements in collection attached to.

Parameters
op

Definition at line 114 of file Collection.h.

115 {
116 return m_ops[op]->GetNumElmt();
117 }

References m_ops.

◆ GetOpSharedPtr()

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

Definition at line 93 of file Collection.h.

94 {
95 return m_ops[op];
96 }

References m_ops.

◆ GetOutputSize()

int Nektar::Collections::Collection::GetOutputSize ( const OperatorType op,
bool  defaultOut = true 
)
inline

◆ HasOperator()

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

Definition at line 177 of file Collection.h.

178{
179 return (m_ops.find(op) != m_ops.end());
180}

References m_ops.

Referenced by Initialise().

◆ Initialise()

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

Definition at line 66 of file Collection.cpp.

68{
69 if (!HasOperator(opType))
70 {
71 auto it = m_impTypes.find(opType);
72
73 if (it != m_impTypes.end())
74 {
75 ImplementationType impType = it->second;
76 OperatorKey opKey(m_collExp[0]->DetShapeType(), opType, impType,
77 m_collExp[0]->IsNodalNonTensorialExp());
78
79 stringstream ss;
80 ss << opKey;
81 ASSERTL0(GetOperatorFactory().ModuleExists(opKey),
82 "Requested unknown operator " + ss.str());
83
86 }
87 else
88 {
89 WARNINGL2(false,
90 "Failed to determine implmentation to initialise "
91 "collection operator: " +
92 std::string(Collections::OperatorTypeMap[opType]));
93 }
94 }
95}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
#define WARNINGL2(condition, msg)
Definition: ErrorUtil.hpp:266
bool HasOperator(const OperatorType &op)
Definition: Collection.h:177
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
const char *const OperatorTypeMap[]
Definition: Operator.h:74
std::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
Definition: Operator.h:120
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::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().

◆ UpdateFactors()

void Nektar::Collections::Collection::UpdateFactors ( const OperatorType  opType,
StdRegions::FactorMap  factors 
)

Update the factor map in operator.

Parameters
opTypeby input
factors

Definition at line 54 of file Collection.cpp.

56{
57 m_ops[opType]->UpdateFactors(factors);
58}

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

◆ UpdateVarcoeffs()

void Nektar::Collections::Collection::UpdateVarcoeffs ( const OperatorType  opType,
StdRegions::VarCoeffMap varcoeffs = StdRegions::NullVarCoeffMap 
)

Definition at line 60 of file Collection.cpp.

62{
63 m_ops[opType]->UpdateVarcoeffs(varcoeffs);
64}

References m_ops.

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

Member Data Documentation

◆ m_collExp

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

Definition at line 124 of file Collection.h.

Referenced by Initialise().

◆ m_geomData

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

Definition at line 121 of file Collection.h.

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

◆ m_impTypes

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

Definition at line 125 of file Collection.h.

Referenced by Initialise().

◆ m_ops

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