Nektar++
IndexMapKey.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File IndexMapKey.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: Headers for Index Maps
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef INDEXMAPKEY_H
36 #define INDEXMAPKEY_H
37 
40 #include <ostream>
41 #include <memory>
42 
43 namespace Nektar
44 {
45  namespace StdRegions
46  {
47  struct IndexValue
48  {
49  unsigned short index;
50  short sign;
51  };
52 
54 
56  {
57  public:
59  const StdRegions::IndexMapType indexmapType,
60  const LibUtilities::ShapeType shapeType,
61  const unsigned short p,
62  const unsigned short q,
63  const unsigned short r,
64  const unsigned short entityID = 0,
65  const StdRegions::Orientation orientation = eNoOrientation);
66 
67  STD_REGIONS_EXPORT IndexMapKey(const IndexMapKey& rhs,const StdRegions::IndexMapType indexmapType);
68 
69  STD_REGIONS_EXPORT IndexMapKey(const IndexMapKey& rhs);
70 
71  virtual ~IndexMapKey()
72  {
73  }
74 
75  // Used to lookup the create function in NekManager.
76  struct opLess
77  {
78  STD_REGIONS_EXPORT bool operator()(const IndexMapKey &lhs, const IndexMapKey &rhs) const;
79  };
80 
81  // Used for finding value given the key in NekManager.
82  STD_REGIONS_EXPORT friend bool operator<(const IndexMapKey &lhs, const IndexMapKey &rhs);
83  STD_REGIONS_EXPORT friend bool operator==(const IndexMapKey &lhs, const IndexMapKey &rhs);
84  STD_REGIONS_EXPORT friend bool opLess::operator()(const IndexMapKey &lhs, const IndexMapKey &rhs) const;
85 
87  {
88  return m_indexMapType;
89  }
90 
92  {
93  return m_orientation;
94  }
95 
96  int GetIndexEntity() const
97  {
98  return m_entityID;
99  }
100 
101  protected:
102 
104 
106 
107  unsigned short m_p;
108  unsigned short m_q;
109  unsigned short m_r;
110 
111  unsigned short m_entityID;
112 
114 
115  private:
116 
117  IndexMapKey();
118  };
119  //=======================================================================================
120 
121  STD_REGIONS_EXPORT std::ostream& operator<<(std::ostream& os, const IndexMapKey& rhs);
122 
123  typedef std::shared_ptr<IndexMapKey> IndexMapKeySharedPtr;
124  typedef std::shared_ptr<IndexMapValues> IndexMapValuesSharedPtr;
125  } // end of namespace
126 } // end of namespace
127 
128 #endif
Array< OneD, IndexValue > IndexMapValues
Definition: IndexMapKey.h:53
bool operator<(const IndexMapKey &lhs, const IndexMapKey &rhs)
Definition: IndexMapKey.cpp:89
std::shared_ptr< IndexMapKey > IndexMapKeySharedPtr
Definition: IndexMapKey.h:123
std::ostream & operator<<(std::ostream &os, const IndexMapKey &rhs)
Orientation GetIndexOrientation() const
Definition: IndexMapKey.h:91
StandardMatrixTag & lhs
LibUtilities::ShapeType m_shapeType
Definition: IndexMapKey.h:105
IndexMapType GetIndexMapType() const
Definition: IndexMapKey.h:86
bool operator==(const IndexMapKey &lhs, const IndexMapKey &rhs)
#define STD_REGIONS_EXPORT
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs
std::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:124