primitiveMesh::pointInCellBB: Inflate the cell isotropically to handle anisotropic cells more robustly

This commit is contained in:
Henry
2015-01-01 13:42:13 +00:00
parent 10ee5c477b
commit fef662401a
2 changed files with 11 additions and 13 deletions

View File

@ -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

View File

@ -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);