ENH: Move longestEdge function to face.H as a global function

This commit is contained in:
laurence
2013-07-19 15:50:48 +01:00
parent 53c8a12668
commit 686b8f19d1
4 changed files with 30 additions and 31 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -829,4 +829,26 @@ Foam::label Foam::face::trianglesQuads
}
Foam::label Foam::longestEdge(const face& f, const pointField& pts)
{
const edgeList& eds = f.edges();
label longestEdgeI = -1;
scalar longestEdgeLength = -SMALL;
forAll(eds, edI)
{
scalar edgeLength = eds[edI].mag(pts);
if (edgeLength > longestEdgeLength)
{
longestEdgeI = edI;
longestEdgeLength = edgeLength;
}
}
return longestEdgeI;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -408,6 +408,12 @@ public:
};
// Global functions
//- Find the longest edge on a face. Face point labels index into pts.
label longestEdge(const face& f, const pointField& pts);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -42,32 +42,6 @@ defineTypeNameAndDebug(edgeCollapser, 0);
}
Foam::label Foam::edgeCollapser::longestEdge
(
const face& f,
const pointField& pts
)
{
const edgeList& eds = f.edges();
label longestEdgeI = -1;
scalar longestEdgeLength = -SMALL;
forAll(eds, edI)
{
scalar edgeLength = eds[edI].mag(pts);
if (edgeLength > longestEdgeLength)
{
longestEdgeI = edI;
longestEdgeLength = edgeLength;
}
}
return longestEdgeI;
}
Foam::HashSet<Foam::label> Foam::edgeCollapser::checkBadFaces
(
const polyMesh& mesh,

View File

@ -262,9 +262,6 @@ public:
// Check
//- Find the longest edge in a face
static label longestEdge(const face& f, const pointField& pts);
//- Calls motionSmoother::checkMesh and returns a set of bad faces
static HashSet<label> checkBadFaces
(