mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: make maxTreeDepth optional in triSurfaceSearch constructor
- makes it easier to construct with a tolerance only
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -175,7 +175,12 @@ Foam::triSurfaceSearch::triSurfaceSearch
|
|||||||
tolerance_(tolerance),
|
tolerance_(tolerance),
|
||||||
maxTreeDepth_(maxTreeDepth),
|
maxTreeDepth_(maxTreeDepth),
|
||||||
treePtr_(nullptr)
|
treePtr_(nullptr)
|
||||||
{}
|
{
|
||||||
|
if (tolerance_ < 0)
|
||||||
|
{
|
||||||
|
tolerance_ = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -227,7 +232,7 @@ Foam::triSurfaceSearch::tree() const
|
|||||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance_;
|
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance_;
|
||||||
|
|
||||||
treePtr_.reset
|
treePtr_.reset
|
||||||
@ -285,7 +290,7 @@ void Foam::triSurfaceSearch::findNearest
|
|||||||
List<pointIndexHit>& info
|
List<pointIndexHit>& info
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
||||||
|
|
||||||
const indexedOctree<treeDataTriSurface>& octree = tree();
|
const indexedOctree<treeDataTriSurface>& octree = tree();
|
||||||
@ -332,7 +337,7 @@ void Foam::triSurfaceSearch::findLine
|
|||||||
|
|
||||||
info.setSize(start.size());
|
info.setSize(start.size());
|
||||||
|
|
||||||
scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
||||||
|
|
||||||
forAll(start, i)
|
forAll(start, i)
|
||||||
@ -355,7 +360,7 @@ void Foam::triSurfaceSearch::findLineAny
|
|||||||
|
|
||||||
info.setSize(start.size());
|
info.setSize(start.size());
|
||||||
|
|
||||||
scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
||||||
|
|
||||||
forAll(start, i)
|
forAll(start, i)
|
||||||
@ -378,7 +383,7 @@ void Foam::triSurfaceSearch::findLineAll
|
|||||||
|
|
||||||
info.setSize(start.size());
|
info.setSize(start.size());
|
||||||
|
|
||||||
scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
||||||
|
|
||||||
// Work array
|
// Work array
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -85,10 +85,10 @@ class triSurfaceSearch
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
triSurfaceSearch(const triSurfaceSearch&);
|
triSurfaceSearch(const triSurfaceSearch&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const triSurfaceSearch&);
|
void operator=(const triSurfaceSearch&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -96,17 +96,18 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from surface. Holds reference to surface!
|
//- Construct from surface. Holds reference to surface!
|
||||||
explicit triSurfaceSearch(const triSurface&);
|
explicit triSurfaceSearch(const triSurface& surface);
|
||||||
|
|
||||||
//- Construct from surface and dictionary.
|
//- Construct from surface and dictionary.
|
||||||
triSurfaceSearch(const triSurface&, const dictionary& dict);
|
triSurfaceSearch(const triSurface& surface, const dictionary& dict);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components.
|
||||||
|
// A invalid (negative) tolerance uses the default tolerance.
|
||||||
triSurfaceSearch
|
triSurfaceSearch
|
||||||
(
|
(
|
||||||
const triSurface& surface,
|
const triSurface& surface,
|
||||||
const scalar tolerance,
|
const scalar tolerance,
|
||||||
const label maxTreeDepth
|
const label maxTreeDepth = 10
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -155,7 +156,7 @@ public:
|
|||||||
// - hit() : whether nearest point found within bounding box
|
// - hit() : whether nearest point found within bounding box
|
||||||
// - hitPoint() : coordinate of nearest point
|
// - hitPoint() : coordinate of nearest point
|
||||||
// - index() : surface triangle label
|
// - index() : surface triangle label
|
||||||
pointIndexHit nearest(const point&, const vector& span) const;
|
pointIndexHit nearest(const point& pt, const vector& span) const;
|
||||||
|
|
||||||
void findLine
|
void findLine
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user