mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Added bounds and findNearestIntersection functions to searchableSurfaces, removed spurious returns from void functions.
This commit is contained in:
@ -204,6 +204,60 @@ void Foam::conformalVoronoiMesh::insertInitialPoints()
|
|||||||
void Foam::conformalVoronoiMesh::conformToSurface()
|
void Foam::conformalVoronoiMesh::conformToSurface()
|
||||||
{
|
{
|
||||||
startOfSurfacePointPairs_ = number_of_vertices();
|
startOfSurfacePointPairs_ = number_of_vertices();
|
||||||
|
|
||||||
|
const dictionary& cvMeshDict( cvMeshControls_.cvMeshDict());
|
||||||
|
|
||||||
|
scalar defaultCellSize
|
||||||
|
(
|
||||||
|
cvMeshDict.subDict("motionControl").lookup("defaultCellSize")
|
||||||
|
);
|
||||||
|
|
||||||
|
scalar surfDepthCoeff
|
||||||
|
(
|
||||||
|
cvMeshDict.subDict("surfaceConformation").lookup
|
||||||
|
(
|
||||||
|
"surfacePointSearchDepthCoeff"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
DynamicList<point> surfacePoints;
|
||||||
|
DynamicList<point> surfaceNormals;
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
Triangulation::Finite_vertices_iterator vit = finite_vertices_begin();
|
||||||
|
vit != finite_vertices_end();
|
||||||
|
vit++
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (vit->internalPoint())
|
||||||
|
{
|
||||||
|
point vert(topoint(vit->point()));
|
||||||
|
|
||||||
|
// TODO Need to have a function to recover the local cell size, use
|
||||||
|
// the defaultCellSize for the moment
|
||||||
|
|
||||||
|
scalar searchDistanceSqr = sqr(defaultCellSize*surfDepthCoeff);
|
||||||
|
|
||||||
|
pointIndexHit pHit = geometryToConformTo_.findNearest
|
||||||
|
(
|
||||||
|
vert,
|
||||||
|
searchDistanceSqr
|
||||||
|
);
|
||||||
|
|
||||||
|
if (pHit.hit())
|
||||||
|
{
|
||||||
|
vit->setNearBoundary();
|
||||||
|
|
||||||
|
if (dualCellSurfaceIntersection(vit))
|
||||||
|
{
|
||||||
|
allNearSurfacePoints.append(vert);
|
||||||
|
allSurfacePoints.append(pHit.hitPoint());
|
||||||
|
allSurfaceTris.append(pHit.index());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -253,7 +253,6 @@ bool Foam::conformationSurfaces::findAnyIntersection
|
|||||||
);
|
);
|
||||||
|
|
||||||
return hitInfo[0].hit();
|
return hitInfo[0].hit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -285,7 +285,8 @@ void Foam::searchableSurfaces::findAnyIntersection
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Find intersections of edge nearest to both endpoints.
|
//- Find all intersections in order from start to end. Returns for
|
||||||
|
// every hit the surface and the hit info.
|
||||||
void Foam::searchableSurfaces::findAllIntersections
|
void Foam::searchableSurfaces::findAllIntersections
|
||||||
(
|
(
|
||||||
const pointField& start,
|
const pointField& start,
|
||||||
@ -306,6 +307,31 @@ void Foam::searchableSurfaces::findAllIntersections
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Find intersections of edge nearest to both endpoints.
|
||||||
|
void Foam::searchableSurfaces::findNearestIntersection
|
||||||
|
(
|
||||||
|
const pointField& start,
|
||||||
|
const pointField& end,
|
||||||
|
labelList& surface1,
|
||||||
|
List<pointIndexHit>& hit1,
|
||||||
|
labelList& surface2,
|
||||||
|
List<pointIndexHit>& hit2
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
searchableSurfacesQueries::findNearestIntersection
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
allSurfaces_,
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
surface1,
|
||||||
|
hit1,
|
||||||
|
surface2,
|
||||||
|
hit2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Find nearest. Return -1 or nearest point
|
// Find nearest. Return -1 or nearest point
|
||||||
void Foam::searchableSurfaces::findNearest
|
void Foam::searchableSurfaces::findNearest
|
||||||
(
|
(
|
||||||
@ -315,7 +341,7 @@ void Foam::searchableSurfaces::findNearest
|
|||||||
List<pointIndexHit>& nearestInfo
|
List<pointIndexHit>& nearestInfo
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return searchableSurfacesQueries::findNearest
|
searchableSurfacesQueries::findNearest
|
||||||
(
|
(
|
||||||
*this,
|
*this,
|
||||||
allSurfaces_,
|
allSurfaces_,
|
||||||
@ -327,6 +353,17 @@ void Foam::searchableSurfaces::findNearest
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Calculate bounding box
|
||||||
|
Foam::boundBox Foam::searchableSurfaces::bounds() const
|
||||||
|
{
|
||||||
|
return searchableSurfacesQueries::bounds
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
allSurfaces_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Calculate point which is on a set of surfaces.
|
//- Calculate point which is on a set of surfaces.
|
||||||
Foam::pointIndexHit Foam::searchableSurfaces::facesIntersection
|
Foam::pointIndexHit Foam::searchableSurfaces::facesIntersection
|
||||||
(
|
(
|
||||||
|
|||||||
@ -154,6 +154,17 @@ public:
|
|||||||
List<List<pointIndexHit> >&
|
List<List<pointIndexHit> >&
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//Find intersections of edge nearest to both endpoints.
|
||||||
|
void findNearestIntersection
|
||||||
|
(
|
||||||
|
const pointField& start,
|
||||||
|
const pointField& end,
|
||||||
|
labelList& surface1,
|
||||||
|
List<pointIndexHit>& hit1,
|
||||||
|
labelList& surface2,
|
||||||
|
List<pointIndexHit>& hit2
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Find nearest. Return -1 (and a miss()) or surface and nearest
|
//- Find nearest. Return -1 (and a miss()) or surface and nearest
|
||||||
// point.
|
// point.
|
||||||
void findNearest
|
void findNearest
|
||||||
@ -164,6 +175,9 @@ public:
|
|||||||
List<pointIndexHit>&
|
List<pointIndexHit>&
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Calculate bounding box
|
||||||
|
boundBox bounds() const;
|
||||||
|
|
||||||
|
|
||||||
// Single point queries
|
// Single point queries
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user