From 1d39f8a3f4402ebcd963e1b569d956eea11a8746 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Thu, 16 Jun 2011 19:11:25 +0100 Subject: [PATCH] ENH: searchableSurface: overlap() function added --- .../searchableSurface/searchableCylinder.H | 13 ++++++++++++- src/meshTools/searchableSurface/searchablePlane.H | 13 ++++++++++++- src/meshTools/searchableSurface/searchablePlate.H | 13 ++++++++++++- .../searchableSurface/searchableSphere.H | 13 ++++++++++++- .../searchableSurface/searchableSurface.H | 15 +++------------ .../searchableSurfaceCollection.H | 13 ++++++++++++- .../searchableSurface/searchableSurfaceWithGaps.H | 10 +++++++++- 7 files changed, 72 insertions(+), 18 deletions(-) diff --git a/src/meshTools/searchableSurface/searchableCylinder.H b/src/meshTools/searchableSurface/searchableCylinder.H index f6d17181fdf..ad46e7612f7 100644 --- a/src/meshTools/searchableSurface/searchableCylinder.H +++ b/src/meshTools/searchableSurface/searchableCylinder.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -154,6 +154,17 @@ public: // Usually the element centres (should be of length size()). virtual pointField coordinates() const; + //- Does any part of the surface overlap the supplied bound box? + virtual bool overlaps(const boundBox& bb) const + { + notImplemented + ( + "searchableCylinder::overlaps(const boundBox&) const" + ); + + return false; + } + // Multiple point queries. diff --git a/src/meshTools/searchableSurface/searchablePlane.H b/src/meshTools/searchableSurface/searchablePlane.H index 3a3b467add0..2651985f8d8 100644 --- a/src/meshTools/searchableSurface/searchablePlane.H +++ b/src/meshTools/searchableSurface/searchablePlane.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -130,6 +130,17 @@ public: return pointField(1, refPoint()); } + //- Does any part of the surface overlap the supplied bound box? + virtual bool overlaps(const boundBox& bb) const + { + notImplemented + ( + "searchablePlane::overlaps(const boundBox&) const" + ); + + return false; + } + // Multiple point queries. diff --git a/src/meshTools/searchableSurface/searchablePlate.H b/src/meshTools/searchableSurface/searchablePlate.H index 780bcd5c390..7f465952a70 100644 --- a/src/meshTools/searchableSurface/searchablePlate.H +++ b/src/meshTools/searchableSurface/searchablePlate.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -149,6 +149,17 @@ public: return pointField(1, origin_); } + //- Does any part of the surface overlap the supplied bound box? + virtual bool overlaps(const boundBox& bb) const + { + notImplemented + ( + "searchablePlate::overlaps(const boundBox&) const" + ); + + return false; + } + // Multiple point queries. diff --git a/src/meshTools/searchableSurface/searchableSphere.H b/src/meshTools/searchableSurface/searchableSphere.H index bb82d4fc4aa..946bd8a3465 100644 --- a/src/meshTools/searchableSurface/searchableSphere.H +++ b/src/meshTools/searchableSurface/searchableSphere.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -138,6 +138,17 @@ public: return pointField(1, centre_); } + //- Does any part of the surface overlap the supplied bound box? + virtual bool overlaps(const boundBox& bb) const + { + notImplemented + ( + "searchableSphere::overlaps(const boundBox&) const" + ); + + return false; + } + // Multiple point queries. diff --git a/src/meshTools/searchableSurface/searchableSurface.H b/src/meshTools/searchableSurface/searchableSurface.H index 26c370c4aed..a748e2c391e 100644 --- a/src/meshTools/searchableSurface/searchableSurface.H +++ b/src/meshTools/searchableSurface/searchableSurface.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -206,17 +206,8 @@ public: // Usually the element centres (should be of length size()). virtual pointField coordinates() const = 0; - // Does any part of the surface overlap the supplied bound box? - virtual bool overlaps(const boundBox& bb) const - { - notImplemented - ( - "searchableSurface::overlaps(const boundBox& bb) const" - ); - - return false; - } - + //- Does any part of the surface overlap the supplied bound box? + virtual bool overlaps(const boundBox& bb) const = 0; // Single point queries. diff --git a/src/meshTools/searchableSurface/searchableSurfaceCollection.H b/src/meshTools/searchableSurface/searchableSurfaceCollection.H index 81ac620a108..665c61ceb1c 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceCollection.H +++ b/src/meshTools/searchableSurface/searchableSurfaceCollection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -176,6 +176,17 @@ public: // Usually the element centres (should be of length size()). virtual pointField coordinates() const; + //- Does any part of the surface overlap the supplied bound box? + virtual bool overlaps(const boundBox& bb) const + { + notImplemented + ( + "searchableSurfaceCollection::overlaps(const boundBox&) const" + ); + + return false; + } + // Multiple point queries. diff --git a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H index bf32421cab5..ed30a52d22f 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H +++ b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -156,6 +156,14 @@ public: return surface().coordinates(); } + //- Does any part of the surface overlap the supplied bound box? + // Note: use perturbed surface? Since uses boundbox of points and + // not actual intersection chosen to use unperturbed surface. + virtual bool overlaps(const boundBox& bb) const + { + return surface().overlaps(bb); + } + // Multiple point queries. -- GitLab