Nektar++
Operator.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Operator.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: Operator top class definition
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #include <Collections/Collection.h>
36 #include <Collections/Operator.h>
37 
38 namespace Nektar
39 {
40 namespace Collections
41 {
42 
43 Operator::Operator(std::vector<StdRegions::StdExpansionSharedPtr> pCollExp,
44  std::shared_ptr<CoalescedGeomData> GeomData,
45  StdRegions::FactorMap factors)
46  : m_isDeformed(GeomData->IsDeformed(pCollExp)),
47  m_stdExp(pCollExp[0]->GetStdExp()), m_numElmt(pCollExp.size()),
48  m_nqe(pCollExp[0]->GetTotPoints()), m_wspSize(0)
49 {
50  boost::ignore_unused(factors);
51 }
52 
53 /**
54  *
55  */
56 bool operator<(OperatorKey const &p1, OperatorKey const &p2)
57 {
58  if (std::get<0>(p1) < std::get<0>(p2))
59  {
60  return true;
61  }
62  if (std::get<0>(p1) > std::get<0>(p2))
63  {
64  return false;
65  }
66  if (std::get<1>(p1) < std::get<1>(p2))
67  {
68  return true;
69  }
70  if (std::get<1>(p1) > std::get<1>(p2))
71  {
72  return false;
73  }
74  if (std::get<2>(p1) < std::get<2>(p2))
75  {
76  return true;
77  }
78  if (std::get<2>(p1) > std::get<2>(p2))
79  {
80  return false;
81  }
82 
83  if (std::get<3>(p1) < std::get<3>(p2))
84  {
85  return true;
86  }
87  if (std::get<3>(p1) > std::get<3>(p2))
88  {
89  return false;
90  }
91 
92  return false;
93 }
94 
95 /**
96  *
97  */
98 std::ostream &operator<<(std::ostream &os, OperatorKey const &p)
99 {
100  os << LibUtilities::ShapeTypeMap[std::get<0>(p)] << ", "
101  << OperatorTypeMap[std::get<1>(p)] << ", "
102  << ImplementationTypeMap[std::get<2>(p)] << ", "
103  << (std::get<3>(p) ? "Nodal" : "Modal");
104  return os;
105 }
106 
107 /**
108  *
109  */
111 {
112 }
113 
114 /**
115  *
116  */
118 {
119  static OperatorFactory instance;
120  return instance;
121 }
122 
123 // simple operator Map evaluation
125 {
126  OperatorImpMap opMap;
127 
128  for (int i = 0; i < SIZE_OperatorType; ++i)
129  {
130  opMap[(OperatorType)i] = defaultType;
131  }
132 
133  return opMap;
134 }
135 
136 } // namespace Collections
137 } // namespace Nektar
virtual COLLECTIONS_EXPORT ~Operator()
Definition: Operator.cpp:110
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition: Operator.cpp:43
Provides a generic Factory class.
Definition: NekFactory.hpp:105
bool operator<(OperatorKey const &p1, OperatorKey const &p2)
Less-than comparison operator for OperatorKey objects.
Definition: Operator.cpp:56
std::map< OperatorType, ImplementationType > OperatorImpMap
Definition: Operator.h:112
const char *const ImplementationTypeMap[]
Definition: Operator.h:94
std::ostream & operator<<(std::ostream &os, OperatorKey const &p)
Stream output operator for OperatorKey objects.
Definition: Operator.cpp:98
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
OperatorImpMap SetFixedImpType(ImplementationType defaultType)
simple Operator Implementation Map generator
Definition: Operator.cpp:124
ConstFactorMap FactorMap
Definition: StdRegions.hpp:403
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2