Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Operator.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Operator.h
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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Operator top class definition
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #include <loki/Singleton.h>
37 #include <Collections/Operator.h>
38 #include <Collections/Collection.h>
39 
40 namespace Nektar {
41 namespace Collections {
42 
43 /**
44  *
45  */
46 bool operator< (OperatorKey const &p1, OperatorKey const &p2)
47 {
48  if (boost::get<0>(p1) < boost::get<0>(p2))
49  {
50  return true;
51  }
52  if (boost::get<0>(p1) > boost::get<0>(p2))
53  {
54  return false;
55  }
56  if (boost::get<1>(p1) < boost::get<1>(p2))
57  {
58  return true;
59  }
60  if (boost::get<1>(p1) > boost::get<1>(p2))
61  {
62  return false;
63  }
64  if (boost::get<2>(p1) < boost::get<2>(p2))
65  {
66  return true;
67  }
68  if (boost::get<2>(p1) > boost::get<2>(p2))
69  {
70  return false;
71  }
72 
73  if (boost::get<3>(p1) < boost::get<3>(p2))
74  {
75  return true;
76  }
77  if (boost::get<3>(p1) > boost::get<3>(p2))
78  {
79  return false;
80  }
81 
82  return false;
83 }
84 
85 
86 /**
87  *
88  */
89 std::ostream &operator<<(std::ostream &os, OperatorKey const &p)
90 {
91  os << LibUtilities::ShapeTypeMap[boost::get<0>(p)] << ", "
92  << OperatorTypeMap [boost::get<1>(p)] << ", "
93  << ImplementationTypeMap [boost::get<2>(p)] << ", "
94  << (boost::get<3>(p) ? "Nodal" : "Modal");
95  return os;
96 }
97 
98 
99 /**
100  *
101  */
103 {
104 }
105 
106 
107 /**
108  *
109  */
111 {
112  typedef Loki::SingletonHolder<OperatorFactory,
113  Loki::CreateUsingNew,
114  Loki::NoDestroy,
115  Loki::SingleThreaded> Type;
116  return Type::Instance();
117 }
118 
119 
120 
121 // simple operator Map evaluation
123 {
124  OperatorImpMap opMap;
125 
126  for(int i = 0; i < SIZE_OperatorType; ++i)
127  {
128  opMap[(OperatorType)i] = defaultType;
129  }
130 
131  return opMap;
132 }
133 
134 }
135 }
const char *const ImplementationTypeMap[]
Definition: Operator.h:91
boost::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
Definition: Operator.h:159
bool operator<(OperatorKey const &p1, OperatorKey const &p2)
Less-than comparison operator for OperatorKey objects.
Definition: Operator.cpp:46
const char *const OperatorTypeMap[]
Definition: Operator.h:73
std::ostream & operator<<(std::ostream &os, OperatorKey const &p)
Stream output operator for OperatorKey objects.
Definition: Operator.cpp:89
std::map< OperatorType, ImplementationType > OperatorImpMap
Definition: Operator.h:102
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
Definition: Operator.cpp:110
Nektar::LibUtilities::NekFactory< OperatorKey, Operator, std::vector< StdRegions::StdExpansionSharedPtr >, CoalescedGeomDataSharedPtr > OperatorFactory
Operator factory definition.
Definition: Operator.h:172
virtual COLLECTIONS_EXPORT ~Operator()
Definition: Operator.cpp:102
OperatorImpMap SetFixedImpType(ImplementationType defaultType)
simple Operator Implementation Map generator
Definition: Operator.cpp:122
Provides a generic Factory class.
Definition: NekFactory.hpp:116