Added basic outline and support functions for surface conformation.

This commit is contained in:
graham
2009-04-08 19:35:13 +01:00
parent c9e580d266
commit bca5e21ada
6 changed files with 149 additions and 9 deletions

View File

@ -29,6 +29,59 @@ License
#include "uint.H"
#include "ulong.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::conformalVoronoiMesh::dualCellSurfaceIntersection
(
const Triangulation::Finite_vertices_iterator& vit
) const
{
std::list<Facet> facets;
incident_facets(vit, std::back_inserter(facets));
for
(
std::list<Facet>::iterator fit=facets.begin();
fit != facets.end();
++fit
)
{
if
(
is_infinite(fit->first)
|| is_infinite(fit->first->neighbor(fit->second))
)
{
return true;
}
point dE0 = topoint(dual(fit->first));
// If edge end is outside bounding box then edge cuts boundary
if (!geometryToConformTo_.bounds().contains(dE0))
{
return true;
}
point dE1 = topoint(dual(fit->first->neighbor(fit->second)));
// If other edge end is outside bounding box then edge cuts boundary
if (!!geometryToConformTo_.bounds().contains(dE1))
{
return true;
}
// Check for the edge passing through a surface
if (geometryToConformTo_.findAnyIntersection(dE0, dE1))
{
return true;
}
}
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::conformalVoronoiMesh::conformalVoronoiMesh
@ -148,5 +201,10 @@ void Foam::conformalVoronoiMesh::insertInitialPoints()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::conformalVoronoiMesh::conformToSurface()
{
startOfSurfacePointPairs_ = number_of_vertices();
}
// ************************************************************************* //

View File

@ -100,12 +100,6 @@ class conformalVoronoiMesh
// Private Member Functions
//- Disallow default bitwise copy construct
conformalVoronoiMesh(const conformalVoronoiMesh&);
//- Disallow default bitwise assignment
void operator=(const conformalVoronoiMesh&);
//- Write the elapsedCpuTime
void timeCheck() const;
@ -138,6 +132,20 @@ class conformalVoronoiMesh
// initialPointsMethod
void insertInitialPoints();
//- Check to see if dual cell specified by given vertex iterator
// intersects the boundary and hence reqires a point-pair.
bool dualCellSurfaceIntersection
(
const Triangulation::Finite_vertices_iterator& vit
) const;
//- Disallow default bitwise copy construct
conformalVoronoiMesh(const conformalVoronoiMesh&);
//- Disallow default bitwise assignment
void operator=(const conformalVoronoiMesh&);
public:
// Constructors
@ -158,7 +166,10 @@ public:
// Member Functions
// Conversion functions between point (OpenFOAM) and Point (CGAL)
//- Insert the necessary point pairs to conform to the surface
void conformToSurface();
//- Conversion functions between point (OpenFOAM) and Point (CGAL)
# ifdef CGAL_INEXACT
typedef const point& pointFromPoint;

View File

@ -26,6 +26,52 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline Foam::label Foam::conformalVoronoiMesh::insertPoint
(
const point& p,
const label type
)
{
uint nVert = number_of_vertices();
Vertex_handle vh = insert(toPoint(p));
if (nVert == number_of_vertices())
{
WarningIn("Foam::conformalVoronoiMesh::insertPoint")
<< "Failed to insert point " << p << endl;
}
else
{
vh->index() = nVert;
vh->type() = type;
}
return vh->index();
}
inline void Foam::conformalVoronoiMesh::insertPointPair
(
const scalar ppDist,
const point& surfPt,
const vector& n
)
{
vector ppDistn = ppDist*n;
label master = insertPoint
(
surfPt - ppDistn,
number_of_vertices() + 1
);
insertPoint(surfPt + ppDistn, master);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
#ifdef CGAL_INEXACT

View File

@ -233,5 +233,28 @@ Foam::Field<bool> Foam::conformationSurfaces::wellOutside
}
bool Foam::conformationSurfaces::findAnyIntersection
(
point start,
point end
) const
{
labelList hitSurfaces;
List<pointIndexHit> hitInfo;
searchableSurfacesQueries::findAnyIntersection
(
allGeometry_,
surfaces_,
pointField(1, start),
pointField(1, end),
hitSurfaces,
hitInfo
);
return hitInfo[0].hit();
}
// ************************************************************************* //

View File

@ -143,6 +143,10 @@ public:
const scalar dist2
) const;
// Finding if the line joining start and end intersects the surface
bool findAnyIntersection(point start, point end) const;
// Member Operators
};

View File

@ -61,8 +61,6 @@ std::vector<Vb::Point> uniformGrid::initialPoints() const
{
const boundBox& bb = cvMesh_.geometryToConformTo().bounds();
Info<< bb << endl;
scalar x0 = bb.min().x();
scalar xR = bb.max().x() - x0;
int ni = int(xR/initialCellSize_) + 1;