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