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