STYLE: code cleanup searchableSurface (issue #929)

- improve doxygen entries for searchable surfaces.

- support selection of searchable surfaces with shorter names.
  Eg,
      type   box | cylinder | ...;
  vs  type   searchableBox | searchableCylinder | ...;
This commit is contained in:
Mark Olesen
2018-07-06 11:03:28 +02:00
parent 1ee5144079
commit d530bc254a
82 changed files with 804 additions and 700 deletions

View File

@ -30,10 +30,8 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(closedTriSurfaceMesh, 0);
defineTypeNameAndDebug(closedTriSurfaceMesh, 0); addToRunTimeSelectionTable(searchableSurface, closedTriSurfaceMesh, dict);
addToRunTimeSelectionTable(searchableSurface, closedTriSurfaceMesh, dict);
} }
@ -65,10 +63,4 @@ Foam::closedTriSurfaceMesh::closedTriSurfaceMesh
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::closedTriSurfaceMesh::~closedTriSurfaceMesh()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -52,7 +52,8 @@ class closedTriSurfaceMesh
: :
public triSurfaceMesh public triSurfaceMesh
{ {
private:
// Private Member Functions
//- No copy construct //- No copy construct
closedTriSurfaceMesh(const closedTriSurfaceMesh&) = delete; closedTriSurfaceMesh(const closedTriSurfaceMesh&) = delete;
@ -76,7 +77,7 @@ public:
closedTriSurfaceMesh(const IOobject& io); closedTriSurfaceMesh(const IOobject& io);
//- Construct from IO and dictionary (used by searchableSurface). //- Construct from IO and dictionary (used by searchableSurface).
// Dictionary may contain a 'scale' entry (eg, 0.001: mm -> m) // Dictionary may contain a 'scale' entry (eg, 0.001: mm to m)
closedTriSurfaceMesh closedTriSurfaceMesh
( (
const IOobject& io, const IOobject& io,
@ -84,9 +85,9 @@ public:
); );
// Destructor //- Destructor
virtual ~closedTriSurfaceMesh() = default;
virtual ~closedTriSurfaceMesh();
// Member Functions // Member Functions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -32,7 +32,19 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(searchableBox, 0); defineTypeNameAndDebug(searchableBox, 0);
addToRunTimeSelectionTable(searchableSurface, searchableBox, dict); addToRunTimeSelectionTable
(
searchableSurface,
searchableBox,
dict
);
addNamedToRunTimeSelectionTable
(
searchableSurface,
searchableBox,
dict,
box
);
} }
@ -47,6 +59,7 @@ void Foam::searchableBox::projectOntoCoordPlane
{ {
// Set point // Set point
info.rawPoint()[dir] = planePt[dir]; info.rawPoint()[dir] = planePt[dir];
// Set face // Set face
if (planePt[dir] == min()[dir]) if (planePt[dir] == min()[dir])
{ {
@ -92,7 +105,7 @@ Foam::pointIndexHit Foam::searchableBox::findNearest
// (for internal points) per direction what nearest cube side is // (for internal points) per direction what nearest cube side is
point near; point near;
for (direction dir = 0; dir < vector::nComponents; dir++) for (direction dir = 0; dir < vector::nComponents; ++dir)
{ {
if (info.rawPoint()[dir] < min()[dir]) if (info.rawPoint()[dir] < min()[dir])
{ {
@ -188,7 +201,7 @@ Foam::searchableBox::searchableBox
) )
: :
searchableSurface(io), searchableSurface(io),
treeBoundBox(dict.lookup("min"), dict.lookup("max")) treeBoundBox(dict.get<point>("min"), dict.get<point>("max"))
{ {
if (!contains(midpoint())) if (!contains(midpoint()))
{ {
@ -201,12 +214,6 @@ Foam::searchableBox::searchableBox
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::searchableBox::~searchableBox()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::wordList& Foam::searchableBox::regions() const const Foam::wordList& Foam::searchableBox::regions() const
@ -222,8 +229,8 @@ const Foam::wordList& Foam::searchableBox::regions() const
Foam::tmp<Foam::pointField> Foam::searchableBox::coordinates() const Foam::tmp<Foam::pointField> Foam::searchableBox::coordinates() const
{ {
tmp<pointField> tCtrs(new pointField(6)); auto tctrs = tmp<pointField>::New(6);
pointField& ctrs = tCtrs.ref(); auto& ctrs = tctrs.ref();
const pointField pts(treeBoundBox::points()); const pointField pts(treeBoundBox::points());
const faceList& fcs = treeBoundBox::faces; const faceList& fcs = treeBoundBox::faces;
@ -233,7 +240,7 @@ Foam::tmp<Foam::pointField> Foam::searchableBox::coordinates() const
ctrs[i] = fcs[i].centre(pts); ctrs[i] = fcs[i].centre(pts);
} }
return tCtrs; return tctrs;
} }
@ -255,9 +262,9 @@ void Foam::searchableBox::boundingSpheres
const face& f = fcs[i]; const face& f = fcs[i];
centres[i] = f.centre(pts); centres[i] = f.centre(pts);
forAll(f, fp) for (const label pointi : f)
{ {
const point& pt = pts[f[fp]]; const point& pt = pts[pointi];
radiusSqr[i] = Foam::max radiusSqr[i] = Foam::max
( (
@ -303,7 +310,7 @@ Foam::pointIndexHit Foam::searchableBox::findNearestOnEdge
// (for internal points) per direction what nearest cube side is // (for internal points) per direction what nearest cube side is
point near; point near;
for (direction dir = 0; dir < vector::nComponents; dir++) for (direction dir = 0; dir < vector::nComponents; ++dir)
{ {
if (info.rawPoint()[dir] < min()[dir]) if (info.rawPoint()[dir] < min()[dir])
{ {
@ -405,7 +412,7 @@ Foam::pointIndexHit Foam::searchableBox::findLine
{ {
info.setHit(); info.setHit();
for (direction dir = 0; dir < vector::nComponents; dir++) for (direction dir = 0; dir < vector::nComponents; ++dir)
{ {
if (info.rawPoint()[dir] == min()[dir]) if (info.rawPoint()[dir] == min()[dir])
{ {
@ -602,20 +609,23 @@ void Foam::searchableBox::getVolumeType
) const ) const
{ {
volType.setSize(points.size()); volType.setSize(points.size());
volType = volumeType::INSIDE;
forAll(points, pointi) forAll(points, pointi)
{ {
const point& pt = points[pointi]; const point& pt = points[pointi];
for (direction dir = 0; dir < vector::nComponents; dir++) volumeType vt = volumeType::INSIDE;
for (direction dir=0; dir < vector::nComponents; ++dir)
{ {
if (pt[dir] < min()[dir] || pt[dir] > max()[dir]) if (pt[dir] < min()[dir] || pt[dir] > max()[dir])
{ {
volType[pointi] = volumeType::OUTSIDE; vt = volumeType::OUTSIDE;
break; break;
} }
} }
volType[pointi] = vt;
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,6 +27,14 @@ Class
Description Description
Searching on bounding box Searching on bounding box
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | box / searchableBox | selector |
min | minimum point for bounding box | yes |
max | maximum point for bounding box | yes |
\endtable
SourceFiles SourceFiles
searchableBox.C searchableBox.C
@ -43,8 +51,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class searchableBox Declaration Class searchableBox Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -54,8 +60,6 @@ class searchableBox
public searchableSurface, public searchableSurface,
public treeBoundBox public treeBoundBox
{ {
private:
// Private Member Data // Private Member Data
mutable wordList regions_; mutable wordList regions_;
@ -109,14 +113,15 @@ public:
); );
//- Destructor //- Destructor
virtual ~searchableBox(); virtual ~searchableBox() = default;
// Member Functions // Member Functions
//- Names of regions
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below //- Whether surface supports volume type (below)
virtual bool hasVolumeType() const virtual bool hasVolumeType() const
{ {
return true; return true;
@ -248,12 +253,11 @@ public:
vectorField& normal vectorField& normal
) const; ) const;
//- Determine type (inside/outside/mixed) for point. unknown if //- Determine type (inside/outside) for points.
// cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField&, const pointField& points,
List<volumeType>& List<volumeType>& volType
) const; ) const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,7 +31,19 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(searchableCone, 0); defineTypeNameAndDebug(searchableCone, 0);
addToRunTimeSelectionTable(searchableSurface, searchableCone, dict); addToRunTimeSelectionTable
(
searchableSurface,
searchableCone,
dict
);
addNamedToRunTimeSelectionTable
(
searchableSurface,
searchableCone,
dict,
cone
);
} }
@ -39,9 +51,7 @@ namespace Foam
Foam::tmp<Foam::pointField> Foam::searchableCone::coordinates() const Foam::tmp<Foam::pointField> Foam::searchableCone::coordinates() const
{ {
tmp<pointField> tCtrs(new pointField(1, 0.5*(point1_ + point2_))); return tmp<pointField>::New(1, 0.5*(point1_ + point2_));
return tCtrs;
} }
@ -71,13 +81,13 @@ void Foam::searchableCone::boundingSpheres
Foam::tmp<Foam::pointField> Foam::searchableCone::points() const Foam::tmp<Foam::pointField> Foam::searchableCone::points() const
{ {
tmp<pointField> tPts(new pointField(2)); auto tpts = tmp<pointField>::New(2);
pointField& pts = tPts.ref(); auto& pts = tpts.ref();
pts[0] = point1_; pts[0] = point1_;
pts[1] = point2_; pts[1] = point2_;
return tPts; return tpts;
} }
@ -92,7 +102,7 @@ void Foam::searchableCone::findNearestAndNormal
vector v(sample - point1_); vector v(sample - point1_);
// Decompose sample-point1 into normal and parallel component // Decompose sample-point1 into normal and parallel component
scalar parallel = (v & unitDir_); const scalar parallel = (v & unitDir_);
// Remove the parallel component and normalise // Remove the parallel component and normalise
v -= parallel*unitDir_; v -= parallel*unitDir_;
@ -338,8 +348,8 @@ void Foam::searchableCone::findLineAll
vector point1End(end-cone.point1_); vector point1End(end-cone.point1_);
// Quick rejection of complete vector outside endcaps // Quick rejection of complete vector outside endcaps
scalar s1 = point1Start&(cone.unitDir_); scalar s1 = point1Start & (cone.unitDir_);
scalar s2 = point1End&(cone.unitDir_); scalar s2 = point1End & (cone.unitDir_);
if ((s1 < 0.0 && s2 < 0.0) || (s1 > cone.magDir_ && s2 > cone.magDir_)) if ((s1 < 0.0 && s2 < 0.0) || (s1 > cone.magDir_ && s2 > cone.magDir_))
{ {
@ -735,12 +745,12 @@ Foam::searchableCone::searchableCone
) )
: :
searchableSurface(io), searchableSurface(io),
point1_(dict.lookup("point1")), point1_(dict.get<point>("point1")),
radius1_(readScalar(dict.lookup("radius1"))), radius1_(dict.get<scalar>("radius1")),
innerRadius1_(dict.lookupOrDefault("innerRadius1", 0.0)), innerRadius1_(dict.lookupOrDefault<scalar>("innerRadius1", 0)),
point2_(dict.lookup("point2")), point2_(dict.get<point>("point2")),
radius2_(readScalar(dict.lookup("radius2"))), radius2_(dict.get<scalar>("radius2")),
innerRadius2_(dict.lookupOrDefault("innerRadius2", 0.0)), innerRadius2_(dict.lookupOrDefault<scalar>("innerRadius2", 0)),
magDir_(mag(point2_-point1_)), magDir_(mag(point2_-point1_)),
unitDir_((point2_-point1_)/magDir_) unitDir_((point2_-point1_)/magDir_)
{ {
@ -748,12 +758,6 @@ Foam::searchableCone::searchableCone
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::searchableCone::~searchableCone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::wordList& Foam::searchableCone::regions() const const Foam::wordList& Foam::searchableCone::regions() const
@ -775,6 +779,7 @@ void Foam::searchableCone::findNearest
) const ) const
{ {
info.setSize(samples.size()); info.setSize(samples.size());
forAll(samples, i) forAll(samples, i)
{ {
vector normal; vector normal;
@ -1071,48 +1076,36 @@ void Foam::searchableCone::getVolumeType
) const ) const
{ {
volType.setSize(points.size()); volType.setSize(points.size());
volType = volumeType::INSIDE;
forAll(points, pointI) forAll(points, pointi)
{ {
const point& pt = points[pointI]; const point& pt = points[pointi];
volType[pointi] = volumeType::OUTSIDE;
vector v(pt - point1_); vector v(pt - point1_);
// Decompose sample-point1 into normal and parallel component // Decompose sample-point1 into normal and parallel component
scalar parallel = v & unitDir_; const scalar parallel = (v & unitDir_);
scalar comp = parallel;
scalar compInner = parallel;
// Quick rejection. Left of point1 endcap, or right of point2 endcap
scalar radius_sec = radius1_+comp*(radius2_-radius1_)/magDir_; if (parallel < 0 || parallel > magDir_)
scalar radius_sec_inner =
innerRadius1_
+compInner*(innerRadius2_-innerRadius1_)/magDir_;
if (parallel < 0)
{ {
// Left of point1 endcap continue;
volType[pointI] = volumeType::OUTSIDE;
} }
else if (parallel > magDir_)
{ const scalar radius_sec =
// Right of point2 endcap radius1_ + parallel * (radius2_-radius1_)/magDir_;
volType[pointI] = volumeType::OUTSIDE;
} const scalar radius_sec_inner =
else innerRadius1_ + parallel * (innerRadius2_-innerRadius1_)/magDir_;
{
// Remove the parallel component // Remove the parallel component
v -= parallel*unitDir_; v -= parallel*unitDir_;
if (mag(v) >= radius_sec_inner && mag(v) <= radius_sec) if (mag(v) >= radius_sec_inner && mag(v) <= radius_sec)
{ {
volType[pointI] = volumeType::INSIDE; volType[pointi] = volumeType::INSIDE;
}
else
{
volType[pointI] = volumeType::OUTSIDE;
}
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,15 +27,16 @@ Class
Description Description
Searching on (optionally hollow) cone. Searching on (optionally hollow) cone.
\heading Function object usage \heading Dictionary parameters
\table \table
Property | Description | Required | Default value Property | Description | Required | Default
type | code / searchableCone | selector |
point1 | coordinate of endpoint | yes | point1 | coordinate of endpoint | yes |
radius1 | radius at point1 | yes | yes radius1 | radius at point1 | yes |
innerRadius1 | inner radius at point1 | no | innerRadius1| inner radius at point1 | no | 0
point2 | coordinate of endpoint | yes | point2 | coordinate of endpoint | yes |
radius2 | radius at point2 | yes | yes radius2 | radius at point2 | yes |
innerRadius2 | inner radius at point2 | no | innerRadius2| inner radius at point2 | no | 0
\endtable \endtable
Note Note
@ -171,15 +172,15 @@ public:
//- Destructor //- Destructor
virtual ~searchableCone() = default;
virtual ~searchableCone();
// Member Functions // Member Functions
//- Names of regions
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below //- Whether supports volume type (below)
virtual bool hasVolumeType() const virtual bool hasVolumeType() const
{ {
return true; return true;
@ -262,12 +263,12 @@ public:
vectorField& normal vectorField& normal
) const; ) const;
//- Determine type (inside/outside/mixed) for point. unknown if //- Determine type (inside/outside/mixed) for point.
// cannot be determined (e.g. non-manifold surface) // Unknown if cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField&, const pointField& points,
List<volumeType>& List<volumeType>& volType
) const; ) const;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,7 +31,19 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(searchableCylinder, 0); defineTypeNameAndDebug(searchableCylinder, 0);
addToRunTimeSelectionTable(searchableSurface, searchableCylinder, dict); addToRunTimeSelectionTable
(
searchableSurface,
searchableCylinder,
dict
);
addNamedToRunTimeSelectionTable
(
searchableSurface,
searchableCylinder,
dict,
cylinder
);
} }
@ -39,9 +51,7 @@ namespace Foam
Foam::tmp<Foam::pointField> Foam::searchableCylinder::coordinates() const Foam::tmp<Foam::pointField> Foam::searchableCylinder::coordinates() const
{ {
tmp<pointField> tCtrs(new pointField(1, 0.5*(point1_ + point2_))); return tmp<pointField>::New(1, 0.5*(point1_ + point2_));
return tCtrs;
} }
@ -64,13 +74,13 @@ void Foam::searchableCylinder::boundingSpheres
Foam::tmp<Foam::pointField> Foam::searchableCylinder::points() const Foam::tmp<Foam::pointField> Foam::searchableCylinder::points() const
{ {
tmp<pointField> tPts(new pointField(2)); auto tpts = tmp<pointField>::New(2);
pointField& pts = tPts.ref(); auto& pts = tpts.ref();
pts[0] = point1_; pts[0] = point1_;
pts[1] = point2_; pts[1] = point2_;
return tPts; return tpts;
} }
@ -180,7 +190,7 @@ Foam::pointIndexHit Foam::searchableCylinder::findNearest
Foam::scalar Foam::searchableCylinder::radius2(const point& pt) const Foam::scalar Foam::searchableCylinder::radius2(const point& pt) const
{ {
const vector x = (pt-point1_) ^ unitDir_; const vector x = (pt-point1_) ^ unitDir_;
return x&x; return (x & x);
} }
@ -500,22 +510,16 @@ Foam::searchableCylinder::searchableCylinder
) )
: :
searchableSurface(io), searchableSurface(io),
point1_(dict.lookup("point1")), point1_(dict.get<point>("point1")),
point2_(dict.lookup("point2")), point2_(dict.get<point>("point2")),
magDir_(mag(point2_-point1_)), magDir_(mag(point2_-point1_)),
unitDir_((point2_-point1_)/magDir_), unitDir_((point2_-point1_)/magDir_),
radius_(readScalar(dict.lookup("radius"))) radius_(dict.get<scalar>("radius"))
{ {
bounds() = calcBounds(); bounds() = calcBounds();
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::searchableCylinder::~searchableCylinder()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::wordList& Foam::searchableCylinder::regions() const const Foam::wordList& Foam::searchableCylinder::regions() const
@ -660,7 +664,7 @@ void Foam::searchableCylinder::getNormal
vector v(info[i].hitPoint() - point1_); vector v(info[i].hitPoint() - point1_);
// Decompose sample-point1 into normal and parallel component // Decompose sample-point1 into normal and parallel component
scalar parallel = (v & unitDir_); const scalar parallel = (v & unitDir_);
// Remove the parallel component and normalise // Remove the parallel component and normalise
v -= parallel*unitDir_; v -= parallel*unitDir_;
@ -728,25 +732,21 @@ void Foam::searchableCylinder::getVolumeType
) const ) const
{ {
volType.setSize(points.size()); volType.setSize(points.size());
volType = volumeType::INSIDE;
forAll(points, pointi) forAll(points, pointi)
{ {
const point& pt = points[pointi]; const point& pt = points[pointi];
volType[pointi] = volumeType::OUTSIDE;
vector v(pt - point1_); vector v(pt - point1_);
// Decompose sample-point1 into normal and parallel component // Decompose sample-point1 into normal and parallel component
scalar parallel = v & unitDir_; const scalar parallel = (v & unitDir_);
if (parallel < 0) // Quick rejection. Left of point1 endcap, or right of point2 endcap
if (parallel < 0 || parallel > magDir_)
{ {
// left of point1 endcap
volType[pointi] = volumeType::OUTSIDE;
}
else if (parallel > magDir_)
{
// right of point2 endcap
volType[pointi] = volumeType::OUTSIDE; volType[pointi] = volumeType::OUTSIDE;
} }
else else
@ -754,14 +754,12 @@ void Foam::searchableCylinder::getVolumeType
// Remove the parallel component // Remove the parallel component
v -= parallel*unitDir_; v -= parallel*unitDir_;
if (mag(v) > radius_) volType[pointi] =
{ (
volType[pointi] = volumeType::OUTSIDE; mag(v) <= radius_
} ? volumeType::INSIDE
else : volumeType::OUTSIDE
{ );
volType[pointi] = volumeType::INSIDE;
}
} }
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,7 +25,16 @@ Class
Foam::searchableCylinder Foam::searchableCylinder
Description Description
Searching on cylinder Searching on a cylinder.
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | cylinder / searchableCylinder | selector |
point1 | coordinate of endpoint | yes |
point2 | coordinate of endpoint | yes |
radius | cylinder radius | yes |
\endtable
SourceFiles SourceFiles
searchableCylinder.C searchableCylinder.C
@ -55,10 +64,10 @@ private:
// Private Member Data // Private Member Data
//- 'left' point //- The 'left' point
const point point1_; const point point1_;
//- 'right' point //- The 'right' point
const point point2_; const point point2_;
//- Length of vector point2-point1 //- Length of vector point2-point1
@ -67,7 +76,7 @@ private:
//- Normalised vector point2-point1 //- Normalised vector point2-point1
const vector unitDir_; const vector unitDir_;
//- Radius squared //- The radius
const scalar radius_; const scalar radius_;
//- Names of regions //- Names of regions
@ -119,8 +128,8 @@ public:
searchableCylinder searchableCylinder
( (
const IOobject& io, const IOobject& io,
const point&, const point& point1,
const point&, const point& point2,
const scalar radius const scalar radius
); );
@ -131,12 +140,14 @@ public:
const dictionary& dict const dictionary& dict
); );
//- Destructor //- Destructor
virtual ~searchableCylinder(); virtual ~searchableCylinder() = default;
// Member Functions // Member Functions
//- Names of regions
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below //- Whether supports volume type below
@ -170,7 +181,6 @@ public:
virtual bool overlaps(const boundBox& bb) const virtual bool overlaps(const boundBox& bb) const
{ {
NotImplemented; NotImplemented;
return false; return false;
} }
@ -220,12 +230,12 @@ public:
vectorField& normal vectorField& normal
) const; ) const;
//- Determine type (inside/outside/mixed) for point. unknown if //- Determine type (inside/outside/mixed) for point.
// cannot be determined (e.g. non-manifold surface) // Unknown if cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField&, const pointField& points,
List<volumeType>& List<volumeType>& volType
) const; ) const;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,10 +30,20 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(searchableDisk, 0);
defineTypeNameAndDebug(searchableDisk, 0); addToRunTimeSelectionTable
addToRunTimeSelectionTable(searchableSurface, searchableDisk, dict); (
searchableSurface,
searchableDisk,
dict
);
addNamedToRunTimeSelectionTable
(
searchableSurface,
searchableDisk,
dict,
disk
);
} }
@ -50,7 +60,7 @@ Foam::pointIndexHit Foam::searchableDisk::findNearest
vector v(sample - origin_); vector v(sample - origin_);
// Decompose sample-origin into normal and parallel component // Decompose sample-origin into normal and parallel component
scalar parallel = (v & normal_); const scalar parallel = (v & normal_);
// Remove the parallel component and normalise // Remove the parallel component and normalise
v -= parallel*normal_; v -= parallel*normal_;
@ -90,7 +100,7 @@ void Foam::searchableDisk::findLine
vector v(start - origin_); vector v(start - origin_);
// Decompose sample-origin into normal and parallel component // Decompose sample-origin into normal and parallel component
scalar parallel = (v & normal_); const scalar parallel = (v & normal_);
if (sign(parallel) == sign((end - origin_) & normal_)) if (sign(parallel) == sign((end - origin_) & normal_))
{ {
@ -160,9 +170,9 @@ Foam::searchableDisk::searchableDisk
) )
: :
searchableSurface(io), searchableSurface(io),
origin_(dict.lookup("origin")), origin_(dict.get<point>("origin")),
normal_(dict.lookup("normal")), normal_(dict.get<vector>("normal")),
radius_(readScalar(dict.lookup("radius"))) radius_(dict.get<scalar>("radius"))
{ {
normal_ /= mag(normal_); normal_ /= mag(normal_);
@ -183,12 +193,6 @@ Foam::searchableDisk::searchableDisk
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::searchableDisk::~searchableDisk()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::wordList& Foam::searchableDisk::regions() const const Foam::wordList& Foam::searchableDisk::regions() const

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,6 +28,15 @@ Description
Searching on circular disk given as origin, normal (gets normalised) Searching on circular disk given as origin, normal (gets normalised)
and radius and radius
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | disk / searchableDisk | selector |
origin | centre of disk | yes |
normal | normal vector | yes |
radius | disk radius | yes |
\endtable
SourceFiles SourceFiles
searchableDisk.C searchableDisk.C
@ -56,13 +65,13 @@ private:
// Private Member Data // Private Member Data
//- origin //- Origin
const point origin_; const point origin_;
//- normal //- Normal
vector normal_; vector normal_;
//- radius //- Radius
const scalar radius_; const scalar radius_;
//- Names of regions //- Names of regions
@ -120,14 +129,15 @@ public:
); );
//- Destructor //- Destructor
virtual ~searchableDisk(); virtual ~searchableDisk() = default;
// Member Functions // Member Functions
//- Names of regions
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below //- Whether supports volume type (below)
virtual bool hasVolumeType() const virtual bool hasVolumeType() const
{ {
return false; return false;
@ -143,8 +153,7 @@ public:
// Usually the element centres (should be of length size()). // Usually the element centres (should be of length size()).
virtual tmp<pointField> coordinates() const virtual tmp<pointField> coordinates() const
{ {
tmp<pointField> tCtrs(new pointField(1, origin_)); return tmp<pointField>::New(1, origin_);
return tCtrs;
} }
//- Get bounding spheres (centre and radius squared), one per element. //- Get bounding spheres (centre and radius squared), one per element.
@ -165,7 +174,6 @@ public:
virtual bool overlaps(const boundBox& bb) const virtual bool overlaps(const boundBox& bb) const
{ {
NotImplemented; NotImplemented;
return false; return false;
} }
@ -215,12 +223,12 @@ public:
vectorField& normal vectorField& normal
) const; ) const;
//- Determine type (inside/outside/mixed) for point. unknown if //- Determine type (inside/outside/mixed) for point.
// cannot be determined (e.g. non-manifold surface) // Unknown if cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField&, const pointField& points,
List<volumeType>& List<volumeType>& volType
) const; ) const;

View File

@ -43,6 +43,13 @@ namespace Foam
searchableExtrudedCircle, searchableExtrudedCircle,
dict dict
); );
addNamedToRunTimeSelectionTable
(
searchableSurface,
searchableExtrudedCircle,
dict,
extrudedCircle
);
} }
@ -61,7 +68,7 @@ Foam::searchableExtrudedCircle::searchableExtrudedCircle
( (
IOobject IOobject
( (
dict.lookup("file"), // name dict.get<word>("file"), // name
io.time().constant(), // instance io.time().constant(), // instance
"geometry", // local "geometry", // local
io.time(), // registry io.time(), // registry
@ -71,7 +78,7 @@ Foam::searchableExtrudedCircle::searchableExtrudedCircle
).objectPath() ).objectPath()
) )
), ),
radius_(readScalar(dict.lookup("radius"))) radius_(dict.get<scalar>("radius"))
{ {
const edgeMesh& eMesh = eMeshPtr_(); const edgeMesh& eMesh = eMeshPtr_();

View File

@ -25,7 +25,18 @@ Class
Foam::searchableExtrudedCircle Foam::searchableExtrudedCircle
Description Description
Searching on edgemesh with constant radius Searching on edgeMesh with constant radius
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | extrudedCircle / searchableExtrudedCircle | selector |
file | The name of the edge mesh | yes |
radius | Search radius around the edges | yes |
\endtable
Note
The edge mesh file is to be located in the constant/geometry directory.
SourceFiles SourceFiles
searchableExtrudedCircle.C searchableExtrudedCircle.C
@ -43,10 +54,10 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class edgeMesh; class edgeMesh;
class treeDataEdge; class treeDataEdge;
template <class Type> class indexedOctree; template<class Type> class indexedOctree;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class searchableExtrudedCircle Declaration Class searchableExtrudedCircle Declaration
@ -102,6 +113,7 @@ public:
// Member Functions // Member Functions
//- Names of regions
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below //- Whether supports volume type below
@ -206,8 +218,8 @@ public:
vectorField& normal vectorField& normal
) const; ) const;
//- Determine type (inside/outside/mixed) for point. unknown if //- Determine type (inside/outside/mixed) for point.
// cannot be determined (e.g. non-manifold surface) // Unknown if cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField&, const pointField&,

View File

@ -31,10 +31,20 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(searchablePlane, 0);
defineTypeNameAndDebug(searchablePlane, 0); addToRunTimeSelectionTable
addToRunTimeSelectionTable(searchableSurface, searchablePlane, dict); (
searchableSurface,
searchablePlane,
dict
);
addNamedToRunTimeSelectionTable
(
searchableSurface,
searchablePlane,
dict,
plane
);
} }
@ -115,12 +125,6 @@ Foam::searchablePlane::searchablePlane
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::searchablePlane::~searchablePlane()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::wordList& Foam::searchablePlane::regions() const const Foam::wordList& Foam::searchablePlane::regions() const

View File

@ -25,7 +25,15 @@ Class
Foam::searchablePlane Foam::searchablePlane
Description Description
Searching on (infinite) plane. See plane.H Searching on (infinite) plane.
The dictionary specifications are identical to the Foam::plane
requirements.
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | plane / searchablePlane | selector |
\endtable
SourceFiles SourceFiles
searchablePlane.C searchablePlane.C
@ -43,8 +51,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class searchablePlane Declaration Class searchablePlane Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -58,6 +64,7 @@ private:
// Private Member Data // Private Member Data
//- Names of regions
mutable wordList regions_; mutable wordList regions_;
@ -103,11 +110,12 @@ public:
); );
//- Destructor //- Destructor
virtual ~searchablePlane(); virtual ~searchablePlane() = default;
// Member Functions // Member Functions
//- Names of regions
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below //- Whether supports volume type below
@ -126,8 +134,7 @@ public:
// Usually the element centres (should be of length size()). // Usually the element centres (should be of length size()).
virtual tmp<pointField> coordinates() const virtual tmp<pointField> coordinates() const
{ {
tmp<pointField> tCtrs(new pointField(1, refPoint())); return tmp<pointField>::New(1, refPoint());
return tCtrs;
} }
//- Get bounding spheres (centre and radius squared), one per element. //- Get bounding spheres (centre and radius squared), one per element.
@ -149,7 +156,6 @@ public:
virtual bool overlaps(const boundBox& bb) const virtual bool overlaps(const boundBox& bb) const
{ {
NotImplemented; NotImplemented;
return false; return false;
} }
@ -199,8 +205,8 @@ public:
vectorField& normal vectorField& normal
) const; ) const;
//- Determine type (inside/outside/mixed) for point. unknown if //- Determine type (inside/outside/mixed) for point.
// cannot be determined (e.g. non-manifold surface) // Unknown if cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField&, const pointField&,

View File

@ -32,7 +32,19 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(searchablePlate, 0); defineTypeNameAndDebug(searchablePlate, 0);
addToRunTimeSelectionTable(searchableSurface, searchablePlate, dict); addToRunTimeSelectionTable
(
searchableSurface,
searchablePlate,
dict
);
addNamedToRunTimeSelectionTable
(
searchableSurface,
searchablePlate,
dict,
plate
);
} }
@ -42,7 +54,7 @@ Foam::direction Foam::searchablePlate::calcNormal(const point& span)
{ {
direction normalDir = 3; direction normalDir = 3;
for (direction dir = 0; dir < vector::nComponents; dir++) for (direction dir = 0; dir < vector::nComponents; ++dir)
{ {
if (span[dir] < 0) if (span[dir] < 0)
{ {
@ -96,7 +108,7 @@ Foam::pointIndexHit Foam::searchablePlate::findNearest
info.rawPoint()[normalDir_] = origin_[normalDir_]; info.rawPoint()[normalDir_] = origin_[normalDir_];
// Clip to edges if outside // Clip to edges if outside
for (direction dir = 0; dir < vector::nComponents; dir++) for (direction dir = 0; dir < vector::nComponents; ++dir)
{ {
if (dir != normalDir_) if (dir != normalDir_)
{ {
@ -158,7 +170,7 @@ Foam::pointIndexHit Foam::searchablePlate::findLine
info.rawPoint()[normalDir_] = origin_[normalDir_]; info.rawPoint()[normalDir_] = origin_[normalDir_];
// Clip to edges // Clip to edges
for (direction dir = 0; dir < vector::nComponents; dir++) for (direction dir = 0; dir < vector::nComponents; ++dir)
{ {
if (dir != normalDir_) if (dir != normalDir_)
{ {
@ -236,8 +248,8 @@ Foam::searchablePlate::searchablePlate
) )
: :
searchableSurface(io), searchableSurface(io),
origin_(dict.lookup("origin")), origin_(dict.get<point>("origin")),
span_(dict.lookup("span")), span_(dict.get<vector>("span")),
normalDir_(calcNormal(span_)) normalDir_(calcNormal(span_))
{ {
if (debug) if (debug)
@ -253,12 +265,6 @@ Foam::searchablePlate::searchablePlate
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::searchablePlate::~searchablePlate()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::wordList& Foam::searchablePlate::regions() const const Foam::wordList& Foam::searchablePlate::regions() const
@ -297,8 +303,8 @@ void Foam::searchablePlate::boundingSpheres
Foam::tmp<Foam::pointField> Foam::searchablePlate::points() const Foam::tmp<Foam::pointField> Foam::searchablePlate::points() const
{ {
tmp<pointField> tPts(new pointField(4)); auto tpts = tmp<pointField>::New(4);
pointField& pts = tPts.ref(); auto& pts = tpts.ref();
pts[0] = origin_; pts[0] = origin_;
pts[2] = origin_ + span_; pts[2] = origin_ + span_;
@ -319,7 +325,7 @@ Foam::tmp<Foam::pointField> Foam::searchablePlate::points() const
pts[3] = origin_ + point(0, span_.y(), 0); pts[3] = origin_ + point(0, span_.y(), 0);
} }
return tPts; return tpts;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,11 +30,21 @@ Description
Plate defined as origin and span. One of the components of span has Plate defined as origin and span. One of the components of span has
to be 0 which defines the normal direction. E.g. to be 0 which defines the normal direction. E.g.
\verbatim
span = (Sx Sy 0) // plate in x-y plane span = (Sx Sy 0) // plate in x-y plane
origin = (Ox Oy Oz) origin = (Ox Oy Oz)
\endverbatim
now plane is from (Ox Oy Oz) to (Ox+Sx Oy+Sy Oz) now plane is from (Ox Oy Oz) to (Ox+Sx Oy+Sy Oz)
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | plate / searchablePlate | selector |
origin | centre of the plate | yes |
span | The plate dimensions | yes |
\endtable
SourceFiles SourceFiles
searchablePlate.C searchablePlate.C
@ -51,8 +61,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class searchablePlate Declaration Class searchablePlate Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -72,6 +80,7 @@ private:
//- Coordinate direction which is normal //- Coordinate direction which is normal
const direction normalDir_; const direction normalDir_;
//- Names of regions
mutable wordList regions_; mutable wordList regions_;
@ -127,11 +136,12 @@ public:
//- Destructor //- Destructor
virtual ~searchablePlate(); virtual ~searchablePlate() = default;
// Member Functions // Member Functions
//- Names of regions
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below //- Whether supports volume type below

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -32,7 +32,19 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(searchableRotatedBox, 0); defineTypeNameAndDebug(searchableRotatedBox, 0);
addToRunTimeSelectionTable(searchableSurface, searchableRotatedBox, dict); addToRunTimeSelectionTable
(
searchableSurface,
searchableRotatedBox,
dict
);
addNamedToRunTimeSelectionTable
(
searchableSurface,
searchableRotatedBox,
dict,
rotatedBox
);
} }
@ -57,26 +69,20 @@ Foam::searchableRotatedBox::searchableRotatedBox
io.writeOpt(), io.writeOpt(),
false //io.registerObject(), false //io.registerObject(),
), ),
treeBoundBox(Zero, dict.lookup("span")) treeBoundBox(Zero, dict.get<vector>("span"))
), ),
transform_ transform_
( (
"rotation", "rotation",
dict.lookup("origin"), dict.get<point>("origin"),
dict.lookup("e3"), dict.get<vector>("e3"),
dict.lookup("e1") dict.get<vector>("e1")
) )
{ {
points_ = transform_.globalPosition(box_.points()); points_ = transform_.globalPosition(box_.points());
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::searchableRotatedBox::~searchableRotatedBox()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::wordList& Foam::searchableRotatedBox::regions() const const Foam::wordList& Foam::searchableRotatedBox::regions() const
@ -135,10 +141,8 @@ bool Foam::searchableRotatedBox::overlaps(const boundBox& bb) const
// 3a. my edges through bb faces // 3a. my edges through bb faces
const edgeList& edges = treeBoundBox::edges; const edgeList& edges = treeBoundBox::edges;
forAll(edges, edgeI) for (const edge& e : edges)
{ {
const edge& e = edges[edgeI];
point inter; point inter;
if (treeBb.intersects(points_[e[0]], points_[e[1]], inter)) if (treeBb.intersects(points_[e[0]], points_[e[1]], inter))
{ {
@ -150,15 +154,12 @@ bool Foam::searchableRotatedBox::overlaps(const boundBox& bb) const
const pointField bbPoints(bb.points()); const pointField bbPoints(bb.points());
forAll(fcs, faceI) for (const face& f : fcs)
{ {
const face& f = fcs[faceI];
point fc = f.centre(points_); point fc = f.centre(points_);
forAll(edges, edgeI) for (const edge& e : edges)
{ {
const edge& e = edges[edgeI];
pointHit inter = f.intersection pointHit inter = f.intersection
( (
bbPoints[e[0]], bbPoints[e[0]],

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,6 +39,16 @@ Description
e3 (0 0 1); e3 (0 0 1);
\endverbatim \endverbatim
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | rotatedBox / searchableRotatedBox | selector |
span | The box dimensions | yes |
origin | The box corner | yes |
e1 | Local x-axis of the box | yes |
e3 | Local z-axis of the box | yes |
\endtable
SourceFiles SourceFiles
searchableRotatedBox.C searchableRotatedBox.C
@ -68,13 +78,13 @@ private:
// Private Member Data // Private Member Data
//- box in local coordinate system //- Box in local coordinate system
searchableBox box_; searchableBox box_;
//- transformation from local to global coordinates //- Transformation from local to global coordinates
coordinateSystem transform_; coordinateSystem transform_;
//- (global) corner points (in treeBoundBox order) //- The (global) corner points (in treeBoundBox order)
pointField points_; pointField points_;
@ -104,11 +114,12 @@ public:
//- Destructor //- Destructor
virtual ~searchableRotatedBox(); virtual ~searchableRotatedBox() = default;
// Member Functions // Member Functions
//- Names of regions
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below //- Whether supports volume type below
@ -236,8 +247,8 @@ public:
// cannot be determined (e.g. non-manifold surface) // cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField&, const pointField& points,
List<volumeType>& List<volumeType>& volType
) const; ) const;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,10 +30,20 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(searchableSphere, 0);
defineTypeNameAndDebug(searchableSphere, 0); addToRunTimeSelectionTable
addToRunTimeSelectionTable(searchableSurface, searchableSphere, dict); (
searchableSurface,
searchableSphere,
dict
);
addNamedToRunTimeSelectionTable
(
searchableSurface,
searchableSphere,
dict,
sphere
);
} }
@ -148,8 +158,8 @@ Foam::searchableSphere::searchableSphere
) )
: :
searchableSurface(io), searchableSurface(io),
centre_(dict.lookup("centre")), centre_(dict.get<point>("centre")),
radius_(readScalar(dict.lookup("radius"))) radius_(dict.get<scalar>("radius"))
{ {
bounds() = boundBox bounds() = boundBox
( (
@ -159,12 +169,6 @@ Foam::searchableSphere::searchableSphere
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::searchableSphere::~searchableSphere()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::searchableSphere::overlaps(const boundBox& bb) const bool Foam::searchableSphere::overlaps(const boundBox& bb) const
@ -351,20 +355,18 @@ void Foam::searchableSphere::getVolumeType
) const ) const
{ {
volType.setSize(points.size()); volType.setSize(points.size());
volType = volumeType::INSIDE;
const scalar rad2 = sqr(radius_);
forAll(points, pointi) forAll(points, pointi)
{ {
const point& pt = points[pointi]; const point& pt = points[pointi];
if (magSqr(pt - centre_) <= sqr(radius_)) volType[pointi] =
{ (
volType[pointi] = volumeType::INSIDE; (magSqr(pt - centre_) <= rad2)
} ? volumeType::INSIDE : volumeType::OUTSIDE
else );
{
volType[pointi] = volumeType::OUTSIDE;
}
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,6 +27,14 @@ Class
Description Description
Searching on sphere Searching on sphere
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | sphere / searchableSphere | selector |
centre | The sphere centre | yes |
radius | The (outside) radius of sphere | yes |
\endtable
SourceFiles SourceFiles
searchableSphere.C searchableSphere.C
@ -43,8 +51,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class searchableSphere Declaration Class searchableSphere Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -57,10 +63,10 @@ private:
// Private Member Data // Private Member Data
//- Centre point //- Centre point of the sphere
const point centre_; const point centre_;
//- Radius //- The outer radius of the sphere
const scalar radius_; const scalar radius_;
//- Names of regions //- Names of regions
@ -105,7 +111,12 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
searchableSphere(const IOobject& io, const point&, const scalar radius); searchableSphere
(
const IOobject& io,
const point& centre,
const scalar radius
);
//- Construct from dictionary (used by searchableSurface) //- Construct from dictionary (used by searchableSurface)
searchableSphere searchableSphere
@ -114,15 +125,17 @@ public:
const dictionary& dict const dictionary& dict
); );
//- Destructor //- Destructor
virtual ~searchableSphere(); virtual ~searchableSphere() = default;
// Member Functions // Member Functions
//- Names of regions
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below //- Whether supports volume type (below)
virtual bool hasVolumeType() const virtual bool hasVolumeType() const
{ {
return true; return true;
@ -138,8 +151,7 @@ public:
// Usually the element centres (should be of length size()). // Usually the element centres (should be of length size()).
virtual tmp<pointField> coordinates() const virtual tmp<pointField> coordinates() const
{ {
tmp<pointField> tCtrs(new pointField(1, centre_)); return tmp<pointField>::New(1, centre_);
return tCtrs;
} }
//- Get bounding spheres (centre and radius squared), one per element. //- Get bounding spheres (centre and radius squared), one per element.
@ -205,12 +217,12 @@ public:
vectorField& normal vectorField& normal
) const; ) const;
//- Determine type (inside/outside/mixed) for point. unknown if //- Determine type (inside/outside/mixed) for point.
// cannot be determined (e.g. non-manifold surface) // Unknown if cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField&, const pointField& points,
List<volumeType>& List<volumeType>& volType
) const; ) const;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -67,14 +67,14 @@ Foam::searchableSurface::searchableSurface(const IOobject& io)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::searchableSurface::~searchableSurface()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::searchableSurface::hasVolumeType() const
{
return false;
}
void Foam::searchableSurface::findNearest void Foam::searchableSurface::findNearest
( (
const pointField& sample, const pointField& sample,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -55,7 +55,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class objectRegistry; class objectRegistry;
class mapDistribute; class mapDistribute;
class treeBoundBox; class treeBoundBox;
@ -155,7 +155,7 @@ public:
//- Destructor //- Destructor
virtual ~searchableSurface(); virtual ~searchableSurface() = default;
// Member Functions // Member Functions
@ -188,8 +188,9 @@ public:
//- Names of regions //- Names of regions
virtual const wordList& regions() const = 0; virtual const wordList& regions() const = 0;
//- Whether supports volume type below //- Whether supports volume type (below).
virtual bool hasVolumeType() const = 0; // This is false for the base class.
virtual bool hasVolumeType() const;
//- Range of local indices that can be returned //- Range of local indices that can be returned
virtual label size() const = 0; virtual label size() const = 0;
@ -335,8 +336,8 @@ public:
vectorField& normal vectorField& normal
) const = 0; ) const = 0;
//- Determine type (inside/outside) for point. unknown if //- Determine type (inside/outside) for point.
// cannot be determined (e.g. non-manifold surface) // Unknown if cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField&, const pointField&,

View File

@ -33,15 +33,13 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(searchableSurfaceCollection, 0);
defineTypeNameAndDebug(searchableSurfaceCollection, 0); addToRunTimeSelectionTable
addToRunTimeSelectionTable (
(
searchableSurface, searchableSurface,
searchableSurfaceCollection, searchableSurfaceCollection,
dict dict
); );
} }
@ -182,7 +180,7 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
scale_(dict.size()), scale_(dict.size()),
transform_(dict.size()), transform_(dict.size()),
subGeom_(dict.size()), subGeom_(dict.size()),
mergeSubRegions_(dict.lookup("mergeSubRegions")), mergeSubRegions_(dict.get<bool>("mergeSubRegions")),
indexOffset_(dict.size()+1) indexOffset_(dict.size()+1)
{ {
Info<< "SearchableCollection : " << name() << endl; Info<< "SearchableCollection : " << name() << endl;
@ -197,7 +195,7 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
const dictionary& subDict = dict.subDict(instance_[surfI]); const dictionary& subDict = dict.subDict(instance_[surfI]);
scale_[surfI] = subDict.lookup("scale"); subDict.read("scale", scale_[surfI]);
transform_.set transform_.set
( (
surfI, surfI,
@ -207,7 +205,7 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
) )
); );
const word subGeomName(subDict.lookup("surface")); const word subGeomName(subDict.get<word>("surface"));
//Pout<< "Trying to find " << subGeomName << endl; //Pout<< "Trying to find " << subGeomName << endl;
const searchableSurface& s = const searchableSurface& s =
@ -223,7 +221,7 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
<< exit(FatalError); << exit(FatalError);
} }
subGeom_.set(surfI, &const_cast<searchableSurface&>(s)); subGeom_.set(surfI, &(const_cast<searchableSurface&>(s)));
indexOffset_[surfI] = startIndex; indexOffset_[surfI] = startIndex;
startIndex += subGeom_[surfI].size(); startIndex += subGeom_[surfI].size();
@ -303,9 +301,9 @@ const Foam::wordList& Foam::searchableSurfaceCollection::regions() const
{ {
const wordList& subRegions = subGeom_[surfI].regions(); const wordList& subRegions = subGeom_[surfI].regions();
forAll(subRegions, i) for (const word& regionName : subRegions)
{ {
allRegions.append(instance_[surfI] + "_" + subRegions[i]); allRegions.append(instance_[surfI] + "_" + regionName);
} }
} }
} }
@ -324,8 +322,8 @@ Foam::label Foam::searchableSurfaceCollection::size() const
Foam::tmp<Foam::pointField> Foam::tmp<Foam::pointField>
Foam::searchableSurfaceCollection::coordinates() const Foam::searchableSurfaceCollection::coordinates() const
{ {
tmp<pointField> tCtrs(new pointField(size())); auto tctrs = tmp<pointField>::New(size());
pointField& ctrs = tCtrs.ref(); auto& ctrs = tctrs.ref();
// Append individual coordinates // Append individual coordinates
label coordI = 0; label coordI = 0;
@ -347,7 +345,7 @@ Foam::searchableSurfaceCollection::coordinates() const
} }
} }
return tCtrs; return tctrs;
} }
@ -399,8 +397,8 @@ Foam::searchableSurfaceCollection::points() const
nPoints += subGeom_[surfI].points()().size(); nPoints += subGeom_[surfI].points()().size();
} }
tmp<pointField> tPts(new pointField(nPoints)); auto tpts = tmp<pointField>::New(nPoints);
pointField& pts = tPts.ref(); auto& pts = tpts.ref();
// Append individual coordinates // Append individual coordinates
nPoints = 0; nPoints = 0;
@ -422,7 +420,7 @@ Foam::searchableSurfaceCollection::points() const
} }
} }
return tPts; return tpts;
} }

