Commit 3c5afd98 authored by graham's avatar graham
Browse files

ENH: CGAL 3.7 upgrade.

Removing depricated triangulation hierarchy, using Fast_location.

Renamed typedef HTriangulation->Delaunay.

Any use of point in conformalVoronoiMesh must now be fully scoped as Foam::point
- there is a function called point() in the new version of Triangulation_3.h.
parent 82103f4c
......@@ -31,9 +31,6 @@ Description
otherwise the more robust but much less efficient
Exact_predicates_exact_constructions will be used.
Define CGAL_HIERARCHY to use hierarchical Delaunay triangulation which is
faster but uses more memory than the standard Delaunay triangulation.
\*---------------------------------------------------------------------------*/
#ifndef CGALTriangulation3Ddefs_H
......@@ -60,20 +57,12 @@ Description
typedef CGAL::indexedVertex<K> Vb;
typedef CGAL::indexedCell<K> Cb;
#ifdef CGAL_HIERARCHY
// Data structures for hierarchical Delaunay triangulation which is more
// efficient but also uses more storage
#include "CGAL/Triangulation_hierarchy_3.h"
typedef CGAL::Triangulation_hierarchy_vertex_base_3<Vb> Vbh;
typedef CGAL::Triangulation_data_structure_3<Vbh, Cb> Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Triangulation;
typedef CGAL::Triangulation_hierarchy_3<Triangulation> HTriangulation;
#else
// Data structures for standard Delaunay triangulation
typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Triangulation;
typedef Triangulation HTriangulation;
#endif
typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;
typedef CGAL::Delaunay_triangulation_3 <K, Tds, CGAL::Fast_location> Delaunay;
typedef Delaunay::Vertex_handle Vertex_handle;
typedef Delaunay::Cell_handle Cell_handle;
typedef Delaunay::Point Point;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -32,7 +32,7 @@ License
Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment
(
const point& pt
const Foam::point& pt
) const
{
pointIndexHit surfHit;
......@@ -126,7 +126,7 @@ Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment
//external spoke
point mirrorPt = pt + 2*d;
Foam::point mirrorPt = pt + 2*d;
geometryToConformTo_.findSurfaceNearestIntersection
(
......@@ -220,7 +220,7 @@ void Foam::conformalVoronoiMesh::insertSurfacePointPairs
const vector& normal = norm[0];
const point& surfacePt(surfaceHits[i].hitPoint());
const Foam::point& surfacePt(surfaceHits[i].hitPoint());
insertPointPair
(
......@@ -232,7 +232,7 @@ void Foam::conformalVoronoiMesh::insertSurfacePointPairs
if(cvMeshControls().objOutput() && fName != fileName::null)
{
List<point> surfacePts(surfaceHits.size());
List<Foam::point> surfacePts(surfaceHits.size());
forAll(surfacePts, i)
{
......@@ -272,7 +272,7 @@ void Foam::conformalVoronoiMesh::insertEdgePointGroups
if(cvMeshControls().objOutput() && fName != fileName::null)
{
List<point> edgePts(edgeHits.size());
List<Foam::point> edgePts(edgeHits.size());
forAll(edgePts, i)
{
......@@ -335,7 +335,7 @@ void Foam::conformalVoronoiMesh::insertExternalEdgePointGroup
const pointIndexHit& edHit
)
{
const point& edgePt = edHit.hitPoint();
const Foam::point& edgePt = edHit.hitPoint();
scalar ppDist = pointPairDistance(edgePt);
......@@ -347,7 +347,7 @@ void Foam::conformalVoronoiMesh::insertExternalEdgePointGroup
const vector& nB = feNormals[edNormalIs[1]];
// Convex. So refPt will be inside domain and hence a master point
point refPt = edgePt - ppDist*(nA + nB)/(1 + (nA & nB) + VSMALL);
Foam::point refPt = edgePt - ppDist*(nA + nB)/(1 + (nA & nB) + VSMALL);
// Insert the master point referring the the first slave
label masterPtIndex = insertPoint(refPt, number_of_vertices() + 1);
......@@ -355,10 +355,10 @@ void Foam::conformalVoronoiMesh::insertExternalEdgePointGroup
// Insert the slave points by reflecting refPt in both faces.
// with each slave refering to the master
point reflectedA = refPt + 2*ppDist*nA;
Foam::point reflectedA = refPt + 2*ppDist*nA;
insertPoint(reflectedA, masterPtIndex);
point reflectedB = refPt + 2*ppDist*nB;
Foam::point reflectedB = refPt + 2*ppDist*nB;
insertPoint(reflectedB, masterPtIndex);
}
......@@ -369,7 +369,7 @@ void Foam::conformalVoronoiMesh::insertInternalEdgePointGroup
const pointIndexHit& edHit
)
{
const point& edgePt = edHit.hitPoint();
const Foam::point& edgePt = edHit.hitPoint();
scalar ppDist = pointPairDistance(edgePt);
......@@ -381,15 +381,15 @@ void Foam::conformalVoronoiMesh::insertInternalEdgePointGroup
const vector& nB = feNormals[edNormalIs[1]];
// Concave. master and reflected points inside the domain.
point refPt = edgePt - ppDist*(nA + nB)/(1 + (nA & nB) + VSMALL);
Foam::point refPt = edgePt - ppDist*(nA + nB)/(1 + (nA & nB) + VSMALL);
// Generate reflected master to be outside.
point reflMasterPt = refPt + 2*(edgePt - refPt);
Foam::point reflMasterPt = refPt + 2*(edgePt - refPt);
// Reflect reflMasterPt in both faces.
point reflectedA = reflMasterPt - 2*ppDist*nA;
Foam::point reflectedA = reflMasterPt - 2*ppDist*nA;
point reflectedB = reflMasterPt - 2*ppDist*nB;
Foam::point reflectedB = reflMasterPt - 2*ppDist*nB;
scalar totalAngle =
radToDeg(constant::mathematical::pi + acos(mag(nA & nB)));
......@@ -418,10 +418,10 @@ void Foam::conformalVoronoiMesh::insertInternalEdgePointGroup
}
else if (nAddPoints == 2)
{
point reflectedAa = refPt + ppDist*nB;
Foam::point reflectedAa = refPt + ppDist*nB;
insertPoint(reflectedAa, reflectedMaster);
point reflectedBb = refPt + ppDist*nA;
Foam::point reflectedBb = refPt + ppDist*nA;
insertPoint(reflectedBb, reflectedMaster);
}
......@@ -436,7 +436,7 @@ void Foam::conformalVoronoiMesh::insertFlatEdgePointGroup
const pointIndexHit& edHit
)
{
const point& edgePt = edHit.hitPoint();
const Foam::point& edgePt = edHit.hitPoint();
scalar ppDist = pointPairDistance(edgePt);
......@@ -518,7 +518,7 @@ void Foam::conformalVoronoiMesh::createFeaturePoints()
for
(
Triangulation::Finite_vertices_iterator vit = finite_vertices_begin();
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
vit++
)
......@@ -558,12 +558,13 @@ void Foam::conformalVoronoiMesh::insertConvexFeaturePoints()
{
vectorField featPtNormals = feMesh.featurePointNormals(ptI);
const point& featPt = feMesh.points()[ptI];
const Foam::point& featPt = feMesh.points()[ptI];
vector cornerNormal = sum(featPtNormals);
cornerNormal /= mag(cornerNormal);
point internalPt = featPt - pointPairDistance(featPt)*cornerNormal;
Foam::point internalPt =
featPt - pointPairDistance(featPt)*cornerNormal;
label internalPtIndex =
insertPoint(internalPt, number_of_vertices() + 1);
......@@ -574,7 +575,7 @@ void Foam::conformalVoronoiMesh::insertConvexFeaturePoints()
plane planeN = plane(featPt, n);
point externalPt =
Foam::point externalPt =
internalPt + 2.0 * planeN.distance(internalPt) * n;
insertPoint(externalPt, internalPtIndex);
......@@ -601,12 +602,13 @@ void Foam::conformalVoronoiMesh::insertConcaveFeaturePoints()
{
vectorField featPtNormals = feMesh.featurePointNormals(ptI);
const point& featPt = feMesh.points()[ptI];
const Foam::point& featPt = feMesh.points()[ptI];
vector cornerNormal = sum(featPtNormals);
cornerNormal /= mag(cornerNormal);
point externalPt = featPt + pointPairDistance(featPt)*cornerNormal;
Foam::point externalPt =
featPt + pointPairDistance(featPt)*cornerNormal;
label externalPtIndex = number_of_vertices() + featPtNormals.size();
......@@ -618,7 +620,7 @@ void Foam::conformalVoronoiMesh::insertConcaveFeaturePoints()
plane planeN = plane(featPt, n);
point internalPt =
Foam::point internalPt =
externalPt - 2.0 * planeN.distance(externalPt) * n;
internalPtIndex = insertPoint(internalPt, externalPtIndex);
......@@ -686,7 +688,7 @@ void Foam::conformalVoronoiMesh::insertMixedFeaturePoints()
continue;
}
const point& pt(feMesh.points()[ptI]);
const Foam::point& pt(feMesh.points()[ptI]);
scalar edgeGroupDistance = mixedFeaturePointDistance(pt);
......@@ -694,7 +696,7 @@ void Foam::conformalVoronoiMesh::insertMixedFeaturePoints()
{
label edgeI = pEds[e];
point edgePt =
Foam::point edgePt =
pt + edgeGroupDistance*feMesh.edgeDirection(edgeI, ptI);
pointIndexHit edgeHit(true, edgePt, edgeI);
......@@ -709,7 +711,7 @@ void Foam::conformalVoronoiMesh::insertMixedFeaturePoints()
void Foam::conformalVoronoiMesh::constructFeaturePointLocations()
{
DynamicList<point> ftPtLocs;
DynamicList<Foam::point> ftPtLocs;
const PtrList<featureEdgeMesh>& feMeshes(geometryToConformTo_.features());
......@@ -753,8 +755,8 @@ Foam::conformalVoronoiMesh::featurePointTree() const
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen_, 1E-4)
);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
featurePointTreePtr_.reset
(
......@@ -773,7 +775,7 @@ Foam::conformalVoronoiMesh::featurePointTree() const
}
bool Foam::conformalVoronoiMesh::nearFeaturePt(const point& pt) const
bool Foam::conformalVoronoiMesh::nearFeaturePt(const Foam::point& pt) const
{
const indexedOctree<treeDataPoint>& tree = featurePointTree();
......@@ -883,14 +885,14 @@ void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()
for
(
Triangulation::Finite_vertices_iterator vit = finite_vertices_begin();
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
vit++
)
{
if (vit->internalOrBoundaryPoint())
{
point pt(topoint(vit->point()));
Foam::point pt(topoint(vit->point()));
pointIndexHit info = tree.findNearest(pt, spanSqr);
......@@ -904,7 +906,7 @@ void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()
// for
// (
// Triangulation::Finite_vertices_iterator vit =
// Delaunay::Finite_vertices_iterator vit =
// finite_vertices_begin();
// vit != finite_vertices_end();
// vit++
......@@ -924,7 +926,7 @@ void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()
Foam::face Foam::conformalVoronoiMesh::buildDualFace
(
const Triangulation::Finite_edges_iterator& eit
const Delaunay::Finite_edges_iterator& eit
) const
{
Cell_circulator ccStart = incident_cells(*eit);
......@@ -1000,7 +1002,7 @@ Foam::face Foam::conformalVoronoiMesh::buildDualFace
Foam::label Foam::conformalVoronoiMesh::maxFilterCount
(
const Triangulation::Finite_edges_iterator& eit
const Delaunay::Finite_edges_iterator& eit
) const
{
Cell_circulator ccStart = incident_cells(*eit);
......@@ -1128,7 +1130,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
const dictionary& cvMeshDict
)
:
HTriangulation(),
Delaunay(),
runTime_(runTime),
rndGen_(7864293),
allGeometry_
......@@ -1233,7 +1235,7 @@ void Foam::conformalVoronoiMesh::move()
// Find the dual point of each tetrahedron and assign it an index.
for
(
Triangulation::Finite_cells_iterator cit = finite_cells_begin();
Delaunay::Finite_cells_iterator cit = finite_cells_begin();
cit != finite_cells_end();
++cit
)
......@@ -1286,7 +1288,7 @@ void Foam::conformalVoronoiMesh::move()
for
(
Triangulation::Finite_edges_iterator eit = finite_edges_begin();
Delaunay::Finite_edges_iterator eit = finite_edges_begin();
eit != finite_edges_end();
++eit
)
......@@ -1303,8 +1305,8 @@ void Foam::conformalVoronoiMesh::move()
Vertex_handle vA = c->vertex(eit->second);
Vertex_handle vB = c->vertex(eit->third);
point dVA = topoint(vA->point());
point dVB = topoint(vB->point());
Foam::point dVA = topoint(vA->point());
Foam::point dVB = topoint(vB->point());
Field<vector> alignmentDirsA =
vA->alignment() & cartesianDirections;
......@@ -1505,7 +1507,7 @@ void Foam::conformalVoronoiMesh::move()
// Limit displacements that pierce, or get too close to the surface
for
(
Triangulation::Finite_vertices_iterator vit = finite_vertices_begin();
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
++vit
)
......@@ -1528,7 +1530,7 @@ void Foam::conformalVoronoiMesh::move()
for
(
Triangulation::Finite_vertices_iterator vit = finite_vertices_begin();
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
++vit
)
......
......@@ -37,7 +37,6 @@ SourceFiles
#define conformalVoronoiMesh_H
//#define CGAL_INEXACT
#define CGAL_HIERARCHY
#include "CGALTriangulation3Ddefs.H"
#include "uint.H"
......@@ -64,6 +63,7 @@ SourceFiles
#include "labelPair.H"
#include "HashSet.H"
#include "memInfo.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -84,7 +84,7 @@ class faceAreaWeightModel;
class conformalVoronoiMesh
:
public HTriangulation
public Delaunay
{
public:
......@@ -178,7 +178,7 @@ private:
// to be on a surface.
inline scalar targetCellSize
(
const point& pt,
const Foam::point& pt,
bool isSurfacePoint = false
) const;
......@@ -204,34 +204,40 @@ private:
// a dual edge
inline scalar averageAnyCellSize
(
const Triangulation::Finite_facets_iterator& fit
const Delaunay::Finite_facets_iterator& fit
) const;
//- Return the local point pair separation at the given location
inline scalar pointPairDistance(const point& pt) const;
inline scalar pointPairDistance(const Foam::point& pt) const;
//- Return the local mixed feature point placement distance
inline scalar mixedFeaturePointDistance(const point& pt) const;
inline scalar mixedFeaturePointDistance(const Foam::point& pt) const;
//- Return the square of the local feature point exclusion distance
inline scalar featurePointExclusionDistanceSqr(const point& pt) const;
inline scalar featurePointExclusionDistanceSqr
(
const Foam::point& pt
) const;
//- Return the square of the local feature edge exclusion distance
inline scalar featureEdgeExclusionDistanceSqr(const point& pt) const;
inline scalar featureEdgeExclusionDistanceSqr
(
const Foam::point& pt
) const;
//- Return the square of the local surface search distance
inline scalar surfaceSearchDistanceSqr(const point& pt) const;
inline scalar surfaceSearchDistanceSqr(const Foam::point& pt) const;
//- Return the local maximum surface protrusion distance
inline scalar maxSurfaceProtrusion(const point& pt) const;
inline scalar maxSurfaceProtrusion(const Foam::point& pt) const;
//- Return the required alignment directions at the given location
tensor requiredAlignment(const point& pt) const;
tensor requiredAlignment(const Foam::point& pt) const;
//- Insert point and return its index
inline label insertPoint
(
const point& pt,
const Foam::point& pt,
const label type
);
......@@ -244,7 +250,7 @@ private:
inline void insertPointPair
(
const scalar ppDist,
const point& surfPt,
const Foam::point& surfPt,
const vector& n
);
......@@ -343,7 +349,7 @@ private:
const indexedOctree<treeDataPoint>& featurePointTree() const;
//- Check if a location is in exclusion range around a feature point
bool nearFeaturePt(const point& pt) const;
bool nearFeaturePt(const Foam::point& pt) const;
//- Insert the initial points into the triangulation, based on the
// initialPointsMethod
......@@ -365,7 +371,7 @@ private:
//- Builds a dual face by circulating around the supplied edge.
face buildDualFace
(
const Triangulation::Finite_edges_iterator& eit
const Delaunay::Finite_edges_iterator& eit
) const;
//- Finds the maximum filterCount of the dual vertices
......@@ -373,7 +379,7 @@ private:
// supplied edge
label maxFilterCount
(
const Triangulation::Finite_edges_iterator& eit
const Delaunay::Finite_edges_iterator& eit
) const;
//- Determines the owner and neighbour labels for dual cells
......@@ -406,14 +412,14 @@ private:
// intersects the boundary and hence reqires a point-pair
bool dualCellSurfaceAnyIntersection
(
const Triangulation::Finite_vertices_iterator& vit
const Delaunay::Finite_vertices_iterator& vit
) const;
//- Find the "worst" protrusion of a dual cell through the surface,
// subject to the tolerance
void dualCellLargestSurfaceProtrusion
(
const Triangulation::Finite_vertices_iterator& vit,
const Delaunay::Finite_vertices_iterator& vit,
pointIndexHit& surfHit,
label& hitSurface
) const;
......@@ -422,7 +428,7 @@ private:
// surface to be meshed or come too close to it
void limitDisplacement
(
const Triangulation::Finite_vertices_iterator& vit,
const Delaunay::Finite_vertices_iterator& vit,
vector& displacement,
label callCount = 0
) const;
......@@ -431,8 +437,8 @@ private:
//- edge conformation location
bool nearFeatureEdgeLocation
(
const point& pt,
DynamicList<point>& newEdgeLocations,
const Foam::point& pt,
DynamicList<Foam::point>& newEdgeLocations,
pointField& existingEdgeLocations,
autoPtr<indexedOctree<treeDataPoint> >& edgeLocationTree
) const;
......@@ -451,8 +457,8 @@ private:
// and edge conformation locations to add
void addSurfaceAndEdgeHits
(
const Triangulation::Finite_vertices_iterator& vit,
const point& vert,
const Delaunay::Finite_vertices_iterator& vit,
const Foam::point& vert,
const pointIndexHit& surfHit,
label hitSurface,
scalar surfacePtReplaceDistCoeffSqr,
......@@ -461,7 +467,7 @@ private:
DynamicList<label>& hitSurfaces,
DynamicList<pointIndexHit>& featureEdgeHits,
DynamicList<label>& featureEdgeFeaturesHit,
DynamicList<point>& newEdgeLocations,
DynamicList<Foam::point>& newEdgeLocations,
pointField& existingEdgeLocations,
autoPtr<indexedOctree<treeDataPoint> >& edgeLocationTree
) const;
......@@ -504,14 +510,14 @@ private:
// edge is a boundary face
inline bool isBoundaryDualFace
(
const Triangulation::Finite_edges_iterator& eit
const Delaunay::Finite_edges_iterator& eit
) const;
//- Determines if the dual vertex constructed by the Delaunay
// cell is a boundary vertex
inline bool isBoundaryDualVertex
(
const Triangulation::Finite_cells_iterator& cit
const Delaunay::Finite_cells_iterator& cit
) const;
//- Merge vertices that are very close together
......@@ -691,19 +697,19 @@ public:
//- Conversion functions between point (OpenFOAM) and Point (CGAL)
# ifdef CGAL_INEXACT
typedef const point& pointFromPoint;
typedef const Foam::point& pointFromPoint;
typedef const Point& PointFrompoint;
# else
typedef point pointFromPoint;
typedef Foam::point pointFromPoint;
typedef Point PointFrompoint;
# endif
inline pointFromPoint topoint(const Point&) const;
inline PointFrompoint toPoint(const point&) const;
inline PointFrompoint toPoint(const Foam::point&) const;
typedef K::Vector_3 CGALVector;
inline CGALVector toCGALVector(const point& pt) const;
inline CGALVector toCGALVector(const Foam::point& pt) const;
// Access
......@@ -739,7 +745,7 @@ public:
void writePoints
(
const fileName& fName,
const List<point>& points
const List<Foam::point>& points
) const;
//- Write the internal Delaunay vertices of the tessellation as a
......
......@@ -59,7 +59,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh
for
(
Triangulation::Finite_vertices_iterator vit = finite_vertices_begin();
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
++vit
)
......@@ -81,7 +81,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh
for
(
Triangulation::Finite_cells_iterator cit = finite_cells_begin();
Delaunay::Finite_cells_iterator cit = finite_cells_begin();
cit != finite_cells_end();
++cit
)
......@@ -236,7 +236,7 @@ void Foam::conformalVoronoiMesh::calcTetMesh
for
(
Triangulation::Finite_vertices_iterator vit = finite_vertices_begin();
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();