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