mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
no pointField construction
This commit is contained in:
@ -526,7 +526,7 @@ Foam::point Foam::face::centre(const pointField& meshPoints) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::face::normal(const pointField& meshPoints) const
|
Foam::vector Foam::face::normal(const pointField& p) const
|
||||||
{
|
{
|
||||||
// Calculate the normal by summing the face triangle normals.
|
// Calculate the normal by summing the face triangle normals.
|
||||||
// Changed to deal with small concavity by using a central decomposition
|
// Changed to deal with small concavity by using a central decomposition
|
||||||
@ -539,17 +539,22 @@ Foam::vector Foam::face::normal(const pointField& meshPoints) const
|
|||||||
{
|
{
|
||||||
return triPointRef
|
return triPointRef
|
||||||
(
|
(
|
||||||
meshPoints[operator[](0)],
|
p[operator[](0)],
|
||||||
meshPoints[operator[](1)],
|
p[operator[](1)],
|
||||||
meshPoints[operator[](2)]
|
p[operator[](2)]
|
||||||
).normal();
|
).normal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
label nPoints = size();
|
||||||
|
|
||||||
vector n = vector::zero;
|
vector n = vector::zero;
|
||||||
|
|
||||||
point centrePoint = Foam::average(points(meshPoints));
|
point centrePoint = vector::zero;
|
||||||
|
for (pI = 0; pI < nPoints; pI++)
|
||||||
label nPoints = size();
|
{
|
||||||
|
centrePoint += p[operator[](pI)];
|
||||||
|
}
|
||||||
|
centrePoint /= nPoints;
|
||||||
|
|
||||||
point nextPoint = centrePoint;
|
point nextPoint = centrePoint;
|
||||||
|
|
||||||
@ -559,18 +564,18 @@ Foam::vector Foam::face::normal(const pointField& meshPoints) const
|
|||||||
{
|
{
|
||||||
if (pI < nPoints - 1)
|
if (pI < nPoints - 1)
|
||||||
{
|
{
|
||||||
nextPoint = meshPoints[operator[](pI + 1)];
|
nextPoint = p[operator[](pI + 1)];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nextPoint = meshPoints[operator[](0)];
|
nextPoint = p[operator[](0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: for best accuracy, centre point always comes last
|
// Note: for best accuracy, centre point always comes last
|
||||||
//
|
//
|
||||||
n += triPointRef
|
n += triPointRef
|
||||||
(
|
(
|
||||||
meshPoints[operator[](pI)],
|
p[operator[](pI)],
|
||||||
nextPoint,
|
nextPoint,
|
||||||
centrePoint
|
centrePoint
|
||||||
).normal();
|
).normal();
|
||||||
|
|||||||
Reference in New Issue
Block a user