View File

@ -28,6 +28,13 @@ Description
Set of transformed searchableSurfaces. Does not do boolean operations Set of transformed searchableSurfaces. Does not do boolean operations
so when meshing might find parts 'inside'. so when meshing might find parts 'inside'.
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | searchableSurfaceCollection | selector |
mergeSubRegions | boolean | yes |
\endtable
SourceFiles SourceFiles
searchableSurfaceCollection.C searchableSurfaceCollection.C
@ -40,7 +47,6 @@ SourceFiles
#include "treeBoundBox.H" #include "treeBoundBox.H"
#include "coordinateSystem.H" #include "coordinateSystem.H"
#include "UPtrList.H" #include "UPtrList.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -70,13 +76,13 @@ class searchableSurfaceCollection
UPtrList<searchableSurface> subGeom_; UPtrList<searchableSurface> subGeom_;
Switch mergeSubRegions_; bool mergeSubRegions_;
//- Offsets for indices coming from different surfaces //- Offsets for indices coming from different surfaces
// (sized with size() of each surface) // (sized with size() of each surface)
labelList indexOffset_; labelList indexOffset_;
//- Region names //- Names of regions
mutable wordList regions_; mutable wordList regions_;
//- From individual regions to collection regions //- From individual regions to collection regions
@ -164,9 +170,10 @@ public:
return transform_; return transform_;
} }
//- Names of regions
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below //- Whether supports volume type (below)
virtual bool hasVolumeType() const virtual bool hasVolumeType() const
{ {
return false; return false;
@ -194,7 +201,6 @@ public:
virtual bool overlaps(const boundBox& bb) const virtual bool overlaps(const boundBox& bb) const
{ {
NotImplemented; NotImplemented;
return false; return false;
} }
@ -244,12 +250,12 @@ public:
vectorField& normal vectorField& normal
) const; ) const;
//- Determine type (inside/outside/mixed) for point. unknown if //- Determine type (inside/outside/mixed) for point.
// cannot be determined (e.g. non-manifold surface) // Unknown if cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField&, const pointField& points,
List<volumeType>& List<volumeType>& volType
) const; ) const;
// Other // Other

View File

@ -32,10 +32,13 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(searchableSurfaceWithGaps, 0);
defineTypeNameAndDebug(searchableSurfaceWithGaps, 0); addToRunTimeSelectionTable
addToRunTimeSelectionTable(searchableSurface, searchableSurfaceWithGaps, dict); (
searchableSurface,
searchableSurfaceWithGaps,
dict
);
} }
@ -178,26 +181,21 @@ Foam::searchableSurfaceWithGaps::searchableSurfaceWithGaps
) )
: :
searchableSurface(io), searchableSurface(io),
gap_(readScalar(dict.lookup("gap"))), gap_(dict.get<scalar>("gap")),
subGeom_(1) subGeom_(1)
{ {
const word subGeomName(dict.lookup("surface")); const word subGeomName(dict.get<word>("surface"));
const searchableSurface& s = subGeom_.set
io.db().lookupObject<searchableSurface>(subGeomName); (
0,
subGeom_.set(0, &const_cast<searchableSurface&>(s)); io.db().lookupObjectRefPtr<searchableSurface>(subGeomName)
);
bounds() = subGeom_[0].bounds(); bounds() = subGeom_[0].bounds();
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::searchableSurfaceWithGaps::~searchableSurfaceWithGaps()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::searchableSurfaceWithGaps::findLine void Foam::searchableSurfaceWithGaps::findLine

View File

@ -43,13 +43,19 @@ Description
sphere sphere
{ {
type searchableSurfaceWithGaps; type searchableSurfaceWithGaps;
// Underlying surface surface sphere.stl; // Underlying surface
surface sphere.stl; gap 1e-3; // Perturb distance
// Perturb distance
gap 1e-3;
} }
\endverbatim \endverbatim
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | searchableSurfaceWithGaps | selector |
surface | Name of the underlying surface | yes |
gap | Gap tolerance in meters | yes |
\endtable
SourceFiles SourceFiles
searchableSurfaceWithGaps.C searchableSurfaceWithGaps.C
@ -67,8 +73,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class searchableSurfaceWithGaps Declaration Class searchableSurfaceWithGaps Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -137,23 +141,24 @@ public:
); );
//- Destructor //- Destructor
virtual ~searchableSurfaceWithGaps(); virtual ~searchableSurfaceWithGaps() = default;
// Member Functions // Member Functions
//- The underlying searchableSurface
const searchableSurface& surface() const const searchableSurface& surface() const
{ {
return subGeom_[0]; return subGeom_[0];
} }
//- Name of regions
virtual const wordList& regions() const virtual const wordList& regions() const
{ {
return surface().regions(); return surface().regions();
} }
//- Whether supports volume type below //- Whether supports volume type (below)
virtual bool hasVolumeType() const virtual bool hasVolumeType() const
{ {
return surface().hasVolumeType(); return surface().hasVolumeType();
@ -259,8 +264,8 @@ public:
surface().getNormal(info, normal); surface().getNormal(info, normal);
} }
//- Determine type (inside/outside/mixed) for point. unknown if //- Determine type (inside/outside/mixed) for points.
// cannot be determined (e.g. non-manifold surface) // Unknown if cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField& samples, const pointField& samples,

View File

@ -65,7 +65,6 @@ bool Foam::searchableSurfaces::connected
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct with length.
Foam::searchableSurfaces::searchableSurfaces(const label size) Foam::searchableSurfaces::searchableSurfaces(const label size)
: :
PtrList<searchableSurface>(size), PtrList<searchableSurface>(size),
@ -90,7 +89,7 @@ Foam::searchableSurfaces::searchableSurfaces(const label size)
// //
// // Make IOobject with correct name // // Make IOobject with correct name
// autoPtr<IOobject> namedIO(io.clone()); // autoPtr<IOobject> namedIO(io.clone());
// namedIO().rename(dict.lookup("name")); // namedIO().rename(dict.get<word>("name"));
// //
// // Create and hook surface // // Create and hook surface
// set // set
@ -98,7 +97,7 @@ Foam::searchableSurfaces::searchableSurfaces(const label size)
// surfI, // surfI,
// searchableSurface::New // searchableSurface::New
// ( // (
// dict.lookup("type"), // dict.get<word>("type"),
// namedIO(), // namedIO(),
// dict // dict
// ) // )
@ -140,7 +139,7 @@ Foam::searchableSurfaces::searchableSurfaces(const label size)
// << exit(FatalError); // << exit(FatalError);
// } // }
// //
// globalNames[index] = word(regionDict.lookup("name")); // globalNames[index] = regionDict.get<word>("name");
// } // }
// } // }
// } // }
@ -193,8 +192,7 @@ Foam::searchableSurfaces::searchableSurfaces
const dictionary& dict = topDict.subDict(key); const dictionary& dict = topDict.subDict(key);
names_[surfI] = key; names_[surfI] = dict.lookupOrDefault<word>("name", key);
dict.readIfPresent("name", names_[surfI]);
// Make IOobject with correct name // Make IOobject with correct name
autoPtr<IOobject> namedIO(io.clone()); autoPtr<IOobject> namedIO(io.clone());
@ -211,7 +209,7 @@ Foam::searchableSurfaces::searchableSurfaces
surfI, surfI,
searchableSurface::New searchableSurface::New
( (
dict.lookup("type"), dict.get<word>("type"),
namedIO(), namedIO(),
dict dict
) )
@ -262,7 +260,7 @@ Foam::searchableSurfaces::searchableSurfaces
<< exit(FatalError); << exit(FatalError);
} }
rNames[index] = word(regionDict.lookup("name")); rNames[index] = regionDict.get<word>("name");
} }
} }
} }

