diff --git a/applications/test/syncTools/Test-syncTools.cxx b/applications/test/syncTools/Test-syncTools.cxx index 05bcbf46e2..72e1eca1e7 100644 --- a/applications/test/syncTools/Test-syncTools.cxx +++ b/applications/test/syncTools/Test-syncTools.cxx @@ -525,6 +525,7 @@ public: } } }; + class edgePointTransformOp { public: @@ -543,25 +544,24 @@ public: points1[i] = fld[i].second(); } - pointField points0New; - pointField points1New; if (forward) { - points0New = vt.transformPosition(points0); - points1New = vt.transformPosition(points1); + vt.transformPositionList(points0); + vt.transformPositionList(points1); } else { - points0New = vt.invTransformPosition(points0); - points1New = vt.invTransformPosition(points1); + vt.invTransformPositionList(points0); + vt.invTransformPositionList(points1); } forAll(fld, i) { - fld[i] = PointPair(points0New[i], points1New[i]); + fld[i] = PointPair(points0[i], points1[i]); } } }; + class edgePointFlipOp { public: @@ -572,6 +572,7 @@ public: return newVal; } }; + void testEdgeFlip2(const polyMesh& mesh, Random& rndGen) { Info<< nl << "Testing edge-wise (oriented) data synchronisation." << endl; @@ -759,13 +760,11 @@ class pointListOps { public: - void operator()(pointList& lhs, const pointList& rhs) const + void operator()(UList& lhs, const UList& rhs) const { forAll(lhs, i) { - point& l = lhs[i]; - const point& r = rhs[i]; - maxMagSqrEqOp()(l, r); + maxMagSqrEqOp()(lhs[i], rhs[i]); } } @@ -773,38 +772,31 @@ public: ( const vectorTensorTransform& vt, const bool forward, - List& fld + UList& fld ) const { if (forward) { - for (auto& elems : fld) + for (auto& pts : fld) { - for (auto& elem : elems) - { - elem = vt.transformPosition(elem); - } + vt.transformPositionList(pts); } } else { - for (auto& elems : fld) + for (auto& pts : fld) { - for (auto& elem : elems) - { - elem = vt.invTransformPosition(elem); - } + vt.invTransformPositionList(pts); } } } //- Transform patch-based field - void operator()(const coupledPolyPatch& cpp, List& fld) const + void operator()(const coupledPolyPatch& cpp, UList& fld) const { forAll(fld, facei) { - pointList& pts = fld[facei]; - for (auto& pt : pts) + for (auto& pt : fld[facei]) { cpp.transformPosition(pt, facei); } diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index b8008a71b4..4619f3b446 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -39,8 +39,7 @@ Foam::label Foam::findOppositeWedge && isA(patches[patchi]) ) { - const wedgePolyPatch& pp = - refCast(patches[patchi]); + const auto& pp = refCast(patches[patchi]); // Calculate (cos of) angle to wpp (not pp!) centre normal scalar ppCosAngle = wpp.centreNormal() & pp.n(); @@ -80,8 +79,7 @@ bool Foam::checkWedges { if (patches[patchi].size() && isA(patches[patchi])) { - const wedgePolyPatch& pp = - refCast(patches[patchi]); + const auto& pp = refCast(patches[patchi]); scalar wedgeAngle = acos(pp.cosAngle()); @@ -105,7 +103,7 @@ bool Foam::checkWedges return true; } - const wedgePolyPatch& opp = + const auto& opp = refCast(patches[oppositePatchi]); @@ -275,25 +273,27 @@ namespace Foam void operator() ( const coupledPolyPatch& cpp, - List& pts + UList& pts ) const { - // Each element of pts is all the points in the face. Convert into - // lists of size cpp to transform. + // Each element of pts is all the points in the face. + // Convert into lists of size cpp to transform. List newPts(pts.size()); forAll(pts, facei) { - newPts[facei].setSize(pts[facei].size()); + newPts[facei].resize(pts[facei].size()); } + pointField ptsAtIndex(pts.size()); + label index = 0; while (true) { label n = 0; // Extract for every face the i'th position - pointField ptsAtIndex(pts.size(), Zero); + ptsAtIndex = Zero; forAll(cpp, facei) { const pointField& facePts = pts[facei]; @@ -326,7 +326,8 @@ namespace Foam index++; } - pts.transfer(newPts); + // Transfer newPts -> pts + std::move(newPts.begin(), newPts.end(), pts.begin()); } }; } @@ -352,10 +353,7 @@ bool Foam::checkCoupledPoints { if (patches[patchi].coupled()) { - const coupledPolyPatch& cpp = refCast - ( - patches[patchi] - ); + const auto& cpp = refCast(patches[patchi]); forAll(cpp, i) { @@ -387,8 +385,7 @@ bool Foam::checkCoupledPoints { if (patches[patchi].coupled()) { - const coupledPolyPatch& cpp = - refCast(patches[patchi]); + const auto& cpp = refCast(patches[patchi]); if (cpp.owner()) { @@ -1023,7 +1020,7 @@ Foam::label Foam::checkGeometry { if (isA(pbm[patchi])) { - const cyclicAMIPolyPatch& cpp = + const auto& cpp = refCast(pbm[patchi]); if (cpp.owner()) @@ -1058,7 +1055,7 @@ Foam::label Foam::checkGeometry if (isA(pbm[patchi])) { - const cyclicACMIPolyPatch& pp = + const auto& pp = refCast(pbm[patchi]); scalarField mergedMask; @@ -1108,8 +1105,9 @@ Foam::label Foam::checkGeometry if (isA(pbm[patchi])) { - const cyclicACMIPolyPatch& pp = + const auto& pp = refCast(pbm[patchi]); + scalarField mergedMask; globalFaces().gather ( diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C index 1a8cc8ea39..f0dd047945 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C @@ -40,96 +40,6 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template<> -void Foam::mapDistribute::transform::operator() -( - const vectorTensorTransform&, - const bool, - List