mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: distinguish between face areaNormal/unitNormal in the code
This commit is contained in:
@ -188,19 +188,17 @@ label findInternalFace(const primitiveMesh& mesh, const labelList& meshF)
|
||||
bool correctOrientation(const pointField& points, const cellShape& shape)
|
||||
{
|
||||
// Get centre of shape.
|
||||
point cc(shape.centre(points));
|
||||
const point cc(shape.centre(points));
|
||||
|
||||
// Get outwards pointing faces.
|
||||
faceList faces(shape.faces());
|
||||
|
||||
forAll(faces, i)
|
||||
for (const face& f : faces)
|
||||
{
|
||||
const face& f = faces[i];
|
||||
|
||||
vector n(f.normal(points));
|
||||
const vector areaNorm(f.areaNormal(points));
|
||||
|
||||
// Check if vector from any point on face to cc points outwards
|
||||
if (((points[f[0]] - cc) & n) < 0)
|
||||
if (((points[f[0]] - cc) & areaNorm) < 0)
|
||||
{
|
||||
// Incorrectly oriented
|
||||
return false;
|
||||
|
||||
@ -225,9 +225,10 @@ int main(int argc, char *argv[])
|
||||
// Determine orientation of tri v.s. cell centre.
|
||||
point cc(cll.centre(points));
|
||||
point fc(tri.centre(points));
|
||||
vector fn(tri.normal(points));
|
||||
|
||||
if (((fc - cc) & fn) < 0)
|
||||
const vector areaNorm(tri.areaNormal(points));
|
||||
|
||||
if (((fc - cc) & areaNorm) < 0)
|
||||
{
|
||||
// Boundary face points inwards. Flip.
|
||||
boundaryFaces[facei].flip();
|
||||
|
||||
@ -1832,11 +1832,11 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|
||||
}
|
||||
|
||||
vector correctNormal = calcSharedPatchNormal(vc1, vc2);
|
||||
correctNormal /= mag(correctNormal);
|
||||
correctNormal.normalise();
|
||||
|
||||
Info<< " cN " << correctNormal << endl;
|
||||
|
||||
vector fN = f.normal(pts);
|
||||
vector fN = f.areaNormal(pts);
|
||||
|
||||
if (mag(fN) < SMALL)
|
||||
{
|
||||
@ -1844,7 +1844,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|
||||
continue;
|
||||
}
|
||||
|
||||
fN /= mag(fN);
|
||||
fN.normalise();
|
||||
Info<< " fN " << fN << endl;
|
||||
|
||||
if ((fN & correctNormal) > 0)
|
||||
|
||||
@ -481,10 +481,9 @@ void Foam::conformalVoronoiMesh::calcFaceZones
|
||||
norm
|
||||
);
|
||||
|
||||
vector fN = faces[facei].normal(mesh.points());
|
||||
fN /= mag(fN) + SMALL;
|
||||
const vector areaNorm = faces[facei].areaNormal(mesh.points());
|
||||
|
||||
if ((norm[0] & fN) < 0)
|
||||
if ((norm[0] & areaNorm) < 0)
|
||||
{
|
||||
flipMap[facei] = true;
|
||||
}
|
||||
|
||||
@ -89,11 +89,9 @@ void Foam::conformationSurfaces::hasBoundedVolume
|
||||
Info<< " Index = " << surfaces_[s] << endl;
|
||||
Info<< " Offset = " << regionOffset_[s] << endl;
|
||||
|
||||
forAll(triSurf, sI)
|
||||
for (const labelledTri& f : triSurf)
|
||||
{
|
||||
const label patchID =
|
||||
triSurf[sI].region()
|
||||
+ regionOffset_[s];
|
||||
const label patchID = f.region() + regionOffset_[s];
|
||||
|
||||
// Don't include baffle surfaces in the calculation
|
||||
if
|
||||
@ -102,15 +100,15 @@ void Foam::conformationSurfaces::hasBoundedVolume
|
||||
!= extendedFeatureEdgeMesh::BOTH
|
||||
)
|
||||
{
|
||||
sum += triSurf[sI].normal(surfPts);
|
||||
sum += f.areaNormal(surfPts);
|
||||
}
|
||||
else
|
||||
{
|
||||
nBaffles++;
|
||||
++nBaffles;
|
||||
}
|
||||
}
|
||||
Info<< " has " << nBaffles << " baffles out of "
|
||||
<< triSurf.size() << " triangles" << endl;
|
||||
<< triSurf.size() << " triangles" << nl;
|
||||
|
||||
totalTriangles += triSurf.size();
|
||||
}
|
||||
|
||||
@ -271,8 +271,8 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
);
|
||||
|
||||
//pointField dualPoints(meshMod.points());
|
||||
//vector n(newFace.normal(dualPoints));
|
||||
//n /= mag(n);
|
||||
//const vector n(newFace.unitNormal(dualPoints));
|
||||
//
|
||||
//Pout<< "Generated internal dualFace:" << dualFacei
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)
|
||||
@ -298,8 +298,8 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
);
|
||||
|
||||
//pointField dualPoints(meshMod.points());
|
||||
//vector n(newFace.normal(dualPoints));
|
||||
//n /= mag(n);
|
||||
//const vector n(newFace.unitNormal(dualPoints));
|
||||
//
|
||||
//Pout<< "Generated internal dualFace:" << dualFacei
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)
|
||||
@ -355,8 +355,8 @@ Foam::label Foam::meshDualiser::addBoundaryFace
|
||||
);
|
||||
|
||||
//pointField dualPoints(meshMod.points());
|
||||
//vector n(newFace.normal(dualPoints));
|
||||
//n /= mag(n);
|
||||
//const vector n(newFace.unitNormal(dualPoints));
|
||||
//
|
||||
//Pout<< "Generated boundary dualFace:" << dualFacei
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)
|
||||
|
||||
Reference in New Issue
Block a user