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 {
42 namespace Collections
43 {
44 
45 /**
46  *
47  */
48 Collection::Collection(vector<StdRegions::StdExpansionSharedPtr> pCollExp,
49  OperatorImpMap &impTypes)
50  : m_collExp(pCollExp), 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 
64  StdRegions::FactorMap factors)
65 {
66  if (!HasOperator(opType))
67  {
68  auto it = m_impTypes.find(opType);
69 
70  if (it != m_impTypes.end())
71  {
72  ImplementationType impType = it->second;
73  OperatorKey opKey(m_collExp[0]->DetShapeType(), opType, impType,
74  m_collExp[0]->IsNodalNonTensorialExp());
75 
76  stringstream ss;
77  ss << opKey;
78  ASSERTL0(GetOperatorFactory().ModuleExists(opKey),
79  "Requested unknown operator " + ss.str());
80 
82  opKey, m_collExp, m_geomData, factors);
83  }
84  else
85  {
86  WARNINGL2(false,
87  "Failed to determine implmentation to initialise "
88  "collection operator: " +
89  std::string(Collections::OperatorTypeMap[opType]));
90  }
91  }
92 }
93 } // namespace Collections
94 } // namespace Nektar
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
#define WARNINGL2(condition, msg)
Definition: ErrorUtil.hpp:273
bool HasOperator(const OperatorType &op)
Definition: Collection.h:159
std::vector< StdRegions::StdExpansionSharedPtr > m_collExp
Definition: Collection.h:106
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:102
COLLECTIONS_EXPORT void Initialise(const OperatorType opType, StdRegions::FactorMap factors=StdRegions::NullFactorMap)
Definition: Collection.cpp:63
CoalescedGeomDataSharedPtr m_geomData
Definition: Collection.h:103
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:144
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:112
const char *const OperatorTypeMap[]
Definition: Operator.h:76
std::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
Definition: Operator.h:177
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
Definition: Operator.cpp:117
ConstFactorMap FactorMap
Definition: StdRegions.hpp:403
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2