mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use edge::unitVec() for improved code clarity
This commit is contained in:
@ -319,8 +319,7 @@ bool splitCell
|
||||
{
|
||||
const edge& e = mesh.edges()[edgeI];
|
||||
|
||||
vector eVec = e.vec(mesh.points());
|
||||
eVec /= mag(eVec);
|
||||
const vector eVec = e.unitVec(mesh.points());
|
||||
|
||||
vector planeN = eVec ^ halfNorm;
|
||||
|
||||
|
||||
@ -127,8 +127,7 @@ void greenRefine
|
||||
//{
|
||||
// const edge& e = surf.edges()[edgeIndex];
|
||||
|
||||
// vector eVec = e.vec(surf.localPoints());
|
||||
// eVec /= mag(eVec) + SMALL;
|
||||
// const vector eVec = e.unitVec(surf.localPoints());
|
||||
|
||||
// const labelList& pEdges = surf.pointEdges()[pointIndex];
|
||||
//
|
||||
@ -136,8 +135,7 @@ void greenRefine
|
||||
// {
|
||||
// const edge& nearE = surf.edges()[pEdges[eI]];
|
||||
|
||||
// vector nearEVec = nearE.vec(surf.localPoints());
|
||||
// nearEVec /= mag(nearEVec) + SMALL;
|
||||
// const vector nearEVec = nearE.unitVec(surf.localPoints());
|
||||
|
||||
// const scalar dot = eVec & nearEVec;
|
||||
// const scalar minCos = degToRad(angle);
|
||||
|
||||
@ -63,8 +63,7 @@ Foam::PatchTools::sortedEdgeFaces
|
||||
|
||||
const point& edgePt = localPoints[e.start()];
|
||||
|
||||
vector e2 = e.vec(localPoints);
|
||||
e2 /= mag(e2) + VSMALL;
|
||||
const vector e2 = e.unitVec(localPoints);
|
||||
|
||||
// Get the vertex on 0th face that forms a vector with the first
|
||||
// edge point that has the largest angle with the edge
|
||||
|
||||
@ -410,13 +410,9 @@ void Foam::edgeCollapser::faceCollapseAxisAndAspectRatio
|
||||
|
||||
if (detJ < 1e-5)
|
||||
{
|
||||
collapseAxis = f.edges()[f.longestEdge(pts)].vec(pts);
|
||||
|
||||
// It is possible that all the points of a face are the same
|
||||
if (magSqr(collapseAxis) > VSMALL)
|
||||
{
|
||||
collapseAxis /= mag(collapseAxis);
|
||||
}
|
||||
|
||||
collapseAxis = f.edges()[f.longestEdge(pts)].unitVec(pts);
|
||||
|
||||
// Empirical correlation for high aspect ratio faces
|
||||
|
||||
@ -433,9 +429,7 @@ void Foam::edgeCollapser::faceCollapseAxisAndAspectRatio
|
||||
// Cannot necessarily determine linearly independent
|
||||
// eigenvectors, or any at all, use longest edge direction.
|
||||
|
||||
collapseAxis = f.edges()[f.longestEdge(pts)].vec(pts);
|
||||
|
||||
collapseAxis /= mag(collapseAxis);
|
||||
collapseAxis = f.edges()[f.longestEdge(pts)].unitVec(pts);
|
||||
|
||||
aspectRatio = 1.0;
|
||||
}
|
||||
|
||||
@ -529,8 +529,7 @@ void Foam::faMesh::calcEdgeAreaNormals() const
|
||||
|
||||
forAll(edgeAreaNormals.internalField(), edgeI)
|
||||
{
|
||||
vector e = edges()[edgeI].vec(points());
|
||||
e /= mag(e);
|
||||
const vector e = edges()[edgeI].unitVec(points());
|
||||
|
||||
// scalar wStart =
|
||||
// 1.0 - sqr(mag(e^pointNormals[edges()[edgeI].end()]));
|
||||
@ -580,8 +579,7 @@ void Foam::faMesh::calcEdgeAreaNormals() const
|
||||
pointNormals[patchEdges[edgeI].start()]
|
||||
+ pointNormals[patchEdges[edgeI].end()];
|
||||
|
||||
vector e = patchEdges[edgeI].vec(points());
|
||||
e /= mag(e);
|
||||
const vector e = patchEdges[edgeI].unitVec(points());
|
||||
|
||||
edgeAreaNormals.boundaryFieldRef()[patchI][edgeI] -=
|
||||
e*(e&edgeAreaNormals.boundaryField()[patchI][edgeI]);
|
||||
|
||||
@ -575,8 +575,8 @@ void Foam::refinementFeatures::findNearestEdge
|
||||
|
||||
const treeDataEdge& td = tree.shapes();
|
||||
const edge& e = td.edges()[nearInfo[sampleI].index()];
|
||||
nearNormal[sampleI] = e.vec(td.points());
|
||||
nearNormal[sampleI] /= mag(nearNormal[sampleI])+VSMALL;
|
||||
|
||||
nearNormal[sampleI] = e.unitVec(td.points());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -638,8 +638,8 @@ void Foam::refinementFeatures::findNearestRegionEdge
|
||||
);
|
||||
|
||||
const edge& e = td.edges()[nearInfo[sampleI].index()];
|
||||
nearNormal[sampleI] = e.vec(td.points());
|
||||
nearNormal[sampleI] /= mag(nearNormal[sampleI])+VSMALL;
|
||||
|
||||
nearNormal[sampleI] = e.unitVec(td.points());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,13 +429,11 @@ bool Foam::cellFeatures::isFeaturePoint(const label edge0, const label edge1)
|
||||
|
||||
const edge& e0 = mesh_.edges()[edge0];
|
||||
|
||||
vector e0Vec = e0.vec(mesh_.points());
|
||||
e0Vec /= mag(e0Vec);
|
||||
const vector e0Vec = e0.unitVec(mesh_.points());
|
||||
|
||||
const edge& e1 = mesh_.edges()[edge1];
|
||||
|
||||
vector e1Vec = e1.vec(mesh_.points());
|
||||
e1Vec /= mag(e1Vec);
|
||||
const vector e1Vec = e1.unitVec(mesh_.points());
|
||||
|
||||
scalar cosAngle;
|
||||
|
||||
|
||||
@ -192,11 +192,7 @@ Foam::vector Foam::meshTools::normEdgeVec
|
||||
const label edgeI
|
||||
)
|
||||
{
|
||||
vector eVec = mesh.edges()[edgeI].vec(mesh.points());
|
||||
|
||||
eVec /= mag(eVec);
|
||||
|
||||
return eVec;
|
||||
return mesh.edges()[edgeI].unitVec(mesh.points());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -432,8 +432,8 @@ void Foam::searchableExtrudedCircle::getNormal
|
||||
normal[i] = info[i].hitPoint()-curvePt.hitPoint();
|
||||
|
||||
// Subtract axial direction
|
||||
vector axialVec = edges[curvePt.index()].vec(points);
|
||||
axialVec /= mag(axialVec);
|
||||
const vector axialVec = edges[curvePt.index()].unitVec(points);
|
||||
|
||||
normal[i] -= (normal[i]&axialVec)*axialVec;
|
||||
normal[i] /= mag(normal[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user