Commit cc7af66a authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: use face_type instead of FaceType typedef

parent 213d4134
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -35,7 +36,7 @@ static void markPointNbrs
boolList& okToCollapse
)
{
const triSurface::FaceType& f = surf.localFaces()[facei];
const triSurface::face_type& f = surf.localFaces()[facei];
forAll(f, fp)
{
......@@ -109,7 +110,7 @@ label collapseEdge(triSurface& surf, const scalar minLen)
if (okToCollapse[facei])
{
// Check edge lengths.
const triSurface::FaceType& f = localFaces[facei];
const triSurface::face_type& f = localFaces[facei];
forAll(f, fp)
{
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -459,7 +459,7 @@ label sharedFace
const edge& e = surf.edges()[sharedEdgeI];
const triSurface::FaceType& f = surf.localFaces()[firstFacei];
const triSurface::face_type& f = surf.localFaces()[firstFacei];
label startIndex = f.find(e.start());
......@@ -611,13 +611,13 @@ void renumberFaces
const triSurface& surf,
const labelList& pointMap,
const Map<label>& faceToEdge,
List<triSurface::FaceType>& newTris
List<triSurface::face_type>& newTris
)
{
forAllConstIters(faceToEdge, iter)
{
const label facei = iter.key();
const triSurface::FaceType& f = surf.localFaces()[facei];
const triSurface::face_type& f = surf.localFaces()[facei];
forAll(f, fp)
{
......@@ -932,7 +932,7 @@ int main(int argc, char *argv[])
// Check if faces use unmoved points.
forAll(newTris, facei)
{
const triSurface::FaceType& f = newTris[facei];
const triSurface::face_type& f = newTris[facei];
forAll(f, fp)
{
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -54,7 +55,7 @@ void PatchToPatchInterpolation<FromPatch, ToPatch>::calcPointAddressing() const
scalarField& pointDistance = *pointDistancePtr_;
const pointField& fromPatchPoints = fromPatch_.localPoints();
const List<typename FromPatch::FaceType>& fromPatchFaces =
const List<typename FromPatch::face_type>& fromPatchFaces =
fromPatch_.localFaces();
const pointField& toPatchPoints = toPatch_.localPoints();
......@@ -79,7 +80,7 @@ void PatchToPatchInterpolation<FromPatch, ToPatch>::calcPointAddressing() const
{
doWeights = false;
const typename FromPatch::FaceType& hitFace =
const typename FromPatch::face_type& hitFace =
fromPatchFaces[proj[pointi].hitObject()];
point hitPoint = Zero;
......@@ -284,7 +285,7 @@ void PatchToPatchInterpolation<FromPatch, ToPatch>::calcFaceAddressing() const
// A hit exists
faceAddressing[facei] = proj[facei].hitObject();
const typename FromPatch::FaceType& hitFace =
const typename FromPatch::face_type& hitFace =
fromPatchFaces[faceAddressing[facei]];
pointHit curHit =
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -58,7 +59,7 @@ PatchToPatchInterpolation<FromPatch, ToPatch>::pointInterpolate
Field<Type>& result = tresult.ref();
const List<typename FromPatch::FaceType>& fromPatchLocalFaces =
const List<typename FromPatch::face_type>& fromPatchLocalFaces =
fromPatch_.localFaces();
const FieldField<Field, scalar>& weights = pointWeights();
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -60,7 +61,7 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights() const
}
const pointField& points = patch_.localPoints();
const List<typename Patch::FaceType>& faces = patch_.localFaces();
const List<typename Patch::face_type>& faces = patch_.localFaces();
faceToPointWeightsPtr_ = new scalarListList(points.size());
scalarListList& weights = *faceToPointWeightsPtr_;
......@@ -116,7 +117,7 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights() const
}
const pointField& points = patch_.localPoints();
const List<typename Patch::FaceType>& faces = patch_.localFaces();
const List<typename Patch::face_type>& faces = patch_.localFaces();
const edgeList& edges = patch_.edges();
const labelListList& edgeFaces = patch_.edgeFaces();
......@@ -253,7 +254,7 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
Field<Type>& result = tresult.ref();
const List<typename Patch::FaceType>& localFaces = patch_.localFaces();
const List<typename Patch::face_type>& localFaces = patch_.localFaces();
forAll(result, facei)
{
......
......@@ -219,7 +219,7 @@ void Foam::PatchTools::calcBounds
nPoints = 0;
bb = boundBox::invertedBox;
for (const Face& f : p)
for (const auto& f : p)
{
for (const label pointi : f)
{
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -51,7 +51,6 @@ void Foam::treeDataPrimitivePatch<PatchType>::update()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
template<class PatchType>
Foam::treeDataPrimitivePatch<PatchType>::treeDataPrimitivePatch
(
......@@ -166,8 +165,8 @@ Foam::volumeType Foam::treeDataPrimitivePatch<PatchType>::getVolumeType
<< " nearest face:" << facei;
}
const typename PatchType::FaceType& localF = patch_.localFaces()[facei];
const typename PatchType::FaceType& f = patch_[facei];
const typename PatchType::face_type& localF = patch_.localFaces()[facei];
const typename PatchType::face_type& f = patch_[facei];
const pointField& points = patch_.points();
const labelList& mp = patch_.meshPoints();
......@@ -380,7 +379,7 @@ bool Foam::treeDataPrimitivePatch<PatchType>::overlaps
// 2. Check if one or more face points inside
const pointField& points = patch_.points();
const typename PatchType::FaceType& f = patch_[index];
const typename PatchType::face_type& f = patch_[index];
if (cubeBb.containsAny(points, f))
{
......@@ -478,7 +477,7 @@ void Foam::treeDataPrimitivePatch<PatchType>::findNearestOp::operator()
for (const label index : indices)
{
const typename PatchType::FaceType& f = patch[index];
const typename PatchType::face_type& f = patch[index];
const pointHit nearHit = f.nearestPoint(sample, points);
const scalar distSqr = sqr(nearHit.distance());
......@@ -560,7 +559,7 @@ bool Foam::treeDataPrimitivePatch<PatchType>::findSelfIntersectOp::operator()
const treeDataPrimitivePatch<PatchType>& shape = tree_.shapes();
const PatchType& patch = shape.patch();
const typename PatchType::FaceType& f = patch.localFaces()[index];
const typename PatchType::face_type& f = patch.localFaces()[index];
const edge& e = patch.edges()[edgeID_];
if (!f.found(e[0]) && !f.found(e[1]))
......@@ -586,7 +585,7 @@ bool Foam::treeDataPrimitivePatch<PatchType>::findIntersection
const PatchType& patch = shape.patch();
const pointField& points = patch.points();
const typename PatchType::FaceType& f = patch[index];
const typename PatchType::face_type& f = patch[index];
// Do quick rejection test
if (shape.cacheBb_)
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -38,9 +39,9 @@ void Foam::meshTools::writeOBJ
label vertI = 0;
forAll(faceLabels, i)
for (const label facei : faceLabels)
{
const FaceType& f = faces[faceLabels[i]];
const FaceType& f = faces[facei];
forAll(f, fp)
{
......
......@@ -92,7 +92,7 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
facesPerEdge.clear();
for (const label facei : pFaces)
{
const triSurface::FaceType& f = triSurface::operator[](facei);
const triSurface::face_type& f = triSurface::operator[](facei);
const label fp = f.find(pointi);
// Something weird: if I expand the code of addFaceToEdge in both
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -43,7 +43,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(edgeIntersections, 0);
defineTypeNameAndDebug(edgeIntersections, 0);
}
Foam::scalar Foam::edgeIntersections::alignedCos_ = Foam::cos(degToRad(89.0));
......@@ -383,14 +383,12 @@ bool Foam::edgeIntersections::offsetPerturb
bool hasPerturbed = false;
// For all hits on edge
forAll(hits, i)
for (const pointIndexHit& pHit : hits)
{
const pointIndexHit& pHit = hits[i];
// Classify point on face of surface2
label surf2Facei = pHit.index();
const label surf2Facei = pHit.index();
const triSurface::FaceType& f2 = surf2.localFaces()[surf2Facei];
const triSurface::face_type& f2 = surf2.localFaces()[surf2Facei];
const pointField& surf2Pts = surf2.localPoints();
const point ctr = f2.centre(surf2Pts);
......@@ -440,7 +438,6 @@ bool Foam::edgeIntersections::offsetPerturb
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct null
Foam::edgeIntersections::edgeIntersections()
:
List<List<pointIndexHit>>(),
......@@ -475,7 +472,6 @@ Foam::edgeIntersections::edgeIntersections
}
// Construct from components
Foam::edgeIntersections::edgeIntersections
(
const List<List<pointIndexHit>>& intersections,
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2018 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -41,7 +41,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(surfaceIntersection, 0);
defineTypeNameAndDebug(surfaceIntersection, 0);
}
const Foam::Enum
......@@ -283,7 +283,7 @@ void Foam::surfaceIntersection::classifyHit
// Classify point on surface2
const triSurface::FaceType& f2 = surf2.localFaces()[surf2Facei];
const triSurface::face_type& f2 = surf2.localFaces()[surf2Facei];
const pointField& surf1Pts = surf1.localPoints();
const pointField& surf2Pts = surf2.localPoints();
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -34,23 +35,30 @@ License
namespace Foam
{
defineTypeNameAndDebug(orientedSurface, 0);
defineTypeNameAndDebug(orientedSurface, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
// Return true if edge is used in opposite order in faces
bool Foam::orientedSurface::consistentEdge
(
const edge& e,
const triSurface::FaceType& f0,
const triSurface::FaceType& f1
)
namespace Foam
{
return (f0.edgeDirection(e) > 0) ^ (f1.edgeDirection(e) > 0);
}
// True if edge is used in opposite order in faces
template<class Face>
static inline bool consistentEdge
(
const edge& e,
const Face& f0,
const Face& f1
)
{
return (f0.edgeDirection(e) > 0) ^ (f1.edgeDirection(e) > 0);
}
} // End namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::labelList Foam::orientedSurface::faceToEdge
(
......@@ -61,13 +69,11 @@ Foam::labelList Foam::orientedSurface::faceToEdge
labelList changedEdges(3*changedFaces.size());
label changedI = 0;
forAll(changedFaces, i)
for (const label facei : changedFaces)
{
const labelList& fEdges = s.faceEdges()[changedFaces[i]];
forAll(fEdges, j)
for (const label edgei : s.faceEdges()[facei])
{
changedEdges[changedI++] = fEdges[j];
changedEdges[changedI++] = edgei;
}
}
changedEdges.setSize(changedI);
......@@ -86,10 +92,8 @@ Foam::labelList Foam::orientedSurface::edgeToFace
labelList changedFaces(2*changedEdges.size());
label changedI = 0;
forAll(changedEdges, i)
for (const label edgeI : changedEdges)
{
label edgeI = changedEdges[i];
const labelList& eFaces = s.edgeFaces()[edgeI];
if (eFaces.size() < 2)
......@@ -98,11 +102,11 @@ Foam::labelList Foam::orientedSurface::edgeToFace
}
else if (eFaces.size() == 2)
{
label face0 = eFaces[0];
label face1 = eFaces[1];
const label face0 = eFaces[0];
const label face1 = eFaces[1];
const triSurface::FaceType& f0 = s.localFaces()[face0];
const triSurface::FaceType& f1 = s.localFaces()[face1];
const triSurface::face_type& f0 = s.localFaces()[face0];
const triSurface::face_type& f1 = s.localFaces()[face1];
if (flip[face0] == UNVISITED)
{
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -45,7 +46,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
// Forward Declarations
class triSurfaceSearch;
/*---------------------------------------------------------------------------*\
......@@ -72,14 +73,6 @@ private:
// Private Member Functions
//- Return true if edge is used in opposite order in faces
static bool consistentEdge
(
const edge& e,
const triSurface::FaceType& f0,
const triSurface::FaceType& f1
);
//- From changed faces get the changed edges
static labelList faceToEdge
(
......@@ -145,7 +138,7 @@ public:
// Constructors
//- Construct null
//- Default construct
orientedSurface();
//- Construct from triSurface and sample point which is either
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -1062,7 +1062,7 @@ void Foam::triSurfaceTools::snapToEnd
if (current.elementType() == triPointRef::NONE)
{
// endpoint on point; current on triangle
const triSurface::FaceType& f = s.localFaces()[current.index()];
const triSurface::face_type& f = s.localFaces()[current.index()];
if (f.found(end.index()))
{
......@@ -1443,7 +1443,7 @@ Foam::label Foam::triSurfaceTools::oppositeVertex
const label edgeI
)
{
const triSurface::FaceType& f = surf.localFaces()[facei];
const triSurface::face_type& f = surf.localFaces()[facei];
const edge& e = surf.edges()[edgeI];
for (const label pointi : f)
......@@ -1958,7 +1958,7 @@ Foam::vector Foam::triSurfaceTools::surfaceNormal
const point& nearestPt
)
{
const triSurface::FaceType& f = surf[nearestFacei];
const triSurface::face_type& f = surf[nearestFacei];
const pointField& points = surf.points();
label nearType, nearLabel;
......@@ -1989,7 +1989,7 @@ Foam::vector Foam::triSurfaceTools::surfaceNormal
else
{
// Nearest to point
const triSurface::FaceType& localF = surf.localFaces()[nearestFacei];
const triSurface::face_type& localF = surf.localFaces()[nearestFacei];
return surf.pointNormals()[localF[nearLabel]];
}
}
......@@ -2039,7 +2039,7 @@ Foam::triSurfaceTools::sideType Foam::triSurfaceTools::surfaceSide
const label nearestFacei
)
{
const triSurface::FaceType& f = surf[nearestFacei];
const triSurface::face_type& f = surf[nearestFacei];
const pointField& points = surf.points();
// Find where point is on face
......@@ -2135,7 +2135,7 @@ Foam::triSurfaceTools::sideType Foam::triSurfaceTools::surfaceSide
// above (nearType == triPointRef::EDGE).
const triSurface::FaceType& localF = surf.localFaces()[nearestFacei];
const triSurface::face_type& localF = surf.localFaces()[nearestFacei];
label nearPointi = localF[nearLabel];
const edgeList& edges = surf.edges();
......
......@@ -1106,19 +1106,16 @@ Foam::label Foam::distributedTriSurfaceMesh::findOtherFace
) const
{
const triSurface& surf = static_cast<const triSurface&>(*this);
const triSurface::FaceType& nearF = surf[nearFacei];
const triSurface::face_type& nearF = surf[nearFacei];
const edge e(nearF[nearLabel], nearF[nearF.fcIndex(nearLabel)]);
const labelList& pFaces = pointFaces[e[0]];
forAll(pFaces, pFacei)
for (const label facei : pFaces)
{
const label facei = pFaces[pFacei];
if (facei != nearFacei)
{
const triSurface::FaceType& f = surf[facei];
int dir = f.edgeDirection(e);
int dir = surf[facei].edgeDirection(e);
if (dir != 0)
{
return facei;
......@@ -1151,9 +1148,8 @@ void Foam::distributedTriSurfaceMesh::calcFaceFaces
{
const edge e(f[fp], f[f.fcIndex(fp)]);
const labelList& pFaces = pointFaces[f[fp]];
forAll(pFaces, pFacei)
for (const label otherFacei : pFaces)
{
const label otherFacei = pFaces[pFacei];
if (otherFacei != facei)
{
if (s[otherFacei].edgeDirection(e) != 0)
......@@ -1223,8 +1219,8 @@ void Foam::distributedTriSurfaceMesh::surfaceSide
forAll(triangleIndex, i)
{
label facei = triangleIndex[i];
const triSurface::FaceType& f = surf[facei];
const label facei = triangleIndex[i];
const triSurface::face_type& f = surf[facei];
const point& sample = localSamples[i];
// Find where point is on face
......@@ -1287,10 +1283,9 @@ void Foam::distributedTriSurfaceMesh::surfaceSide
scalar maxCosAngle = -GREAT;
labelPair maxEdgeFaces(-1, -1);
forAll(pFaces, pFacei)
for (const label facei : pFaces)
{
label facei = pFaces[pFacei];
const triSurface::FaceType& f = surf[facei];
const triSurface::face_type& f = surf[facei];
label fp = f.find(pointi);
label p1 = f[f.fcIndex(fp)];
......@@ -1716,10 +1711,8 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
// Find bounding box for all triangles on new distribution.
forAll(s, trii)
{
const triSurface::FaceType& f = s[trii];
treeBoundBox& bb = bbs[distribution[trii]][0];
bb.add(s.points(), f);
bb.add(s.points(), s[trii