Commit 4977d93e authored by Henry's avatar Henry
Browse files

primitiveMesh::pointInCellBB: Inflate the cell isotropically to handle...

primitiveMesh::pointInCellBB: Inflate the cell isotropically to handle anisotropic cells more robustly
parent 4e492805
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment