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 
35 #include <Collections/Collection.h>
36 #include <sstream>
37 
38 using namespace std;
39 
40 namespace Nektar {
41 namespace Collections {
42 
43 /**
44  *
45  */
46 Collection::Collection(
47  vector<StdRegions::StdExpansionSharedPtr> pCollExp,
48  OperatorImpMap &impTypes):
49  m_collExp(pCollExp),
50  m_impTypes(impTypes)
51 {
52  // Initialise geometry data.
54 }
55 
57  StdRegions::FactorMap factors,
58  int coll_phys_offset)
59 {
60  m_ops[opType]->CheckFactors(factors, coll_phys_offset);
61 }
62 
63 
65  StdRegions::FactorMap factors)
66 {
67  if(!HasOperator(opType))
68  {
69  auto it = m_impTypes.find(opType);
70 
71  if (it != m_impTypes.end())
72  {
73  ImplementationType impType = it->second;
74  OperatorKey opKey(m_collExp[0]->DetShapeType(), opType, impType,
75  m_collExp[0]->IsNodalNonTensorialExp());
76 
77  stringstream ss;
78  ss << opKey;
79  ASSERTL0(GetOperatorFactory().ModuleExists(opKey),
80  "Requested unknown operator "+ss.str());
81 
83  opKey, m_collExp, m_geomData, factors);
84  }
85  else
86  {
88  "Failed to determine implmentation to initialise "
89  "collection operator: " +
90  std::string(Collections::OperatorTypeMap[opType]));
91  }
92  }
93 }
94 }
95 }
96 
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209
bool HasOperator(const OperatorType &op)
Definition: Collection.h:172
std::vector< StdRegions::StdExpansionSharedPtr > m_collExp
Definition: Collection.h:110
COLLECTIONS_EXPORT void CheckFactors(const OperatorType opType, StdRegions::FactorMap factors, int coll_phys_offset=0)
Definition: Collection.cpp:56
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:107
COLLECTIONS_EXPORT void Initialise(const OperatorType opType, StdRegions::FactorMap factors=StdRegions::NullFactorMap)
Definition: Collection.cpp:64
CoalescedGeomDataSharedPtr m_geomData
Definition: Collection.h:108
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:145
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:108
const char *const OperatorTypeMap[]
Definition: Operator.h:76
std::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
Definition: Operator.h:181
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
Definition: Operator.cpp:121
ConstFactorMap FactorMap
Definition: StdRegions.hpp:318
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1