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