mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
primitiveMesh::pointInCellBB: Inflate the cell isotropically to handle anisotropic cells more robustly
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -755,16 +755,17 @@ public:
|
||||
|
||||
// Useful derived info
|
||||
|
||||
//- Is the point in the cell bounding box, option relative
|
||||
// tolerance to increase the effective size of the boundBox
|
||||
//- Return true if the point in the cell bounding box.
|
||||
// The bounding box may be isotropically inflated by the fraction
|
||||
// inflationFraction
|
||||
bool pointInCellBB
|
||||
(
|
||||
const point& p,
|
||||
label celli,
|
||||
scalar tol = 0
|
||||
scalar inflationFraction = 0
|
||||
) const;
|
||||
|
||||
//- Is the point in the cell
|
||||
//- Return true if the point is in the cell
|
||||
bool pointInCell(const point& p, label celli) const;
|
||||
|
||||
//- Find the cell with the nearest cell centre to location
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,7 +33,7 @@ bool Foam::primitiveMesh::pointInCellBB
|
||||
(
|
||||
const point& p,
|
||||
label celli,
|
||||
scalar tol
|
||||
scalar inflationFraction
|
||||
) const
|
||||
{
|
||||
boundBox bb
|
||||
@ -46,13 +46,10 @@ bool Foam::primitiveMesh::pointInCellBB
|
||||
false
|
||||
);
|
||||
|
||||
if (tol > SMALL)
|
||||
if (inflationFraction > SMALL)
|
||||
{
|
||||
bb = boundBox
|
||||
(
|
||||
bb.min() - tol*bb.span(),
|
||||
bb.max() + tol*bb.span()
|
||||
);
|
||||
vector inflation = inflationFraction*vector::one*mag(bb.span());
|
||||
bb = boundBox(bb.min() - inflation, bb.max() + inflation);
|
||||
}
|
||||
|
||||
return bb.contains(p);
|
||||
|
||||
Reference in New Issue
Block a user