View File

@ -26,6 +26,28 @@ Class
Description Description
Container for searchableSurfaces. Container for searchableSurfaces.
The collection is specified as a dictionary. For example,
\verbatim
geometry
{
surface1
{
type ...;
}
surface2
{
type ...;
}
}
\endverbatim
\heading The Sub-dictionary parameters
\table
Property | Description | Required | Default
name | alternative name for surface | no | dict name
regions | Region names sub-dictionary | no |
\endtable
SourceFiles SourceFiles
searchableSurfaces.C searchableSurfaces.C
@ -44,7 +66,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class triSurface; class triSurface;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -99,9 +121,10 @@ public:
////- Construct from list of dictionaries ////- Construct from list of dictionaries
//searchableSurfaces(const IOobject&, const PtrList<dictionary>&); //searchableSurfaces(const IOobject&, const PtrList<dictionary>&);
//- Construct from dictionary and whether to construct names always //- Construct from dictionary.
// as surfaceName "_" regionName (singleRegionName false) or // \param singleRegionName controls if names are constructed as
// for single region surfaces as surfaceName only (singleRegionName // surfaceName "_" regionName (singleRegionName false) or for
// single region surfaces as surfaceName only (singleRegionName
// true) // true)
searchableSurfaces searchableSurfaces
( (
@ -113,21 +136,25 @@ public:
// Member Functions // Member Functions
//- Surface names, not region names
const wordList& names() const const wordList& names() const
{ {
return names_; return names_;
} }
//- Surface names, not region names
wordList& names() wordList& names()
{ {
return names_; return names_;
} }
//- Region names per surface
const List<wordList>& regionNames() const const List<wordList>& regionNames() const
{ {
return regionNames_; return regionNames_;
} }
//- Region names per surface
List<wordList>& regionNames() List<wordList>& regionNames()
{ {
return regionNames_; return regionNames_;

View File

@ -659,14 +659,14 @@ void Foam::searchableSurfacesQueries::signedDistance
Foam::boundBox Foam::searchableSurfacesQueries::bounds Foam::boundBox Foam::searchableSurfacesQueries::bounds
( (
const PtrList<searchableSurface>& allSurfaces, const PtrList<searchableSurface>& allSurfaces,
const labelList& surfacesToTest const labelUList& surfacesToTest
) )
{ {
boundBox bb(boundBox::invertedBox); boundBox bb(boundBox::invertedBox);
forAll(surfacesToTest, testi) for (const label surfi : surfacesToTest)
{ {
bb.add(allSurfaces[surfacesToTest[testi]].bounds()); bb.add(allSurfaces[surfi].bounds());
} }
return bb; return bb;

View File

@ -42,7 +42,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class plane; class plane;
class pointConstraint; class pointConstraint;
@ -171,7 +171,7 @@ public:
static boundBox bounds static boundBox bounds
( (
const PtrList<searchableSurface>& allSurfaces, const PtrList<searchableSurface>& allSurfaces,
const labelList& surfacesToTest const labelUList& surfacesToTest
); );
}; };

View File

@ -30,22 +30,26 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(subTriSurfaceMesh, 0);
defineTypeNameAndDebug(subTriSurfaceMesh, 0); addToRunTimeSelectionTable
addToRunTimeSelectionTable(searchableSurface, subTriSurfaceMesh, dict); (
searchableSurface,
subTriSurfaceMesh,
dict
);
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::wordList Foam::subTriSurfaceMesh::patchNames(const triSurface& s) Foam::wordList Foam::subTriSurfaceMesh::patchNames(const triSurface& s)
{ {
const geometricSurfacePatchList& patches = s.patches(); const auto& patches = s.patches();
wordList names(patches.size()); wordList names(patches.size());
forAll(patches, patchI) forAll(patches, patchi)
{ {
names[patchI] = patches[patchI].name(); names[patchi] = patches[patchi].name();
} }
return names; return names;
} }
@ -54,30 +58,25 @@ Foam::wordList Foam::subTriSurfaceMesh::patchNames(const triSurface& s)
Foam::labelList Foam::subTriSurfaceMesh::selectedRegions Foam::labelList Foam::subTriSurfaceMesh::selectedRegions
( (
const triSurface& s, const triSurface& s,
const UList<wordRe>& regionNames const wordRes& regionNameMatcher
) )
{ {
const wordList names(patchNames(s)); const wordList names(patchNames(s));
labelList regions(names.size()); labelList regionIds(names.size());
label compactI = 0; label count = 0;
forAll(names, regionI) forAll(names, regioni)
{ {
const word& name = names[regionI]; if (regionNameMatcher.match(names[regioni]))
forAll(regionNames, i)
{ {
if (regionNames[i].match(name)) regionIds[count++] = regioni;
{
regions[compactI++] = regionI;
} }
} }
} regionIds.setSize(count);
regions.setSize(compactI);
return regions; return regionIds;
} }
@ -87,16 +86,16 @@ Foam::triSurface Foam::subTriSurfaceMesh::subset
const dictionary& dict const dictionary& dict
) )
{ {
const word subGeomName(dict.lookup("surface")); const word subGeomName(dict.get<word>("surface"));
const triSurfaceMesh& s = const triSurfaceMesh& s =
io.db().lookupObject<triSurfaceMesh>(subGeomName); io.db().lookupObject<triSurfaceMesh>(subGeomName);
const wordRes regionNames(dict.lookup("patches")); const wordRes regionNames(dict.get<wordRes>("patches"));
labelList regionMap(selectedRegions(s, regionNames)); labelList regionMap(selectedRegions(s, regionNames));
if (regionMap.size() == 0) if (regionMap.empty())
{ {
FatalIOErrorInFunction(dict) FatalIOErrorInFunction(dict)
<< "Found no regions in triSurface matching " << regionNames << "Found no regions in triSurface matching " << regionNames

View File

@ -43,6 +43,13 @@ Note
} }
\endverbatim \endverbatim
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | subTriSurfaceMesh | selector |
surface | Name of the underlying surface | yes |
patches | List of surface region names or regexs | yes |
\endtable
SourceFiles SourceFiles
subTriSurfaceMesh.C subTriSurfaceMesh.C
@ -76,7 +83,7 @@ class subTriSurfaceMesh
static labelList selectedRegions static labelList selectedRegions
( (
const triSurface& s, const triSurface& s,
const UList<wordRe>& regionNames const wordRes& regionNameMatcher
); );
//- Subset triSurface based on regions //- Subset triSurface based on regions
@ -101,6 +108,7 @@ public:
//- Destructor //- Destructor
virtual ~subTriSurfaceMesh() = default; virtual ~subTriSurfaceMesh() = default;
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,9 +37,11 @@ namespace Foam
{ {
defineTypeNameAndDebug(triSurfaceMesh, 0); defineTypeNameAndDebug(triSurfaceMesh, 0);
addToRunTimeSelectionTable(searchableSurface, triSurfaceMesh, dict); addToRunTimeSelectionTable(searchableSurface, triSurfaceMesh, dict);
word triSurfaceMesh::meshSubDir = "triSurface";
} }
Foam::word Foam::triSurfaceMesh::meshSubDir = "triSurface";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::fileName Foam::triSurfaceMesh::checkFile Foam::fileName Foam::triSurfaceMesh::checkFile
@ -136,19 +138,13 @@ bool Foam::triSurfaceMesh::addFaceToEdge
EdgeMap<label>& facesPerEdge EdgeMap<label>& facesPerEdge
) )
{ {
EdgeMap<label>::iterator eFnd = facesPerEdge.find(e); label& count = facesPerEdge(e, 0); // lookup or new entry
if (eFnd != facesPerEdge.end()) if (count == 2)
{
if (eFnd() == 2)
{ {
return false; return false;
} }
eFnd()++;
} ++count;
else
{
facesPerEdge.insert(e, 1);
}
return true; return true;
} }
@ -172,10 +168,10 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
const labelList& pFaces = pointFaces[pointi]; const labelList& pFaces = pointFaces[pointi];
facesPerEdge.clear(); facesPerEdge.clear();
forAll(pFaces, i) for (const label facei : pFaces)
{ {
const triSurface::FaceType& f = triSurface::operator[](pFaces[i]); const triSurface::FaceType& f = triSurface::operator[](facei);
label fp = f.find(pointi); const label fp = f.find(pointi);
// Something weird: if I expand the code of addFaceToEdge in both // Something weird: if I expand the code of addFaceToEdge in both
// below instances it gives a segmentation violation on some // below instances it gives a segmentation violation on some
@ -183,7 +179,7 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
// Forward edge // Forward edge
label nextPointi = f[f.fcIndex(fp)]; const label nextPointi = f[f.fcIndex(fp)];
if (nextPointi > pointi) if (nextPointi > pointi)
{ {
@ -198,8 +194,9 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
return false; return false;
} }
} }
// Reverse edge // Reverse edge
label prevPointi = f[f.rcIndex(fp)]; const label prevPointi = f[f.rcIndex(fp)];
if (prevPointi > pointi) if (prevPointi > pointi)
{ {
@ -217,9 +214,9 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
} }
// Check for any edges used only once. // Check for any edges used only once.
forAllConstIter(EdgeMap<label>, facesPerEdge, iter) forAllConstIters(facesPerEdge, iter)
{ {
if (iter() != 2) if (iter.object() != 2)
{ {
return false; return false;
} }
@ -477,17 +474,17 @@ void Foam::triSurfaceMesh::clearOut()
Foam::tmp<Foam::pointField> Foam::triSurfaceMesh::coordinates() const Foam::tmp<Foam::pointField> Foam::triSurfaceMesh::coordinates() const
{ {
tmp<pointField> tPts(new pointField(8)); auto tpts = tmp<pointField>::New(8);
pointField& pt = tPts.ref(); auto& pts = tpts.ref();
// Use copy to calculate face centres so they don't get stored // Use copy to calculate face centres so they don't get stored
pt = PrimitivePatch<triSurface::FaceType, SubList, const pointField&> pts = PrimitivePatch<triSurface::FaceType, SubList, const pointField&>
( (
SubList<triSurface::FaceType>(*this, triSurface::size()), SubList<triSurface::FaceType>(*this, triSurface::size()),
triSurface::points() triSurface::points()
).faceCentres(); ).faceCentres();
return tPts; return tpts;
} }
@ -507,9 +504,9 @@ void Foam::triSurfaceMesh::boundingSpheres
{ {
const labelledTri& f = triSurface::operator[](facei); const labelledTri& f = triSurface::operator[](facei);
const point& fc = centres[facei]; const point& fc = centres[facei];
forAll(f, fp) for (const label pointi : f)
{ {
const point& pt = pts[f[fp]]; const point& pt = pts[pointi];
radiusSqr[facei] = max(radiusSqr[facei], Foam::magSqr(fc-pt)); radiusSqr[facei] = max(radiusSqr[facei], Foam::magSqr(fc-pt));
} }
} }
@ -543,7 +540,7 @@ void Foam::triSurfaceMesh::movePoints(const pointField& newPoints)
searchableSurface::instance() = objectRegistry::time().timeName(); searchableSurface::instance() = objectRegistry::time().timeName();
objectRegistry::instance() = searchableSurface::instance(); objectRegistry::instance() = searchableSurface::instance();
label event = getEvent(); const label event = getEvent();
searchableSurface::eventNo() = event; searchableSurface::eventNo() = event;
objectRegistry::eventNo() = searchableSurface::eventNo(); objectRegistry::eventNo() = searchableSurface::eventNo();
@ -623,9 +620,9 @@ const Foam::wordList& Foam::triSurfaceMesh::regions() const
if (regions_.empty()) if (regions_.empty())
{ {
regions_.setSize(patches().size()); regions_.setSize(patches().size());
forAll(regions_, regionI) forAll(regions_, regioni)
{ {
regions_[regionI] = patches()[regionI].name(); regions_[regioni] = patches()[regioni].name();
} }
} }
return regions_; return regions_;
@ -765,14 +762,13 @@ void Foam::triSurfaceMesh::getNormal
// Search neighbouring triangles // Search neighbouring triangles
const labelList& fFaces = faceFaces[facei]; const labelList& fFaces = faceFaces[facei];
forAll(fFaces, j) for (const label nbri : fFaces)
{ {
label nbrI = fFaces[j]; scalar nbrQual = s[nbri].tri(pts).quality();
scalar nbrQual = s[nbrI].tri(pts).quality();
if (nbrQual > qual) if (nbrQual > qual)
{ {
qual = nbrQual; qual = nbrQual;
normal[i] = s[nbrI].normal(pts); normal[i] = s[nbri].normal(pts);
} }
} }
} }
@ -792,7 +788,7 @@ void Foam::triSurfaceMesh::getNormal
{ {
if (info[i].hit()) if (info[i].hit())
{ {
label facei = info[i].index(); const label facei = info[i].index();
// Cached: // Cached:
//normal[i] = faceNormals()[facei]; //normal[i] = faceNormals()[facei];
@ -812,22 +808,14 @@ void Foam::triSurfaceMesh::getNormal
void Foam::triSurfaceMesh::setField(const labelList& values) void Foam::triSurfaceMesh::setField(const labelList& values)
{ {
if (foundObject<triSurfaceLabelField>("values")) if (foundObject<triSurfaceLabelField>("values"))
{ {
triSurfaceLabelField& fld = const_cast<triSurfaceLabelField&> lookupObjectRef<triSurfaceLabelField>("values").field() = values;
(
lookupObject<triSurfaceLabelField>
(
"values"
)
);
fld.field() = values;
} }
else else
{ {
autoPtr<triSurfaceLabelField> fldPtr auto fldPtr = autoPtr<triSurfaceLabelField>::New
(
new triSurfaceLabelField
( (
IOobject IOobject
( (
@ -841,7 +829,6 @@ void Foam::triSurfaceMesh::setField(const labelList& values)
*this, *this,
dimless, dimless,
labelField(values) labelField(values)
)
); );
// Store field on triMesh // Store field on triMesh
@ -858,12 +845,9 @@ void Foam::triSurfaceMesh::getField
{ {
if (foundObject<triSurfaceLabelField>("values")) if (foundObject<triSurfaceLabelField>("values"))
{ {
values.setSize(info.size()); const auto& fld = lookupObject<triSurfaceLabelField>("values");
const triSurfaceLabelField& fld = lookupObject<triSurfaceLabelField> values.setSize(info.size());
(
"values"
);
forAll(info, i) forAll(info, i)
{ {
@ -882,18 +866,21 @@ void Foam::triSurfaceMesh::getVolumeType
List<volumeType>& volType List<volumeType>& volType
) const ) const
{ {
volType.setSize(points.size()); const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance(); indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
volType.setSize(points.size());
forAll(points, pointi) forAll(points, pointi)
{ {
const point& pt = points[pointi]; const point& pt = points[pointi];
if (!tree().bb().contains(pt)) if (tree().bb().contains(pt))
{ {
if (hasVolumeType()) // Use cached volume type per each tree node
volType[pointi] = tree().getVolumeType(pt);
}
else if (hasVolumeType())
{ {
// Precalculate and cache value for this outside point // Precalculate and cache value for this outside point
if (outsideVolType_ == volumeType::UNKNOWN) if (outsideVolType_ == volumeType::UNKNOWN)
@ -908,12 +895,6 @@ void Foam::triSurfaceMesh::getVolumeType
volType[pointi] = tree().shapes().getVolumeType(tree(), pt); volType[pointi] = tree().shapes().getVolumeType(tree(), pt);
} }
} }
else
{
// - use cached volume type per each tree node
volType[pointi] = tree().getVolumeType(pt);
}
}
indexedOctree<treeDataTriSurface>::perturbTol() = oldTol; indexedOctree<treeDataTriSurface>::perturbTol() = oldTol;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,12 +27,21 @@ Class
Description Description
IOoject and searching on triSurface IOoject and searching on triSurface
Note: when constructing from dictionary has optional parameters: Note: when constructing from dictionary has the following parameters:
- scale : scaling factor. - scale : scaling factor.
- tolerance : relative tolerance for doing intersections - tolerance : relative tolerance for doing intersections
(see triangle::intersection) (see triangle::intersection)
- minQuality: discard triangles with low quality when getting normal - minQuality: discard triangles with low quality when getting normal
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | triSurfaceMesh | selector |
file | File name to locate the surface | no |
scale | Scaling factor | no | 0
minQuality | Quality criterion | no | -1
\endtable
SourceFiles SourceFiles
triSurfaceMesh.C triSurfaceMesh.C
@ -183,6 +192,7 @@ public:
//- Destructor //- Destructor
virtual ~triSurfaceMesh(); virtual ~triSurfaceMesh();
//- Clear storage //- Clear storage
void clearOut(); void clearOut();
@ -198,9 +208,10 @@ public:
// searchableSurface implementation // searchableSurface implementation
//- Names of regions
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below. I.e. whether is closed. //- Whether supports volume type (below) - i.e. whether is closed.
virtual bool hasVolumeType() const; virtual bool hasVolumeType() const;
//- Range of local indices that can be returned. //- Range of local indices that can be returned.
@ -278,12 +289,12 @@ public:
vectorField& normal vectorField& normal
) const; ) const;
//- Determine type (inside/outside/mixed) for point. unknown if //- Determine type (inside/outside/mixed) for point.
// cannot be determined (e.g. non-manifold surface) // Unknown if cannot be determined (e.g. non-manifold surface)
virtual void getVolumeType virtual void getVolumeType
( (
const pointField&, const pointField& points,
List<volumeType>& List<volumeType>& volType
) const; ) const;

View File

@ -59,8 +59,7 @@ geometry
type triSurfaceMesh; type triSurfaceMesh;
name walls; name walls;
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -30,12 +30,11 @@ geometry
{ {
box1 //0.6x1x0.02 [cm] box1 //0.6x1x0.02 [cm]
{ {
type searchableBox; type box;
min (-0.1 -0.01 -0.1); min (-0.1 -0.01 -0.1);
max (0.1 0.30 0.1); max (0.1 0.30 0.1);
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -61,7 +61,7 @@ geometry
type triSurfaceMesh; type triSurfaceMesh;
file "membrane-membrane.stl"; file "membrane-membrane.stl";
} }
}; }
castellatedMeshControls castellatedMeshControls
{ {

View File

@ -55,7 +55,7 @@ geometry
} }
cylinder cylinder
{ {
type searchableCylinder; type cylinder;
point1 ($:aerofoil.xUpper -1e3 0); point1 ($:aerofoil.xUpper -1e3 0);
point2 ($:aerofoil.xUpper 1e3 0); point2 ($:aerofoil.xUpper 1e3 0);
radius $:domain.zMax; radius $:domain.zMax;

View File

@ -73,7 +73,7 @@ geometry
type triSurfaceMesh; type triSurfaceMesh;
name walls; name walls;
} }
}; }
castellatedMeshControls castellatedMeshControls
{ {

View File

@ -55,7 +55,7 @@ geometry
} }
cylinder cylinder
{ {
type searchableCylinder; type cylinder;
point1 ($:aerofoil.xUpper -1e3 0); point1 ($:aerofoil.xUpper -1e3 0);
point2 ($:aerofoil.xUpper 1e3 0); point2 ($:aerofoil.xUpper 1e3 0);
radius $:domain.zMax; radius $:domain.zMax;

View File

@ -57,12 +57,11 @@ geometry
refinementBox refinementBox
{ {
type searchableBox; type box;
min (-0.5 -0.125 -0.25); min (-0.5 -0.125 -0.25);
max (1.5 0.125 0.25); max (1.5 0.125 0.25);
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -30,14 +30,14 @@ geometry
{ {
igloo igloo
{ {
type searchableSphere; type sphere;
centre (3 3 0); centre (3 3 0);
radius 4; radius 4;
} }
box1 box1
{ {
type searchableBox; type box;
min (0 0 0); min (0 0 0);
max (1 1 1); max (1 1 1);
} }
@ -87,8 +87,7 @@ geometry
} }
} }
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -34,8 +34,7 @@ geometry
type triSurfaceMesh; type triSurfaceMesh;
name geom; name geom;
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -33,7 +33,7 @@ geometry
type triSurfaceMesh; type triSurfaceMesh;
name building; name building;
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -35,11 +35,11 @@ geometry
refinementBox refinementBox
{ {
type searchableBox; type box;
min (-1 -1 -1); min (-1 -1 -1);
max ( 5 1 1); max ( 5 1 1);
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.
castellatedMeshControls castellatedMeshControls

View File

@ -30,11 +30,11 @@ geometry
refinementBox refinementBox
{ {
type searchableBox; type box;
min (-5 -1 -1); min (-5 -1 -1);
max ( 5 1 1); max ( 5 1 1);
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.
castellatedMeshControls castellatedMeshControls

View File

@ -79,7 +79,7 @@ baffles
{ {
//- Select faces and orientation through a searchableSurface //- Select faces and orientation through a searchableSurface
type searchableSurface; type searchableSurface;
surface searchablePlate; surface plate;
origin (0.099 -0.006 0.004); origin (0.099 -0.006 0.004);
span (0 0.012 0.012); span (0 0.012 0.012);

View File

@ -112,8 +112,7 @@ geometry
} }
} }
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -36,12 +36,11 @@ geometry
refinementBox refinementBox
{ {
type searchableBox; type box;
min (-1 -1 -1); min (-1 -1 -1);
max ( 5 1 1); max ( 5 1 1);
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -794,7 +794,7 @@ boundary
/* optional /* optional
surface surface
{ {
type searchableCylinder; // none type cylinder; // none
point1 (0 0 -1); point1 (0 0 -1);
point2 (0 0 1); point2 (0 0 1);
radius 0.5; radius 0.5;
@ -821,7 +821,7 @@ boundary
/* optional /* optional
surface surface
{ {
type searchableCylinder; // none type cylinder; // none
point1 (0 0 -1); point1 (0 0 -1);
point2 (0 0 1); point2 (0 0 1);
radius 0.5; radius 0.5;

View File

@ -37,12 +37,11 @@ geometry
// Analytical shape; cylinder, sphere // Analytical shape; cylinder, sphere
refinementBox refinementBox
{ {
type searchableBox; type box;
min (-1.0 -0.7 0.0); min (-1.0 -0.7 0.0);
max ( 8.0 0.7 2.5); max ( 8.0 0.7 2.5);
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -36,12 +36,11 @@ geometry
refinementBox refinementBox
{ {
type searchableBox; type box;
min (-1.0 -0.7 0.0); min (-1.0 -0.7 0.0);
max ( 8.0 0.7 2.5); max ( 8.0 0.7 2.5);
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -38,7 +38,7 @@ geometry
type triSurfaceMesh; type triSurfaceMesh;
name rotatingZone; name rotatingZone;
} }
}; }
castellatedMeshControls castellatedMeshControls
{ {

View File

@ -31,14 +31,14 @@ geometry
{ {
windTurbine1 windTurbine1
{ {
type searchableBox; type box;
min (581845 4785805 1061); min (581845 4785805 1061);
max (581855 4785815 1071); max (581855 4785815 1071);
} }
windTurbine2 windTurbine2
{ {
type searchableBox; type box;
min (581740 4785658 1065); min (581740 4785658 1065);
max (581771 4785671 1079); max (581771 4785671 1079);
} }
@ -48,8 +48,7 @@ geometry
type triSurfaceMesh; type triSurfaceMesh;
name terrain; name terrain;
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -30,11 +30,11 @@ geometry
refinementBox refinementBox
{ {
type searchableBox; type box;
min ( 0 0 0); min ( 0 0 0);
max (250 180 90); max (250 180 90);
} }
}; }
castellatedMeshControls castellatedMeshControls
{ {

View File

@ -34,8 +34,7 @@ geometry
type triSurfaceMesh; type triSurfaceMesh;
name walls; name walls;
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -810,7 +810,7 @@ boundary
/* optional /* optional
surface surface
{ {
type searchableCylinder; // none type cylinder; // none
point1 (0 0 -1); point1 (0 0 -1);
point2 (0 0 1); point2 (0 0 1);
radius 0.5; radius 0.5;
@ -837,7 +837,7 @@ boundary
/* optional /* optional
surface surface
{ {
type searchableCylinder; // none type cylinder; // none
point1 (0 0 -1); point1 (0 0 -1);
point2 (0 0 1); point2 (0 0 1);
radius 0.5; radius 0.5;

View File

@ -18,20 +18,20 @@ geometry
{ {
cylinder cylinder
{ {
type searchableCylinder; type cylinder;
point1 (0 -4 0); point1 (0 -4 0);
point2 (0 4 0); point2 (0 4 0);
radius 0.7; radius 0.7;
} }
cylinder2 cylinder2
{ {
type searchableExtrudedCircle; type extrudedCircle;
file "curve2.vtk"; file "curve2.vtk";
radius 0.5; radius 0.5;
} }
inletPlane inletPlane
{ {
type searchablePlate; type plate;
origin (-4 -50 -50); origin (-4 -50 -50);
span (0 100 100); span (0 100 100);
} }

View File

@ -18,7 +18,7 @@ geometry
{ {
sphere sphere
{ {
type searchableSphere; type sphere;
centre (0 0 0); centre (0 0 0);
radius 1; radius 1;
} }

View File

@ -20,7 +20,7 @@ geometry
{ {
sphere sphere
{ {
type searchableSphere; type sphere;
centre (0 0 0); centre (0 0 0);
radius 1; radius 1;
} }

View File

@ -20,14 +20,14 @@ geometry
{ {
sphere sphere
{ {
type searchableSphere; type sphere;
centre (0 0 0); centre (0 0 0);
radius 1; radius 1;
} }
innerSphere innerSphere
{ {
type searchableSphere; type sphere;
centre (0 0 0); centre (0 0 0);
radius 0.5; radius 0.5;
} }

View File

@ -27,7 +27,7 @@ geometry
refinementBox refinementBox
{ {
type searchableBox; type box;
min (-0.2 -0.6 -0.2); min (-0.2 -0.6 -0.2);
max ( 0.4 0.2 0.35); max ( 0.4 0.2 0.35);
} }

View File

@ -36,11 +36,11 @@ geometry
// //
// refinementBox // refinementBox
// { // {
// type searchableBox; // type box;
// min (-1.0 -0.7 0.0); // min (-1.0 -0.7 0.0);
// max ( 8.0 0.7 2.5); // max ( 8.0 0.7 2.5);
// } // }
}; }

View File

@ -34,11 +34,10 @@ geometry
// Outside of domain // Outside of domain
domain domain
{ {
type searchableBox; type box;
min (-0.7 -0.9 -1); min (-0.7 -0.9 -1);
max (1.3 1.1 1); max (1.3 1.1 1);
} }
} }

View File

@ -25,7 +25,7 @@ geometry
refinementBox refinementBox
{ {
type searchableBox; type box;
min (0.25 0.25 -1000); min (0.25 0.25 -1000);
max (0.75 0.75 1000); max (0.75 0.75 1000);
} }

View File

@ -30,7 +30,7 @@ geometry
{ {
v_dualWing v_dualWing
{ {
type searchableCylinder; type cylinder;
name v_dualWing; name v_dualWing;
point1 (-0.43 0 -10); point1 (-0.43 0 -10);
point2 (-0.43 0 10); point2 (-0.43 0 10);
@ -40,7 +40,7 @@ geometry
v_rotor v_rotor
{ {
type searchableCylinder; type cylinder;
name v_rotor; name v_rotor;
point1 (0 0 -10); point1 (0 0 -10);
point2 (0 0 10); point2 (0 0 10);
@ -48,19 +48,19 @@ geometry
} }
wing1 wing1
{ {
type searchableBox; type box;
name wing1; name wing1;
min (-0.5 -0.01 -10); min (-0.5 -0.01 -10);
max (-0.44 0.01 10); max (-0.44 0.01 10);
} }
wing2 wing2
{ {
type searchableBox; type box;
name wing2; name wing2;
min (-0.42 -0.0025 -10); min (-0.42 -0.0025 -10);
max (-0.36 0.0025 10); max (-0.36 0.0025 10);
} }
}; }

View File

@ -23,7 +23,7 @@ addLayers true;
// Geometry. Definition of all surfaces. All surfaces are of class // Geometry. Definition of all surfaces. All surfaces are of class
// searchableSurface. // searchableSurface.
geometry geometry
{}; {}

View File

@ -35,12 +35,11 @@ geometry
} }
wake wake
{ {
type searchableBox; type box;
min (0.8 -0.1 -0.1); min (0.8 -0.1 -0.1);
max (2.0 0.1 0.1); max (2.0 0.1 0.1);
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -38,12 +38,11 @@ geometry
//- Refine a bit extra around the small centre hole //- Refine a bit extra around the small centre hole
refineHole refineHole
{ {
type searchableSphere; type sphere;
centre (0 0 -0.012); centre (0 0 -0.012);
radius 0.003; radius 0.003;
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -34,13 +34,11 @@ geometry
} }
all all
{ {
type searchableBox; type box;
min (-1000 -1000 -1000); min (-1000 -1000 -1000);
max (1000 1000 1000); max (1000 1000 1000);
} }
}
};
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -39,8 +39,7 @@ geometry
type wall; type wall;
} }
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -39,8 +39,7 @@ geometry
type wall; type wall;
} }
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -27,7 +27,7 @@ baffles
{ {
//- Select faces and orientation through a searchableSurface //- Select faces and orientation through a searchableSurface
type searchableSurface; type searchableSurface;
surface searchablePlate; surface plate;
origin (0.3042 0.0493 -100); origin (0.3042 0.0493 -100);
span (0 0.1584 200); span (0 0.1584 200);

View File

@ -130,7 +130,8 @@ geometry
name rotating; name rotating;
type triSurfaceMesh; type triSurfaceMesh;
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.
castellatedMeshControls castellatedMeshControls

View File

@ -33,7 +33,7 @@ geometry
type triSurfaceMesh; type triSurfaceMesh;
name motorBike; name motorBike;
} }
}; }
//// Optional: avoid patch-face merging. Allows mesh to be used for //// Optional: avoid patch-face merging. Allows mesh to be used for

View File

@ -30,7 +30,7 @@ geometry
{ {
cylinder cylinder
{ {
type searchableCylinder; type cylinder;
point1 (0 0 -1); point1 (0 0 -1);
point2 (0 0 1); point2 (0 0 1);
radius $radius; radius $radius;

View File

@ -27,7 +27,7 @@ geometry
type closedTriSurfaceMesh; type closedTriSurfaceMesh;
name sloshingCylinder; name sloshingCylinder;
} }
}; }
castellatedMeshControls castellatedMeshControls
{ {

View File

@ -112,7 +112,7 @@ geometry
} }
} }
} }
}; }

View File

@ -45,20 +45,19 @@ geometry
refinement1 refinement1
{ {
type searchableSphere; type sphere;
centre (0 0 0.0025); centre (0 0 0.0025);
radius 0.0075; radius 0.0075;
} }
refinement2 refinement2
{ {
type searchableCylinder; type cylinder;
point1 (0 0 0); point1 (0 0 0);
point2 (0 0 0.03); point2 (0 0 0.03);
radius 0.0075; radius 0.0075;
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -794,7 +794,7 @@ boundary
/* optional /* optional
surface surface
{ {
type searchableCylinder; // none type cylinder; // none
point1 (0 0 -1); point1 (0 0 -1);
point2 (0 0 1); point2 (0 0 1);
radius 0.5; radius 0.5;
@ -821,7 +821,7 @@ boundary
/* optional /* optional
surface surface
{ {
type searchableCylinder; // none type cylinder; // none
point1 (0 0 -1); point1 (0 0 -1);
point2 (0 0 1); point2 (0 0 1);
radius 0.5; radius 0.5;

View File

@ -36,12 +36,11 @@ geometry
refinementBox refinementBox
{ {
type searchableBox; type box;
min (-1.0 -0.7 0.0); min (-1.0 -0.7 0.0);
max ( 8.0 0.7 2.5); max ( 8.0 0.7 2.5);
} }
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.

View File

@ -61,12 +61,11 @@ geometry
//refinementBox //refinementBox
//{ //{
// type searchableBox; // type box;
// min (-0.3 -0.4 -0.1); // min (-0.3 -0.4 -0.1);
// max ( 3.0 0.4 1.4); // max ( 3.0 0.4 1.4);
// } //}
}; }
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.