indexedCell.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2019 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  CGAL::indexedCell
26 
27 Description
28  An indexed form of CGAL::Triangulation_cell_base_3<K> used to keep
29  track of the Delaunay cells (tets) in the tessellation.
30 
31 SourceFiles
32  indexedCellI.H
33  indexedCell.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef indexedCell_H
38 #define indexedCell_H
39 
40 #include "CGAL/Triangulation_3.h"
41 #include "CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h"
42 #include "indexedVertex.H"
43 #include "List.H"
44 #include "globalIndex.H"
45 #include "Pstream.H"
46 #include "Swap.H"
47 #include "InfoProxy.H"
48 #include "tetCell.H"
49 #include "typeInfo.H"
50 #include "vectorTools.H"
51 #include "indexedCellEnum.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace CGAL
56 {
57 template<class Gt, class Cb> class indexedCell;
58 }
59 
60 namespace Foam
61 {
62 class Ostream;
63 template<class Gt, class Cb> Ostream& operator<<
64 (
65  Ostream&,
67 );
68 }
69 
70 
71 namespace CGAL
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class indexedCell Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 template
79 <
80  class Gt,
81  class Cb=CGAL::Delaunay_triangulation_cell_base_with_circumcenter_3<Gt>
82 >
83 class indexedCell
84 :
85  public Foam::indexedCellEnum,
86  public Cb
87 {
88  // Private Data
89 
90  //- The index for this Delaunay tetrahedral cell. Type information is
91  //- Also carried:
92 
93  // ctFar : the dual point of this cell does not form part of the
94  // internal or boundary of the dual mesh
95  // >=0 : the (local) index of an internal or boundary dual point,
96  // not on a processor face
97  // < 0 && > ctFar : the (global) index of a dual point on a processor
98  // face
99 
100  Foam::label index_;
101 
102  //- The number of times that this Delaunay cell has been limited
103  // during filtering
104  int filterCount_;
105 
106 
107  // Private Member Functions
108 
109  //- Same as globallyOrderedCellVertices but without sorting
110  Foam::tetCell unsortedVertexGlobalIndices
111  (
112  const Foam::globalIndex& globalDelaunayVertexIndices
113  ) const;
114 
115 
116 public:
118  typedef typename Cb::Triangulation_data_structure Tds;
120  typedef typename Cb::Cell_handle Cell_handle;
121 
122  template<class TDS2>
123  struct Rebind_TDS
124  {
125  typedef typename Cb::template Rebind_TDS<TDS2>::Other Cb2;
126  typedef indexedCell<Gt, Cb2> Other;
127  };
128 
129 
130  // Constructors
131 
132  inline indexedCell();
133 
134  inline indexedCell
135  (
136  Vertex_handle v0,
137  Vertex_handle v1,
138  Vertex_handle v2,
139  Vertex_handle v3
140  );
141 
142  inline indexedCell
143  (
144  Vertex_handle v0,
145  Vertex_handle v1,
146  Vertex_handle v2,
147  Vertex_handle v3,
148  Cell_handle n0,
149  Cell_handle n1,
150  Cell_handle n2,
151  Cell_handle n3
152  );
153 
154 
155  // Member Functions
156 
157  inline Foam::label& cellIndex();
158 
159  inline Foam::label cellIndex() const;
160 
161 #ifdef CGAL_INEXACT
162  inline const Foam::point& dual();
163 #else
164  inline const Foam::point dual();
165 #endif
166 
167  inline bool unassigned() const;
168 
169  inline int& filterCount();
170 
171  inline int filterCount() const;
172 
173  //- Is the Delaunay cell real, i.e. any real vertex
174  inline bool real() const;
175 
176  //- Does the Delaunay cell have a far point
177  inline bool hasFarPoint() const;
178 
179  //- Does the Delaunay cell have a referred point
180  inline bool hasReferredPoint() const;
181 
182  //- Does the Delaunay cell have a feature point
183  inline bool hasFeaturePoint() const;
184 
185  //- Does the Delaunay cell have a seed point
186  inline bool hasSeedPoint() const;
187 
188  inline bool hasInternalPoint() const;
189  inline bool hasBoundaryPoint() const;
190 
191  inline bool hasConstrainedPoint() const;
192 
193  //- Does the Dual vertex form part of a processor patch
194  inline bool parallelDualVertex() const;
195 
196  inline Foam::label vertexLowestProc() const;
197 
198  //- Using the globalIndex object, return a list of four (sorted) global
199  // Delaunay vertex indices that uniquely identify this tet in parallel
200  inline Foam::tetCell vertexGlobalIndices
201  (
202  const Foam::globalIndex& globalDelaunayVertexIndices
203  ) const;
204 
205  //- Using the globalIndex object, return a list of four vertices with
206  // so that the cell has a consistent orientation in parallel.
207  inline Foam::FixedList<Foam::label, 4> globallyOrderedCellVertices
208  (
209  const Foam::globalIndex& globalDelaunayVertexIndices
210  ) const;
211 
212  //- Is the Delaunay cell part of the final dual mesh, i.e. any vertex
213  // form part of the internal or boundary definition
214  inline bool internalOrBoundaryDualVertex() const;
215 
216  //- Is the Delaunay cell real or referred (or mixed), i.e. all vertices
217  // form part of the real or referred internal or boundary definition
218  inline bool anyInternalOrBoundaryDualVertex() const;
219 
220  //- A dual vertex on the boundary will result from a Delaunay cell with
221  // least one Delaunay vertex outside and at least one inside
222  inline bool boundaryDualVertex() const;
223 
224  inline bool baffleSurfaceDualVertex() const;
225 
226  inline bool baffleEdgeDualVertex() const;
227 
228  //- A dual vertex on a feature edge will result from this Delaunay cell
229  inline bool featureEdgeDualVertex() const;
230 
231  //- A dual vertex on a feature point will result from this Delaunay cell
232  inline bool featurePointDualVertex() const;
233 
234  inline bool nearProcBoundary() const;
235 
236  inline bool potentialCoplanarCell() const;
237 
238  inline bool featurePointExternalCell() const;
239  inline bool featurePointInternalCell() const;
240 
241 
242  // Info
243 
244  //- Return info proxy.
245  // Used to print indexedCell information to a stream
247  {
248  return *this;
249  }
250 
251  friend Foam::Ostream& Foam::operator<< <Gt, Cb>
252  (
253  Foam::Ostream&,
255  );
256 
257 };
258 
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
262 } // End namespace CGAL
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #include "indexedCellI.H"
267 
268 #ifdef NoRepository
269  #include "indexedCell.C"
270 #endif
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 #endif
275 
276 // ************************************************************************* //
Cb::template Rebind_TDS< TDS2 >::Other Cb2
Definition: indexedCell.H:124
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
A 1D vector of objects of type <T> with a fixed size <Size>.
Definition: FixedList.H:54
Cb::Cell_handle Cell_handle
Definition: indexedCell.H:119
An indexed form of CGAL::Triangulation_cell_base_3<K> used to keep track of the Delaunay cells (tets)...
Definition: indexedCell.H:56
CGAL::Triangulation_data_structure_3< Vb, Cb > Tds
Cb::Vertex_handle Vertex_handle
Definition: indexedCell.H:118
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:63
A tetrahedral cell primitive.
Definition: tetCell.H:58
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:45
Swap its arguments.
Namespace for OpenFOAM.