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