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 int coll_phys_offset)
57{
58 m_ops[opType]->CheckFactors(factors, coll_phys_offset);
59}
60
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}
91} // 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:167
std::vector< StdRegions::StdExpansionSharedPtr > m_collExp
Definition: Collection.h:114
COLLECTIONS_EXPORT void CheckFactors(const OperatorType opType, StdRegions::FactorMap factors, int coll_phys_offset=0)
Definition: Collection.cpp:54
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:110
COLLECTIONS_EXPORT void Initialise(const OperatorType opType, StdRegions::FactorMap factors=StdRegions::NullFactorMap)
Definition: Collection.cpp:61
CoalescedGeomDataSharedPtr m_geomData
Definition: Collection.h:111
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:143
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:126
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
ConstFactorMap FactorMap
Definition: StdRegions.hpp:406
StdRegions::ConstFactorMap factors