Nektar++
Collection.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: Collection.cpp
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Collection top class definition
32//
33///////////////////////////////////////////////////////////////////////////////
34
36#include <sstream>
37
38using namespace std;
39
40namespace Nektar::Collections
41{
42
43/**
44 *
45 */
46Collection::Collection(vector<StdRegions::StdExpansionSharedPtr> pCollExp,
47 OperatorImpMap &impTypes)
48 : m_collExp(pCollExp), m_impTypes(impTypes)
49{
50 // Initialise geometry data.
52}
53
56{
57 m_ops[opType]->UpdateFactors(factors);
58}
59
61 StdRegions::VarCoeffMap &varcoeffs)
62{
63 m_ops[opType]->UpdateVarcoeffs(varcoeffs);
64}
65
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}
96} // namespace Nektar::Collections
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
#define WARNINGL2(condition, msg)
Definition: ErrorUtil.hpp:266
COLLECTIONS_EXPORT Collection(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, OperatorImpMap &impTypes)
Definition: Collection.cpp:46
bool HasOperator(const OperatorType &op)
Definition: Collection.h:177
std::vector< StdRegions::StdExpansionSharedPtr > m_collExp
Definition: Collection.h:124
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:120
COLLECTIONS_EXPORT void UpdateVarcoeffs(const OperatorType opType, StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
Definition: Collection.cpp:60
COLLECTIONS_EXPORT void Initialise(const OperatorType opType, StdRegions::FactorMap factors=StdRegions::NullFactorMap)
Definition: Collection.cpp:66
CoalescedGeomDataSharedPtr m_geomData
Definition: Collection.h:121
COLLECTIONS_EXPORT void UpdateFactors(const OperatorType opType, StdRegions::FactorMap factors)
Update the factor map in operator.
Definition: Collection.cpp:54
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::map< OperatorType, ImplementationType > OperatorImpMap
Definition: Operator.h:131
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
ConstFactorMap FactorMap
Definition: StdRegions.hpp:434
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
Definition: StdRegions.hpp:375
StdRegions::ConstFactorMap factors
STL namespace.