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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -755,16 +755,17 @@ public:
// Useful derived info // Useful derived info
//- Is the point in the cell bounding box, option relative //- Return true if the point in the cell bounding box.
// tolerance to increase the effective size of the boundBox // The bounding box may be isotropically inflated by the fraction
// inflationFraction
bool pointInCellBB bool pointInCellBB
( (
const point& p, const point& p,
label celli, label celli,
scalar tol = 0 scalar inflationFraction = 0
) const; ) const;
//- Is the point in the cell //- Return true if the point is in the cell
bool pointInCell(const point& p, label celli) const; bool pointInCell(const point& p, label celli) const;
//- Find the cell with the nearest cell centre to location //- Find the cell with the nearest cell centre to location

View File

@ -2,7 +2,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-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,7 +33,7 @@ bool Foam::primitiveMesh::pointInCellBB
( (
const point& p, const point& p,
label celli, label celli,
scalar tol scalar inflationFraction
) const ) const
{ {
boundBox bb boundBox bb
@ -46,13 +46,10 @@ bool Foam::primitiveMesh::pointInCellBB
false false
); );
if (tol > SMALL) if (inflationFraction > SMALL)
{ {
bb = boundBox vector inflation = inflationFraction*vector::one*mag(bb.span());
( bb = boundBox(bb.min() - inflation, bb.max() + inflation);
bb.min() - tol*bb.span(),
bb.max() + tol*bb.span()
);
} }
return bb.contains(p); return bb.contains(p);