Nektar++
IndexMapKey.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File IndexMapKey.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 // 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: Definition of IndexMapKey
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #include <StdRegions/IndexMapKey.h>
38 
39 namespace Nektar
40 {
41  namespace StdRegions
42  {
44  const StdRegions::IndexMapType indexmapType,
45  const LibUtilities::ShapeType shapeType,
46  const unsigned short p,
47  const unsigned short q,
48  const unsigned short r,
49  const unsigned short entityID,
50  const StdRegions::Orientation orientation)
51  : m_indexMapType(indexmapType),
52  m_shapeType(shapeType),
53  m_p(p),
54  m_q(q),
55  m_r(r),
56  m_entityID(entityID),
57  m_orientation(orientation)
58  {
59  }
60 
62  const StdRegions::IndexMapType indexmapType):
63  m_indexMapType (indexmapType),
64  m_shapeType(rhs.m_shapeType),
65  m_p (rhs.m_p),
66  m_q (rhs.m_q),
67  m_r (rhs.m_r),
68  m_entityID (rhs.m_entityID),
69  m_orientation (rhs.m_orientation)
70  {
71  }
72 
74  m_indexMapType (rhs.m_indexMapType),
75  m_shapeType(rhs.m_shapeType),
76  m_p (rhs.m_p),
77  m_q (rhs.m_q),
78  m_r (rhs.m_r),
79  m_entityID (rhs.m_entityID),
80  m_orientation (rhs.m_orientation)
81  {
82  }
83 
85  const IndexMapKey &rhs) const
86  {
87  return (lhs.m_indexMapType < rhs.m_indexMapType);
88  }
89 
90  bool operator<(const IndexMapKey &lhs, const IndexMapKey &rhs)
91  {
92  if(lhs.m_indexMapType < rhs.m_indexMapType)
93  {
94  return true;
95  }
96 
97  if(lhs.m_indexMapType > rhs.m_indexMapType)
98  {
99  return false;
100  }
101 
102  if(lhs.m_shapeType < rhs.m_shapeType)
103  {
104  return true;
105  }
106  if(lhs.m_shapeType > rhs.m_shapeType)
107  {
108  return false;
109  }
110 
111  if(lhs.m_p < rhs.m_p)
112  {
113  return true;
114  }
115  if(lhs.m_p > rhs.m_p)
116  {
117  return false;
118  }
119 
120  if(lhs.m_q < rhs.m_q)
121  {
122  return true;
123  }
124  if(lhs.m_q > rhs.m_q)
125  {
126  return false;
127  }
128 
129  if(lhs.m_r < rhs.m_r)
130  {
131  return true;
132  }
133  if(lhs.m_r > rhs.m_r)
134  {
135  return false;
136  }
137 
138  if(lhs.m_entityID < rhs.m_entityID)
139  {
140  return true;
141  }
142  if(lhs.m_entityID > rhs.m_entityID)
143  {
144  return false;
145  }
146 
147  if(lhs.m_orientation < rhs.m_orientation)
148  {
149  return true;
150  }
151  if(lhs.m_orientation > rhs.m_orientation)
152  {
153  return false;
154  }
155 
156  return false;
157  }
158 
159  bool operator==(const IndexMapKey &lhs, const IndexMapKey &rhs)
160  {
161  if(lhs.m_indexMapType != rhs.m_indexMapType)
162  {
163  return false;
164  }
165 
166  if(lhs.m_shapeType != rhs.m_shapeType)
167  {
168  return false;
169  }
170 
171  if(lhs.m_p != rhs.m_p)
172  {
173  return false;
174  }
175 
176  if(lhs.m_q != rhs.m_q)
177  {
178  return false;
179  }
180 
181  if(lhs.m_r != rhs.m_r)
182  {
183  return false;
184  }
185 
186  if(lhs.m_entityID != rhs.m_entityID)
187  {
188  return false;
189  }
190 
191  if(lhs.m_orientation != rhs.m_orientation)
192  {
193  return false;
194  }
195 
196  return true;
197  }
198 
199  std::ostream& operator<<(std::ostream& os, const IndexMapKey& rhs)
200  {
201  os << "IndexMapType: " << IndexMapTypeMap[rhs.GetIndexMapType()]
202  << std::endl;
203  return os;
204  }
205  } // end StdRegion namespace
206 } // end Nektar namespace
friend bool operator==(const IndexMapKey &lhs, const IndexMapKey &rhs)
std::ostream & operator<<(std::ostream &os, const IndexMapKey &rhs)
const char *const IndexMapTypeMap[]
Definition: StdRegions.hpp:261
StandardMatrixTag & lhs
bool operator()(const IndexMapKey &lhs, const IndexMapKey &rhs) const
Definition: IndexMapKey.cpp:84
LibUtilities::ShapeType m_shapeType
Definition: IndexMapKey.h:107
friend bool operator<(const IndexMapKey &lhs, const IndexMapKey &rhs)
Definition: IndexMapKey.cpp:90
IndexMapType GetIndexMapType() const
Definition: IndexMapKey.h:88