mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Use concavity check based on face planes.
A cell is concave if there is a face whose face-centre is outside the plane of any other face on the cell. Another option is to check for any vertices being outside ,, ,, but this is not consistent with current tracking.
This commit is contained in:
@ -2111,7 +2111,6 @@ bool Foam::primitiveMesh::checkConcaveCells
|
|||||||
const labelList& fOwner = faceOwner();
|
const labelList& fOwner = faceOwner();
|
||||||
const vectorField& fAreas = faceAreas();
|
const vectorField& fAreas = faceAreas();
|
||||||
const pointField& fCentres = faceCentres();
|
const pointField& fCentres = faceCentres();
|
||||||
const pointField& pts = points();
|
|
||||||
|
|
||||||
label nConcaveCells = 0;
|
label nConcaveCells = 0;
|
||||||
|
|
||||||
@ -2119,8 +2118,6 @@ bool Foam::primitiveMesh::checkConcaveCells
|
|||||||
{
|
{
|
||||||
const cell& cFaces = c[cellI];
|
const cell& cFaces = c[cellI];
|
||||||
|
|
||||||
const labelList& cPoints = cellPoints()[cellI];
|
|
||||||
|
|
||||||
bool concave = false;
|
bool concave = false;
|
||||||
|
|
||||||
forAll(cFaces, i)
|
forAll(cFaces, i)
|
||||||
@ -2134,8 +2131,6 @@ bool Foam::primitiveMesh::checkConcaveCells
|
|||||||
|
|
||||||
const point& fC = fCentres[fI];
|
const point& fC = fCentres[fI];
|
||||||
|
|
||||||
const face& f = faces()[fI];
|
|
||||||
|
|
||||||
vector fN = fAreas[fI];
|
vector fN = fAreas[fI];
|
||||||
|
|
||||||
fN /= max(mag(fN), VSMALL);
|
fN /= max(mag(fN), VSMALL);
|
||||||
@ -2147,20 +2142,16 @@ bool Foam::primitiveMesh::checkConcaveCells
|
|||||||
fN *= -1;
|
fN *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is any vertex of the cell on the wrong side of the
|
// Is the centre of any other face of the cell on the
|
||||||
// plane of this face?
|
// wrong side of the plane of this face?
|
||||||
|
|
||||||
forAll(cPoints, cPtI)
|
forAll(cFaces, j)
|
||||||
{
|
{
|
||||||
label ptI = cPoints[cPtI];
|
if (j != i)
|
||||||
|
|
||||||
// Skip points that are on this face
|
|
||||||
if (findIndex(f, ptI) > -1)
|
|
||||||
{
|
{
|
||||||
continue;
|
label fJ = cFaces[j];
|
||||||
}
|
|
||||||
|
|
||||||
const point& pt = pts[ptI];
|
const point& pt = fCentres[fJ];
|
||||||
|
|
||||||
// If the cell is concave, the point will be on the
|
// If the cell is concave, the point will be on the
|
||||||
// positive normal side of the plane of f, defined by
|
// positive normal side of the plane of f, defined by
|
||||||
@ -2190,6 +2181,7 @@ bool Foam::primitiveMesh::checkConcaveCells
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
reduce(nConcaveCells, sumOp<label>());
|
reduce(nConcaveCells, sumOp<label>());
|
||||||
|
|
||||||
@ -2197,8 +2189,8 @@ bool Foam::primitiveMesh::checkConcaveCells
|
|||||||
{
|
{
|
||||||
if (debug || report)
|
if (debug || report)
|
||||||
{
|
{
|
||||||
Info<< " ***Concave cells found, number of cells: "
|
Info<< " ***Concave cells (using face planes) found,"
|
||||||
<< nConcaveCells << endl;
|
<< " number of cells: " << nConcaveCells << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user