mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: setter/getter for octree permutation tolerance
- make template invariant
This commit is contained in:
committed by
Andrew Heather
parent
3d7dc6a870
commit
b8d01a88ea
@ -31,11 +31,6 @@ License
|
||||
#include "OFstream.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::scalar Foam::dynamicIndexedOctree<Type>::perturbTol_ = 10*SMALL;
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -2046,13 +2041,6 @@ Foam::dynamicIndexedOctree<Type>::dynamicIndexedOctree
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::scalar& Foam::dynamicIndexedOctree<Type>::perturbTol()
|
||||
{
|
||||
return perturbTol_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findNearest
|
||||
(
|
||||
|
||||
@ -89,15 +89,6 @@ class dynamicIndexedOctree
|
||||
:
|
||||
public dynamicIndexedOctreeBase
|
||||
{
|
||||
// Static data
|
||||
|
||||
//- Relative perturbation tolerance. Determines when point is
|
||||
// considered to be close to face/edge of bb of node.
|
||||
// The tolerance is relative to the bounding box of the smallest
|
||||
// node.
|
||||
static scalar perturbTol_;
|
||||
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Underlying shapes for geometric queries.
|
||||
@ -333,10 +324,6 @@ class dynamicIndexedOctree
|
||||
|
||||
public:
|
||||
|
||||
//- Get the perturbation tolerance
|
||||
static scalar& perturbTol();
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from shapes
|
||||
|
||||
@ -32,12 +32,6 @@ License
|
||||
#include "ListOps.H"
|
||||
#include "memInfo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::scalar Foam::indexedOctree<Type>::perturbTol_ = 10*SMALL;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -2293,13 +2287,6 @@ Foam::indexedOctree<Type>::indexedOctree
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::scalar& Foam::indexedOctree<Type>::perturbTol()
|
||||
{
|
||||
return perturbTol_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||
(
|
||||
|
||||
@ -178,6 +178,16 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
// Static Data
|
||||
|
||||
//- Relative perturbation tolerance.
|
||||
// Determines when point is considered to be close to face/edge
|
||||
// of bb of node.
|
||||
// The tolerance is relative to the bounding box of the smallest
|
||||
// node.
|
||||
static scalar perturbTol_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
// Encode node addressing
|
||||
@ -204,6 +214,18 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
//- Get the perturbation tolerance
|
||||
static scalar& perturbTol() noexcept { return perturbTol_; }
|
||||
|
||||
//- Set the perturbation tolerance, return the old value
|
||||
static scalar perturbTol(scalar tol) noexcept
|
||||
{
|
||||
scalar old(perturbTol_);
|
||||
perturbTol_ = tol;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("indexedOctree");
|
||||
|
||||
@ -236,15 +258,6 @@ class indexedOctree
|
||||
:
|
||||
public indexedOctreeBase
|
||||
{
|
||||
// Static data
|
||||
|
||||
//- Relative perturbation tolerance. Determines when point is
|
||||
// considered to be close to face/edge of bb of node.
|
||||
// The tolerance is relative to the bounding box of the smallest
|
||||
// node.
|
||||
static scalar perturbTol_;
|
||||
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Underlying shapes for geometric queries.
|
||||
@ -489,10 +502,6 @@ class indexedOctree
|
||||
|
||||
public:
|
||||
|
||||
//- Get the perturbation tolerance
|
||||
static scalar& perturbTol();
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
|
||||
@ -34,6 +34,8 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(indexedOctreeBase, 0);
|
||||
|
||||
scalar indexedOctreeBase::perturbTol_ = 10*SMALL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -801,8 +801,8 @@ Foam::triSurfaceMesh::edgeTree() const
|
||||
<< "calculating edge tree for bb:" << bb << endl;
|
||||
}
|
||||
|
||||
scalar oldTol = indexedOctree<treeDataEdge>::perturbTol();
|
||||
indexedOctree<treeDataEdge>::perturbTol() = tolerance();
|
||||
const scalar oldTol =
|
||||
indexedOctree<treeDataEdge>::perturbTol(tolerance());
|
||||
|
||||
edgeTree_.reset
|
||||
(
|
||||
@ -822,7 +822,7 @@ Foam::triSurfaceMesh::edgeTree() const
|
||||
)
|
||||
);
|
||||
|
||||
indexedOctree<treeDataEdge>::perturbTol() = oldTol;
|
||||
indexedOctree<treeDataEdge>::perturbTol(oldTol);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -1221,8 +1221,8 @@ void Foam::triSurfaceMesh::getVolumeType
|
||||
List<volumeType>& volType
|
||||
) const
|
||||
{
|
||||
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
||||
const scalar oldTol =
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(tolerance());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -1258,7 +1258,8 @@ void Foam::triSurfaceMesh::getVolumeType
|
||||
}
|
||||
}
|
||||
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = oldTol;
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(oldTol);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::getVolumeType :"
|
||||
|
||||
@ -108,8 +108,7 @@ Foam::triSurfaceRegionSearch::treeByRegion() const
|
||||
|
||||
forAll(regionsAddressing, regionI)
|
||||
{
|
||||
scalar oldTol = treeType::perturbTol();
|
||||
treeType::perturbTol() = tolerance();
|
||||
const scalar oldTol = treeType::perturbTol(tolerance());
|
||||
|
||||
indirectRegionPatches_.set
|
||||
(
|
||||
@ -177,7 +176,7 @@ Foam::triSurfaceRegionSearch::treeByRegion() const
|
||||
)
|
||||
);
|
||||
|
||||
treeType::perturbTol() = oldTol;
|
||||
treeType::perturbTol(oldTol);
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,8 +198,7 @@ void Foam::triSurfaceRegionSearch::findNearest
|
||||
}
|
||||
else
|
||||
{
|
||||
scalar oldTol = treeType::perturbTol();
|
||||
treeType::perturbTol() = tolerance();
|
||||
const scalar oldTol = treeType::perturbTol(tolerance());
|
||||
|
||||
const PtrList<treeType>& octrees = treeByRegion();
|
||||
|
||||
@ -249,7 +247,7 @@ void Foam::triSurfaceRegionSearch::findNearest
|
||||
}
|
||||
}
|
||||
|
||||
treeType::perturbTol() = oldTol;
|
||||
treeType::perturbTol(oldTol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -233,8 +233,8 @@ Foam::triSurfaceSearch::tree() const
|
||||
bb.inflate(rndGen, 1e-4, ROOTVSMALL);
|
||||
}
|
||||
|
||||
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance_;
|
||||
const scalar oldTol =
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(tolerance_);
|
||||
|
||||
treePtr_.reset
|
||||
(
|
||||
@ -248,7 +248,7 @@ Foam::triSurfaceSearch::tree() const
|
||||
)
|
||||
);
|
||||
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = oldTol;
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(oldTol);
|
||||
}
|
||||
|
||||
return *treePtr_;
|
||||
@ -291,8 +291,8 @@ void Foam::triSurfaceSearch::findNearest
|
||||
List<pointIndexHit>& info
|
||||
) const
|
||||
{
|
||||
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
||||
const scalar oldTol =
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(tolerance());
|
||||
|
||||
const indexedOctree<treeDataTriSurface>& octree = tree();
|
||||
|
||||
@ -310,7 +310,7 @@ void Foam::triSurfaceSearch::findNearest
|
||||
);
|
||||
}
|
||||
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = oldTol;
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(oldTol);
|
||||
}
|
||||
|
||||
|
||||
@ -338,15 +338,15 @@ void Foam::triSurfaceSearch::findLine
|
||||
|
||||
info.setSize(start.size());
|
||||
|
||||
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
||||
const scalar oldTol =
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(tolerance());
|
||||
|
||||
forAll(start, i)
|
||||
{
|
||||
info[i] = octree.findLine(start[i], end[i]);
|
||||
}
|
||||
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = oldTol;
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(oldTol);
|
||||
}
|
||||
|
||||
|
||||
@ -361,15 +361,15 @@ void Foam::triSurfaceSearch::findLineAny
|
||||
|
||||
info.setSize(start.size());
|
||||
|
||||
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
||||
const scalar oldTol =
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(tolerance());
|
||||
|
||||
forAll(start, i)
|
||||
{
|
||||
info[i] = octree.findLineAny(start[i], end[i]);
|
||||
}
|
||||
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = oldTol;
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(oldTol);
|
||||
}
|
||||
|
||||
|
||||
@ -384,8 +384,8 @@ void Foam::triSurfaceSearch::findLineAll
|
||||
|
||||
info.setSize(start.size());
|
||||
|
||||
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
||||
const scalar oldTol =
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(tolerance());
|
||||
|
||||
// Work array
|
||||
DynamicList<pointIndexHit> hits;
|
||||
@ -437,7 +437,7 @@ void Foam::triSurfaceSearch::findLineAll
|
||||
info[pointi].transfer(hits);
|
||||
}
|
||||
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = oldTol;
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(oldTol);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user