pointPairs.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::pointPairs
28 
29 Description
30  HashSet of unique edges. The edges are stored as a pair of pairs:
31 
32  ( (local index, processor index) (local index, processor index) )
33 
34  e.g.,
35 
36  ( (0 1) (3 1) )
37  ( (0 2) (5 1) )
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef pointPairs_H
42 #define pointPairs_H
43 
44 #include "labelPairHashes.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class pointPairs Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class Triangulation>
56 class pointPairs
57 :
58  public HashSet<labelPairPair, labelPairPair::Hash<>>
59 {
60  // Private typedefs
61 
63  typedef typename Triangulation::Vertex_handle Vertex_handle;
64 
65 
66  // Private data
67 
68  const Triangulation& triangulation_;
69 
70 
71  // Private Member Functions
72 
73  inline labelPairPair orderPointPair
74  (
75  const labelPair& vA,
76  const labelPair& vB
77  ) const;
78 
79  inline bool insertPointPair
80  (
81  const labelPair& vA,
82  const labelPair& vB
83  );
84 
85  inline bool findPointPair
86  (
87  const labelPair& vA,
88  const labelPair& vB
89  ) const;
90 
91 
92 public:
93 
94  // Constructors
95 
96  //- Construct from triangulation
97  pointPairs(const Triangulation& triangulation);
98 
99 
100  //- Destructor
101  ~pointPairs();
102 
103 
104  // Member Functions
105 
106  // Access
107 
108  inline bool isPointPair
109  (
110  const Vertex_handle& vA,
111  const Vertex_handle& vB
112  ) const;
113 
114  inline bool isPointPair
115  (
116  const labelPair& vA,
117  const labelPair& vB
118  ) const;
119 
120 
121  // Edit
122 
123  inline bool addPointPair
124  (
125  const labelPair& vA,
126  const labelPair& vB
127  );
128 
129  inline bool addPointPair
130  (
131  const labelPair& master,
132  const DynamicList<labelPair>& slaves
133  );
134 
135  inline bool addPointPair
136  (
137  const label vA,
138  const label vB
139  );
140 
141  void reIndex(const Map<label>& oldToNewIndices);
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #ifdef NoRepository
152  #include "pointPairs.C"
153 #endif
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
Foam::pointPairs::addPointPair
bool addPointPair(const labelPair &vA, const labelPair &vB)
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:55
pointPairs.C
Foam::Map< label >
Foam::HashSet
A HashTable with keys but without contents that is similar to std::unordered_set.
Definition: HashSet.H:83
labelPairHashes.H
A HashTable to objects of type <T> with a labelPair key. The hashing is based on labelPair (FixedList...
Foam::pointPairs
HashSet of unique edges. The edges are stored as a pair of pairs:
Definition: pointPairs.H:55
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Pair
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:54
Foam::pointPairs::~pointPairs
~pointPairs()
Destructor.
Foam::pointPairs::reIndex
void reIndex(const Map< label > &oldToNewIndices)
Foam::pointPairs::isPointPair
bool isPointPair(const Vertex_handle &vA, const Vertex_handle &vB) const
Foam::pointPairs::pointPairs
pointPairs(const Triangulation &triangulation)
Construct from triangulation.