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:
parent
1ee5144079
commit
d530bc254a
@ -30,10 +30,8 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(closedTriSurfaceMesh, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, closedTriSurfaceMesh, dict);
|
||||
|
||||
defineTypeNameAndDebug(closedTriSurfaceMesh, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, closedTriSurfaceMesh, dict);
|
||||
}
|
||||
|
||||
|
||||
@ -65,10 +63,4 @@ Foam::closedTriSurfaceMesh::closedTriSurfaceMesh
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::closedTriSurfaceMesh::~closedTriSurfaceMesh()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -52,7 +52,8 @@ class closedTriSurfaceMesh
|
||||
:
|
||||
public triSurfaceMesh
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
closedTriSurfaceMesh(const closedTriSurfaceMesh&) = delete;
|
||||
@ -76,7 +77,7 @@ public:
|
||||
closedTriSurfaceMesh(const IOobject& io);
|
||||
|
||||
//- 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
|
||||
(
|
||||
const IOobject& io,
|
||||
@ -84,9 +85,9 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
//- Destructor
|
||||
virtual ~closedTriSurfaceMesh() = default;
|
||||
|
||||
virtual ~closedTriSurfaceMesh();
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,19 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
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
|
||||
info.rawPoint()[dir] = planePt[dir];
|
||||
|
||||
// Set face
|
||||
if (planePt[dir] == min()[dir])
|
||||
{
|
||||
@ -92,7 +105,7 @@ Foam::pointIndexHit Foam::searchableBox::findNearest
|
||||
// (for internal points) per direction what nearest cube side is
|
||||
point near;
|
||||
|
||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
||||
for (direction dir = 0; dir < vector::nComponents; ++dir)
|
||||
{
|
||||
if (info.rawPoint()[dir] < min()[dir])
|
||||
{
|
||||
@ -188,7 +201,7 @@ Foam::searchableBox::searchableBox
|
||||
)
|
||||
:
|
||||
searchableSurface(io),
|
||||
treeBoundBox(dict.lookup("min"), dict.lookup("max"))
|
||||
treeBoundBox(dict.get<point>("min"), dict.get<point>("max"))
|
||||
{
|
||||
if (!contains(midpoint()))
|
||||
{
|
||||
@ -201,12 +214,6 @@ Foam::searchableBox::searchableBox
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchableBox::~searchableBox()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
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
|
||||
{
|
||||
tmp<pointField> tCtrs(new pointField(6));
|
||||
pointField& ctrs = tCtrs.ref();
|
||||
auto tctrs = tmp<pointField>::New(6);
|
||||
auto& ctrs = tctrs.ref();
|
||||
|
||||
const pointField pts(treeBoundBox::points());
|
||||
const faceList& fcs = treeBoundBox::faces;
|
||||
@ -233,7 +240,7 @@ Foam::tmp<Foam::pointField> Foam::searchableBox::coordinates() const
|
||||
ctrs[i] = fcs[i].centre(pts);
|
||||
}
|
||||
|
||||
return tCtrs;
|
||||
return tctrs;
|
||||
}
|
||||
|
||||
|
||||
@ -255,9 +262,9 @@ void Foam::searchableBox::boundingSpheres
|
||||
const face& f = fcs[i];
|
||||
|
||||
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
|
||||
(
|
||||
@ -303,7 +310,7 @@ Foam::pointIndexHit Foam::searchableBox::findNearestOnEdge
|
||||
// (for internal points) per direction what nearest cube side is
|
||||
point near;
|
||||
|
||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
||||
for (direction dir = 0; dir < vector::nComponents; ++dir)
|
||||
{
|
||||
if (info.rawPoint()[dir] < min()[dir])
|
||||
{
|
||||
@ -405,7 +412,7 @@ Foam::pointIndexHit Foam::searchableBox::findLine
|
||||
{
|
||||
info.setHit();
|
||||
|
||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
||||
for (direction dir = 0; dir < vector::nComponents; ++dir)
|
||||
{
|
||||
if (info.rawPoint()[dir] == min()[dir])
|
||||
{
|
||||
@ -602,20 +609,23 @@ void Foam::searchableBox::getVolumeType
|
||||
) const
|
||||
{
|
||||
volType.setSize(points.size());
|
||||
volType = volumeType::INSIDE;
|
||||
|
||||
forAll(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])
|
||||
{
|
||||
volType[pointi] = volumeType::OUTSIDE;
|
||||
vt = volumeType::OUTSIDE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
volType[pointi] = vt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,6 +27,14 @@ Class
|
||||
Description
|
||||
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
|
||||
searchableBox.C
|
||||
|
||||
@ -43,8 +51,6 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class searchableBox Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -54,8 +60,6 @@ class searchableBox
|
||||
public searchableSurface,
|
||||
public treeBoundBox
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Member Data
|
||||
|
||||
mutable wordList regions_;
|
||||
@ -109,14 +113,15 @@ public:
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~searchableBox();
|
||||
virtual ~searchableBox() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Names of regions
|
||||
virtual const wordList& regions() const;
|
||||
|
||||
//- Whether supports volume type below
|
||||
//- Whether surface supports volume type (below)
|
||||
virtual bool hasVolumeType() const
|
||||
{
|
||||
return true;
|
||||
@ -248,12 +253,11 @@ public:
|
||||
vectorField& normal
|
||||
) const;
|
||||
|
||||
//- Determine type (inside/outside/mixed) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
//- Determine type (inside/outside) for points.
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField&,
|
||||
List<volumeType>&
|
||||
const pointField& points,
|
||||
List<volumeType>& volType
|
||||
) const;
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,7 +31,19 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
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
|
||||
{
|
||||
tmp<pointField> tCtrs(new pointField(1, 0.5*(point1_ + point2_)));
|
||||
|
||||
return tCtrs;
|
||||
return tmp<pointField>::New(1, 0.5*(point1_ + point2_));
|
||||
}
|
||||
|
||||
|
||||
@ -71,13 +81,13 @@ void Foam::searchableCone::boundingSpheres
|
||||
|
||||
Foam::tmp<Foam::pointField> Foam::searchableCone::points() const
|
||||
{
|
||||
tmp<pointField> tPts(new pointField(2));
|
||||
pointField& pts = tPts.ref();
|
||||
auto tpts = tmp<pointField>::New(2);
|
||||
auto& pts = tpts.ref();
|
||||
|
||||
pts[0] = point1_;
|
||||
pts[1] = point2_;
|
||||
|
||||
return tPts;
|
||||
return tpts;
|
||||
}
|
||||
|
||||
|
||||
@ -92,7 +102,7 @@ void Foam::searchableCone::findNearestAndNormal
|
||||
vector v(sample - point1_);
|
||||
|
||||
// Decompose sample-point1 into normal and parallel component
|
||||
scalar parallel = (v & unitDir_);
|
||||
const scalar parallel = (v & unitDir_);
|
||||
|
||||
// Remove the parallel component and normalise
|
||||
v -= parallel*unitDir_;
|
||||
@ -338,8 +348,8 @@ void Foam::searchableCone::findLineAll
|
||||
vector point1End(end-cone.point1_);
|
||||
|
||||
// Quick rejection of complete vector outside endcaps
|
||||
scalar s1 = point1Start&(cone.unitDir_);
|
||||
scalar s2 = point1End&(cone.unitDir_);
|
||||
scalar s1 = point1Start & (cone.unitDir_);
|
||||
scalar s2 = point1End & (cone.unitDir_);
|
||||
|
||||
if ((s1 < 0.0 && s2 < 0.0) || (s1 > cone.magDir_ && s2 > cone.magDir_))
|
||||
{
|
||||
@ -735,12 +745,12 @@ Foam::searchableCone::searchableCone
|
||||
)
|
||||
:
|
||||
searchableSurface(io),
|
||||
point1_(dict.lookup("point1")),
|
||||
radius1_(readScalar(dict.lookup("radius1"))),
|
||||
innerRadius1_(dict.lookupOrDefault("innerRadius1", 0.0)),
|
||||
point2_(dict.lookup("point2")),
|
||||
radius2_(readScalar(dict.lookup("radius2"))),
|
||||
innerRadius2_(dict.lookupOrDefault("innerRadius2", 0.0)),
|
||||
point1_(dict.get<point>("point1")),
|
||||
radius1_(dict.get<scalar>("radius1")),
|
||||
innerRadius1_(dict.lookupOrDefault<scalar>("innerRadius1", 0)),
|
||||
point2_(dict.get<point>("point2")),
|
||||
radius2_(dict.get<scalar>("radius2")),
|
||||
innerRadius2_(dict.lookupOrDefault<scalar>("innerRadius2", 0)),
|
||||
magDir_(mag(point2_-point1_)),
|
||||
unitDir_((point2_-point1_)/magDir_)
|
||||
{
|
||||
@ -748,12 +758,6 @@ Foam::searchableCone::searchableCone
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchableCone::~searchableCone()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::wordList& Foam::searchableCone::regions() const
|
||||
@ -775,6 +779,7 @@ void Foam::searchableCone::findNearest
|
||||
) const
|
||||
{
|
||||
info.setSize(samples.size());
|
||||
|
||||
forAll(samples, i)
|
||||
{
|
||||
vector normal;
|
||||
@ -1071,48 +1076,36 @@ void Foam::searchableCone::getVolumeType
|
||||
) const
|
||||
{
|
||||
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_);
|
||||
|
||||
// Decompose sample-point1 into normal and parallel component
|
||||
scalar parallel = v & unitDir_;
|
||||
scalar comp = parallel;
|
||||
scalar compInner = parallel;
|
||||
const scalar parallel = (v & unitDir_);
|
||||
|
||||
|
||||
scalar radius_sec = radius1_+comp*(radius2_-radius1_)/magDir_;
|
||||
|
||||
scalar radius_sec_inner =
|
||||
innerRadius1_
|
||||
+compInner*(innerRadius2_-innerRadius1_)/magDir_;
|
||||
|
||||
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;
|
||||
continue;
|
||||
}
|
||||
else if (parallel > magDir_)
|
||||
|
||||
const scalar radius_sec =
|
||||
radius1_ + parallel * (radius2_-radius1_)/magDir_;
|
||||
|
||||
const scalar radius_sec_inner =
|
||||
innerRadius1_ + parallel * (innerRadius2_-innerRadius1_)/magDir_;
|
||||
|
||||
// Remove the parallel component
|
||||
v -= parallel*unitDir_;
|
||||
|
||||
if (mag(v) >= radius_sec_inner && mag(v) <= radius_sec)
|
||||
{
|
||||
// Right of point2 endcap
|
||||
volType[pointI] = volumeType::OUTSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove the parallel component
|
||||
v -= parallel*unitDir_;
|
||||
if (mag(v) >= radius_sec_inner && mag(v) <= radius_sec)
|
||||
{
|
||||
volType[pointI] = volumeType::INSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
volType[pointI] = volumeType::OUTSIDE;
|
||||
}
|
||||
volType[pointi] = volumeType::INSIDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,15 +27,16 @@ Class
|
||||
Description
|
||||
Searching on (optionally hollow) cone.
|
||||
|
||||
\heading Function object usage
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
point1 | coordinate of endpoint | yes |
|
||||
radius1 | radius at point1 | yes | yes
|
||||
innerRadius1 | inner radius at point1 | no |
|
||||
point2 | coordinate of endpoint | yes |
|
||||
radius2 | radius at point2 | yes | yes
|
||||
innerRadius2 | inner radius at point2 | no |
|
||||
Property | Description | Required | Default
|
||||
type | code / searchableCone | selector |
|
||||
point1 | coordinate of endpoint | yes |
|
||||
radius1 | radius at point1 | yes |
|
||||
innerRadius1| inner radius at point1 | no | 0
|
||||
point2 | coordinate of endpoint | yes |
|
||||
radius2 | radius at point2 | yes |
|
||||
innerRadius2| inner radius at point2 | no | 0
|
||||
\endtable
|
||||
|
||||
Note
|
||||
@ -145,22 +146,22 @@ class searchableCone
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("searchableCone");
|
||||
TypeName("searchableCone");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
searchableCone
|
||||
(
|
||||
const IOobject& io,
|
||||
const point& point1,
|
||||
const scalar radius1,
|
||||
const scalar innerRadius1,
|
||||
const point& point2,
|
||||
const scalar radius2,
|
||||
const scalar innerRadius2
|
||||
);
|
||||
searchableCone
|
||||
(
|
||||
const IOobject& io,
|
||||
const point& point1,
|
||||
const scalar radius1,
|
||||
const scalar innerRadius1,
|
||||
const point& point2,
|
||||
const scalar radius2,
|
||||
const scalar innerRadius2
|
||||
);
|
||||
|
||||
//- Construct from dictionary (used by searchableSurface)
|
||||
searchableCone
|
||||
@ -171,15 +172,15 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
virtual ~searchableCone();
|
||||
virtual ~searchableCone() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Names of regions
|
||||
virtual const wordList& regions() const;
|
||||
|
||||
//- Whether supports volume type below
|
||||
//- Whether supports volume type (below)
|
||||
virtual bool hasVolumeType() const
|
||||
{
|
||||
return true;
|
||||
@ -262,12 +263,12 @@ public:
|
||||
vectorField& normal
|
||||
) const;
|
||||
|
||||
//- Determine type (inside/outside/mixed) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
//- Determine type (inside/outside/mixed) for point.
|
||||
// Unknown if cannot be determined (e.g. non-manifold surface)
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField&,
|
||||
List<volumeType>&
|
||||
const pointField& points,
|
||||
List<volumeType>& volType
|
||||
) const;
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,7 +31,19 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
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
|
||||
{
|
||||
tmp<pointField> tCtrs(new pointField(1, 0.5*(point1_ + point2_)));
|
||||
|
||||
return tCtrs;
|
||||
return tmp<pointField>::New(1, 0.5*(point1_ + point2_));
|
||||
}
|
||||
|
||||
|
||||
@ -64,13 +74,13 @@ void Foam::searchableCylinder::boundingSpheres
|
||||
|
||||
Foam::tmp<Foam::pointField> Foam::searchableCylinder::points() const
|
||||
{
|
||||
tmp<pointField> tPts(new pointField(2));
|
||||
pointField& pts = tPts.ref();
|
||||
auto tpts = tmp<pointField>::New(2);
|
||||
auto& pts = tpts.ref();
|
||||
|
||||
pts[0] = point1_;
|
||||
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
|
||||
{
|
||||
const vector x = (pt-point1_) ^ unitDir_;
|
||||
return x&x;
|
||||
return (x & x);
|
||||
}
|
||||
|
||||
|
||||
@ -500,22 +510,16 @@ Foam::searchableCylinder::searchableCylinder
|
||||
)
|
||||
:
|
||||
searchableSurface(io),
|
||||
point1_(dict.lookup("point1")),
|
||||
point2_(dict.lookup("point2")),
|
||||
point1_(dict.get<point>("point1")),
|
||||
point2_(dict.get<point>("point2")),
|
||||
magDir_(mag(point2_-point1_)),
|
||||
unitDir_((point2_-point1_)/magDir_),
|
||||
radius_(readScalar(dict.lookup("radius")))
|
||||
radius_(dict.get<scalar>("radius"))
|
||||
{
|
||||
bounds() = calcBounds();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchableCylinder::~searchableCylinder()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::wordList& Foam::searchableCylinder::regions() const
|
||||
@ -660,7 +664,7 @@ void Foam::searchableCylinder::getNormal
|
||||
vector v(info[i].hitPoint() - point1_);
|
||||
|
||||
// Decompose sample-point1 into normal and parallel component
|
||||
scalar parallel = (v & unitDir_);
|
||||
const scalar parallel = (v & unitDir_);
|
||||
|
||||
// Remove the parallel component and normalise
|
||||
v -= parallel*unitDir_;
|
||||
@ -728,25 +732,21 @@ void Foam::searchableCylinder::getVolumeType
|
||||
) const
|
||||
{
|
||||
volType.setSize(points.size());
|
||||
volType = volumeType::INSIDE;
|
||||
|
||||
forAll(points, pointi)
|
||||
{
|
||||
const point& pt = points[pointi];
|
||||
|
||||
volType[pointi] = volumeType::OUTSIDE;
|
||||
|
||||
vector v(pt - point1_);
|
||||
|
||||
// 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;
|
||||
}
|
||||
else
|
||||
@ -754,14 +754,12 @@ void Foam::searchableCylinder::getVolumeType
|
||||
// Remove the parallel component
|
||||
v -= parallel*unitDir_;
|
||||
|
||||
if (mag(v) > radius_)
|
||||
{
|
||||
volType[pointi] = volumeType::OUTSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
volType[pointi] = volumeType::INSIDE;
|
||||
}
|
||||
volType[pointi] =
|
||||
(
|
||||
mag(v) <= radius_
|
||||
? volumeType::INSIDE
|
||||
: volumeType::OUTSIDE
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,7 +25,16 @@ Class
|
||||
Foam::searchableCylinder
|
||||
|
||||
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
|
||||
searchableCylinder.C
|
||||
@ -55,10 +64,10 @@ private:
|
||||
|
||||
// Private Member Data
|
||||
|
||||
//- 'left' point
|
||||
//- The 'left' point
|
||||
const point point1_;
|
||||
|
||||
//- 'right' point
|
||||
//- The 'right' point
|
||||
const point point2_;
|
||||
|
||||
//- Length of vector point2-point1
|
||||
@ -67,7 +76,7 @@ private:
|
||||
//- Normalised vector point2-point1
|
||||
const vector unitDir_;
|
||||
|
||||
//- Radius squared
|
||||
//- The radius
|
||||
const scalar radius_;
|
||||
|
||||
//- Names of regions
|
||||
@ -119,8 +128,8 @@ public:
|
||||
searchableCylinder
|
||||
(
|
||||
const IOobject& io,
|
||||
const point&,
|
||||
const point&,
|
||||
const point& point1,
|
||||
const point& point2,
|
||||
const scalar radius
|
||||
);
|
||||
|
||||
@ -131,12 +140,14 @@ public:
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~searchableCylinder();
|
||||
virtual ~searchableCylinder() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Names of regions
|
||||
virtual const wordList& regions() const;
|
||||
|
||||
//- Whether supports volume type below
|
||||
@ -170,7 +181,6 @@ public:
|
||||
virtual bool overlaps(const boundBox& bb) const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -220,12 +230,12 @@ public:
|
||||
vectorField& normal
|
||||
) const;
|
||||
|
||||
//- Determine type (inside/outside/mixed) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
//- Determine type (inside/outside/mixed) for point.
|
||||
// Unknown if cannot be determined (e.g. non-manifold surface)
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField&,
|
||||
List<volumeType>&
|
||||
const pointField& points,
|
||||
List<volumeType>& volType
|
||||
) const;
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,10 +30,20 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(searchableDisk, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, searchableDisk, dict);
|
||||
|
||||
defineTypeNameAndDebug(searchableDisk, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
searchableDisk,
|
||||
dict
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
searchableDisk,
|
||||
dict,
|
||||
disk
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +60,7 @@ Foam::pointIndexHit Foam::searchableDisk::findNearest
|
||||
vector v(sample - origin_);
|
||||
|
||||
// Decompose sample-origin into normal and parallel component
|
||||
scalar parallel = (v & normal_);
|
||||
const scalar parallel = (v & normal_);
|
||||
|
||||
// Remove the parallel component and normalise
|
||||
v -= parallel*normal_;
|
||||
@ -90,7 +100,7 @@ void Foam::searchableDisk::findLine
|
||||
vector v(start - origin_);
|
||||
|
||||
// Decompose sample-origin into normal and parallel component
|
||||
scalar parallel = (v & normal_);
|
||||
const scalar parallel = (v & normal_);
|
||||
|
||||
if (sign(parallel) == sign((end - origin_) & normal_))
|
||||
{
|
||||
@ -160,9 +170,9 @@ Foam::searchableDisk::searchableDisk
|
||||
)
|
||||
:
|
||||
searchableSurface(io),
|
||||
origin_(dict.lookup("origin")),
|
||||
normal_(dict.lookup("normal")),
|
||||
radius_(readScalar(dict.lookup("radius")))
|
||||
origin_(dict.get<point>("origin")),
|
||||
normal_(dict.get<vector>("normal")),
|
||||
radius_(dict.get<scalar>("radius"))
|
||||
{
|
||||
normal_ /= mag(normal_);
|
||||
|
||||
@ -183,12 +193,6 @@ Foam::searchableDisk::searchableDisk
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchableDisk::~searchableDisk()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::wordList& Foam::searchableDisk::regions() const
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,6 +28,15 @@ Description
|
||||
Searching on circular disk given as origin, normal (gets normalised)
|
||||
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
|
||||
searchableDisk.C
|
||||
|
||||
@ -45,7 +54,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class searchableDisk Declaration
|
||||
Class searchableDisk Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class searchableDisk
|
||||
@ -56,13 +65,13 @@ private:
|
||||
|
||||
// Private Member Data
|
||||
|
||||
//- origin
|
||||
//- Origin
|
||||
const point origin_;
|
||||
|
||||
//- normal
|
||||
//- Normal
|
||||
vector normal_;
|
||||
|
||||
//- radius
|
||||
//- Radius
|
||||
const scalar radius_;
|
||||
|
||||
//- Names of regions
|
||||
@ -120,14 +129,15 @@ public:
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~searchableDisk();
|
||||
virtual ~searchableDisk() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Names of regions
|
||||
virtual const wordList& regions() const;
|
||||
|
||||
//- Whether supports volume type below
|
||||
//- Whether supports volume type (below)
|
||||
virtual bool hasVolumeType() const
|
||||
{
|
||||
return false;
|
||||
@ -143,8 +153,7 @@ public:
|
||||
// Usually the element centres (should be of length size()).
|
||||
virtual tmp<pointField> coordinates() const
|
||||
{
|
||||
tmp<pointField> tCtrs(new pointField(1, origin_));
|
||||
return tCtrs;
|
||||
return tmp<pointField>::New(1, origin_);
|
||||
}
|
||||
|
||||
//- Get bounding spheres (centre and radius squared), one per element.
|
||||
@ -165,7 +174,6 @@ public:
|
||||
virtual bool overlaps(const boundBox& bb) const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -215,12 +223,12 @@ public:
|
||||
vectorField& normal
|
||||
) const;
|
||||
|
||||
//- Determine type (inside/outside/mixed) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
//- Determine type (inside/outside/mixed) for point.
|
||||
// Unknown if cannot be determined (e.g. non-manifold surface)
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField&,
|
||||
List<volumeType>&
|
||||
const pointField& points,
|
||||
List<volumeType>& volType
|
||||
) const;
|
||||
|
||||
|
||||
|
@ -43,6 +43,13 @@ namespace Foam
|
||||
searchableExtrudedCircle,
|
||||
dict
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
searchableExtrudedCircle,
|
||||
dict,
|
||||
extrudedCircle
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -61,7 +68,7 @@ Foam::searchableExtrudedCircle::searchableExtrudedCircle
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dict.lookup("file"), // name
|
||||
dict.get<word>("file"), // name
|
||||
io.time().constant(), // instance
|
||||
"geometry", // local
|
||||
io.time(), // registry
|
||||
@ -71,7 +78,7 @@ Foam::searchableExtrudedCircle::searchableExtrudedCircle
|
||||
).objectPath()
|
||||
)
|
||||
),
|
||||
radius_(readScalar(dict.lookup("radius")))
|
||||
radius_(dict.get<scalar>("radius"))
|
||||
{
|
||||
const edgeMesh& eMesh = eMeshPtr_();
|
||||
|
||||
|
@ -25,7 +25,18 @@ Class
|
||||
Foam::searchableExtrudedCircle
|
||||
|
||||
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
|
||||
searchableExtrudedCircle.C
|
||||
@ -43,10 +54,10 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
// Forward declarations
|
||||
class edgeMesh;
|
||||
class treeDataEdge;
|
||||
template <class Type> class indexedOctree;
|
||||
template<class Type> class indexedOctree;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class searchableExtrudedCircle Declaration
|
||||
@ -102,6 +113,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Names of regions
|
||||
virtual const wordList& regions() const;
|
||||
|
||||
//- Whether supports volume type below
|
||||
@ -206,8 +218,8 @@ public:
|
||||
vectorField& normal
|
||||
) const;
|
||||
|
||||
//- Determine type (inside/outside/mixed) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
//- Determine type (inside/outside/mixed) for point.
|
||||
// Unknown if cannot be determined (e.g. non-manifold surface)
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField&,
|
||||
|
@ -31,10 +31,20 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(searchablePlane, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, searchablePlane, dict);
|
||||
|
||||
defineTypeNameAndDebug(searchablePlane, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
searchablePlane,
|
||||
dict
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
searchablePlane,
|
||||
dict,
|
||||
plane
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -115,12 +125,6 @@ Foam::searchablePlane::searchablePlane
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchablePlane::~searchablePlane()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::wordList& Foam::searchablePlane::regions() const
|
||||
|
@ -25,7 +25,15 @@ Class
|
||||
Foam::searchablePlane
|
||||
|
||||
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
|
||||
searchablePlane.C
|
||||
@ -43,8 +51,6 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class searchablePlane Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -58,6 +64,7 @@ private:
|
||||
|
||||
// Private Member Data
|
||||
|
||||
//- Names of regions
|
||||
mutable wordList regions_;
|
||||
|
||||
|
||||
@ -103,11 +110,12 @@ public:
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~searchablePlane();
|
||||
virtual ~searchablePlane() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Names of regions
|
||||
virtual const wordList& regions() const;
|
||||
|
||||
//- Whether supports volume type below
|
||||
@ -126,8 +134,7 @@ public:
|
||||
// Usually the element centres (should be of length size()).
|
||||
virtual tmp<pointField> coordinates() const
|
||||
{
|
||||
tmp<pointField> tCtrs(new pointField(1, refPoint()));
|
||||
return tCtrs;
|
||||
return tmp<pointField>::New(1, refPoint());
|
||||
}
|
||||
|
||||
//- Get bounding spheres (centre and radius squared), one per element.
|
||||
@ -149,7 +156,6 @@ public:
|
||||
virtual bool overlaps(const boundBox& bb) const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -199,8 +205,8 @@ public:
|
||||
vectorField& normal
|
||||
) const;
|
||||
|
||||
//- Determine type (inside/outside/mixed) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
//- Determine type (inside/outside/mixed) for point.
|
||||
// Unknown if cannot be determined (e.g. non-manifold surface)
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField&,
|
||||
|
@ -32,7 +32,19 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
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;
|
||||
|
||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
||||
for (direction dir = 0; dir < vector::nComponents; ++dir)
|
||||
{
|
||||
if (span[dir] < 0)
|
||||
{
|
||||
@ -96,7 +108,7 @@ Foam::pointIndexHit Foam::searchablePlate::findNearest
|
||||
info.rawPoint()[normalDir_] = origin_[normalDir_];
|
||||
|
||||
// Clip to edges if outside
|
||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
||||
for (direction dir = 0; dir < vector::nComponents; ++dir)
|
||||
{
|
||||
if (dir != normalDir_)
|
||||
{
|
||||
@ -158,7 +170,7 @@ Foam::pointIndexHit Foam::searchablePlate::findLine
|
||||
info.rawPoint()[normalDir_] = origin_[normalDir_];
|
||||
|
||||
// Clip to edges
|
||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
||||
for (direction dir = 0; dir < vector::nComponents; ++dir)
|
||||
{
|
||||
if (dir != normalDir_)
|
||||
{
|
||||
@ -236,8 +248,8 @@ Foam::searchablePlate::searchablePlate
|
||||
)
|
||||
:
|
||||
searchableSurface(io),
|
||||
origin_(dict.lookup("origin")),
|
||||
span_(dict.lookup("span")),
|
||||
origin_(dict.get<point>("origin")),
|
||||
span_(dict.get<vector>("span")),
|
||||
normalDir_(calcNormal(span_))
|
||||
{
|
||||
if (debug)
|
||||
@ -253,12 +265,6 @@ Foam::searchablePlate::searchablePlate
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchablePlate::~searchablePlate()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::wordList& Foam::searchablePlate::regions() const
|
||||
@ -297,8 +303,8 @@ void Foam::searchablePlate::boundingSpheres
|
||||
|
||||
Foam::tmp<Foam::pointField> Foam::searchablePlate::points() const
|
||||
{
|
||||
tmp<pointField> tPts(new pointField(4));
|
||||
pointField& pts = tPts.ref();
|
||||
auto tpts = tmp<pointField>::New(4);
|
||||
auto& pts = tpts.ref();
|
||||
|
||||
pts[0] = origin_;
|
||||
pts[2] = origin_ + span_;
|
||||
@ -319,7 +325,7 @@ Foam::tmp<Foam::pointField> Foam::searchablePlate::points() const
|
||||
pts[3] = origin_ + point(0, span_.y(), 0);
|
||||
}
|
||||
|
||||
return tPts;
|
||||
return tpts;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,11 +30,21 @@ Description
|
||||
Plate defined as origin and span. One of the components of span has
|
||||
to be 0 which defines the normal direction. E.g.
|
||||
|
||||
\verbatim
|
||||
span = (Sx Sy 0) // plate in x-y plane
|
||||
origin = (Ox Oy Oz)
|
||||
\endverbatim
|
||||
|
||||
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
|
||||
searchablePlate.C
|
||||
|
||||
@ -51,8 +61,6 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class searchablePlate Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -72,6 +80,7 @@ private:
|
||||
//- Coordinate direction which is normal
|
||||
const direction normalDir_;
|
||||
|
||||
//- Names of regions
|
||||
mutable wordList regions_;
|
||||
|
||||
|
||||
@ -127,11 +136,12 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~searchablePlate();
|
||||
virtual ~searchablePlate() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Names of regions
|
||||
virtual const wordList& regions() const;
|
||||
|
||||
//- Whether supports volume type below
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,19 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
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(),
|
||||
false //io.registerObject(),
|
||||
),
|
||||
treeBoundBox(Zero, dict.lookup("span"))
|
||||
treeBoundBox(Zero, dict.get<vector>("span"))
|
||||
),
|
||||
transform_
|
||||
(
|
||||
"rotation",
|
||||
dict.lookup("origin"),
|
||||
dict.lookup("e3"),
|
||||
dict.lookup("e1")
|
||||
dict.get<point>("origin"),
|
||||
dict.get<vector>("e3"),
|
||||
dict.get<vector>("e1")
|
||||
)
|
||||
{
|
||||
points_ = transform_.globalPosition(box_.points());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchableRotatedBox::~searchableRotatedBox()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
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
|
||||
const edgeList& edges = treeBoundBox::edges;
|
||||
forAll(edges, edgeI)
|
||||
for (const edge& e : edges)
|
||||
{
|
||||
const edge& e = edges[edgeI];
|
||||
|
||||
point 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());
|
||||
|
||||
forAll(fcs, faceI)
|
||||
for (const face& f : fcs)
|
||||
{
|
||||
const face& f = fcs[faceI];
|
||||
point fc = f.centre(points_);
|
||||
|
||||
forAll(edges, edgeI)
|
||||
for (const edge& e : edges)
|
||||
{
|
||||
const edge& e = edges[edgeI];
|
||||
|
||||
pointHit inter = f.intersection
|
||||
(
|
||||
bbPoints[e[0]],
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,12 +33,22 @@ Description
|
||||
E.g. box with sides 1 1 1 rotated 45 degrees around z-axis at
|
||||
origin (0.5 0.5 0.5)
|
||||
\verbatim
|
||||
span (1 1 1);
|
||||
span (1 1 1);
|
||||
origin (0.5 0.5 0.5);
|
||||
e1 (1 1 0);
|
||||
e3 (0 0 1);
|
||||
\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
|
||||
searchableRotatedBox.C
|
||||
|
||||
@ -68,13 +78,13 @@ private:
|
||||
|
||||
// Private Member Data
|
||||
|
||||
//- box in local coordinate system
|
||||
//- Box in local coordinate system
|
||||
searchableBox box_;
|
||||
|
||||
//- transformation from local to global coordinates
|
||||
//- Transformation from local to global coordinates
|
||||
coordinateSystem transform_;
|
||||
|
||||
//- (global) corner points (in treeBoundBox order)
|
||||
//- The (global) corner points (in treeBoundBox order)
|
||||
pointField points_;
|
||||
|
||||
|
||||
@ -104,11 +114,12 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~searchableRotatedBox();
|
||||
virtual ~searchableRotatedBox() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Names of regions
|
||||
virtual const wordList& regions() const;
|
||||
|
||||
//- Whether supports volume type below
|
||||
@ -236,8 +247,8 @@ public:
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField&,
|
||||
List<volumeType>&
|
||||
const pointField& points,
|
||||
List<volumeType>& volType
|
||||
) const;
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,10 +30,20 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(searchableSphere, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, searchableSphere, dict);
|
||||
|
||||
defineTypeNameAndDebug(searchableSphere, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
searchableSphere,
|
||||
dict
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
searchableSphere,
|
||||
dict,
|
||||
sphere
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -148,8 +158,8 @@ Foam::searchableSphere::searchableSphere
|
||||
)
|
||||
:
|
||||
searchableSurface(io),
|
||||
centre_(dict.lookup("centre")),
|
||||
radius_(readScalar(dict.lookup("radius")))
|
||||
centre_(dict.get<point>("centre")),
|
||||
radius_(dict.get<scalar>("radius"))
|
||||
{
|
||||
bounds() = boundBox
|
||||
(
|
||||
@ -159,12 +169,6 @@ Foam::searchableSphere::searchableSphere
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchableSphere::~searchableSphere()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::searchableSphere::overlaps(const boundBox& bb) const
|
||||
@ -351,20 +355,18 @@ void Foam::searchableSphere::getVolumeType
|
||||
) const
|
||||
{
|
||||
volType.setSize(points.size());
|
||||
volType = volumeType::INSIDE;
|
||||
|
||||
const scalar rad2 = sqr(radius_);
|
||||
|
||||
forAll(points, pointi)
|
||||
{
|
||||
const point& pt = points[pointi];
|
||||
|
||||
if (magSqr(pt - centre_) <= sqr(radius_))
|
||||
{
|
||||
volType[pointi] = volumeType::INSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
volType[pointi] = volumeType::OUTSIDE;
|
||||
}
|
||||
volType[pointi] =
|
||||
(
|
||||
(magSqr(pt - centre_) <= rad2)
|
||||
? volumeType::INSIDE : volumeType::OUTSIDE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,6 +27,14 @@ Class
|
||||
Description
|
||||
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
|
||||
searchableSphere.C
|
||||
|
||||
@ -43,10 +51,8 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class searchableSphere Declaration
|
||||
Class searchableSphere Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class searchableSphere
|
||||
@ -57,10 +63,10 @@ private:
|
||||
|
||||
// Private Member Data
|
||||
|
||||
//- Centre point
|
||||
//- Centre point of the sphere
|
||||
const point centre_;
|
||||
|
||||
//- Radius
|
||||
//- The outer radius of the sphere
|
||||
const scalar radius_;
|
||||
|
||||
//- Names of regions
|
||||
@ -105,7 +111,12 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- 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)
|
||||
searchableSphere
|
||||
@ -114,15 +125,17 @@ public:
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~searchableSphere();
|
||||
virtual ~searchableSphere() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Names of regions
|
||||
virtual const wordList& regions() const;
|
||||
|
||||
//- Whether supports volume type below
|
||||
//- Whether supports volume type (below)
|
||||
virtual bool hasVolumeType() const
|
||||
{
|
||||
return true;
|
||||
@ -138,8 +151,7 @@ public:
|
||||
// Usually the element centres (should be of length size()).
|
||||
virtual tmp<pointField> coordinates() const
|
||||
{
|
||||
tmp<pointField> tCtrs(new pointField(1, centre_));
|
||||
return tCtrs;
|
||||
return tmp<pointField>::New(1, centre_);
|
||||
}
|
||||
|
||||
//- Get bounding spheres (centre and radius squared), one per element.
|
||||
@ -205,12 +217,12 @@ public:
|
||||
vectorField& normal
|
||||
) const;
|
||||
|
||||
//- Determine type (inside/outside/mixed) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
//- Determine type (inside/outside/mixed) for point.
|
||||
// Unknown if cannot be determined (e.g. non-manifold surface)
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField&,
|
||||
List<volumeType>&
|
||||
const pointField& points,
|
||||
List<volumeType>& volType
|
||||
) const;
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -67,14 +67,14 @@ Foam::searchableSurface::searchableSurface(const IOobject& io)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchableSurface::~searchableSurface()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::searchableSurface::hasVolumeType() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::searchableSurface::findNearest
|
||||
(
|
||||
const pointField& sample,
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -55,7 +55,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
// Forward declarations
|
||||
class objectRegistry;
|
||||
class mapDistribute;
|
||||
class treeBoundBox;
|
||||
@ -155,7 +155,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~searchableSurface();
|
||||
virtual ~searchableSurface() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -188,8 +188,9 @@ public:
|
||||
//- Names of regions
|
||||
virtual const wordList& regions() const = 0;
|
||||
|
||||
//- Whether supports volume type below
|
||||
virtual bool hasVolumeType() const = 0;
|
||||
//- Whether supports volume type (below).
|
||||
// This is false for the base class.
|
||||
virtual bool hasVolumeType() const;
|
||||
|
||||
//- Range of local indices that can be returned
|
||||
virtual label size() const = 0;
|
||||
@ -335,8 +336,8 @@ public:
|
||||
vectorField& normal
|
||||
) const = 0;
|
||||
|
||||
//- Determine type (inside/outside) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
//- Determine type (inside/outside) for point.
|
||||
// Unknown if cannot be determined (e.g. non-manifold surface)
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField&,
|
||||
|
@ -33,15 +33,13 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(searchableSurfaceCollection, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
searchableSurfaceCollection,
|
||||
dict
|
||||
);
|
||||
|
||||
defineTypeNameAndDebug(searchableSurfaceCollection, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
searchableSurfaceCollection,
|
||||
dict
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -182,7 +180,7 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
|
||||
scale_(dict.size()),
|
||||
transform_(dict.size()),
|
||||
subGeom_(dict.size()),
|
||||
mergeSubRegions_(dict.lookup("mergeSubRegions")),
|
||||
mergeSubRegions_(dict.get<bool>("mergeSubRegions")),
|
||||
indexOffset_(dict.size()+1)
|
||||
{
|
||||
Info<< "SearchableCollection : " << name() << endl;
|
||||
@ -197,7 +195,7 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
|
||||
|
||||
const dictionary& subDict = dict.subDict(instance_[surfI]);
|
||||
|
||||
scale_[surfI] = subDict.lookup("scale");
|
||||
subDict.read("scale", scale_[surfI]);
|
||||
transform_.set
|
||||
(
|
||||
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;
|
||||
|
||||
const searchableSurface& s =
|
||||
@ -223,7 +221,7 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
subGeom_.set(surfI, &const_cast<searchableSurface&>(s));
|
||||
subGeom_.set(surfI, &(const_cast<searchableSurface&>(s)));
|
||||
|
||||
indexOffset_[surfI] = startIndex;
|
||||
startIndex += subGeom_[surfI].size();
|
||||
@ -303,9 +301,9 @@ const Foam::wordList& Foam::searchableSurfaceCollection::regions() const
|
||||
{
|
||||
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::searchableSurfaceCollection::coordinates() const
|
||||
{
|
||||
tmp<pointField> tCtrs(new pointField(size()));
|
||||
pointField& ctrs = tCtrs.ref();
|
||||
auto tctrs = tmp<pointField>::New(size());
|
||||
auto& ctrs = tctrs.ref();
|
||||
|
||||
// Append individual coordinates
|
||||
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();
|
||||
}
|
||||
|
||||
tmp<pointField> tPts(new pointField(nPoints));
|
||||
pointField& pts = tPts.ref();
|
||||
auto tpts = tmp<pointField>::New(nPoints);
|
||||
auto& pts = tpts.ref();
|
||||
|
||||
// Append individual coordinates
|
||||
nPoints = 0;
|
||||
@ -422,7 +420,7 @@ Foam::searchableSurfaceCollection::points() const
|
||||
}
|
||||
}
|
||||
|
||||
return tPts;
|
||||
return tpts;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,13 @@ Description
|
||||
Set of transformed searchableSurfaces. Does not do boolean operations
|
||||
so when meshing might find parts 'inside'.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | searchableSurfaceCollection | selector |
|
||||
mergeSubRegions | boolean | yes |
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
searchableSurfaceCollection.C
|
||||
|
||||
@ -40,7 +47,6 @@ SourceFiles
|
||||
#include "treeBoundBox.H"
|
||||
#include "coordinateSystem.H"
|
||||
#include "UPtrList.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -70,13 +76,13 @@ class searchableSurfaceCollection
|
||||
|
||||
UPtrList<searchableSurface> subGeom_;
|
||||
|
||||
Switch mergeSubRegions_;
|
||||
bool mergeSubRegions_;
|
||||
|
||||
//- Offsets for indices coming from different surfaces
|
||||
// (sized with size() of each surface)
|
||||
labelList indexOffset_;
|
||||
|
||||
//- Region names
|
||||
//- Names of regions
|
||||
mutable wordList regions_;
|
||||
|
||||
//- From individual regions to collection regions
|
||||
@ -164,9 +170,10 @@ public:
|
||||
return transform_;
|
||||
}
|
||||
|
||||
//- Names of regions
|
||||
virtual const wordList& regions() const;
|
||||
|
||||
//- Whether supports volume type below
|
||||
//- Whether supports volume type (below)
|
||||
virtual bool hasVolumeType() const
|
||||
{
|
||||
return false;
|
||||
@ -194,7 +201,6 @@ public:
|
||||
virtual bool overlaps(const boundBox& bb) const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -244,12 +250,12 @@ public:
|
||||
vectorField& normal
|
||||
) const;
|
||||
|
||||
//- Determine type (inside/outside/mixed) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
//- Determine type (inside/outside/mixed) for point.
|
||||
// Unknown if cannot be determined (e.g. non-manifold surface)
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField&,
|
||||
List<volumeType>&
|
||||
const pointField& points,
|
||||
List<volumeType>& volType
|
||||
) const;
|
||||
|
||||
// Other
|
||||
|
@ -32,10 +32,13 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(searchableSurfaceWithGaps, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, searchableSurfaceWithGaps, dict);
|
||||
|
||||
defineTypeNameAndDebug(searchableSurfaceWithGaps, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
searchableSurfaceWithGaps,
|
||||
dict
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -178,26 +181,21 @@ Foam::searchableSurfaceWithGaps::searchableSurfaceWithGaps
|
||||
)
|
||||
:
|
||||
searchableSurface(io),
|
||||
gap_(readScalar(dict.lookup("gap"))),
|
||||
gap_(dict.get<scalar>("gap")),
|
||||
subGeom_(1)
|
||||
{
|
||||
const word subGeomName(dict.lookup("surface"));
|
||||
const word subGeomName(dict.get<word>("surface"));
|
||||
|
||||
const searchableSurface& s =
|
||||
io.db().lookupObject<searchableSurface>(subGeomName);
|
||||
|
||||
subGeom_.set(0, &const_cast<searchableSurface&>(s));
|
||||
subGeom_.set
|
||||
(
|
||||
0,
|
||||
io.db().lookupObjectRefPtr<searchableSurface>(subGeomName)
|
||||
);
|
||||
|
||||
bounds() = subGeom_[0].bounds();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchableSurfaceWithGaps::~searchableSurfaceWithGaps()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::searchableSurfaceWithGaps::findLine
|
||||
|
@ -42,14 +42,20 @@ Description
|
||||
|
||||
sphere
|
||||
{
|
||||
type searchableSurfaceWithGaps;
|
||||
// Underlying surface
|
||||
surface sphere.stl;
|
||||
// Perturb distance
|
||||
gap 1e-3;
|
||||
type searchableSurfaceWithGaps;
|
||||
surface sphere.stl; // Underlying surface
|
||||
gap 1e-3; // Perturb distance
|
||||
}
|
||||
\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
|
||||
searchableSurfaceWithGaps.C
|
||||
|
||||
@ -67,8 +73,6 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class searchableSurfaceWithGaps Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -137,23 +141,24 @@ public:
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~searchableSurfaceWithGaps();
|
||||
virtual ~searchableSurfaceWithGaps() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- The underlying searchableSurface
|
||||
const searchableSurface& surface() const
|
||||
{
|
||||
return subGeom_[0];
|
||||
}
|
||||
|
||||
|
||||
//- Name of regions
|
||||
virtual const wordList& regions() const
|
||||
{
|
||||
return surface().regions();
|
||||
}
|
||||
|
||||
//- Whether supports volume type below
|
||||
//- Whether supports volume type (below)
|
||||
virtual bool hasVolumeType() const
|
||||
{
|
||||
return surface().hasVolumeType();
|
||||
@ -259,8 +264,8 @@ public:
|
||||
surface().getNormal(info, normal);
|
||||
}
|
||||
|
||||
//- Determine type (inside/outside/mixed) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
//- Determine type (inside/outside/mixed) for points.
|
||||
// Unknown if cannot be determined (e.g. non-manifold surface)
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField& samples,
|
||||
|
@ -65,7 +65,6 @@ bool Foam::searchableSurfaces::connected
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct with length.
|
||||
Foam::searchableSurfaces::searchableSurfaces(const label size)
|
||||
:
|
||||
PtrList<searchableSurface>(size),
|
||||
@ -90,7 +89,7 @@ Foam::searchableSurfaces::searchableSurfaces(const label size)
|
||||
//
|
||||
// // Make IOobject with correct name
|
||||
// autoPtr<IOobject> namedIO(io.clone());
|
||||
// namedIO().rename(dict.lookup("name"));
|
||||
// namedIO().rename(dict.get<word>("name"));
|
||||
//
|
||||
// // Create and hook surface
|
||||
// set
|
||||
@ -98,7 +97,7 @@ Foam::searchableSurfaces::searchableSurfaces(const label size)
|
||||
// surfI,
|
||||
// searchableSurface::New
|
||||
// (
|
||||
// dict.lookup("type"),
|
||||
// dict.get<word>("type"),
|
||||
// namedIO(),
|
||||
// dict
|
||||
// )
|
||||
@ -140,7 +139,7 @@ Foam::searchableSurfaces::searchableSurfaces(const label size)
|
||||
// << 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);
|
||||
|
||||
names_[surfI] = key;
|
||||
dict.readIfPresent("name", names_[surfI]);
|
||||
names_[surfI] = dict.lookupOrDefault<word>("name", key);
|
||||
|
||||
// Make IOobject with correct name
|
||||
autoPtr<IOobject> namedIO(io.clone());
|
||||
@ -211,7 +209,7 @@ Foam::searchableSurfaces::searchableSurfaces
|
||||
surfI,
|
||||
searchableSurface::New
|
||||
(
|
||||
dict.lookup("type"),
|
||||
dict.get<word>("type"),
|
||||
namedIO(),
|
||||
dict
|
||||
)
|
||||
@ -262,7 +260,7 @@ Foam::searchableSurfaces::searchableSurfaces
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
rNames[index] = word(regionDict.lookup("name"));
|
||||
rNames[index] = regionDict.get<word>("name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,28 @@ Class
|
||||
|
||||
Description
|
||||
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
|
||||
searchableSurfaces.C
|
||||
@ -44,7 +66,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
// Forward declarations
|
||||
class triSurface;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -99,10 +121,11 @@ public:
|
||||
////- Construct from list of dictionaries
|
||||
//searchableSurfaces(const IOobject&, const PtrList<dictionary>&);
|
||||
|
||||
//- Construct from dictionary and whether to construct names always
|
||||
// as surfaceName "_" regionName (singleRegionName false) or
|
||||
// for single region surfaces as surfaceName only (singleRegionName
|
||||
// true)
|
||||
//- Construct from dictionary.
|
||||
// \param singleRegionName controls if names are constructed as
|
||||
// surfaceName "_" regionName (singleRegionName false) or for
|
||||
// single region surfaces as surfaceName only (singleRegionName
|
||||
// true)
|
||||
searchableSurfaces
|
||||
(
|
||||
const IOobject&,
|
||||
@ -113,21 +136,25 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Surface names, not region names
|
||||
const wordList& names() const
|
||||
{
|
||||
return names_;
|
||||
}
|
||||
|
||||
//- Surface names, not region names
|
||||
wordList& names()
|
||||
{
|
||||
return names_;
|
||||
}
|
||||
|
||||
//- Region names per surface
|
||||
const List<wordList>& regionNames() const
|
||||
{
|
||||
return regionNames_;
|
||||
}
|
||||
|
||||
//- Region names per surface
|
||||
List<wordList>& regionNames()
|
||||
{
|
||||
return regionNames_;
|
||||
|
@ -659,14 +659,14 @@ void Foam::searchableSurfacesQueries::signedDistance
|
||||
Foam::boundBox Foam::searchableSurfacesQueries::bounds
|
||||
(
|
||||
const PtrList<searchableSurface>& allSurfaces,
|
||||
const labelList& surfacesToTest
|
||||
const labelUList& surfacesToTest
|
||||
)
|
||||
{
|
||||
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;
|
||||
|
@ -42,7 +42,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
// Forward declarations
|
||||
class plane;
|
||||
class pointConstraint;
|
||||
|
||||
@ -171,7 +171,7 @@ public:
|
||||
static boundBox bounds
|
||||
(
|
||||
const PtrList<searchableSurface>& allSurfaces,
|
||||
const labelList& surfacesToTest
|
||||
const labelUList& surfacesToTest
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -30,22 +30,26 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(subTriSurfaceMesh, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, subTriSurfaceMesh, dict);
|
||||
|
||||
defineTypeNameAndDebug(subTriSurfaceMesh, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
subTriSurfaceMesh,
|
||||
dict
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::wordList Foam::subTriSurfaceMesh::patchNames(const triSurface& s)
|
||||
{
|
||||
const geometricSurfacePatchList& patches = s.patches();
|
||||
const auto& patches = s.patches();
|
||||
|
||||
wordList names(patches.size());
|
||||
forAll(patches, patchI)
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
names[patchI] = patches[patchI].name();
|
||||
names[patchi] = patches[patchi].name();
|
||||
}
|
||||
return names;
|
||||
}
|
||||
@ -54,30 +58,25 @@ Foam::wordList Foam::subTriSurfaceMesh::patchNames(const triSurface& s)
|
||||
Foam::labelList Foam::subTriSurfaceMesh::selectedRegions
|
||||
(
|
||||
const triSurface& s,
|
||||
const UList<wordRe>& regionNames
|
||||
const wordRes& regionNameMatcher
|
||||
)
|
||||
{
|
||||
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];
|
||||
|
||||
forAll(regionNames, i)
|
||||
if (regionNameMatcher.match(names[regioni]))
|
||||
{
|
||||
if (regionNames[i].match(name))
|
||||
{
|
||||
regions[compactI++] = regionI;
|
||||
}
|
||||
regionIds[count++] = regioni;
|
||||
}
|
||||
}
|
||||
regions.setSize(compactI);
|
||||
regionIds.setSize(count);
|
||||
|
||||
return regions;
|
||||
return regionIds;
|
||||
}
|
||||
|
||||
|
||||
@ -87,16 +86,16 @@ Foam::triSurface Foam::subTriSurfaceMesh::subset
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
const word subGeomName(dict.lookup("surface"));
|
||||
const word subGeomName(dict.get<word>("surface"));
|
||||
|
||||
const triSurfaceMesh& s =
|
||||
io.db().lookupObject<triSurfaceMesh>(subGeomName);
|
||||
|
||||
const wordRes regionNames(dict.lookup("patches"));
|
||||
const wordRes regionNames(dict.get<wordRes>("patches"));
|
||||
|
||||
labelList regionMap(selectedRegions(s, regionNames));
|
||||
|
||||
if (regionMap.size() == 0)
|
||||
if (regionMap.empty())
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Found no regions in triSurface matching " << regionNames
|
||||
|
@ -43,6 +43,13 @@ Note
|
||||
}
|
||||
\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
|
||||
subTriSurfaceMesh.C
|
||||
@ -76,7 +83,7 @@ class subTriSurfaceMesh
|
||||
static labelList selectedRegions
|
||||
(
|
||||
const triSurface& s,
|
||||
const UList<wordRe>& regionNames
|
||||
const wordRes& regionNameMatcher
|
||||
);
|
||||
|
||||
//- Subset triSurface based on regions
|
||||
@ -101,6 +108,7 @@ public:
|
||||
|
||||
//- Destructor
|
||||
virtual ~subTriSurfaceMesh() = default;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / 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
|
||||
This file is part of OpenFOAM.
|
||||
@ -37,9 +37,11 @@ namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(triSurfaceMesh, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, triSurfaceMesh, dict);
|
||||
word triSurfaceMesh::meshSubDir = "triSurface";
|
||||
}
|
||||
|
||||
Foam::word Foam::triSurfaceMesh::meshSubDir = "triSurface";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||
@ -136,19 +138,13 @@ bool Foam::triSurfaceMesh::addFaceToEdge
|
||||
EdgeMap<label>& facesPerEdge
|
||||
)
|
||||
{
|
||||
EdgeMap<label>::iterator eFnd = facesPerEdge.find(e);
|
||||
if (eFnd != facesPerEdge.end())
|
||||
label& count = facesPerEdge(e, 0); // lookup or new entry
|
||||
if (count == 2)
|
||||
{
|
||||
if (eFnd() == 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
eFnd()++;
|
||||
}
|
||||
else
|
||||
{
|
||||
facesPerEdge.insert(e, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
++count;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -172,10 +168,10 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
|
||||
const labelList& pFaces = pointFaces[pointi];
|
||||
|
||||
facesPerEdge.clear();
|
||||
forAll(pFaces, i)
|
||||
for (const label facei : pFaces)
|
||||
{
|
||||
const triSurface::FaceType& f = triSurface::operator[](pFaces[i]);
|
||||
label fp = f.find(pointi);
|
||||
const triSurface::FaceType& f = triSurface::operator[](facei);
|
||||
const label fp = f.find(pointi);
|
||||
|
||||
// Something weird: if I expand the code of addFaceToEdge in both
|
||||
// below instances it gives a segmentation violation on some
|
||||
@ -183,7 +179,7 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
|
||||
|
||||
|
||||
// Forward edge
|
||||
label nextPointi = f[f.fcIndex(fp)];
|
||||
const label nextPointi = f[f.fcIndex(fp)];
|
||||
|
||||
if (nextPointi > pointi)
|
||||
{
|
||||
@ -198,8 +194,9 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Reverse edge
|
||||
label prevPointi = f[f.rcIndex(fp)];
|
||||
const label prevPointi = f[f.rcIndex(fp)];
|
||||
|
||||
if (prevPointi > pointi)
|
||||
{
|
||||
@ -217,9 +214,9 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
|
||||
}
|
||||
|
||||
// Check for any edges used only once.
|
||||
forAllConstIter(EdgeMap<label>, facesPerEdge, iter)
|
||||
forAllConstIters(facesPerEdge, iter)
|
||||
{
|
||||
if (iter() != 2)
|
||||
if (iter.object() != 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -477,17 +474,17 @@ void Foam::triSurfaceMesh::clearOut()
|
||||
|
||||
Foam::tmp<Foam::pointField> Foam::triSurfaceMesh::coordinates() const
|
||||
{
|
||||
tmp<pointField> tPts(new pointField(8));
|
||||
pointField& pt = tPts.ref();
|
||||
auto tpts = tmp<pointField>::New(8);
|
||||
auto& pts = tpts.ref();
|
||||
|
||||
// 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()),
|
||||
triSurface::points()
|
||||
).faceCentres();
|
||||
|
||||
return tPts;
|
||||
return tpts;
|
||||
}
|
||||
|
||||
|
||||
@ -507,9 +504,9 @@ void Foam::triSurfaceMesh::boundingSpheres
|
||||
{
|
||||
const labelledTri& f = triSurface::operator[](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));
|
||||
}
|
||||
}
|
||||
@ -543,7 +540,7 @@ void Foam::triSurfaceMesh::movePoints(const pointField& newPoints)
|
||||
searchableSurface::instance() = objectRegistry::time().timeName();
|
||||
objectRegistry::instance() = searchableSurface::instance();
|
||||
|
||||
label event = getEvent();
|
||||
const label event = getEvent();
|
||||
searchableSurface::eventNo() = event;
|
||||
objectRegistry::eventNo() = searchableSurface::eventNo();
|
||||
|
||||
@ -623,9 +620,9 @@ const Foam::wordList& Foam::triSurfaceMesh::regions() const
|
||||
if (regions_.empty())
|
||||
{
|
||||
regions_.setSize(patches().size());
|
||||
forAll(regions_, regionI)
|
||||
forAll(regions_, regioni)
|
||||
{
|
||||
regions_[regionI] = patches()[regionI].name();
|
||||
regions_[regioni] = patches()[regioni].name();
|
||||
}
|
||||
}
|
||||
return regions_;
|
||||
@ -765,14 +762,13 @@ void Foam::triSurfaceMesh::getNormal
|
||||
// Search neighbouring triangles
|
||||
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)
|
||||
{
|
||||
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())
|
||||
{
|
||||
label facei = info[i].index();
|
||||
const label facei = info[i].index();
|
||||
// Cached:
|
||||
//normal[i] = faceNormals()[facei];
|
||||
|
||||
@ -812,36 +808,27 @@ void Foam::triSurfaceMesh::getNormal
|
||||
|
||||
void Foam::triSurfaceMesh::setField(const labelList& values)
|
||||
{
|
||||
|
||||
if (foundObject<triSurfaceLabelField>("values"))
|
||||
{
|
||||
triSurfaceLabelField& fld = const_cast<triSurfaceLabelField&>
|
||||
(
|
||||
lookupObject<triSurfaceLabelField>
|
||||
(
|
||||
"values"
|
||||
)
|
||||
);
|
||||
fld.field() = values;
|
||||
lookupObjectRef<triSurfaceLabelField>("values").field() = values;
|
||||
}
|
||||
else
|
||||
{
|
||||
autoPtr<triSurfaceLabelField> fldPtr
|
||||
auto fldPtr = autoPtr<triSurfaceLabelField>::New
|
||||
(
|
||||
new triSurfaceLabelField
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"values",
|
||||
objectRegistry::time().timeName(), // instance
|
||||
meshSubDir, // local
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
"values",
|
||||
objectRegistry::time().timeName(), // instance
|
||||
meshSubDir, // local
|
||||
*this,
|
||||
dimless,
|
||||
labelField(values)
|
||||
)
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
*this,
|
||||
dimless,
|
||||
labelField(values)
|
||||
);
|
||||
|
||||
// Store field on triMesh
|
||||
@ -858,12 +845,9 @@ void Foam::triSurfaceMesh::getField
|
||||
{
|
||||
if (foundObject<triSurfaceLabelField>("values"))
|
||||
{
|
||||
values.setSize(info.size());
|
||||
const auto& fld = lookupObject<triSurfaceLabelField>("values");
|
||||
|
||||
const triSurfaceLabelField& fld = lookupObject<triSurfaceLabelField>
|
||||
(
|
||||
"values"
|
||||
);
|
||||
values.setSize(info.size());
|
||||
|
||||
forAll(info, i)
|
||||
{
|
||||
@ -882,36 +866,33 @@ void Foam::triSurfaceMesh::getVolumeType
|
||||
List<volumeType>& volType
|
||||
) const
|
||||
{
|
||||
volType.setSize(points.size());
|
||||
|
||||
scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
||||
|
||||
volType.setSize(points.size());
|
||||
|
||||
forAll(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
|
||||
if (outsideVolType_ == volumeType::UNKNOWN)
|
||||
{
|
||||
// Precalculate and cache value for this outside point
|
||||
if (outsideVolType_ == volumeType::UNKNOWN)
|
||||
{
|
||||
outsideVolType_ = tree().shapes().getVolumeType(tree(), pt);
|
||||
}
|
||||
volType[pointi] = outsideVolType_;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Have to calculate directly as outside the octree
|
||||
volType[pointi] = tree().shapes().getVolumeType(tree(), pt);
|
||||
outsideVolType_ = tree().shapes().getVolumeType(tree(), pt);
|
||||
}
|
||||
volType[pointi] = outsideVolType_;
|
||||
}
|
||||
else
|
||||
{
|
||||
// - use cached volume type per each tree node
|
||||
volType[pointi] = tree().getVolumeType(pt);
|
||||
// Have to calculate directly as outside the octree
|
||||
volType[pointi] = tree().shapes().getVolumeType(tree(), pt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,12 +27,21 @@ Class
|
||||
Description
|
||||
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.
|
||||
- tolerance : relative tolerance for doing intersections
|
||||
(see triangle::intersection)
|
||||
- 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
|
||||
triSurfaceMesh.C
|
||||
|
||||
@ -183,6 +192,7 @@ public:
|
||||
//- Destructor
|
||||
virtual ~triSurfaceMesh();
|
||||
|
||||
|
||||
//- Clear storage
|
||||
void clearOut();
|
||||
|
||||
@ -198,9 +208,10 @@ public:
|
||||
|
||||
// searchableSurface implementation
|
||||
|
||||
//- Names of regions
|
||||
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;
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
@ -278,12 +289,12 @@ public:
|
||||
vectorField& normal
|
||||
) const;
|
||||
|
||||
//- Determine type (inside/outside/mixed) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
//- Determine type (inside/outside/mixed) for point.
|
||||
// Unknown if cannot be determined (e.g. non-manifold surface)
|
||||
virtual void getVolumeType
|
||||
(
|
||||
const pointField&,
|
||||
List<volumeType>&
|
||||
const pointField& points,
|
||||
List<volumeType>& volType
|
||||
) const;
|
||||
|
||||
|
||||
|
@ -59,8 +59,7 @@ geometry
|
||||
type triSurfaceMesh;
|
||||
name walls;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -30,12 +30,11 @@ geometry
|
||||
{
|
||||
box1 //0.6x1x0.02 [cm]
|
||||
{
|
||||
type searchableBox;
|
||||
min (-0.1 -0.01 -0.1);
|
||||
max (0.1 0.30 0.1);
|
||||
type box;
|
||||
min (-0.1 -0.01 -0.1);
|
||||
max (0.1 0.30 0.1);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -61,7 +61,7 @@ geometry
|
||||
type triSurfaceMesh;
|
||||
file "membrane-membrane.stl";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
castellatedMeshControls
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ geometry
|
||||
}
|
||||
cylinder
|
||||
{
|
||||
type searchableCylinder;
|
||||
type cylinder;
|
||||
point1 ($:aerofoil.xUpper -1e3 0);
|
||||
point2 ($:aerofoil.xUpper 1e3 0);
|
||||
radius $:domain.zMax;
|
||||
|
@ -73,7 +73,7 @@ geometry
|
||||
type triSurfaceMesh;
|
||||
name walls;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
castellatedMeshControls
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ geometry
|
||||
}
|
||||
cylinder
|
||||
{
|
||||
type searchableCylinder;
|
||||
type cylinder;
|
||||
point1 ($:aerofoil.xUpper -1e3 0);
|
||||
point2 ($:aerofoil.xUpper 1e3 0);
|
||||
radius $:domain.zMax;
|
||||
|
@ -57,12 +57,11 @@ geometry
|
||||
|
||||
refinementBox
|
||||
{
|
||||
type searchableBox;
|
||||
min (-0.5 -0.125 -0.25);
|
||||
max (1.5 0.125 0.25);
|
||||
type box;
|
||||
min (-0.5 -0.125 -0.25);
|
||||
max (1.5 0.125 0.25);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -30,16 +30,16 @@ geometry
|
||||
{
|
||||
igloo
|
||||
{
|
||||
type searchableSphere;
|
||||
centre (3 3 0);
|
||||
radius 4;
|
||||
type sphere;
|
||||
centre (3 3 0);
|
||||
radius 4;
|
||||
}
|
||||
|
||||
box1
|
||||
{
|
||||
type searchableBox;
|
||||
min (0 0 0);
|
||||
max (1 1 1);
|
||||
type box;
|
||||
min (0 0 0);
|
||||
max (1 1 1);
|
||||
}
|
||||
|
||||
twoFridgeFreezers
|
||||
@ -51,7 +51,7 @@ geometry
|
||||
seal
|
||||
{
|
||||
surface box1;
|
||||
scale (1.0 1.0 2.1);
|
||||
scale (1.0 1.0 2.1);
|
||||
transform
|
||||
{
|
||||
coordinateSystem
|
||||
@ -70,7 +70,7 @@ geometry
|
||||
herring
|
||||
{
|
||||
surface box1;
|
||||
scale (1.0 1.0 2.1);
|
||||
scale (1.0 1.0 2.1);
|
||||
transform
|
||||
{
|
||||
coordinateSystem
|
||||
@ -87,8 +87,7 @@ geometry
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -34,8 +34,7 @@ geometry
|
||||
type triSurfaceMesh;
|
||||
name geom;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -33,7 +33,7 @@ geometry
|
||||
type triSurfaceMesh;
|
||||
name building;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -35,11 +35,11 @@ geometry
|
||||
|
||||
refinementBox
|
||||
{
|
||||
type searchableBox;
|
||||
type box;
|
||||
min (-1 -1 -1);
|
||||
max ( 5 1 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
castellatedMeshControls
|
||||
|
@ -30,11 +30,11 @@ geometry
|
||||
|
||||
refinementBox
|
||||
{
|
||||
type searchableBox;
|
||||
type box;
|
||||
min (-5 -1 -1);
|
||||
max ( 5 1 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
castellatedMeshControls
|
||||
|
@ -79,7 +79,7 @@ baffles
|
||||
{
|
||||
//- Select faces and orientation through a searchableSurface
|
||||
type searchableSurface;
|
||||
surface searchablePlate;
|
||||
surface plate;
|
||||
origin (0.099 -0.006 0.004);
|
||||
span (0 0.012 0.012);
|
||||
|
||||
|
@ -36,7 +36,7 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name innerCylinder;
|
||||
name innerCylinder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name innerCylinderSmall;
|
||||
name innerCylinderSmall;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name outerCylinder;
|
||||
name outerCylinder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name propellerTip;
|
||||
name propellerTip;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -84,7 +84,7 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name propellerStem1;
|
||||
name propellerStem1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -108,12 +108,11 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name propellerStem3;
|
||||
name propellerStem3;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -36,12 +36,11 @@ geometry
|
||||
|
||||
refinementBox
|
||||
{
|
||||
type searchableBox;
|
||||
type box;
|
||||
min (-1 -1 -1);
|
||||
max ( 5 1 1);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -794,10 +794,10 @@ boundary
|
||||
/* optional
|
||||
surface
|
||||
{
|
||||
type searchableCylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
type cylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
}
|
||||
*/
|
||||
faces
|
||||
@ -821,10 +821,10 @@ boundary
|
||||
/* optional
|
||||
surface
|
||||
{
|
||||
type searchableCylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
type cylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
}
|
||||
*/
|
||||
faces
|
||||
|
@ -37,12 +37,11 @@ geometry
|
||||
// Analytical shape; cylinder, sphere
|
||||
refinementBox
|
||||
{
|
||||
type searchableBox;
|
||||
min (-1.0 -0.7 0.0);
|
||||
max ( 8.0 0.7 2.5);
|
||||
type box;
|
||||
min (-1.0 -0.7 0.0);
|
||||
max ( 8.0 0.7 2.5);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -36,12 +36,11 @@ geometry
|
||||
|
||||
refinementBox
|
||||
{
|
||||
type searchableBox;
|
||||
min (-1.0 -0.7 0.0);
|
||||
max ( 8.0 0.7 2.5);
|
||||
type box;
|
||||
min (-1.0 -0.7 0.0);
|
||||
max ( 8.0 0.7 2.5);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -38,7 +38,7 @@ geometry
|
||||
type triSurfaceMesh;
|
||||
name rotatingZone;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
castellatedMeshControls
|
||||
{
|
||||
|
@ -31,16 +31,16 @@ geometry
|
||||
{
|
||||
windTurbine1
|
||||
{
|
||||
type searchableBox;
|
||||
min (581845 4785805 1061);
|
||||
max (581855 4785815 1071);
|
||||
type box;
|
||||
min (581845 4785805 1061);
|
||||
max (581855 4785815 1071);
|
||||
}
|
||||
|
||||
windTurbine2
|
||||
{
|
||||
type searchableBox;
|
||||
min (581740 4785658 1065);
|
||||
max (581771 4785671 1079);
|
||||
type box;
|
||||
min (581740 4785658 1065);
|
||||
max (581771 4785671 1079);
|
||||
}
|
||||
|
||||
terrain.stl
|
||||
@ -48,8 +48,7 @@ geometry
|
||||
type triSurfaceMesh;
|
||||
name terrain;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -30,11 +30,11 @@ geometry
|
||||
|
||||
refinementBox
|
||||
{
|
||||
type searchableBox;
|
||||
type box;
|
||||
min ( 0 0 0);
|
||||
max (250 180 90);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
castellatedMeshControls
|
||||
{
|
||||
|
@ -34,8 +34,7 @@ geometry
|
||||
type triSurfaceMesh;
|
||||
name walls;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -810,10 +810,10 @@ boundary
|
||||
/* optional
|
||||
surface
|
||||
{
|
||||
type searchableCylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
type cylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
}
|
||||
*/
|
||||
faces
|
||||
@ -837,10 +837,10 @@ boundary
|
||||
/* optional
|
||||
surface
|
||||
{
|
||||
type searchableCylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
type cylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
}
|
||||
*/
|
||||
faces
|
||||
|
@ -18,20 +18,20 @@ geometry
|
||||
{
|
||||
cylinder
|
||||
{
|
||||
type searchableCylinder;
|
||||
type cylinder;
|
||||
point1 (0 -4 0);
|
||||
point2 (0 4 0);
|
||||
radius 0.7;
|
||||
}
|
||||
cylinder2
|
||||
{
|
||||
type searchableExtrudedCircle;
|
||||
type extrudedCircle;
|
||||
file "curve2.vtk";
|
||||
radius 0.5;
|
||||
}
|
||||
inletPlane
|
||||
{
|
||||
type searchablePlate;
|
||||
type plate;
|
||||
origin (-4 -50 -50);
|
||||
span (0 100 100);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ geometry
|
||||
{
|
||||
sphere
|
||||
{
|
||||
type searchableSphere;
|
||||
type sphere;
|
||||
centre (0 0 0);
|
||||
radius 1;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ geometry
|
||||
{
|
||||
sphere
|
||||
{
|
||||
type searchableSphere;
|
||||
type sphere;
|
||||
centre (0 0 0);
|
||||
radius 1;
|
||||
}
|
||||
|
@ -20,14 +20,14 @@ geometry
|
||||
{
|
||||
sphere
|
||||
{
|
||||
type searchableSphere;
|
||||
type sphere;
|
||||
centre (0 0 0);
|
||||
radius 1;
|
||||
}
|
||||
|
||||
innerSphere
|
||||
{
|
||||
type searchableSphere;
|
||||
type sphere;
|
||||
centre (0 0 0);
|
||||
radius 0.5;
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ geometry
|
||||
|
||||
refinementBox
|
||||
{
|
||||
type searchableBox;
|
||||
min (-0.2 -0.6 -0.2);
|
||||
max ( 0.4 0.2 0.35);
|
||||
type box;
|
||||
min (-0.2 -0.6 -0.2);
|
||||
max ( 0.4 0.2 0.35);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,11 +36,11 @@ geometry
|
||||
//
|
||||
// refinementBox
|
||||
// {
|
||||
// type searchableBox;
|
||||
// min (-1.0 -0.7 0.0);
|
||||
// max ( 8.0 0.7 2.5);
|
||||
// type box;
|
||||
// min (-1.0 -0.7 0.0);
|
||||
// max ( 8.0 0.7 2.5);
|
||||
// }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -34,11 +34,10 @@ geometry
|
||||
// Outside of domain
|
||||
domain
|
||||
{
|
||||
type searchableBox;
|
||||
min (-0.7 -0.9 -1);
|
||||
max (1.3 1.1 1);
|
||||
type box;
|
||||
min (-0.7 -0.9 -1);
|
||||
max (1.3 1.1 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,9 +25,9 @@ geometry
|
||||
|
||||
refinementBox
|
||||
{
|
||||
type searchableBox;
|
||||
min (0.25 0.25 -1000);
|
||||
max (0.75 0.75 1000);
|
||||
type box;
|
||||
min (0.25 0.25 -1000);
|
||||
max (0.75 0.75 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,37 +30,37 @@ geometry
|
||||
{
|
||||
v_dualWing
|
||||
{
|
||||
type searchableCylinder;
|
||||
name v_dualWing;
|
||||
point1 (-0.43 0 -10);
|
||||
point2 (-0.43 0 10);
|
||||
radius 0.1;
|
||||
type cylinder;
|
||||
name v_dualWing;
|
||||
point1 (-0.43 0 -10);
|
||||
point2 (-0.43 0 10);
|
||||
radius 0.1;
|
||||
}
|
||||
|
||||
|
||||
v_rotor
|
||||
{
|
||||
type searchableCylinder;
|
||||
name v_rotor;
|
||||
point1 (0 0 -10);
|
||||
point2 (0 0 10);
|
||||
radius 0.75;
|
||||
type cylinder;
|
||||
name v_rotor;
|
||||
point1 (0 0 -10);
|
||||
point2 (0 0 10);
|
||||
radius 0.75;
|
||||
}
|
||||
wing1
|
||||
{
|
||||
type searchableBox;
|
||||
name wing1;
|
||||
min (-0.5 -0.01 -10);
|
||||
max (-0.44 0.01 10);
|
||||
type box;
|
||||
name wing1;
|
||||
min (-0.5 -0.01 -10);
|
||||
max (-0.44 0.01 10);
|
||||
}
|
||||
wing2
|
||||
{
|
||||
type searchableBox;
|
||||
name wing2;
|
||||
min (-0.42 -0.0025 -10);
|
||||
max (-0.36 0.0025 10);
|
||||
type box;
|
||||
name wing2;
|
||||
min (-0.42 -0.0025 -10);
|
||||
max (-0.36 0.0025 10);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ addLayers true;
|
||||
// Geometry. Definition of all surfaces. All surfaces are of class
|
||||
// searchableSurface.
|
||||
geometry
|
||||
{};
|
||||
{}
|
||||
|
||||
|
||||
|
||||
|
@ -35,12 +35,11 @@ geometry
|
||||
}
|
||||
wake
|
||||
{
|
||||
type searchableBox;
|
||||
min (0.8 -0.1 -0.1);
|
||||
max (2.0 0.1 0.1);
|
||||
type box;
|
||||
min (0.8 -0.1 -0.1);
|
||||
max (2.0 0.1 0.1);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -38,12 +38,11 @@ geometry
|
||||
//- Refine a bit extra around the small centre hole
|
||||
refineHole
|
||||
{
|
||||
type searchableSphere;
|
||||
centre (0 0 -0.012);
|
||||
radius 0.003;
|
||||
type sphere;
|
||||
centre (0 0 -0.012);
|
||||
radius 0.003;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -34,13 +34,11 @@ geometry
|
||||
}
|
||||
all
|
||||
{
|
||||
type searchableBox;
|
||||
min (-1000 -1000 -1000);
|
||||
max (1000 1000 1000);
|
||||
type box;
|
||||
min (-1000 -1000 -1000);
|
||||
max (1000 1000 1000);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -39,8 +39,7 @@ geometry
|
||||
type wall;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -39,8 +39,7 @@ geometry
|
||||
type wall;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -27,7 +27,7 @@ baffles
|
||||
{
|
||||
//- Select faces and orientation through a searchableSurface
|
||||
type searchableSurface;
|
||||
surface searchablePlate;
|
||||
surface plate;
|
||||
origin (0.3042 0.0493 -100);
|
||||
span (0 0.1584 200);
|
||||
|
||||
|
@ -130,7 +130,8 @@ geometry
|
||||
name rotating;
|
||||
type triSurfaceMesh;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
castellatedMeshControls
|
||||
|
@ -33,7 +33,7 @@ geometry
|
||||
type triSurfaceMesh;
|
||||
name motorBike;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//// Optional: avoid patch-face merging. Allows mesh to be used for
|
||||
|
@ -30,10 +30,10 @@ geometry
|
||||
{
|
||||
cylinder
|
||||
{
|
||||
type searchableCylinder;
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius $radius;
|
||||
type cylinder;
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius $radius;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ geometry
|
||||
type closedTriSurfaceMesh;
|
||||
name sloshingCylinder;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
castellatedMeshControls
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name innerCylinder;
|
||||
name innerCylinder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name innerCylinderSmall;
|
||||
name innerCylinderSmall;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name outerCylinder;
|
||||
name outerCylinder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name propellerTip;
|
||||
name propellerTip;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -84,7 +84,7 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name propellerStem1;
|
||||
name propellerStem1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name propellerStem2;
|
||||
name propellerStem2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -108,11 +108,11 @@ geometry
|
||||
{
|
||||
ascii
|
||||
{
|
||||
name propellerStem3;
|
||||
name propellerStem3;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -45,20 +45,19 @@ geometry
|
||||
|
||||
refinement1
|
||||
{
|
||||
type searchableSphere;
|
||||
type sphere;
|
||||
centre (0 0 0.0025);
|
||||
radius 0.0075;
|
||||
}
|
||||
|
||||
refinement2
|
||||
{
|
||||
type searchableCylinder;
|
||||
type cylinder;
|
||||
point1 (0 0 0);
|
||||
point2 (0 0 0.03);
|
||||
radius 0.0075;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -794,10 +794,10 @@ boundary
|
||||
/* optional
|
||||
surface
|
||||
{
|
||||
type searchableCylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
type cylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
}
|
||||
*/
|
||||
faces
|
||||
@ -821,10 +821,10 @@ boundary
|
||||
/* optional
|
||||
surface
|
||||
{
|
||||
type searchableCylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
type cylinder; // none
|
||||
point1 (0 0 -1);
|
||||
point2 (0 0 1);
|
||||
radius 0.5;
|
||||
}
|
||||
*/
|
||||
faces
|
||||
|
@ -36,12 +36,11 @@ geometry
|
||||
|
||||
refinementBox
|
||||
{
|
||||
type searchableBox;
|
||||
min (-1.0 -0.7 0.0);
|
||||
max ( 8.0 0.7 2.5);
|
||||
type box;
|
||||
min (-1.0 -0.7 0.0);
|
||||
max ( 8.0 0.7 2.5);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
@ -61,12 +61,11 @@ geometry
|
||||
|
||||
//refinementBox
|
||||
//{
|
||||
// type searchableBox;
|
||||
// min (-0.3 -0.4 -0.1);
|
||||
// max ( 3.0 0.4 1.4);
|
||||
// }
|
||||
};
|
||||
|
||||
// type box;
|
||||
// min (-0.3 -0.4 -0.1);
|
||||
// max ( 3.0 0.4 1.4);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
|
Loading…
Reference in New Issue
Block a user