Nektar++
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 // 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/Operator.h>
36 #include <Collections/Collection.h>
37 
38 namespace Nektar {
39 namespace Collections {
40 
41 /**
42  *
43  */
44 bool operator< (OperatorKey const &p1, OperatorKey const &p2)
45 {
46  if (std::get<0>(p1) < std::get<0>(p2))
47  {
48  return true;
49  }
50  if (std::get<0>(p1) > std::get<0>(p2))
51  {
52  return false;
53  }
54  if (std::get<1>(p1) < std::get<1>(p2))
55  {
56  return true;
57  }
58  if (std::get<1>(p1) > std::get<1>(p2))
59  {
60  return false;
61  }
62  if (std::get<2>(p1) < std::get<2>(p2))
63  {
64  return true;
65  }
66  if (std::get<2>(p1) > std::get<2>(p2))
67  {
68  return false;
69  }
70 
71  if (std::get<3>(p1) < std::get<3>(p2))
72  {
73  return true;
74  }
75  if (std::get<3>(p1) > std::get<3>(p2))
76  {
77  return false;
78  }
79 
80  return false;
81 }
82 
83 
84 /**
85  *
86  */
87 std::ostream &operator<<(std::ostream &os, OperatorKey const &p)
88 {
89  os << LibUtilities::ShapeTypeMap[std::get<0>(p)] << ", "
90  << OperatorTypeMap [std::get<1>(p)] << ", "
91  << ImplementationTypeMap [std::get<2>(p)] << ", "
92  << (std::get<3>(p) ? "Nodal" : "Modal");
93  return os;
94 }
95 
96 
97 /**
98  *
99  */
101 {
102 }
103 
104 
105 /**
106  *
107  */
109 {
110  static OperatorFactory instance;
111  return instance;
112 }
113 
114 
115 
116 // simple operator Map evaluation
118 {
119  OperatorImpMap opMap;
120 
121  for(int i = 0; i < SIZE_OperatorType; ++i)
122  {
123  opMap[(OperatorType)i] = defaultType;
124  }
125 
126  return opMap;
127 }
128 
129 }
130 }
const char *const ImplementationTypeMap[]
Definition: Operator.h:92
std::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
Definition: Operator.h:161
bool operator<(OperatorKey const &p1, OperatorKey const &p2)
Less-than comparison operator for OperatorKey objects.
Definition: Operator.cpp:44
const char *const OperatorTypeMap[]
Definition: Operator.h:74
std::ostream & operator<<(std::ostream &os, OperatorKey const &p)
Stream output operator for OperatorKey objects.
Definition: Operator.cpp:87
std::map< OperatorType, ImplementationType > OperatorImpMap
Definition: Operator.h:103
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
Definition: Operator.cpp:108
virtual COLLECTIONS_EXPORT ~Operator()
Definition: Operator.cpp:100
OperatorImpMap SetFixedImpType(ImplementationType defaultType)
simple Operator Implementation Map generator
Definition: Operator.cpp:117
Provides a generic Factory class.
Definition: NekFactory.hpp:103