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