diff --git a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C index d0bd001f6f..34f157dfa0 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C +++ b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2021 OpenCFD Ltd. + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -88,7 +88,7 @@ label findPoint(const primitivePatch& pp, const point& nearPoint) for (const label pointi : meshPoints) { - scalar distSqr = magSqr(nearPoint - points[pointi]); + scalar distSqr = nearPoint.distSqr(points[pointi]); if (distSqr < minDistSqr) { @@ -288,7 +288,7 @@ label findCell(const primitiveMesh& mesh, const point& nearPoint) if (celli != -1) { - scalar distToCcSqr = magSqr(nearPoint - mesh.cellCentres()[celli]); + scalar distToCcSqr = nearPoint.distSqr(mesh.cellCentres()[celli]); const labelList& cPoints = mesh.cellPoints()[celli]; @@ -297,7 +297,7 @@ label findCell(const primitiveMesh& mesh, const point& nearPoint) for (const label pointi : cPoints) { - scalar distSqr = magSqr(nearPoint - mesh.points()[pointi]); + scalar distSqr = nearPoint.distSqr(mesh.points()[pointi]); if (distSqr < minDistSqr) { diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C index ad263e559e..77774439ce 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C @@ -869,9 +869,7 @@ Foam::DistributedDelaunayMesh::rangeInsertReferredWithInfo if (!bb.contains(samplePoint)) { - const Foam::point nearestPoint = bb.nearest(samplePoint); - - distFromBbSqr = magSqr(nearestPoint - samplePoint); + distFromBbSqr = bb.nearest(samplePoint).distSqr(samplePoint); } pointsBbDistSqr.append diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C index 0aebe1fd4a..c2de2091d6 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C @@ -1119,10 +1119,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::processorNearestPosition if (info.hit()) { - distanceSqrToCandidate[tPI] = magSqr - ( - testPoints[tPI] - info.hitPoint() - ); + distanceSqrToCandidate[tPI] = info.point().distSqr(testPoints[tPI]); } } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C index 0277cbfa59..ab7bf54aad 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -132,10 +132,7 @@ Foam::word Foam::cellShapeControlMesh::meshSubDir = "cellShapeControlMesh"; // // if (spokeHit.hit()) // { -// scalar spokeHitDistance = mag -// ( -// spokeHit.hitPoint() - pt -// ); +// scalar spokeHitDistance = spokeHit.point().dist(pt); // // if (spokeHitDistance < closestSpokeHitDistance) // { @@ -159,10 +156,7 @@ Foam::word Foam::cellShapeControlMesh::meshSubDir = "cellShapeControlMesh"; // // if (spokeHit.hit()) // { -// scalar spokeHitDistance = mag -// ( -// spokeHit.hitPoint() - mirrorPt -// ); +// scalar spokeHitDistance = spokeHit.point().dist(mirrorPt); // // if (spokeHitDistance < closestSpokeHitDistance) // { @@ -202,10 +196,10 @@ Foam::word Foam::cellShapeControlMesh::meshSubDir = "cellShapeControlMesh"; // FatalErrorInFunction // << "Parallel normals detected in spoke search." << nl // << "point: " << pt << nl -// << "closest surface point: " << surfHit.hitPoint() << nl -// << "closest spoke hit: " << closestSpokeHit.hitPoint() << nl -// << "np: " << surfHit.hitPoint() + np << nl -// << "ns: " << closestSpokeHit.hitPoint() + na << nl +// << "closest surface point: " << surfHit.point() << nl +// << "closest spoke hit: " << closestSpokeHit.point() << nl +// << "np: " << surfHit.point() + np << nl +// << "ns: " << closestSpokeHit.point() + na << nl // << exit(FatalError); // } // diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.C index d6c20276f8..c8b8dc2280 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -439,7 +439,7 @@ void Foam::searchableSurfaceControl::initialVertices { // Limit cell size const vector vN = - infoList[0].hitPoint() + infoList[0].point() - 2.0*normals[0]*defaultCellSize_; List intersectionList; @@ -453,8 +453,7 @@ void Foam::searchableSurfaceControl::initialVertices // if (intersectionList[0].hit()) // { -// scalar dist = -// mag(intersectionList[0].hitPoint() - pts[pI]); +// scalar dist = intersectionList[0].point().dist(pts[pI]); // // limitedCellSize = dist/2.0; // } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C index 02d5d1709e..313a039a7b 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2015 OpenFOAM Foundation + Copyright (C) 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -739,7 +740,7 @@ Foam::label Foam::controlMeshRefinement::refineMesh if (hitPt.hit()) { - const Foam::point& pt = hitPt.hitPoint(); + const Foam::point& pt = hitPt.point(); if (!geometryToConformTo_.inside(pt)) { diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.C index d8ae5340a8..775ca579fd 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2015 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -155,10 +155,10 @@ bool Foam::linearDistance::cellSize(const point& pt, scalar& size) const if (hitInfo.hit()) { - const point& hitPt = hitInfo.hitPoint(); + const point& hitPt = hitInfo.point(); const label hitIndex = hitInfo.index(); - const scalar dist = mag(pt - hitPt); + const scalar dist = hitPt.dist(pt); if (sideMode_ == rmBothsides) { diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C index 2055f9cb1a..99d119e8a9 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2015 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -206,10 +206,10 @@ bool Foam::surfaceOffsetLinearDistance::cellSize if (hitInfo.hit()) { - const point& hitPt = hitInfo.hitPoint(); + const point& hitPt = hitInfo.point(); const label hitIndex = hitInfo.index(); - const scalar dist = mag(pt - hitPt); + const scalar dist = hitPt.dist(pt); if (sideMode_ == rmBothsides) { @@ -220,7 +220,7 @@ bool Foam::surfaceOffsetLinearDistance::cellSize // If the nearest point is essentially on the surface, do not do a // getVolumeType calculation, as it will be prone to error. - if (mag(pt - hitInfo.hitPoint()) < snapToSurfaceTol_) + if (hitInfo.point().dist(pt) < snapToSurfaceTol_) { size = sizeFunction(hitPt, 0, hitIndex); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.C index 88157088ef..cd522974fe 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2015 OpenFOAM Foundation + Copyright (C) 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -97,7 +98,7 @@ bool uniform::cellSize if (hitInfo.hit()) { - const point& hitPt = hitInfo.hitPoint(); + const point& hitPt = hitInfo.point(); const label index = hitInfo.index(); if (sideMode_ == rmBothsides) diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.C index 141e4aade9..c337e143fe 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2015 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -134,7 +134,7 @@ bool Foam::uniformDistance::cellSize if (hitInfo.hit()) { - const point& hitPt = hitInfo.hitPoint(); + const point& hitPt = hitInfo.point(); const label index = hitInfo.index(); if (sideMode_ == rmBothsides) @@ -146,7 +146,7 @@ bool Foam::uniformDistance::cellSize // If the nearest point is essentially on the surface, do not do a // getVolumeType calculation, as it will be prone to error. - if (mag(pt - hitInfo.hitPoint()) < snapToSurfaceTol_) + if (hitInfo.point().dist(pt) < snapToSurfaceTol_) { size = surfaceCellSizeFunction_().interpolate(hitPt, index); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index 996a9e2e13..199d23a3e7 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -231,7 +231,7 @@ void Foam::conformalVoronoiMesh::insertSurfacePointPairs const vector& normal = norm[0]; - const Foam::point& surfacePt(surfaceHit.hitPoint()); + const Foam::point& surfacePt = surfaceHit.hitPoint(); extendedFeatureEdgeMesh::sideVolumeType meshableSide = geometryToConformTo_.meshableSide(featureIndex, surfaceHit); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index 1c0a115919..c1cebc026a 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -488,7 +488,7 @@ Foam::label Foam::conformalVoronoiMesh::mergeIdenticalDualVertices //// //// if (surfHit.hit()) //// { -//// pt += (surfHit.hitPoint() - pt) +//// pt += (surfHit.point() - pt) //// *pow //// ( //// foamyHexMeshControls() @@ -969,7 +969,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::findOffsetPatchFaces if ( pHit.hit() - && (mag(pHit.hitPoint() - faceCentre) > allowedOffset*targetSize) + && (pHit.point().dist(faceCentre) > allowedOffset*targetSize) ) { offsetBoundaryCells.insert(fCell[pLFI]); @@ -1362,10 +1362,10 @@ void Foam::conformalVoronoiMesh::indexDualVertices if (debug) { Info<< "Dual = " << dual << nl - << " Nearest = " << fpHit.hitPoint() << endl; + << " Nearest = " << fpHit.point() << endl; } - pts[cit->cellIndex()] = fpHit.hitPoint(); + pts[cit->cellIndex()] = fpHit.point(); } } } @@ -1401,7 +1401,7 @@ void Foam::conformalVoronoiMesh::indexDualVertices // ); // // pointFromPoint nearestPointOnTet = -// tet.nearestPoint(dual).rawPoint(); +// tet.nearestPoint(dual).point(); // // // Get nearest point on surface from tet. // geometryToConformTo_.findSurfaceNearest @@ -1440,10 +1440,10 @@ void Foam::conformalVoronoiMesh::indexDualVertices // snapping2.writeLine // ( // nearestPointOnTet, -// hitInfo.hitPoint() +// hitInfo.point() // ); // -// pts[cit->cellIndex()] = hitInfo.hitPoint(); +// pts[cit->cellIndex()] = hitInfo.point(); // } // } // } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C index bc1ccb10c5..8591f6bb0c 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C @@ -311,7 +311,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation() ) { // meshTools::writeOBJ(Pout, vert); - // meshTools::writeOBJ(Pout, surfHit.hitPoint()); + // meshTools::writeOBJ(Pout, surfHit.point()); // Pout<< "l cr0 cr1" << endl; addSurfaceAndEdgeHits @@ -804,7 +804,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees if (nearest.hit()) { // Pout<< "Not inserting " << peI << " " << pt << " " -// << nearest.rawPoint() << " on proc " << proci +// << nearest.point() << " on proc " << proci // << ", near edge = " << nearest // << " near ftPt = "<< info // << " " << featureEdgeExclusionDistanceSqr(pt) @@ -1477,9 +1477,9 @@ void Foam::conformalVoronoiMesh::reportProcessorOccupancy() // << vit->type() << nl // << vit->ppMaster() << nl // << "nearFeaturePt " -// << nearFeaturePt(surfHit.hitPoint()) << nl +// << nearFeaturePt(surfHit.point()) << nl // << vert << nl -// << surfHit.hitPoint() +// << surfHit.point() // << endl; // } // } @@ -1614,7 +1614,7 @@ void Foam::conformalVoronoiMesh::limitDisplacement { limit = true; - if (magSqr(pt - surfHit.hitPoint()) <= searchDistanceSqr) + if (surfHit.point().distSqr(pt) <= searchDistanceSqr) { // Cannot limit displacement, point closer than tolerance displacement = Zero; @@ -1711,7 +1711,7 @@ bool Foam::conformalVoronoiMesh::nearSurfacePoint ( closeToSurfacePt && ( - magSqr(pt - closePoint.hitPoint()) + closePoint.hitPoint().distSqr(pt) > sqr(pointPairDistance(pt)) ) ) @@ -2079,7 +2079,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits if (edHit.hit()) { - const Foam::point& edPt = edHit.hitPoint(); + const Foam::point& edPt = edHit.point(); if ( @@ -2095,7 +2095,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits { if ( - magSqr(edPt - surfPt) + surfPt.distSqr(edPt) < surfacePtReplaceDistCoeffSqr*cellSizeSqr ) { @@ -2141,7 +2141,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits surfacePtToEdgePtDist.insert ( existingEdgeLocations_.size() - 1, - magSqr(edPt - surfPt) + surfPt.distSqr(edPt) ); } else if (firstPass) @@ -2152,7 +2152,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits if ( - magSqr(edPt - surfPt) + surfPt.distSqr(edPt) < surfacePtToEdgePtDist[hitIndex] ) { @@ -2162,7 +2162,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits existingEdgeLocations_[hitIndex] = edHit.hitPoint(); surfacePtToEdgePtDist[hitIndex] = - magSqr(edPt - surfPt); + surfPt.distSqr(edPt); // Change edge location in featureEdgeHits // remove index from edge tree diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C index 03fef9501c..a52d0c6dcc 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -746,7 +746,7 @@ Foam::Field Foam::conformationSurfaces::wellInOutSide const vector hitDir = normalised ( - info[0].rawPoint() - samplePts[i] + info[0].point() - samplePts[i] ); pointIndexHit surfHit; @@ -755,7 +755,7 @@ Foam::Field Foam::conformationSurfaces::wellInOutSide findSurfaceNearestIntersection ( samplePts[i], - info[0].rawPoint() - 1e-3*mag(hitDir)*hitDir, + info[0].point() - 1e-3*mag(hitDir)*hitDir, surfHit, hitSurface ); @@ -1057,7 +1057,7 @@ void Foam::conformationSurfaces::findFeaturePointNearest if (hitInfo.hit()) { - minDistSqr = magSqr(hitInfo.hitPoint()- sample); + minDistSqr = hitInfo.point().distSqr(sample); fpHit = hitInfo; featureHit = testI; } @@ -1123,11 +1123,9 @@ void Foam::conformationSurfaces::findEdgeNearest { if (hitInfo[pointi].hit()) { - minDistSqr[pointi] = magSqr - ( - hitInfo[pointi].hitPoint() - - samples[pointi] - ); + minDistSqr[pointi] = + hitInfo[pointi].point().distSqr(samples[pointi]); + edgeHits[pointi] = hitInfo[pointi]; featuresHit[pointi] = testI; } @@ -1167,7 +1165,7 @@ void Foam::conformationSurfaces::findEdgeNearestByType { if (hitInfo[typeI].hit()) { - minDistSqr[typeI] = magSqr(hitInfo[typeI].hitPoint() - sample); + minDistSqr[typeI] = hitInfo[typeI].point().distSqr(sample); edgeHits[typeI] = hitInfo[typeI]; featuresHit[typeI] = testI; } @@ -1207,6 +1205,7 @@ void Foam::conformationSurfaces::findAllNearestEdges if (hitInfo[hitI].hit()) { anyHit = true; + break; } } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/rayShooting/rayShooting.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/rayShooting/rayShooting.C index 62fcd4b98f..5a1c358456 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/rayShooting/rayShooting.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/rayShooting/rayShooting.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2015 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -238,7 +238,7 @@ Foam::List Foam::rayShooting::initialPoints() const if ((normStart[0] & normEnd[0]) < 0) { - line l(fC, surfHitEnd.hitPoint()); + line l(fC, surfHitEnd.point()); if (Pstream::parRun()) { @@ -256,7 +256,7 @@ Foam::List Foam::rayShooting::initialPoints() const line ( l.start(), - procIntersection.hitPoint() + procIntersection.point() ); } } diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C index e2965da1e3..add0d3c80f 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C @@ -353,7 +353,7 @@ tmp signedDistance forAll(volType, i) { label pointi = surfIndices[i]; - scalar dist = mag(points[pointi] - nearest[pointi].hitPoint()); + scalar dist = points[pointi].dist(nearest[pointi].hitPoint()); volumeType vT = volType[i]; diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertBoundaryConformPointPairs.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertBoundaryConformPointPairs.C index 080433fe39..098a4d5e7c 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertBoundaryConformPointPairs.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertBoundaryConformPointPairs.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2015 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -113,7 +113,7 @@ bool Foam::CV2D::insertPointPairAtIntersection if (pHit.hit()) { scalar dist2 = - magSqr(toPoint2D(pHit.hitPoint()) - vertices[vi]); + toPoint2D(pHit.point()).distSqr(vertices[vi]); // Check the point is further away than the furthest so far if (dist2 > interDist2) @@ -131,7 +131,7 @@ bool Foam::CV2D::insertPointPairAtIntersection if (dist2 > mps2) { found = true; - interPoint = toPoint2D(pHit.hitPoint()); + interPoint = toPoint2D(pHit.point()); interTri = pHit.index(); interDist2 = dist2; interHitSurface = hitSurface; diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearPointPairs.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearPointPairs.C index f64aca738d..eb0888df4a 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearPointPairs.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearPointPairs.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2015 OpenFOAM Foundation + Copyright (C) 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -89,7 +90,7 @@ void Foam::CV2D::insertSurfaceNearPointPairs() insertPointPair ( meshControls().ppDist(), - toPoint2D(pHit.hitPoint()), + toPoint2D(pHit.point()), toPoint2D(norm[0]) ); diff --git a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H index c3d509e387..c3cdf974c1 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H +++ b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H @@ -146,7 +146,7 @@ for (const int proci : Pstream::allProcs()) if (aggHitIndex[hitIndex] == startAgg[rayID]) { const vector& endP = end[rayID]; - const vector& startP = hitInfo[hitIndex].hitPoint(); + const vector& startP = hitInfo[hitIndex].point(); const vector& d = endP - startP; startHitItself.append(startP + 0.01*d); diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C index ec9a5cb6db..278b84825a 100644 --- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C +++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C @@ -1002,7 +1002,7 @@ int main(int argc, char *argv[]) if (intStreamPtr) { - intStreamPtr().write(hitInfo.hitPoint()); + intStreamPtr().write(hitInfo.point()); } // Try and find from other side. @@ -1014,7 +1014,7 @@ int main(int argc, char *argv[]) if (intStreamPtr) { - intStreamPtr().write(hitInfo2.hitPoint()); + intStreamPtr().write(hitInfo2.point()); } } } @@ -1044,7 +1044,7 @@ int main(int argc, char *argv[]) // // if (hitInfo.hit() && intStreamPtr) // { - // intStreamPtr().write(hitInfo.hitPoint()); + // intStreamPtr().write(hitInfo.point()); // // label nearFaceI = hitInfo.index(); // triPointRef nearTri(surf[nearFaceI].tri(surf.points())); diff --git a/applications/utilities/surface/surfaceClean/collapseBase.C b/applications/utilities/surface/surfaceClean/collapseBase.C index ca20eddbc5..5c5572c23b 100644 --- a/applications/utilities/surface/surfaceClean/collapseBase.C +++ b/applications/utilities/surface/surfaceClean/collapseBase.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -642,7 +643,7 @@ static void projectNonSpanPoints << abort(FatalError); } - scalar w = mag(pHit.hitPoint() - p0) / mag(p1 - p0); + scalar w = pHit.point().dist(p0) / p1.dist(p0); insertSorted(v, w, sortedVertices, sortedWeights); } diff --git a/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C b/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C index 07f01627a3..bc99d0e172 100644 --- a/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C +++ b/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2014-2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -258,7 +258,7 @@ public: { nearestDistSqr = distSqr; minIndex = index; - nearestPoint = nearHit.rawPoint(); + nearestPoint = nearHit.point(); } } } @@ -420,8 +420,8 @@ int main(int argc, char *argv[]) !nearestHit.hit() || ( - magSqr(currentHit.hitPoint() - samplePt) - < magSqr(nearestHit.hitPoint() - samplePt) + currentHit.point().distSqr(samplePt) + < nearestHit.point().distSqr(samplePt) ) ) ) @@ -431,8 +431,6 @@ int main(int argc, char *argv[]) } } - scalar dist2 = magSqr(nearestHit.rawPoint() - samplePt); - if (nearestHit.hit()) { // bool rejectEdge = @@ -444,7 +442,9 @@ int main(int argc, char *argv[]) // 30 // ); - if (dist2 > Foam::sqr(dist)) + scalar distSqr = nearestHit.point().distSqr(samplePt); + + if (distSqr > Foam::sqr(dist)) { nearestHit.setMiss(); } @@ -491,11 +491,11 @@ int main(int argc, char *argv[]) if ( ( - magSqr(pt - hitSurf.localPoints()[e.start()]) + pt.distSqr(hitSurf.localPoints()[e.start()]) < matchTolerance ) || ( - magSqr(pt - hitSurf.localPoints()[e.end()]) + pt.distSqr(hitSurf.localPoints()[e.end()]) < matchTolerance ) ) diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C index 9fbe9cc0d0..6ea3cab7f7 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1570,14 +1570,14 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree::findLine ( octantBb, treeVec, - hitInfo.rawPoint() + hitInfo.point() ) ); if (verbose) { Pout<< "iter:" << i - << " at current:" << hitInfo.rawPoint() + << " at current:" << hitInfo.point() << " (perturbed:" << startPoint << ")" << endl << " node:" << nodeI << " octant:" << octant @@ -1612,7 +1612,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree::findLine break; } - if (hitFaceID == 0 || hitInfo.rawPoint() == treeEnd) + if (hitFaceID == 0 || hitInfo.point() == treeEnd) { // endpoint inside the tree. Return miss. break; @@ -1625,7 +1625,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree::findLine ( octantBb, hitFaceID, - hitInfo.rawPoint(), + hitInfo.point(), false // push outside of octantBb ) ); @@ -1634,7 +1634,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree::findLine { Pout<< " iter:" << i << " hit face:" << faceString(hitFaceID) - << " at:" << hitInfo.rawPoint() << nl + << " at:" << hitInfo.point() << nl << " node:" << nodeI << " octant:" << octant << " bb:" << subBbox(nodeI, octant) << nl @@ -1665,10 +1665,10 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree::findLine if (verbose) { const treeBoundBox octantBb(subBbox(nodeI, octant)); - Pout<< " walked for point:" << hitInfo.rawPoint() << endl + Pout<< " walked for point:" << hitInfo.point() << endl << " to neighbour node:" << nodeI << " octant:" << octant - << " face:" << faceString(octantBb.faceBits(hitInfo.rawPoint())) + << " face:" << faceString(octantBb.faceBits(hitInfo.point())) << " of octantBb:" << octantBb << endl << endl; } diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C index 86583ca6b1..a5914b35a6 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -84,16 +85,7 @@ bool Foam::dynamicTreeDataPoint::overlaps const scalar radiusSqr ) const { - const point& p = points_[index]; - - const scalar distSqr = magSqr(p - centre); - - if (distSqr <= radiusSqr) - { - return true; - } - - return false; + return (centre.distSqr(points_[index]) <= radiusSqr); } @@ -113,7 +105,7 @@ void Foam::dynamicTreeDataPoint::findNearest const point& pt = points_[index]; - scalar distSqr = magSqr(pt - sample); + const scalar distSqr = sample.distSqr(pt); if (distSqr < nearestDistSqr) { @@ -137,7 +129,7 @@ void Foam::dynamicTreeDataPoint::findNearest ) const { // Best so far - scalar nearestDistSqr = magSqr(linePoint - nearestPoint); + scalar nearestDistSqr = linePoint.distSqr(nearestPoint); forAll(indices, i) { @@ -155,7 +147,7 @@ void Foam::dynamicTreeDataPoint::findNearest { nearestDistSqr = distSqr; minIndex = index; - linePoint = pHit.rawPoint(); + linePoint = pHit.point(); nearestPoint = shapePt; { diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C index 463fa65d8e..60a94b6495 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1597,14 +1597,14 @@ Foam::pointIndexHit Foam::indexedOctree::findLine ( octantBb, treeVec, - hitInfo.rawPoint() + hitInfo.point() ) ); if (verbose) { Pout<< "iter:" << i - << " at current:" << hitInfo.rawPoint() + << " at current:" << hitInfo.point() << " (perturbed:" << startPoint << ")" << endl << " node:" << nodeI << " octant:" << octant @@ -1641,7 +1641,7 @@ Foam::pointIndexHit Foam::indexedOctree::findLine break; } - if (hitFaceID == 0 || hitInfo.rawPoint() == treeEnd) + if (hitFaceID == 0 || hitInfo.point() == treeEnd) { // endpoint inside the tree. Return miss. break; @@ -1654,7 +1654,7 @@ Foam::pointIndexHit Foam::indexedOctree::findLine ( octantBb, hitFaceID, - hitInfo.rawPoint(), + hitInfo.point(), false // push outside of octantBb ) ); @@ -1663,7 +1663,7 @@ Foam::pointIndexHit Foam::indexedOctree::findLine { Pout<< " iter:" << i << " hit face:" << faceString(hitFaceID) - << " at:" << hitInfo.rawPoint() << nl + << " at:" << hitInfo.point() << nl << " node:" << nodeI << " octant:" << octant << " bb:" << subBbox(nodeI, octant) << nl @@ -1694,10 +1694,10 @@ Foam::pointIndexHit Foam::indexedOctree::findLine if (verbose) { const treeBoundBox octantBb(subBbox(nodeI, octant)); - Pout<< " walked for point:" << hitInfo.rawPoint() << endl + Pout<< " walked for point:" << hitInfo.point() << endl << " to neighbour node:" << nodeI << " octant:" << octant - << " face:" << faceString(octantBb.faceBits(hitInfo.rawPoint())) + << " face:" << faceString(octantBb.faceBits(hitInfo.point())) << " of octantBb:" << octantBb << endl << endl; } diff --git a/src/OpenFOAM/algorithms/indexedOctree/treeDataCell.C b/src/OpenFOAM/algorithms/indexedOctree/treeDataCell.C index 3591c0cecb..d2752db4a9 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/treeDataCell.C +++ b/src/OpenFOAM/algorithms/indexedOctree/treeDataCell.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -210,13 +210,15 @@ void Foam::treeDataCell::findNearestOp::operator() { label index = indices[i]; label celli = shape.cellLabels()[index]; - scalar distSqr = magSqr(sample - shape.mesh().cellCentres()[celli]); + const point& pt = shape.mesh().cellCentres()[celli]; + + scalar distSqr = sample.distSqr(pt); if (distSqr < nearestDistSqr) { nearestDistSqr = distSqr; minIndex = index; - nearestPoint = shape.mesh().cellCentres()[celli]; + nearestPoint = pt; } } } @@ -300,7 +302,7 @@ bool Foam::treeDataCell::findIntersectOp::operator() // since using half_ray AND zero tolerance. (note that tolerance // is used to look behind us) minDistSqr = sqr(inter.distance()); - intersectionPoint = inter.hitPoint(); + intersectionPoint = inter.point(); hasMin = true; } } diff --git a/src/OpenFOAM/algorithms/indexedOctree/treeDataEdge.C b/src/OpenFOAM/algorithms/indexedOctree/treeDataEdge.C index 0cc41c9b04..fb069c7d4b 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/treeDataEdge.C +++ b/src/OpenFOAM/algorithms/indexedOctree/treeDataEdge.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -198,7 +199,7 @@ void Foam::treeDataEdge::findNearestOp::operator() { nearestDistSqr = distSqr; minIndex = index; - nearestPoint = nearHit.rawPoint(); + nearestPoint = nearHit.point(); } } } @@ -218,7 +219,7 @@ void Foam::treeDataEdge::findNearestOp::operator() const treeDataEdge& shape = tree_.shapes(); // Best so far - scalar nearestDistSqr = magSqr(linePoint - nearestPoint); + scalar nearestDistSqr = linePoint.distSqr(nearestPoint); for (const label index : indices) { diff --git a/src/OpenFOAM/algorithms/indexedOctree/treeDataPoint.C b/src/OpenFOAM/algorithms/indexedOctree/treeDataPoint.C index ce4a72f400..d2329f6058 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/treeDataPoint.C +++ b/src/OpenFOAM/algorithms/indexedOctree/treeDataPoint.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -128,7 +128,7 @@ bool Foam::treeDataPoint::overlaps const scalar radiusSqr ) const { - return (magSqr(shapePoint(index) - centre) <= radiusSqr); + return (centre.distSqr(shapePoint(index)) <= radiusSqr); } @@ -148,7 +148,7 @@ void Foam::treeDataPoint::findNearestOp::operator() { const point& pt = shape.shapePoint(index); - const scalar distSqr = magSqr(pt - sample); + const scalar distSqr = sample.distSqr(pt); if (distSqr < nearestDistSqr) { @@ -177,7 +177,7 @@ void Foam::treeDataPoint::findNearestOp::operator() scalar nearestDistSqr = GREAT; if (minIndex >= 0) { - nearestDistSqr = magSqr(linePoint - nearestPoint); + nearestDistSqr = linePoint.distSqr(nearestPoint); } for (const label index : indices) @@ -194,7 +194,7 @@ void Foam::treeDataPoint::findNearestOp::operator() { nearestDistSqr = distSqr; minIndex = index; - linePoint = pHit.rawPoint(); + linePoint = pHit.point(); nearestPoint = shapePt; { diff --git a/src/OpenFOAM/interpolations/patchToPatchInterpolation/CalcPatchToPatchWeights.C b/src/OpenFOAM/interpolations/patchToPatchInterpolation/CalcPatchToPatchWeights.C index f21b82f00a..9b35f3e617 100644 --- a/src/OpenFOAM/interpolations/patchToPatchInterpolation/CalcPatchToPatchWeights.C +++ b/src/OpenFOAM/interpolations/patchToPatchInterpolation/CalcPatchToPatchWeights.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -208,11 +208,7 @@ void PatchToPatchInterpolation::calcPointAddressing() const pointWeights[pointi][masterPointi] = 1.0/ ( - mag - ( - hitFacePoints[masterPointi] - - hitPoint - ) + hitPoint.dist(hitFacePoints[masterPointi]) + VSMALL ); } @@ -300,7 +296,7 @@ void PatchToPatchInterpolation::calcFaceAddressing() const const labelList& neighbours = fromPatchFaceFaces[faceAddressing[facei]]; - scalar m = mag(curHit.hitPoint() - hitFaceCentre); + scalar m = curHit.hitPoint().dist(hitFaceCentre); if ( @@ -326,10 +322,9 @@ void PatchToPatchInterpolation::calcFaceAddressing() const faceWeights[facei][nI + 1] = 1.0/ ( - mag + curHit.hitPoint().dist ( fromPatchFaceCentres[neighbours[nI]] - - curHit.hitPoint() ) + VSMALL ); diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C b/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C index 92426d3688..624a319e7e 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C +++ b/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -94,7 +95,7 @@ Foam::pointHit Foam::face::ray if (Foam::mag(curHit.distance()) < Foam::mag(nearestHitDist)) { nearestHitDist = curHit.distance(); - nearest.hitPoint(curHit.hitPoint()); + nearest.hitPoint(curHit.point()); } } else if (!nearest.hit()) @@ -110,14 +111,14 @@ Foam::pointHit Foam::face::ray Foam::mag ( p + curHit.distance()*n - - curHit.missPoint() + - curHit.point() ); if (missDist < nearestMissDist) { nearestMissDist = missDist; nearest.setDistance(curHit.distance()); - nearest.setPoint(curHit.missPoint()); + nearest.setPoint(curHit.point()); } } } @@ -180,7 +181,7 @@ Foam::pointHit Foam::face::intersection if (Foam::mag(curHit.distance()) < Foam::mag(nearestHitDist)) { nearestHitDist = curHit.distance(); - nearest.hitPoint(curHit.hitPoint()); + nearest.hitPoint(curHit.point()); } } } @@ -293,13 +294,13 @@ Foam::pointHit Foam::face::nearestPointClassify if (curHit.hit()) { - nearest.hitPoint(curHit.hitPoint()); + nearest.hitPoint(curHit.point()); } else { // In nearest point, miss is always eligible nearest.setMiss(true); - nearest.setPoint(curHit.missPoint()); + nearest.setPoint(curHit.point()); } } } diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.C index a1d6f0822d..52dbd660e8 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.C @@ -238,8 +238,7 @@ Foam::PrimitivePatch::projectPoints else if (curHit.eligibleMiss()) { // Calculate min distance - scalar missDist = - Foam::mag(curHit.missPoint() - curPoint); + scalar missDist = curHit.point().dist(curPoint); if (missDist < minDistance) { @@ -466,8 +465,7 @@ Foam::PrimitivePatch::projectFaceCentres else if (curHit.eligibleMiss()) { // Calculate min distance - scalar missDist = - Foam::mag(curHit.missPoint() - curFaceCentre); + scalar missDist = curHit.point().dist(curFaceCentre); if (missDist < minDistance) { diff --git a/src/OpenFOAM/meshes/primitiveShapes/objectHit/pointIndexHit.H b/src/OpenFOAM/meshes/primitiveShapes/objectHit/pointIndexHit.H index 65cbd54ad8..e0647dc024 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/objectHit/pointIndexHit.H +++ b/src/OpenFOAM/meshes/primitiveShapes/objectHit/pointIndexHit.H @@ -116,6 +116,14 @@ public: index_(index) {} + //- Copy construct with different index + PointIndexHit(const PointIndexHit& p, label index) + : + hit_(p.hit()), + point_(p.point()), + index_(index) + {} + //- Construct from components PointIndexHit(bool success, const point_type& p, label index) : diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H index 64c0134f0a..70f5f177b9 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H @@ -915,7 +915,7 @@ inline Foam::pointHit Foam::triangle::nearestPoint // Hit beyond endpoint lnInfo.setMiss(true); lnInfo.setPoint(ln.end()); - scalar dist = Foam::mag(triInfo.hitPoint()-lnInfo.missPoint()); + scalar dist = triInfo.point().dist(lnInfo.point()); lnInfo.setDistance(dist); triInfo.setMiss(true); triInfo.setDistance(dist); @@ -925,7 +925,7 @@ inline Foam::pointHit Foam::triangle::nearestPoint // Hit beyond startpoint lnInfo.setMiss(true); lnInfo.setPoint(ln.start()); - scalar dist = Foam::mag(triInfo.hitPoint()-lnInfo.missPoint()); + scalar dist = triInfo.point().dist(lnInfo.point()); lnInfo.setDistance(dist); triInfo.setMiss(true); triInfo.setDistance(dist); @@ -933,9 +933,9 @@ inline Foam::pointHit Foam::triangle::nearestPoint else { // Hit on line - lnInfo.hitPoint(triInfo.hitPoint()); - lnInfo.setDistance(0.0); - triInfo.setDistance(0.0); + lnInfo.hitPoint(triInfo.point()); + lnInfo.setDistance(0); + triInfo.setDistance(0); } } else diff --git a/src/OpenFOAM/primitives/Vector/Vector.H b/src/OpenFOAM/primitives/Vector/Vector.H index b47da69fa3..a254b9e855 100644 --- a/src/OpenFOAM/primitives/Vector/Vector.H +++ b/src/OpenFOAM/primitives/Vector/Vector.H @@ -141,6 +141,20 @@ public: const Foam::UList>& /* (unused) */ ) const noexcept; + //- The length (L2-norm) of the vector + inline scalar mag() const; + + //- The length (L2-norm) squared of the vector. + inline scalar magSqr() const; + + //- The L2-norm distance from another vector. + //- The mag() of the difference. + inline scalar dist(const Vector& v2) const; + + //- The L2-norm distance squared from another vector. + //- The magSqr() of the difference. + inline scalar distSqr(const Vector& v2) const; + //- Inplace normalise the vector by its magnitude // For small magnitudes (less than ROOTVSMALL) set to zero. // Will not be particularly useful for a vector of labels @@ -156,14 +170,6 @@ public: //- Cross-product of \c this with another Vector. inline Vector cross(const Vector& v2) const; - //- The L2-norm distance from another vector. - //- The mag() of the difference. - inline scalar dist(const Vector& v2) const; - - //- The L2-norm distance squared from another vector. - //- The magSqr() of the difference. - inline scalar distSqr(const Vector& v2) const; - // Comparision Operations diff --git a/src/OpenFOAM/primitives/Vector/VectorI.H b/src/OpenFOAM/primitives/Vector/VectorI.H index a257dd7ad3..4c33803f65 100644 --- a/src/OpenFOAM/primitives/Vector/VectorI.H +++ b/src/OpenFOAM/primitives/Vector/VectorI.H @@ -79,10 +79,48 @@ inline const Foam::Vector& Foam::Vector::centre } +template +inline Foam::scalar Foam::Vector::magSqr() const +{ + return + ( + Foam::magSqr(this->x()) + + Foam::magSqr(this->y()) + + Foam::magSqr(this->z()) + ); +} + + +template +inline Foam::scalar Foam::Vector::mag() const +{ + return ::sqrt(this->magSqr()); +} + + +template +inline Foam::scalar Foam::Vector::distSqr(const Vector& v2) const +{ + return + ( + Foam::magSqr(v2.x() - this->x()) + + Foam::magSqr(v2.y() - this->y()) + + Foam::magSqr(v2.z() - this->z()) + ); +} + + +template +inline Foam::scalar Foam::Vector::dist(const Vector& v2) const +{ + return ::sqrt(this->distSqr(v2)); +} + + template inline Foam::Vector& Foam::Vector::normalise(const scalar tol) { - const scalar s(Foam::mag(*this)); + const scalar s = this->mag(); if (s < tol) { @@ -132,25 +170,6 @@ Foam::Vector::cross(const Vector& v2) const } -template -inline Foam::scalar Foam::Vector::distSqr(const Vector& v2) const -{ - return - ( - Foam::magSqr(v2.x() - this->x()) - + Foam::magSqr(v2.y() - this->y()) - + Foam::magSqr(v2.z() - this->z()) - ); -} - - -template -inline Foam::scalar Foam::Vector::dist(const Vector& v2) const -{ - return ::sqrt(this->distSqr(v2)); -} - - // * * * * * * * * * * * * * Comparision Operations * * * * * * * * * * * * // template diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2D.H b/src/OpenFOAM/primitives/Vector2D/Vector2D.H index b9e65e711b..2e807e22b6 100644 --- a/src/OpenFOAM/primitives/Vector2D/Vector2D.H +++ b/src/OpenFOAM/primitives/Vector2D/Vector2D.H @@ -121,6 +121,20 @@ public: // Vector Operations + //- The length (L2-norm) of the vector + inline scalar mag() const; + + //- The length (L2-norm) squared of the vector. + inline scalar magSqr() const; + + //- The L2-norm distance from another vector. + //- The mag() of the difference. + inline scalar dist(const Vector2D& v2) const; + + //- The L2-norm distance squared from another vector. + //- The magSqr() of the difference. + inline scalar distSqr(const Vector2D& v2) const; + //- Normalise the vector by its magnitude // For small magnitudes (less than ROOTVSMALL) set to zero. // Will not be particularly useful for a vector of labels @@ -130,7 +144,6 @@ public: //- unit vector. inline Vector2D& removeCollinear(const Vector2D& unitVec); - //- Perp dot product (dot product with perpendicular vector) inline scalar perp(const Vector2D& b) const; diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2DI.H b/src/OpenFOAM/primitives/Vector2D/Vector2DI.H index 0b823ebeb3..1877bce271 100644 --- a/src/OpenFOAM/primitives/Vector2D/Vector2DI.H +++ b/src/OpenFOAM/primitives/Vector2D/Vector2DI.H @@ -62,10 +62,47 @@ inline Foam::Vector2D::Vector2D(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +inline Foam::scalar Foam::Vector2D::magSqr() const +{ + return + ( + Foam::magSqr(this->x()) + + Foam::magSqr(this->y()) + ); +} + + +template +inline Foam::scalar Foam::Vector2D::mag() const +{ + return ::sqrt(this->magSqr()); +} + + +template +inline Foam::scalar +Foam::Vector2D::distSqr(const Vector2D& v2) const +{ + return + ( + Foam::magSqr(v2.x() - this->x()) + + Foam::magSqr(v2.y() - this->y()) + ); +} + + +template +inline Foam::scalar Foam::Vector2D::dist(const Vector2D& v2) const +{ + return ::sqrt(this->distSqr(v2)); +} + + template inline Foam::Vector2D& Foam::Vector2D::normalise(const scalar tol) { - const scalar s(Foam::mag(*this)); + const scalar s = this->mag(); if (s < tol) { @@ -117,7 +154,7 @@ inline bool Vector2D::isClose const scalar tol ) const { - return (mag(x() - b.x()) < tol && mag(y() - b.y()) < tol); + return (Foam::mag(x() - b.x()) < tol && Foam::mag(y() - b.y()) < tol); } diff --git a/src/OpenFOAM/primitives/triad/triad.C b/src/OpenFOAM/primitives/triad/triad.C index f8036b7b50..c4dccf9929 100644 --- a/src/OpenFOAM/primitives/triad/triad.C +++ b/src/OpenFOAM/primitives/triad/triad.C @@ -101,6 +101,8 @@ Foam::triad::triad(const quaternion& q) void Foam::triad::orthogonalise() { + //int which = ((set(0) ? 1 : 0) | (set(1) ? 2 : 0) | (set(2) ? 4 : 0)); + // Hack for 2D z-slab cases // if (!set(2)) // { @@ -126,9 +128,9 @@ void Foam::triad::orthogonalise() { for (int i=0; i<2; i++) { - scalar o01 = mag(operator[](0) & operator[](1)); - scalar o02 = mag(operator[](0) & operator[](2)); - scalar o12 = mag(operator[](1) & operator[](2)); + scalar o01 = Foam::mag(operator[](0) & operator[](1)); + scalar o02 = Foam::mag(operator[](0) & operator[](2)); + scalar o12 = Foam::mag(operator[](1) & operator[](2)); if (o01 < o02 && o01 < o12) { @@ -220,7 +222,7 @@ void Foam::triad::operator+=(const triad& t2) if (!set) { scalar a = operator[](i) & t2.operator[](j); - scalar maga = mag(a); + scalar maga = Foam::mag(a); if (maga > mostAligned) { @@ -243,9 +245,9 @@ void Foam::triad::align(const vector& v) { vector mostAligned ( - mag(v & operator[](0)), - mag(v & operator[](1)), - mag(v & operator[](2)) + Foam::mag(v & operator[](0)), + Foam::mag(v & operator[](1)), + Foam::mag(v & operator[](2)) ); scalar mav; @@ -293,13 +295,13 @@ Foam::triad Foam::triad::sortxyz() const if ( - mag(operator[](0).x()) > mag(operator[](1).x()) - && mag(operator[](0).x()) > mag(operator[](2).x()) + Foam::mag(operator[](0).x()) > Foam::mag(operator[](1).x()) + && Foam::mag(operator[](0).x()) > Foam::mag(operator[](2).x()) ) { t[0] = operator[](0); - if (mag(operator[](1).y()) > mag(operator[](2).y())) + if (Foam::mag(operator[](1).y()) > Foam::mag(operator[](2).y())) { t[1] = operator[](1); t[2] = operator[](2); @@ -312,12 +314,12 @@ Foam::triad Foam::triad::sortxyz() const } else if ( - mag(operator[](1).x()) > mag(operator[](2).x()) + Foam::mag(operator[](1).x()) > Foam::mag(operator[](2).x()) ) { t[0] = operator[](1); - if (mag(operator[](0).y()) > mag(operator[](2).y())) + if (Foam::mag(operator[](0).y()) > Foam::mag(operator[](2).y())) { t[1] = operator[](0); t[2] = operator[](2); @@ -332,7 +334,7 @@ Foam::triad Foam::triad::sortxyz() const { t[0] = operator[](2); - if (mag(operator[](0).y()) > mag(operator[](1).y())) + if (Foam::mag(operator[](0).y()) > Foam::mag(operator[](1).y())) { t[1] = operator[](0); t[2] = operator[](1); @@ -391,7 +393,7 @@ Foam::scalar Foam::diff(const triad& A, const triad& B) scalar cosPhi = (tmpA[dir] & tmpB[dir]) - /(mag(tmpA[dir])*mag(tmpA[dir]) + SMALL); + /(Foam::mag(tmpA[dir])*Foam::mag(tmpA[dir]) + SMALL); cosPhi = min(max(cosPhi, -1), 1); diff --git a/src/OpenFOAM/primitives/triad/triad.H b/src/OpenFOAM/primitives/triad/triad.H index 8ed84b6bce..09b23f4420 100644 --- a/src/OpenFOAM/primitives/triad/triad.H +++ b/src/OpenFOAM/primitives/triad/triad.H @@ -70,7 +70,7 @@ public: // Constructors - //- Default construct + //- Default construct as 'unset' inline triad(); //- Construct from components @@ -92,7 +92,7 @@ public: inline triad(Istream&); - // Static data members + // Static Data Members static const triad I; static const triad unset; diff --git a/src/OpenFOAM/primitives/triad/triadI.H b/src/OpenFOAM/primitives/triad/triadI.H index 8debae6ce1..3ef4aba9a0 100644 --- a/src/OpenFOAM/primitives/triad/triadI.H +++ b/src/OpenFOAM/primitives/triad/triadI.H @@ -81,11 +81,15 @@ inline bool Foam::triad::set() const inline Foam::direction Foam::triad::primaryDirection(const vector& v) { - if (mag(v.x()) > mag(v.y()) && mag(v.x()) > mag(v.z())) + if + ( + Foam::mag(v.x()) > Foam::mag(v.y()) + && Foam::mag(v.x()) > Foam::mag(v.z()) + ) { return triad::X; } - else if (mag(v.y()) > mag(v.z())) + else if (Foam::mag(v.y()) > Foam::mag(v.z())) { return triad::Y; } @@ -104,7 +108,7 @@ inline Foam::vector Foam::triad::orthogonal { vector v3 = v1 ^ v2; - scalar magV3 = mag(v3); + scalar magV3 = Foam::mag(v3); if (magV3 > 0.5) { diff --git a/src/atmosphericModels/porosityModels/powerLawLopesdaCosta/powerLawLopesdaCosta.C b/src/atmosphericModels/porosityModels/powerLawLopesdaCosta/powerLawLopesdaCosta.C index e5c903e2d5..83804f5cdb 100644 --- a/src/atmosphericModels/porosityModels/powerLawLopesdaCosta/powerLawLopesdaCosta.C +++ b/src/atmosphericModels/porosityModels/powerLawLopesdaCosta/powerLawLopesdaCosta.C @@ -145,7 +145,7 @@ Foam::porosityModels::powerLawLopesdaCostaZone::powerLawLopesdaCostaZone porousCells[porousCelli] = porousCells[celli]; zTop[porousCelli] = - (hit.hitPoint() - C[porousCells[porousCelli]]) & zDir; + (hit.point() - C[porousCells[porousCelli]]) & zDir; porousCelli++; } @@ -245,7 +245,7 @@ Foam::porosityModels::powerLawLopesdaCostaZone::powerLawLopesdaCostaZone if (hit.hit()) { zBottom[porousCelli] = - (C[porousCells[porousCelli]] - hit.hitPoint()) & zDir; + (C[porousCells[porousCelli]] - hit.point()) & zDir; } } diff --git a/src/dynamicMesh/boundaryMesh/boundaryMesh.C b/src/dynamicMesh/boundaryMesh/boundaryMesh.C index c41eb1a9e6..cfae3a345c 100644 --- a/src/dynamicMesh/boundaryMesh/boundaryMesh.C +++ b/src/dynamicMesh/boundaryMesh/boundaryMesh.C @@ -1007,8 +1007,8 @@ Foam::labelList Foam::boundaryMesh::getNearest label rightFacei = rightFaces[rightInfo.index()]; label leftFacei = leftFaces[leftInfo.index()]; - label rightDist = mag(rightInfo.hitPoint()-ctr); - label leftDist = mag(leftInfo.hitPoint()-ctr); + label rightDist = rightInfo.point().dist(ctr); + label leftDist = leftInfo.point().dist(ctr); scalar rightSign = n & ns[rightFacei]; scalar leftSign = n & ns[leftFacei]; diff --git a/src/dynamicMesh/pointPatchDist/externalPointEdgePointI.H b/src/dynamicMesh/pointPatchDist/externalPointEdgePointI.H index 2228c16904..0da80add2e 100644 --- a/src/dynamicMesh/pointPatchDist/externalPointEdgePointI.H +++ b/src/dynamicMesh/pointPatchDist/externalPointEdgePointI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,7 +40,7 @@ inline bool Foam::externalPointEdgePoint::update TrackingData& td ) { - const scalar dist2 = magSqr(pt - w2.origin()); + const scalar dist2 = pt.distSqr(w2.origin()); if (!valid(td)) { diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.C index e8cd0ea0d4..3109c51e10 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -274,7 +274,7 @@ void Foam::faceCollapser::setRefinement // See where fp sorts. Make sure it is above fpMin1! pointHit near = lineAB.nearestDist(points[f[fp]]); - scalar w = magSqr(near.rawPoint() - pA); + scalar w = near.point().distSqr(pA); if (w <= dist[fpMin1]) { @@ -287,7 +287,7 @@ void Foam::faceCollapser::setRefinement ); Pout<< "Adapting position of vertex " << f[fp] << " on face " - << f << " from " << near.rawPoint() << " to " << newPoint + << f << " from " << near.point() << " to " << newPoint << endl; near.setPoint(newPoint); @@ -301,7 +301,7 @@ void Foam::faceCollapser::setRefinement polyModifyPoint ( f[fp], - near.rawPoint(), + near.point(), false, -1, true @@ -327,7 +327,7 @@ void Foam::faceCollapser::setRefinement // See where fp sorts. Make sure it is below fpMin1! pointHit near = lineAB.nearestDist(points[f[fp]]); - scalar w = magSqr(near.rawPoint() - pA); + scalar w = near.point().distSqr(pA); if (w <= dist[fpMin1]) { @@ -340,7 +340,7 @@ void Foam::faceCollapser::setRefinement ); Pout<< "Adapting position of vertex " << f[fp] << " on face " - << f << " from " << near.rawPoint() << " to " << newPoint + << f << " from " << near.point() << " to " << newPoint << endl; near.setPoint(newPoint); @@ -354,7 +354,7 @@ void Foam::faceCollapser::setRefinement polyModifyPoint ( f[fp], - near.rawPoint(), + near.point(), false, -1, true diff --git a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C index e478f846cd..40ca37ea7e 100644 --- a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C +++ b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -663,7 +663,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const const scalar cutOnSlave = ( ( - slaveCut.hitPoint() + slaveCut.point() - curSlaveLine.start() ) & curSlaveLine.vec() )/sqr(curSlaveLineMag); @@ -674,7 +674,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const // Pout<< "cutOnMaster: " << cutOnMaster // << " masterCutPoint: " << masterCutPoint - // << " slaveCutPoint: " << slaveCut.hitPoint() + // << " slaveCutPoint: " << slaveCut.point() // << " slaveCut.distance(): " // << slaveCut.distance() // << " slave length: " << mag(b - a) diff --git a/src/dynamicMesh/slidingInterface/slidingInterface.C b/src/dynamicMesh/slidingInterface/slidingInterface.C index f3cdacaecc..896c6a37b8 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterface.C +++ b/src/dynamicMesh/slidingInterface/slidingInterface.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -568,7 +568,7 @@ void Foam::slidingInterface::modifyMotionPoints(pointField& motionPoints) const scalar cutOnSlave = ( ( - slaveCut.hitPoint() + slaveCut.point() - curSlaveLine.start() ) & curSlaveLine.vec() )/sqr(curSlaveLineMag); @@ -599,7 +599,7 @@ void Foam::slidingInterface::modifyMotionPoints(pointField& motionPoints) const << " weight: " << ( ( - slaveCut.missPoint() + slaveCut.point() - curSlaveLine.start() ) & curSlaveLine.vec() )/sqr(curSlaveLineMag) diff --git a/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C b/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C index f52f6b4a1a..02c1262efb 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C +++ b/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -296,7 +296,7 @@ bool Foam::slidingInterface::projectPoints() const integralAdjTol_*minSlavePointLength[pointi]; // Adjust the hit - if (mag(nearPoint - missPoint) < mergeTol) + if (nearPoint.dist(missPoint) < mergeTol) { if (debug) { @@ -307,7 +307,7 @@ bool Foam::slidingInterface::projectPoints() const // << pointi << " miss point: " << missPoint // << " near point: " << nearPoint // << " mergeTol: " << mergeTol -// << " dist: " << mag(nearPoint - missPoint) << endl; +// << " dist: " << nearPoint.dist(missPoint) << endl; projectedSlavePoints[pointi] = nearPoint; @@ -558,7 +558,7 @@ bool Foam::slidingInterface::projectPoints() const if (edgeHit.hit()) { const scalar dist = - mag(edgeHit.hitPoint() - projectedSlavePoints[pointi]); + edgeHit.point().dist(projectedSlavePoints[pointi]); if (dist < mergeTol && dist < minDistance) { @@ -566,7 +566,7 @@ bool Foam::slidingInterface::projectPoints() const nMovedPoints++; slavePointEdgeHits[pointi] = edgei; - projectedSlavePoints[pointi] = edgeHit.hitPoint(); + projectedSlavePoints[pointi] = edgeHit.point(); minDistance = dist; @@ -578,7 +578,7 @@ bool Foam::slidingInterface::projectPoints() const // << " or (" // << masterLocalPoints[curEdge.start()] // << masterLocalPoints[curEdge.end()] -// << ") hit: " << edgeHit.hitPoint() +// << ") hit: " << edgeHit.point() // << ". dist: " << dist // << " mergeTol: " << mergeTol << endl; } @@ -962,7 +962,7 @@ bool Foam::slidingInterface::projectPoints() const // Strict checking of slave cut to avoid capturing // end points. const scalar cutOnSlave = - ((edgeLineHit.hitPoint() - edgeLine.start()) & edgeVec) + ((edgeLineHit.point() - edgeLine.start()) & edgeVec) /sqr(edgeMag); const scalar distInEdgePlane = @@ -973,7 +973,7 @@ bool Foam::slidingInterface::projectPoints() const ( ( masterLocalPoints[cmp] - - edgeLineHit.hitPoint() + - edgeLineHit.point() ) & edgeNormalInPlane ) diff --git a/src/fileFormats/stl/STLpoint.H b/src/fileFormats/stl/STLpoint.H index d39c22d6a2..0c87a37649 100644 --- a/src/fileFormats/stl/STLpoint.H +++ b/src/fileFormats/stl/STLpoint.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2017 OpenCFD Ltd. + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,25 +59,25 @@ public: STLpoint() = default; //- Construct from single-precision point - inline STLpoint(const Vector& p) + STLpoint(const Vector& p) : Vector(p) {} //- Construct from double-precision point - inline STLpoint(const Vector& p) + STLpoint(const Vector& p) : Vector(float(p.x()), float(p.y()), float(p.z())) {} //- Construct from single-precision components - inline STLpoint(float x, float y, float z) + STLpoint(float x, float y, float z) : Vector(x, y, z) {} //- Construct from double-precision components - inline STLpoint(double x, double y, double z) + STLpoint(double x, double y, double z) : Vector(float(x), float(y), float(z)) {} @@ -87,7 +87,7 @@ public: #ifdef WM_DP //- Conversion to double-precision point - inline operator point() const + operator point() const { return point(x(), y(), z()); } diff --git a/src/functionObjects/field/nearWallFields/nearWallFields.C b/src/functionObjects/field/nearWallFields/nearWallFields.C index a4e0f9a2b0..a6e32cdb8e 100644 --- a/src/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/functionObjects/field/nearWallFields/nearWallFields.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -110,12 +110,12 @@ void Foam::functionObjects::nearWallFields::calcAddressing() label tetFacei = meshFacei; label tetPti = (startInfo.index()+1) % f.size(); - start = startInfo.hitPoint(); + start = startInfo.point(); // Uncomment below to shift slightly in: tetIndices tet(celli, tetFacei, tetPti); start = - (1.0 - 1e-6)*startInfo.hitPoint() + (1.0 - 1e-6)*startInfo.point() + 1e-6*tet.tet(mesh_).centre(); // Re-check that we have a valid location diff --git a/src/functionObjects/field/surfaceDistance/surfaceDistance.C b/src/functionObjects/field/surfaceDistance/surfaceDistance.C index 81a96f5e62..0a2e3133e8 100644 --- a/src/functionObjects/field/surfaceDistance/surfaceDistance.C +++ b/src/functionObjects/field/surfaceDistance/surfaceDistance.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -135,7 +135,7 @@ bool Foam::functionObjects::surfaceDistance::execute() scalarField dist(fc.size()); forAll(nearestInfo, i) { - dist[i] = mag(nearestInfo[i].hitPoint()-fc[i]); + dist[i] = nearestInfo[i].hitPoint().dist(fc[i]); } bfld[patchi] == dist; } @@ -157,7 +157,7 @@ bool Foam::functionObjects::surfaceDistance::execute() forAll(nearestInfo, celli) { - distance[celli] = mag(nearestInfo[celli].hitPoint()-cc[celli]); + distance[celli] = nearestInfo[celli].hitPoint().dist(cc[celli]); } } distance.correctBoundaryConditions(); @@ -194,7 +194,7 @@ bool Foam::functionObjects::surfaceDistance::write() // scalarField dist(fc.size()); // forAll(nearestInfo, i) // { -// dist[i] = mag(nearestInfo[i].hitPoint()-fc[i]); +// dist[i] = nearestInfo[i].hitPoint().dist(fc[i]); // } // bfld[patchi] == dist; // } @@ -216,7 +216,7 @@ bool Foam::functionObjects::surfaceDistance::write() // // forAll(nearestInfo, celli) // { -// distance[celli] = mag(nearestInfo[celli].hitPoint()-cc[celli]); +// distance[celli] = nearestInfo[celli].hitPoint().dist(cc[celli]); // } // } // distance.correctBoundaryConditions(); diff --git a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C index 5b7f7c2a32..8125a777b3 100644 --- a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C +++ b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C @@ -88,7 +88,7 @@ Foam::functionObjects::wallBoundedStreamLine::findNearestTet const scalar d2 = nearInfo.distance(); if (d2 < minDistSqr) { - nearestPt = nearInfo.rawPoint(); + nearestPt = nearInfo.point(); minDistSqr = d2; minFacei = facei; minTetPti = i-1; diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C index 954cbd9677..ddc2da8c2f 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -174,14 +174,14 @@ void Foam::surfaceAlignedSBRStressFvMotionSolver::calculateCellRot() if (hit[facei].hit()) { label rotCellId(-1); - const vector hitPoint = hit[facei].hitPoint(); + const vector& hitPoint = hit[facei].point(); if (fvMesh_.isInternalFace(facei)) { - const vector cCOne = Cc[fvMesh_.faceOwner()[facei]]; - const vector cCTwo = Cc[fvMesh_.faceNeighbour()[facei]]; + const point& ownCc = Cc[fvMesh_.faceOwner()[facei]]; + const point& nbrCc = Cc[fvMesh_.faceNeighbour()[facei]]; - if (mag(cCOne - hitPoint) < mag(cCTwo - hitPoint)) + if (hitPoint.distSqr(ownCc) < hitPoint.distSqr(nbrCc)) { rotCellId = fvMesh_.faceOwner()[facei]; } diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C index 236616ccee..66fe7f4e43 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -126,7 +126,7 @@ void Foam::surfaceDisplacementPointPatchVectorField::calcProjection else if (nearest[i].hit()) { displacement[i] = - nearest[i].hitPoint() + nearest[i].point() - points0[meshPoints[i]]; } else @@ -217,7 +217,7 @@ void Foam::surfaceDisplacementPointPatchVectorField::calcProjection { // Found nearest. displacement[i] = - nearest[i].hitPoint() + nearest[i].point() - points0[meshPoints[i]]; } else @@ -226,24 +226,21 @@ void Foam::surfaceDisplacementPointPatchVectorField::calcProjection if (rightHit[i].hit()) { - if (leftHit[i].hit()) - { - if + if + ( + !leftHit[i].hit() + || ( - magSqr(rightHit[i].hitPoint()-start[i]) - < magSqr(leftHit[i].hitPoint()-start[i]) + start[i].distSqr(rightHit[i].point()) + < start[i].distSqr(leftHit[i].point()) ) - { - interPt = rightHit[i]; - } - else - { - interPt = leftHit[i]; - } + ) + { + interPt = rightHit[i]; } else { - interPt = rightHit[i]; + interPt = leftHit[i]; } } else @@ -259,9 +256,9 @@ void Foam::surfaceDisplacementPointPatchVectorField::calcProjection { if (wedgePlane_ >= 0 && wedgePlane_ <= vector::nComponents) { - interPt.rawPoint()[wedgePlane_] += offset[i]; + interPt.point()[wedgePlane_] += offset[i]; } - displacement[i] = interPt.rawPoint()-points0[meshPoints[i]]; + displacement[i] = interPt.point() - points0[meshPoints[i]]; } else { diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C index b64a78cca4..b560085117 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -125,9 +125,7 @@ void Foam::surfaceSlipDisplacementPointPatchVectorField::calcProjection } else if (nearest[i].hit()) { - displacement[i] = - nearest[i].hitPoint() - - points0[meshPoints[i]]; + displacement[i] = nearest[i].point() - points0[meshPoints[i]]; } else { @@ -216,9 +214,7 @@ void Foam::surfaceSlipDisplacementPointPatchVectorField::calcProjection else if (nearest[i].hit()) { // Found nearest. - displacement[i] = - nearest[i].hitPoint() - - points0[meshPoints[i]]; + displacement[i] = nearest[i].point() - points0[meshPoints[i]]; } else { @@ -226,24 +222,21 @@ void Foam::surfaceSlipDisplacementPointPatchVectorField::calcProjection if (rightHit[i].hit()) { - if (leftHit[i].hit()) - { - if + if + ( + !leftHit[i].hit() + || ( - magSqr(rightHit[i].hitPoint()-start[i]) - < magSqr(leftHit[i].hitPoint()-start[i]) + start[i].distSqr(rightHit[i].point()) + < start[i].distSqr(leftHit[i].point()) ) - { - interPt = rightHit[i]; - } - else - { - interPt = leftHit[i]; - } + ) + { + interPt = rightHit[i]; } else { - interPt = rightHit[i]; + interPt = leftHit[i]; } } else @@ -259,9 +252,9 @@ void Foam::surfaceSlipDisplacementPointPatchVectorField::calcProjection { if (wedgePlane_ >= 0 && wedgePlane_ < vector::nComponents) { - interPt.rawPoint()[wedgePlane_] += offset[i]; + interPt.point()[wedgePlane_] += offset[i]; } - displacement[i] = interPt.rawPoint()-points0[meshPoints[i]]; + displacement[i] = interPt.point() - points0[meshPoints[i]]; } else { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C index a126b8d793..e66c5a73a3 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -241,7 +241,7 @@ void Foam::PairCollision::wallInteraction() const vector normal = normalised(mesh.faceAreas()[realFacei]); - const vector& nearPt = nearest.rawPoint(); + const vector& nearPt = nearest.point(); const vector pW = normalised(nearPt - pos); @@ -316,7 +316,7 @@ void Foam::PairCollision::wallInteraction() { const vector normal = rwf.unitNormal(pts); - const vector& nearPt = nearest.rawPoint(); + const vector& nearPt = nearest.point(); const vector pW = normalised(nearPt - pos); diff --git a/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.C b/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.C index ff86c74023..b87539372d 100644 --- a/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.C +++ b/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -147,7 +147,7 @@ Foam::blockEdges::projectCurveEdge::position(const scalarList& lambdas) const { if (nearInfo[i].hit()) { - points[i] = nearInfo[i].hitPoint(); + points[i] = nearInfo[i].point(); } } diff --git a/src/mesh/blockMesh/blockFaces/projectFace/projectFace.C b/src/mesh/blockMesh/blockFaces/projectFace/projectFace.C index c7261a4388..e26d64e403 100644 --- a/src/mesh/blockMesh/blockFaces/projectFace/projectFace.C +++ b/src/mesh/blockMesh/blockFaces/projectFace/projectFace.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -230,12 +230,11 @@ void Foam::blockFaces::projectFace::project { if (hits[i].hit()) { - const point& hitPt = hits[i].hitPoint(); if (debugStr) { - debugStr().writeLine(points[i], hitPt); + debugStr().writeLine(points[i], hits[i].point()); } - points[i] = hitPt; + points[i] = hits[i].point(); } } } diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C index 92e3ffe0b5..6ac13188b0 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C @@ -3692,7 +3692,7 @@ void Foam::meshRefinement::dumpIntersections(const fileName& prefix) const { meshTools::writeOBJ(str, start[i]); verti++; - meshTools::writeOBJ(str, surfaceHitInfo[i].hitPoint()); + meshTools::writeOBJ(str, surfaceHitInfo[i].point()); verti++; meshTools::writeOBJ(str, end[i]); verti++; diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C index 5106cce0fb..2f31191ab6 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C @@ -261,9 +261,9 @@ void Foam::meshRefinement::getIntersections { if (str) { - str().writeLine(start[i], hit1[i].rawPoint()); - str().writeLine(hit1[i].rawPoint(), hit2[i].rawPoint()); - str().writeLine(hit2[i].rawPoint(), end[i]); + str().writeLine(start[i], hit1[i].point()); + str().writeLine(hit1[i].point(), hit2[i].point()); + str().writeLine(hit2[i].point(), end[i]); } // Pick up the patches @@ -1143,13 +1143,13 @@ Foam::List Foam::meshRefinement::freeStandingBaffles ( hit1[i].hit() && hit2[i].hit() - && mag(hit1[i].hitPoint()-hit2[i].hitPoint()) > mergeDistance_ + && hit1[i].point().dist(hit2[i].point()) > mergeDistance_ ) { // Two different hits. Check angle. //str.write //( - // linePointRef(hit1[i].hitPoint(), hit2[i].hitPoint()), + // linePointRef(hit1[i].point(), hit2[i].point()), // normal1[i], // normal2[i] //); diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBlock.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBlock.C index 617bf2fd98..1778e5b630 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBlock.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBlock.C @@ -651,8 +651,8 @@ Foam::label Foam::meshRefinement::markProximityRefinementWave //originNormal.clear(); originSurface.clear(); - originLocation.append(hit1[i].hitPoint()); - originDistSqr.append(magSqr(fc-hit1[i].hitPoint())); + originLocation.append(hit1[i].point()); + originDistSqr.append(hit1[i].point().distSqr(fc)); //originNormal.append(normal1[i]); originSurface.append ( @@ -667,8 +667,8 @@ Foam::label Foam::meshRefinement::markProximityRefinementWave if (hit2[i].hit() && hit1[i] != hit2[i]) { const labelList& fz2 = faceZones[surface2[i]]; - originLocation.append(hit2[i].hitPoint()); - originDistSqr.append(magSqr(fc-hit2[i].hitPoint())); + originLocation.append(hit2[i].point()); + originDistSqr.append(hit2[i].point().distSqr(fc)); //originNormal.append(normal2[i]); originSurface.append ( diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementGapRefine.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementGapRefine.C index a4e26a976b..63e49ca701 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementGapRefine.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementGapRefine.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2015-2020,2022 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -488,7 +488,7 @@ Foam::label Foam::meshRefinement::markSurfaceGapRefinement cellI != -1 && (mag(normal1[i]&normal2[i]) > planarCos) && ( - magSqr(hit1[i].hitPoint()-hit2[i].hitPoint()) + hit1[i].hitPoint().distSqr(hit2[i].hitPoint()) < Foam::sqr(gapSize[i]) ) ) @@ -565,14 +565,14 @@ Foam::label Foam::meshRefinement::markSurfaceGapRefinement // // Nearer. Check if // // - a bit way from other hit // // - in correct search cone -// vector d(nearHit.rawPoint()-oppositePoint_); +// vector d(nearHit.point()-oppositePoint_); // scalar normalDist(d&oppositeNormal_); // // if (normalDist > Foam::sqr(SMALL) && normalDist/mag(d) > minCos_) // { // nearestDistSqr = distSqr; // minIndex = index; -// nearestPoint = nearHit.rawPoint(); +// nearestPoint = nearHit.point(); // } // } // } @@ -1402,7 +1402,8 @@ Foam::label Foam::meshRefinement::markInternalGapRefinement const label cellI = cellMap[i]; - const scalar d2 = magSqr(hit1[i].hitPoint()-hit2[i].hitPoint()); + const scalar d2 = + hit1[i].hitPoint().distSqr(hit2[i].hitPoint()); if ( diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C index 3581ac263c..48f333495a 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -597,7 +597,7 @@ void Foam::meshRefinement::markFacesOnProblemCells { if (hitInfo[i].hit()) { - newPoints[meshPoints[i]] = hitInfo[i].hitPoint(); + newPoints[meshPoints[i]] = hitInfo[i].point(); } } diff --git a/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C b/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C index 1786b62341..afef9a7de0 100644 --- a/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C +++ b/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C @@ -399,7 +399,7 @@ void Foam::refinementFeatures::findHigherLevel label minDistI = findLower ( distances, - mag(nearInfo[candidateI].hitPoint()-candidates[candidateI]) + nearInfo[candidateI].point().dist(candidates[candidateI]) ); label pointi = candidateMap[candidateI]; @@ -665,7 +665,7 @@ void Foam::refinementFeatures::findNearestEdge scalar distSqr; if (nearInfo[sampleI].hit()) { - distSqr = magSqr(nearInfo[sampleI].hitPoint()-sample); + distSqr = nearInfo[sampleI].point().distSqr(sample); } else { @@ -680,7 +680,7 @@ void Foam::refinementFeatures::findNearestEdge nearInfo[sampleI] = pointIndexHit ( info.hit(), - info.hitPoint(), + info.point(), tree.shapes().edgeLabels()[info.index()] ); @@ -726,7 +726,7 @@ void Foam::refinementFeatures::findNearestRegionEdge scalar distSqr; if (nearInfo[sampleI].hit()) { - distSqr = magSqr(nearInfo[sampleI].hitPoint()-sample); + distSqr = nearInfo[sampleI].point().distSqr(sample); } else { @@ -744,7 +744,7 @@ void Foam::refinementFeatures::findNearestRegionEdge nearInfo[sampleI] = pointIndexHit ( info.hit(), - info.hitPoint(), + info.point(), regionTree.shapes().edgeLabels()[info.index()] ); @@ -836,7 +836,7 @@ void Foam::refinementFeatures::findNearestPoint scalar distSqr; if (nearFeature[sampleI] != -1) { - distSqr = magSqr(nearInfo[sampleI].hitPoint()-sample); + distSqr = nearInfo[sampleI].point().distSqr(sample); } else { @@ -851,7 +851,7 @@ void Foam::refinementFeatures::findNearestPoint nearInfo[sampleI] = pointIndexHit ( info.hit(), - info.hitPoint(), + info.point(), tree.shapes().pointLabels()[info.index()] ); } diff --git a/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C b/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C index b36725842e..f2b8df3dd5 100644 --- a/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C +++ b/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C @@ -1654,7 +1654,7 @@ void Foam::refinementSurfaces::findNearestIntersection { if (hit1[pointI].hit()) { - nearest[pointI] = hit1[pointI].hitPoint(); + nearest[pointI] = hit1[pointI].point(); } else { @@ -1784,7 +1784,7 @@ void Foam::refinementSurfaces::findNearestIntersection { if (hit1[pointI].hit()) { - nearest[pointI] = hit1[pointI].hitPoint(); + nearest[pointI] = hit1[pointI].point(); } else { @@ -1868,7 +1868,7 @@ void Foam::refinementSurfaces::findNearestIntersection { surface1[pointI] = surfI; normal1[pointI] = normal[pointI]; - nearest[pointI] = nearestInfo[pointI].hitPoint(); + nearest[pointI] = nearestInfo[pointI].point(); } } } @@ -1918,7 +1918,7 @@ void Foam::refinementSurfaces::findNearestIntersection surface1[pointI] = surfI; hitInfo1[pointI] = nearestInfo[pointI]; normal1[pointI] = normal[pointI]; - nearest[pointI] = nearestInfo[pointI].hitPoint(); + nearest[pointI] = nearestInfo[pointI].point(); } } } diff --git a/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C b/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C index 9564ec4cb9..9340842d8c 100644 --- a/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C +++ b/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C @@ -295,7 +295,7 @@ void Foam::shellSurfaces::findHigherLevel const label minDistI = findLower ( distances, - mag(nearInfo[i].hitPoint()-pt[pointi]) + nearInfo[i].point().dist(pt[pointi]) ); // pt is inbetween shell[minDistI] and shell[minDistI+1] @@ -526,7 +526,7 @@ void Foam::shellSurfaces::findLevel label minDistI = findLower ( distances, - mag(nearInfo[i].hitPoint()-candidates[i]) + nearInfo[i].point().dist(candidates[i]) ); label pointI = candidateMap[i]; diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C index 4c5d1c035c..5defc3fb3e 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C @@ -1296,11 +1296,11 @@ void Foam::snappySnapDriver::detectNearSurfaces // { // if (hit1[i].hit()) // { - // str.writeLine(start[i], hit1[i].hitPoint()); + // str.writeLine(start[i], hit1[i].point()); // } // if (hit2[i].hit()) // { - // str.writeLine(start[i], hit2[i].hitPoint()); + // str.writeLine(start[i], hit2[i].point()); // } // } // } @@ -1331,7 +1331,7 @@ void Foam::snappySnapDriver::detectNearSurfaces // { // if (hit1[rayi].hit()) // { - // const point& pt = hit1[rayi].hitPoint(); + // const point& pt = hit1[rayi].point(); // const vector& n = normal1[rayi]; // // if (!hasNormal) @@ -1363,7 +1363,7 @@ void Foam::snappySnapDriver::detectNearSurfaces // } // if (hit2[rayi].hit()) // { - // const point& pt = hit2[rayi].hitPoint(); + // const point& pt = hit2[rayi].point(); // const vector& n = normal2[rayi]; // // if (!hasNormal) @@ -1498,12 +1498,12 @@ void Foam::snappySnapDriver::detectNearSurfaces // planarCos, // nearestPoint[pointi], // nearestNormal[pointi], - // hit1[pointi].hitPoint(), + // hit1[pointi].point(), // normal1[pointi] // ) // ) // { - // disp[pointi] = hit1[pointi].hitPoint()-pt; + // disp[pointi] = hit1[pointi].point()-pt; // override = true; // } //} @@ -1516,12 +1516,12 @@ void Foam::snappySnapDriver::detectNearSurfaces // planarCos, // nearestPoint[pointi], // nearestNormal[pointi], - // hit2[pointi].hitPoint(), + // hit2[pointi].point(), // normal2[pointi] // ) // ) // { - // disp[pointi] = hit2[pointi].hitPoint()-pt; + // disp[pointi] = hit2[pointi].point()-pt; // override = true; // } //} @@ -1533,9 +1533,9 @@ void Foam::snappySnapDriver::detectNearSurfaces meshRefiner_.isGap ( planarCos, - hit1[pointi].hitPoint(), + hit1[pointi].point(), normal1[pointi], - hit2[pointi].hitPoint(), + hit2[pointi].point(), normal2[pointi] ) ) @@ -1545,12 +1545,11 @@ void Foam::snappySnapDriver::detectNearSurfaces if (gapStr) { - const point& intPt = hit2[pointi].hitPoint(); - gapStr().writeLine(pt, intPt); + gapStr().writeLine(pt, hit2[pointi].point()); } // Choose hit2 : nearest to end point (so inside the domain) - disp[pointi] = hit2[pointi].hitPoint()-pt; + disp[pointi] = hit2[pointi].point()-pt; override = true; } } @@ -1643,12 +1642,12 @@ void Foam::snappySnapDriver::detectNearSurfaces // planarCos, // nearestPoint[pointi], // nearestNormal[pointi], - // hit1[i].hitPoint(), + // hit1[i].point(), // normal1[i] // ) // ) // { - // disp[pointi] = hit1[i].hitPoint()-pt; + // disp[pointi] = hit1[i].point()-pt; // override = true; // } //} @@ -1661,12 +1660,12 @@ void Foam::snappySnapDriver::detectNearSurfaces // planarCos, // nearestPoint[pointi], // nearestNormal[pointi], - // hit2[i].hitPoint(), + // hit2[i].point(), // normal2[i] // ) // ) // { - // disp[pointi] = hit2[i].hitPoint()-pt; + // disp[pointi] = hit2[i].point()-pt; // override = true; // } //} @@ -1678,20 +1677,19 @@ void Foam::snappySnapDriver::detectNearSurfaces meshRefiner_.isGap ( planarCos, - hit1[i].hitPoint(), + hit1[i].point(), normal1[i], - hit2[i].hitPoint(), + hit2[i].point(), normal2[i] ) ) { if (gapStr) { - const point& intPt = hit2[i].hitPoint(); - gapStr().writeLine(pt, intPt); + gapStr().writeLine(pt, hit2[i].point()); } - disp[pointi] = hit2[i].hitPoint()-pt; + disp[pointi] = hit2[i].point()-pt; override = true; } } @@ -1758,7 +1756,7 @@ void Foam::snappySnapDriver::calcNearestSurface if (hitInfo[i].hit()) { label pointi = zonePointIndices[i]; - nearestPoint[pointi] = hitInfo[i].hitPoint(); + nearestPoint[pointi] = hitInfo[i].point(); nearestNormal[pointi] = hitNormal[i]; } } @@ -1784,7 +1782,7 @@ void Foam::snappySnapDriver::calcNearestSurface { label pointi = zonePointIndices[i]; - patchDisp[pointi] = hitInfo[i].hitPoint() - localPoints[pointi]; + patchDisp[pointi] = hitInfo[i].point() - localPoints[pointi]; minSnapDist[pointi] = mag(patchDisp[pointi]); snapSurf[pointi] = hitSurface[i]; } @@ -1958,7 +1956,7 @@ Foam::vectorField Foam::snappySnapDriver::calcNearestSurface { if (hitInfo[pointi].hit()) { - nearestPoint[pointi] = hitInfo[pointi].hitPoint(); + nearestPoint[pointi] = hitInfo[pointi].point(); nearestNormal[pointi] = hitNormal[pointi]; } } @@ -1980,7 +1978,7 @@ Foam::vectorField Foam::snappySnapDriver::calcNearestSurface if (hitInfo[pointi].hit()) { patchDisp[pointi] = - hitInfo[pointi].hitPoint() + hitInfo[pointi].point() - localPoints[pointi]; snapSurf[pointi] = hitSurface[pointi]; diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C index 41eaaaaa29..6c3ee03d07 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2015-2021 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -328,7 +328,7 @@ void Foam::snappySnapDriver::calcNearestFace if (hitInfo[hiti].hit()) { label facei = ppFaces[hiti]; - faceDisp[facei] = hitInfo[hiti].hitPoint() - fc[hiti]; + faceDisp[facei] = hitInfo[hiti].point() - fc[hiti]; faceSurfaceNormal[facei] = hitNormal[hiti]; faceSurfaceGlobalRegion[facei] = surfaces.globalRegion ( @@ -404,7 +404,7 @@ void Foam::snappySnapDriver::calcNearestFace if (hitInfo[hiti].hit()) { label facei = ppFaces[hiti]; - faceDisp[facei] = hitInfo[hiti].hitPoint() - fc[hiti]; + faceDisp[facei] = hitInfo[hiti].point() - fc[hiti]; faceSurfaceNormal[facei] = hitNormal[hiti]; faceSurfaceGlobalRegion[facei] = surfaces.globalRegion ( @@ -2082,8 +2082,7 @@ void Foam::snappySnapDriver::avoidDiagonalAttraction label pointi = f[fp]; if (patchConstraints[pointi].first() <= 1) { - const point& pt = pp.localPoints()[pointi]; - scalar distSqr = magSqr(mid-pt); + scalar distSqr = mid.distSqr(pp.localPoints()[pointi]); if (distSqr < minDistSqr) { minFp = fp; @@ -2172,15 +2171,12 @@ Foam::snappySnapDriver::findNearFeatureEdge { // So we have a point on the feature edge. Use this // instead of our estimate from planes. - edgeAttractors[feati][nearInfo.index()].append - ( - nearInfo.hitPoint() - ); + edgeAttractors[feati][nearInfo.index()].append(nearInfo.point()); pointConstraint c(Tuple2(2, nearNormal[0])); edgeConstraints[feati][nearInfo.index()].append(c); // Store for later use - patchAttraction[pointi] = nearInfo.hitPoint()-pp.localPoints()[pointi]; + patchAttraction[pointi] = nearInfo.point()-pp.localPoints()[pointi]; patchConstraints[pointi] = c; } return Tuple2(feati, nearInfo); @@ -2230,7 +2226,7 @@ Foam::snappySnapDriver::findNearFeaturePoint label featPointi = nearInfo[0].index(); const point& featPt = nearInfo[0].hitPoint(); - scalar distSqr = magSqr(featPt-pt); + scalar distSqr = featPt.distSqr(pt); // Check if already attracted label oldPointi = pointAttractor[feati][featPointi]; @@ -2238,7 +2234,7 @@ Foam::snappySnapDriver::findNearFeaturePoint if (oldPointi != -1) { // Check distance - if (distSqr >= magSqr(featPt-pp.localPoints()[oldPointi])) + if (distSqr >= featPt.distSqr(pp.localPoints()[oldPointi])) { // oldPointi nearest. Keep. feati = -1; @@ -2501,7 +2497,7 @@ void Foam::snappySnapDriver::determineFeatures pp, snapDist, pointi, - multiPatchPt.hitPoint(), // estimatedPt + multiPatchPt.point(), // estimatedPt edgeAttractors, edgeConstraints, @@ -2519,7 +2515,7 @@ void Foam::snappySnapDriver::determineFeatures featureEdgeStr().writeLine ( pt, - info.hitPoint() + info.point() ); } } @@ -2530,7 +2526,7 @@ void Foam::snappySnapDriver::determineFeatures missedEdgeStr().writeLine ( pt, - multiPatchPt.hitPoint() + multiPatchPt.point() ); } } @@ -2685,7 +2681,7 @@ void Foam::snappySnapDriver::determineFeatures && patchConstraints[pointi].first() == 3 ) { - featurePointStr().writeLine(pt, info.hitPoint()); + featurePointStr().writeLine(pt, info.point()); } else if ( @@ -2693,7 +2689,7 @@ void Foam::snappySnapDriver::determineFeatures && patchConstraints[pointi].first() == 2 ) { - featureEdgeStr().writeLine(pt, info.hitPoint()); + featureEdgeStr().writeLine(pt, info.point()); } } else @@ -2793,7 +2789,7 @@ void Foam::snappySnapDriver::determineFeatures const pointIndexHit& info = nearInfo.second(); if (featurePointStr && info.hit()) { - featurePointStr().writeLine(pt, info.hitPoint()); + featurePointStr().writeLine(pt, info.point()); } } } @@ -3045,7 +3041,7 @@ void Foam::snappySnapDriver::determineBaffleFeatures label featPointi = nearInfo[0].index(); const point& featPt = nearInfo[0].hitPoint(); - scalar distSqr = magSqr(featPt-pt); + scalar distSqr = featPt.distSqr(pt); // Check if already attracted label oldPointi = pointAttractor[feati][featPointi]; @@ -3055,7 +3051,7 @@ void Foam::snappySnapDriver::determineBaffleFeatures oldPointi == -1 || ( distSqr - < magSqr(featPt-pp.localPoints()[oldPointi]) + < featPt.distSqr(pp.localPoints()[oldPointi]) ) ) { @@ -3785,7 +3781,7 @@ void Foam::snappySnapDriver::preventFaceSqueeze const point& pt = pp.localPoints()[f[fp]]; const point& nextPt = pp.localPoints()[f.nextLabel(fp)]; - scalar s = magSqr(pt-nextPt); + scalar s = pt.distSqr(nextPt); if (s > maxS) { maxS = s; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index e5d0d68add..7d797052ae 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -135,7 +135,7 @@ void Foam::AMIInterpolation::projectPointsToSurface if (pi.hit()) { - pts[i] = pi.hitPoint(); + pts[i] = pi.point(); } else { @@ -1062,7 +1062,7 @@ const if (ray.hit()) { - tgtPoint = ray.rawPoint(); + tgtPoint = ray.point(); return srcFacei; } else if (ray.distance() < nearest.distance()) @@ -1075,7 +1075,7 @@ const if (nearest.hit() || nearest.eligibleMiss()) { - tgtPoint = nearest.rawPoint(); + tgtPoint = nearest.point(); return nearestFacei; } @@ -1111,7 +1111,7 @@ const if (ray.hit()) { - srcPoint = ray.rawPoint(); + srcPoint = ray.point(); return tgtFacei; } const pointHit near = f.nearestPoint(srcPoint, tgtPoints); @@ -1124,8 +1124,7 @@ const } if (nearest.hit() || nearest.eligibleMiss()) { - - srcPoint = nearest.rawPoint(); + srcPoint = nearest.point(); return nearestFacei; } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C index bb434401bc..6ff8f94379 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2015-2020,2022 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -309,7 +309,7 @@ Foam::label Foam::advancingFrontAMI::findTargetFace if (debug) { Pout<< "Source point = " << srcPt << ", Sample point = " - << sample.hitPoint() << ", Sample index = " << sample.index() + << sample.point() << ", Sample index = " << sample.index() << endl; } } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/findNearestMaskedOp.H b/src/meshTools/AMIInterpolation/AMIInterpolation/findNearestMaskedOp.H index 4bc2507cc9..2290021efb 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/findNearestMaskedOp.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/findNearestMaskedOp.H @@ -52,7 +52,7 @@ public: { nearestDistSqr = distSqr; minIndex = index; - nearestPoint = nearHit.rawPoint(); + nearestPoint = nearHit.point(); } } } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.C index 3c6d27e135..d952925d3c 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.C @@ -134,7 +134,7 @@ Foam::autoPtr Foam::nearestFaceAMI::calcDistributed if (test.hit()) { // With a search radius2 of GREAT all cells should receive a hit - localInfo[srcCelli].second() = magSqr(srcCc - test.hitPoint()); + localInfo[srcCelli].second() = test.point().distSqr(srcCc); test.setIndex(globalTgtCells.toGlobal(test.index())); } } @@ -178,7 +178,7 @@ Foam::autoPtr Foam::nearestFaceAMI::calcDistributed if (test.hit()) { test.setIndex(globalTgtCells.toGlobal(test.index())); - testInfo.second() = magSqr(test.hitPoint() - srcCcs[i]); + testInfo.second() = test.point().distSqr(srcCcs[i]); nearestEqOp()(remoteInfo[i], testInfo); } } diff --git a/src/meshTools/cellClassification/cellClassification.C b/src/meshTools/cellClassification/cellClassification.C index bf0a7d6580..b8de84255c 100644 --- a/src/meshTools/cellClassification/cellClassification.C +++ b/src/meshTools/cellClassification/cellClassification.C @@ -221,7 +221,7 @@ Foam::boolList Foam::cellClassification::markFaces } // Restart from previous endpoint - pt = pHit.hitPoint() + smallVec; + pt = pHit.point() + smallVec; if (((pt-start) & edgeNormal) >= edgeMag) { diff --git a/src/meshTools/edgeMesh/edgeMeshTools/edgeMeshFeatureProximity.C b/src/meshTools/edgeMesh/edgeMeshTools/edgeMeshFeatureProximity.C index a3efb14d93..fbb851e4b3 100644 --- a/src/meshTools/edgeMesh/edgeMeshTools/edgeMeshFeatureProximity.C +++ b/src/meshTools/edgeMesh/edgeMeshTools/edgeMeshFeatureProximity.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -69,9 +69,9 @@ static scalar calcProximityOfFeaturePoints if (pHit2.hit()) { - scalar curDist = mag(pHit1.hitPoint() - pHit2.hitPoint()); + scalar curDist = pHit1.point().dist(pHit2.point()); - minDist = min(curDist, minDist); + minDist = min(minDist, curDist); } } } @@ -119,10 +119,9 @@ scalar calcProximityOfFeatureEdges // Don't refine if the edges are connected to each other if (!e1.connected(e2)) { - scalar curDist = - mag(pHit1.hitPoint() - pHit2.hitPoint()); + scalar curDist = pHit1.point().dist(pHit2.point()); - minDist = min(curDist, minDist); + minDist = min(minDist, curDist); } } } diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C index 2d0f793069..ec030926ae 100644 --- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C +++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C @@ -810,8 +810,7 @@ void Foam::extendedEdgeMesh::allNearestFeatureEdges pointIndexHit nearHit ( - hitPoint.hit(), - hitPoint.rawPoint(), + hitPoint, hitIndex ); diff --git a/src/meshTools/indexedOctree/treeDataFace.C b/src/meshTools/indexedOctree/treeDataFace.C index 859f577306..a5bc221160 100644 --- a/src/meshTools/indexedOctree/treeDataFace.C +++ b/src/meshTools/indexedOctree/treeDataFace.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -208,7 +208,7 @@ Foam::volumeType Foam::treeDataFace::getVolumeType const point& fc = mesh_.faceCentres()[facei]; pointHit curHit = f.nearestPoint(sample, points); - const point& curPt = curHit.rawPoint(); + const point& curPt = curHit.point(); // // 1] Check whether sample is above face @@ -306,7 +306,7 @@ Foam::volumeType Foam::treeDataFace::getVolumeType ).nearestDist(sample); - if ((magSqr(edgeHit.rawPoint() - curPt)/typDimSqr) < tolSqr) + if ((edgeHit.point().distSqr(curPt)/typDimSqr) < tolSqr) { // Face intersection point lies on edge e @@ -326,7 +326,7 @@ Foam::volumeType Foam::treeDataFace::getVolumeType if (debug & 2) { - Pout<< " -> real edge hit point:" << edgeHit.rawPoint() + Pout<< " -> real edge hit point:" << edgeHit.point() << " comparing to edge normal:" << edgeNormal << endl; } @@ -354,7 +354,7 @@ Foam::volumeType Foam::treeDataFace::getVolumeType fc ).nearestDist(sample); - if ((magSqr(edgeHit.rawPoint() - curPt)/typDimSqr) < tolSqr) + if ((edgeHit.point().distSqr(curPt)/typDimSqr) < tolSqr) { // Face intersection point lies on edge between two face triangles @@ -368,7 +368,7 @@ Foam::volumeType Foam::treeDataFace::getVolumeType if (debug & 2) { - Pout<< " -> internal edge hit point:" << edgeHit.rawPoint() + Pout<< " -> internal edge hit point:" << edgeHit.point() << " comparing to edge normal " << 0.5*(nLeft + nRight) << endl; @@ -488,7 +488,7 @@ void Foam::treeDataFace::findNearestOp::operator() { nearestDistSqr = distSqr; minIndex = index; - nearestPoint = nearHit.rawPoint(); + nearestPoint = nearHit.point(); } } } @@ -548,7 +548,7 @@ bool Foam::treeDataFace::findIntersectOp::operator() { // Note: no extra test on whether intersection is in front of us // since using half_ray - intersectionPoint = inter.hitPoint(); + intersectionPoint = inter.point(); return true; } diff --git a/src/meshTools/indexedOctree/treeDataPrimitivePatch.C b/src/meshTools/indexedOctree/treeDataPrimitivePatch.C index 3be57255e0..ca60b6525b 100644 --- a/src/meshTools/indexedOctree/treeDataPrimitivePatch.C +++ b/src/meshTools/indexedOctree/treeDataPrimitivePatch.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -175,7 +175,7 @@ Foam::volumeType Foam::treeDataPrimitivePatch::getVolumeType pointHit curHit = f.nearestPoint(sample, points); const vector area = f.areaNormal(points); - const point& curPt = curHit.rawPoint(); + const point& curPt = curHit.point(); // // 1] Check whether sample is above face @@ -262,7 +262,7 @@ Foam::volumeType Foam::treeDataPrimitivePatch::getVolumeType const linePointRef ln(points[mp[e.start()]], points[mp[e.end()]]); pointHit edgeHit = ln.nearestDist(sample); - if ((magSqr(edgeHit.rawPoint() - curPt)/typDimSqr) < planarTol_) + if ((edgeHit.point().distSqr(curPt)/typDimSqr) < planarTol_) { // Face intersection point lies on edge e @@ -279,7 +279,7 @@ Foam::volumeType Foam::treeDataPrimitivePatch::getVolumeType if (debug & 2) { - Pout<< " -> real edge hit point:" << edgeHit.rawPoint() + Pout<< " -> real edge hit point:" << edgeHit.point() << " comparing to edge normal:" << edgeNormal << endl; } @@ -303,7 +303,7 @@ Foam::volumeType Foam::treeDataPrimitivePatch::getVolumeType { pointHit edgeHit = linePointRef(points[f[fp]], fc).nearestDist(sample); - if ((magSqr(edgeHit.rawPoint() - curPt)/typDimSqr) < planarTol_) + if ((edgeHit.point().distSqr(curPt)/typDimSqr) < planarTol_) { // Face intersection point lies on edge between two face triangles @@ -317,7 +317,7 @@ Foam::volumeType Foam::treeDataPrimitivePatch::getVolumeType if (debug & 2) { - Pout<< " -> internal edge hit point:" << edgeHit.rawPoint() + Pout<< " -> internal edge hit point:" << edgeHit.point() << " comparing to edge normal " << 0.5*(nLeft + nRight) << endl; @@ -486,7 +486,7 @@ void Foam::treeDataPrimitivePatch::findNearestOp::operator() { nearestDistSqr = distSqr; minIndex = index; - nearestPoint = nearHit.rawPoint(); + nearestPoint = nearHit.point(); } } } @@ -630,7 +630,7 @@ bool Foam::treeDataPrimitivePatch::findIntersection { // Note: no extra test on whether intersection is in front of us // since using half_ray - intersectionPoint = inter.hitPoint(); + intersectionPoint = inter.point(); return true; } diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index 15431135d9..b3a1a45a1c 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -163,7 +163,7 @@ Foam::tmp Foam::mappedPatchBase::facePoints mesh, pp.start()+facei, polyMesh::FACE_DIAG_TRIS - ).rawPoint(); + ).point(); } return tfacePoints; @@ -363,11 +363,10 @@ void Foam::mappedPatchBase::findLocalSamples nearInfoWorld& near = nearest[sampleI]; near.first().first() = tree.findNearest(sample, sqr(GREAT)); - near.first().second().first() = magSqr - ( - near.first().first().hitPoint() - -sample - ); + + near.first().second().first() = + near.first().first().hitPoint().distSqr(sample); + near.first().second().second() = myRank; near.second() = mySampleWorld; } @@ -511,7 +510,7 @@ void Foam::mappedPatchBase::findLocalSamples } else { - const point& pt = nearInfo.hitPoint(); + const point& pt = nearInfo.point(); near.first().second().first() = magSqr(pt-sample); near.first().second().second() = myRank; @@ -690,7 +689,7 @@ void Foam::mappedPatchBase::findSamples // << " found on patchfacei:" // << nearest[samplei].first().first().index() << nl // << " found at location:" - // << nearest[samplei].first().first().rawPoint() << nl; + // << nearest[samplei].first().first().point() << nl; // } // Pout<< endl; //} @@ -714,7 +713,7 @@ void Foam::mappedPatchBase::findSamples { sampleProcs[sampleI] = ni.second().second(); sampleIndices[sampleI] = ni.first().index(); - sampleLocations[sampleI] = ni.first().hitPoint(); + sampleLocations[sampleI] = ni.first().point(); } } @@ -1780,7 +1779,7 @@ Foam::pointIndexHit Foam::mappedPatchBase::facePoint if (hitInfo.hit() && hitInfo.distance() > 0) { - return pointIndexHit(true, hitInfo.hitPoint(), i-2); + return pointIndexHit(true, hitInfo.point(), i-2); } fp = nextFp; diff --git a/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C b/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C index 015ce5d8a0..adee824d8f 100644 --- a/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C +++ b/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2021 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -85,7 +85,7 @@ void Foam::searchableBox::projectOntoCoordPlane ) const { // Set point - info.rawPoint()[dir] = planePt[dir]; + info.point()[dir] = planePt[dir]; // Set face if (planePt[dir] == min()[dir]) @@ -135,17 +135,17 @@ Foam::pointIndexHit Foam::searchableBox::findNearest for (direction dir = 0; dir < vector::nComponents; ++dir) { - if (info.rawPoint()[dir] < min()[dir]) + if (info.point()[dir] < min()[dir]) { projectOntoCoordPlane(dir, min(), info); outside = true; } - else if (info.rawPoint()[dir] > max()[dir]) + else if (info.point()[dir] > max()[dir]) { projectOntoCoordPlane(dir, max(), info); outside = true; } - else if (info.rawPoint()[dir] > bbMid[dir]) + else if (info.point()[dir] > bbMid[dir]) { near[dir] = max()[dir]; } @@ -185,7 +185,7 @@ Foam::pointIndexHit Foam::searchableBox::findNearest // Check if outside. Optimisation: could do some checks on distance already // on components above - if (magSqr(info.rawPoint() - sample) > nearestDistSqr) + if (info.point().distSqr(sample) > nearestDistSqr) { info.setMiss(); info.setIndex(-1); @@ -293,11 +293,7 @@ void Foam::searchableBox::boundingSpheres { const point& pt = pts[pointi]; - radiusSqr[i] = Foam::max - ( - radiusSqr[i], - Foam::magSqr(pt-centres[i]) - ); + radiusSqr[i] = Foam::max(radiusSqr[i], centres[i].distSqr(pt)); } } @@ -339,17 +335,17 @@ Foam::pointIndexHit Foam::searchableBox::findNearestOnEdge for (direction dir = 0; dir < vector::nComponents; ++dir) { - if (info.rawPoint()[dir] < min()[dir]) + if (info.point()[dir] < min()[dir]) { projectOntoCoordPlane(dir, min(), info); outside = true; } - else if (info.rawPoint()[dir] > max()[dir]) + else if (info.point()[dir] > max()[dir]) { projectOntoCoordPlane(dir, max(), info); outside = true; } - else if (info.rawPoint()[dir] > bbMid[dir]) + else if (info.point()[dir] > bbMid[dir]) { near[dir] = max()[dir]; } @@ -365,7 +361,7 @@ Foam::pointIndexHit Foam::searchableBox::findNearestOnEdge if (!outside) { // Get the per-component distance to nearest wall - vector dist(cmptMag(info.rawPoint() - near)); + vector dist(cmptMag(info.point() - near)); SortableList sortedDist(3); sortedDist[0] = dist[0]; @@ -382,7 +378,7 @@ Foam::pointIndexHit Foam::searchableBox::findNearestOnEdge // Check if outside. Optimisation: could do some checks on distance already // on components above - if (magSqr(info.rawPoint() - sample) > nearestDistSqr) + if (info.point().distSqr(sample) > nearestDistSqr) { info.setMiss(); info.setIndex(-1); @@ -424,13 +420,13 @@ Foam::pointIndexHit Foam::searchableBox::findLine else { // end is outside. Clip to bounding box. - foundInter = intersects(end, start, info.rawPoint()); + foundInter = intersects(end, start, info.point()); } } else { // start is outside. Clip to bounding box. - foundInter = intersects(start, end, info.rawPoint()); + foundInter = intersects(start, end, info.point()); } @@ -441,12 +437,12 @@ Foam::pointIndexHit Foam::searchableBox::findLine for (direction dir = 0; dir < vector::nComponents; ++dir) { - if (info.rawPoint()[dir] == min()[dir]) + if (info.point()[dir] == min()[dir]) { info.setIndex(2*dir); break; } - else if (info.rawPoint()[dir] == max()[dir]) + else if (info.point()[dir] == max()[dir]) { info.setIndex(2*dir+1); break; @@ -456,7 +452,7 @@ Foam::pointIndexHit Foam::searchableBox::findLine if (info.index() == -1) { FatalErrorInFunction - << "point " << info.rawPoint() + << "point " << info.point() << " on segment " << start << end << " should be on face of " << *this << " but it isn't." << abort(FatalError); diff --git a/src/meshTools/searchableSurfaces/searchableCone/searchableCone.C b/src/meshTools/searchableSurfaces/searchableCone/searchableCone.C index 582a6e9f2f..4e47cb144f 100644 --- a/src/meshTools/searchableSurfaces/searchableCone/searchableCone.C +++ b/src/meshTools/searchableSurfaces/searchableCone/searchableCone.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2015-2021 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -206,10 +206,10 @@ void Foam::searchableCone::findNearestAndNormal // cone) FixedList dist; - dist[0] = magSqr(nearCone-sample); - dist[1] = magSqr(disk1Point-sample); - dist[2] = magSqr(disk2Point-sample); - dist[3] = magSqr(iCnearCone-sample); + dist[0] = sample.distSqr(nearCone); + dist[1] = sample.distSqr(disk1Point); + dist[2] = sample.distSqr(disk2Point); + dist[3] = sample.distSqr(iCnearCone); const label minI = findMin(dist); @@ -301,7 +301,7 @@ void Foam::searchableCone::findNearestAndNormal } - if (magSqr(sample - info.rawPoint()) < nearestDistSqr) + if (info.point().distSqr(sample) < nearestDistSqr) { info.setHit(); info.setIndex(0); @@ -615,11 +615,11 @@ void Foam::searchableCone::insertHit { scalar smallDistSqr = SMALL*magSqr(end-start); - scalar hitMagSqr = magSqr(hit.hitPoint()-start); + scalar hitMagSqr = hit.hitPoint().distSqr(start); forAll(info, i) { - scalar d2 = magSqr(info[i].hitPoint()-start); + scalar d2 = info[i].hitPoint().distSqr(start); if (d2 > hitMagSqr+smallDistSqr) { @@ -827,7 +827,7 @@ void Foam::searchableCone::findLine point newEnd; if (info[i].hit()) { - newEnd = info[i].hitPoint(); + newEnd = info[i].point(); } else { @@ -1048,7 +1048,7 @@ void Foam::searchableCone::getNormal pointIndexHit nearInfo; findNearestAndNormal ( - info[i].hitPoint(), + info[i].point(), Foam::sqr(GREAT), nearInfo, normal[i] diff --git a/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.C b/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.C index e8d26197c6..ab65742b58 100644 --- a/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.C +++ b/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2021 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -180,7 +180,7 @@ Foam::pointIndexHit Foam::searchableCylinder::findNearest } } - if (magSqr(sample - info.rawPoint()) < nearestDistSqr) + if (info.point().distSqr(sample) < nearestDistSqr) { info.setHit(); info.setIndex(0); @@ -661,7 +661,7 @@ void Foam::searchableCylinder::getNormal { if (info[i].hit()) { - vector v(info[i].hitPoint() - point1_); + vector v(info[i].point() - point1_); // Decompose sample-point1 into normal and parallel component const scalar parallel = (v & unitDir_); diff --git a/src/meshTools/searchableSurfaces/searchableDisk/searchableDisk.C b/src/meshTools/searchableSurfaces/searchableDisk/searchableDisk.C index 3fa74ec2fa..2d40f34219 100644 --- a/src/meshTools/searchableSurfaces/searchableDisk/searchableDisk.C +++ b/src/meshTools/searchableSurfaces/searchableDisk/searchableDisk.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2014-2017 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -75,7 +75,7 @@ Foam::pointIndexHit Foam::searchableDisk::findNearest // Clip to inner/outer radius info.setPoint(origin() + radialLimits_.clip(magV)*v); - if (magSqr(sample - info.rawPoint()) < nearestDistSqr) + if (info.point().distSqr(sample) < nearestDistSqr) { info.setHit(); info.setIndex(0); diff --git a/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.C b/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.C index a55d274d42..ad5e8d3c9c 100644 --- a/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.C +++ b/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -190,7 +190,7 @@ void Foam::searchableExtrudedCircle::findNearest if (info[i].hit()) { // Derive distance to nearest surface from distance to nearest edge - const vector d(samples[i] - info[i].hitPoint()); + const vector d(samples[i] - info[i].point()); const scalar s(mag(d)); if (s < ROOTVSMALL) @@ -207,7 +207,7 @@ void Foam::searchableExtrudedCircle::findNearest } else { - info[i].setPoint(info[i].hitPoint() + d/s*radius_); + info[i].setPoint(info[i].point() + d/s*radius_); } } } @@ -453,7 +453,7 @@ void Foam::searchableExtrudedCircle::getNormal // Find nearest on curve pointIndexHit curvePt = tree.findNearest ( - info[i].hitPoint(), + info[i].point(), Foam::magSqr(bounds().span()) ); diff --git a/src/meshTools/searchableSurfaces/searchablePlane/searchablePlane.C b/src/meshTools/searchableSurfaces/searchablePlane/searchablePlane.C index 9da75c3810..a7c522faa1 100644 --- a/src/meshTools/searchableSurfaces/searchablePlane/searchablePlane.C +++ b/src/meshTools/searchableSurfaces/searchablePlane/searchablePlane.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -164,7 +165,7 @@ void Foam::searchablePlane::findNearest { info[i].setPoint(nearestPoint(samples[i])); - if (magSqr(samples[i]-info[i].rawPoint()) > nearestDistSqr[i]) + if (info[i].point().distSqr(samples[i]) > nearestDistSqr[i]) { info[i].setIndex(-1); info[i].setMiss(); diff --git a/src/meshTools/searchableSurfaces/searchablePlate/searchablePlate.C b/src/meshTools/searchableSurfaces/searchablePlate/searchablePlate.C index 31059ec0ae..c5a16ec668 100644 --- a/src/meshTools/searchableSurfaces/searchablePlate/searchablePlate.C +++ b/src/meshTools/searchableSurfaces/searchablePlate/searchablePlate.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -106,27 +106,27 @@ Foam::pointIndexHit Foam::searchablePlate::findNearest // Project point on plane. pointIndexHit info(true, sample, 0); - info.rawPoint()[normalDir_] = origin_[normalDir_]; + info.point()[normalDir_] = origin_[normalDir_]; // Clip to edges if outside for (direction dir = 0; dir < vector::nComponents; ++dir) { if (dir != normalDir_) { - if (info.rawPoint()[dir] < origin_[dir]) + if (info.point()[dir] < origin_[dir]) { - info.rawPoint()[dir] = origin_[dir]; + info.point()[dir] = origin_[dir]; } - else if (info.rawPoint()[dir] > origin_[dir]+span_[dir]) + else if (info.point()[dir] > origin_[dir]+span_[dir]) { - info.rawPoint()[dir] = origin_[dir]+span_[dir]; + info.point()[dir] = origin_[dir]+span_[dir]; } } } // Check if outside. Optimisation: could do some checks on distance already // on components above - if (magSqr(info.rawPoint() - sample) > nearestDistSqr) + if (info.point().distSqr(sample) > nearestDistSqr) { info.setMiss(); info.setIndex(-1); @@ -167,21 +167,21 @@ Foam::pointIndexHit Foam::searchablePlate::findLine } else { - info.rawPoint() = start+t*dir; - info.rawPoint()[normalDir_] = origin_[normalDir_]; + info.point() = start+t*dir; + info.point()[normalDir_] = origin_[normalDir_]; // Clip to edges for (direction dir = 0; dir < vector::nComponents; ++dir) { if (dir != normalDir_) { - if (info.rawPoint()[dir] < origin_[dir]) + if (info.point()[dir] < origin_[dir]) { info.setMiss(); info.setIndex(-1); break; } - else if (info.rawPoint()[dir] > origin_[dir]+span_[dir]) + else if (info.point()[dir] > origin_[dir]+span_[dir]) { info.setMiss(); info.setIndex(-1); @@ -199,14 +199,14 @@ Foam::pointIndexHit Foam::searchablePlate::findLine bb.min()[normalDir_] -= 1e-6; bb.max()[normalDir_] += 1e-6; - if (!bb.contains(info.hitPoint())) + if (!bb.contains(info.point())) { FatalErrorInFunction << "bb:" << bb << endl << "origin_:" << origin_ << endl << "span_:" << span_ << endl << "normalDir_:" << normalDir_ << endl - << "hitPoint:" << info.hitPoint() + << "hitPoint:" << info.point() << abort(FatalError); } } diff --git a/src/meshTools/searchableSurfaces/searchableRotatedBox/searchableRotatedBox.C b/src/meshTools/searchableSurfaces/searchableRotatedBox/searchableRotatedBox.C index 2fe886850c..033f616ea9 100644 --- a/src/meshTools/searchableSurfaces/searchableRotatedBox/searchableRotatedBox.C +++ b/src/meshTools/searchableSurfaces/searchableRotatedBox/searchableRotatedBox.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2014 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -207,7 +207,7 @@ Foam::pointIndexHit Foam::searchableRotatedBox::findNearest ) ); - boxNearest.rawPoint() = transform_.globalPosition(boxNearest.rawPoint()); + boxNearest.point() = transform_.globalPosition(boxNearest.point()); return boxNearest; } @@ -240,7 +240,7 @@ Foam::pointIndexHit Foam::searchableRotatedBox::findLine ) ); - boxHit.rawPoint() = transform_.globalPosition(boxHit.rawPoint()); + boxHit.point() = transform_.globalPosition(boxHit.point()); return boxHit; } @@ -340,7 +340,7 @@ void Foam::searchableRotatedBox::findLineAll hits.clear(); hits.append(inter); - point pt = inter.hitPoint() + smallVec[pointI]; + point pt = inter.point() + smallVec[pointI]; while (((pt-start[pointI])&dirVec[pointI]) <= magSqrDirVec[pointI]) { @@ -359,7 +359,7 @@ void Foam::searchableRotatedBox::findLineAll } hits.append(inter); - pt = inter.hitPoint() + smallVec[pointI]; + pt = inter.point() + smallVec[pointI]; } info[pointI].transfer(hits); diff --git a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C index b79ed2feaa..ddd66897b8 100644 --- a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C +++ b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2021 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -606,7 +606,7 @@ Foam::pointIndexHit Foam::searchableSphere::findNearest // TODO - quick reject for things that are too far away - point& near = info.rawPoint(); + point& near = info.point(); scalar distSqr{0}; if (order_.shape == shapeType::OBLATE) @@ -1072,14 +1072,14 @@ void Foam::searchableSphere::getNormal if (order_.shape == shapeType::SPHERE) { // Special case (sphere) - normal[i] = normalised(info[i].hitPoint() - origin_); + normal[i] = normalised(info[i].point() - origin_); } else { // General case // Normal is (x0/r0^2, x1/r1^2, x2/r2^2) - normal[i] = scalePoint(info[i].hitPoint()); + normal[i] = scalePoint(info[i].point()); normal[i].x() /= radii_.x(); normal[i].y() /= radii_.y(); diff --git a/src/meshTools/searchableSurfaces/searchableSurfaceCollection/searchableSurfaceCollection.C b/src/meshTools/searchableSurfaces/searchableSurfaceCollection/searchableSurfaceCollection.C index ca2c4c145b..f3e8ce0b5e 100644 --- a/src/meshTools/searchableSurfaces/searchableSurfaceCollection/searchableSurfaceCollection.C +++ b/src/meshTools/searchableSurfaces/searchableSurfaceCollection/searchableSurfaceCollection.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -95,7 +95,7 @@ void Foam::searchableSurfaceCollection::findNearest ( cmptMultiply ( - hitInfo[pointi].rawPoint(), + hitInfo[pointi].point(), scale_[surfI] ) ); @@ -165,8 +165,7 @@ void Foam::searchableSurfaceCollection::sortHits label localI = nHits[surfI]++; surfInfo[surfI][localI] = pointIndexHit ( - info[pointi].hit(), - info[pointi].rawPoint(), + info[pointi], index-indexOffset_[surfI] ); infoMap[surfI][localI] = pointi; @@ -500,12 +499,12 @@ void Foam::searchableSurfaceCollection::findLine ( cmptMultiply ( - hitInfo[pointi].rawPoint(), + hitInfo[pointi].point(), scale_[surfI] ) ); info[pointi] = hitInfo[pointi]; - info[pointi].rawPoint() = nearest[pointi]; + info[pointi].point() = nearest[pointi]; info[pointi].setIndex ( hitInfo[pointi].index() @@ -530,7 +529,7 @@ void Foam::searchableSurfaceCollection::findLine { n /= mag(n); - scalar s = ((info[pointi].rawPoint()-start[pointi])&n); + scalar s = ((info[pointi].point()-start[pointi])&n); if (s < 0 || s > 1) { diff --git a/src/meshTools/searchableSurfaces/searchableSurfaceWithGaps/searchableSurfaceWithGaps.C b/src/meshTools/searchableSurfaces/searchableSurfaceWithGaps/searchableSurfaceWithGaps.C index 7230ce8f37..0e546b86c9 100644 --- a/src/meshTools/searchableSurfaces/searchableSurfaceWithGaps/searchableSurfaceWithGaps.C +++ b/src/meshTools/searchableSurfaces/searchableSurfaceWithGaps/searchableSurfaceWithGaps.C @@ -266,7 +266,7 @@ void Foam::searchableSurfaceWithGaps::findLine if (plusInfo[i].hit() && minInfo[i].hit()) { info[compactMap[i]] = plusInfo[i]; - info[compactMap[i]].rawPoint() -= offset0[i]; + info[compactMap[i]].point() -= offset0[i]; } } @@ -318,7 +318,7 @@ void Foam::searchableSurfaceWithGaps::findLine if (plusInfo[i].hit() && minInfo[i].hit()) { info[compactMap[i]] = plusInfo[i]; - info[compactMap[i]].rawPoint() -= offset1[i]; + info[compactMap[i]].point() -= offset1[i]; } } } diff --git a/src/meshTools/searchableSurfaces/searchableSurfaces/searchableSurfaces.C b/src/meshTools/searchableSurfaces/searchableSurfaces/searchableSurfaces.C index 340c2a6aa3..82ede9e7df 100644 --- a/src/meshTools/searchableSurfaces/searchableSurfaces/searchableSurfaces.C +++ b/src/meshTools/searchableSurfaces/searchableSurfaces/searchableSurfaces.C @@ -679,7 +679,7 @@ bool Foam::searchableSurfaces::checkIntersection && (i != j || !connected(s0, edgeI, hits[edgeI])) ) { - intersections.append(hits[edgeI].hitPoint()); + intersections.append(hits[edgeI].point()); intersectionEdge.append(edgeI); nHits++; } diff --git a/src/meshTools/searchableSurfaces/searchableSurfacesQueries/searchableSurfacesQueries.C b/src/meshTools/searchableSurfaces/searchableSurfacesQueries/searchableSurfacesQueries.C index 4b94a017f7..34c17f8d5a 100644 --- a/src/meshTools/searchableSurfaces/searchableSurfacesQueries/searchableSurfacesQueries.C +++ b/src/meshTools/searchableSurfaces/searchableSurfacesQueries/searchableSurfacesQueries.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2018 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,7 +63,7 @@ void Foam::searchableSurfacesQueries::mergeHits scalarList surfDistSqr(surfHits.size()); forAll(surfHits, i) { - surfDistSqr[i] = magSqr(surfHits[i].hitPoint() - start); + surfDistSqr[i] = surfHits[i].hitPoint().distSqr(start); } forAll(surfDistSqr, i) @@ -74,8 +74,8 @@ void Foam::searchableSurfacesQueries::mergeHits if (index >= 0) { // Same. Do not count. - //Pout<< "point:" << surfHits[i].hitPoint() - // << " considered same as:" << allInfo[index].hitPoint() + //Pout<< "point:" << surfHits[i].point() + // << " considered same as:" << allInfo[index].point() // << " within tol:" << mergeDist // << endl; } @@ -86,8 +86,8 @@ void Foam::searchableSurfacesQueries::mergeHits if (next < allDistSqr.size()) { - //Pout<< "point:" << surfHits[i].hitPoint() - // << " considered same as:" << allInfo[next].hitPoint() + //Pout<< "point:" << surfHits[i].point() + // << " considered same as:" << allInfo[next].point() // << " within tol:" << mergeDist // << endl; } @@ -221,7 +221,7 @@ void Foam::searchableSurfacesQueries::findAllIntersections pDistSqr.setSize(pHits.size()); forAll(pHits, i) { - pDistSqr[i] = magSqr(pHits[i].hitPoint() - start[pointi]); + pDistSqr[i] = pHits[i].hitPoint().distSqr(start[pointi]); } } @@ -299,7 +299,7 @@ void Foam::searchableSurfacesQueries::findNearestIntersection { hit1[pointi] = nearestInfo[pointi]; surface1[pointi] = testI; - nearest[pointi] = hit1[pointi].hitPoint(); + nearest[pointi] = hit1[pointi].point(); } } } @@ -318,7 +318,7 @@ void Foam::searchableSurfacesQueries::findNearestIntersection { if (hit1[pointi].hit()) { - nearest[pointi] = hit1[pointi].hitPoint(); + nearest[pointi] = hit1[pointi].point(); } else { @@ -338,7 +338,7 @@ void Foam::searchableSurfacesQueries::findNearestIntersection { hit2[pointi] = nearestInfo[pointi]; surface2[pointi] = testI; - nearest[pointi] = hit2[pointi].hitPoint(); + nearest[pointi] = hit2[pointi].point(); } } } @@ -387,11 +387,9 @@ void Foam::searchableSurfacesQueries::findNearest { if (hitInfo[pointi].hit()) { - minDistSqr[pointi] = magSqr - ( - hitInfo[pointi].hitPoint() - - samples[pointi] - ); + minDistSqr[pointi] = + hitInfo[pointi].point().distSqr(samples[pointi]); + nearestInfo[pointi] = hitInfo[pointi]; nearestSurfaces[pointi] = testI; } @@ -460,11 +458,9 @@ void Foam::searchableSurfacesQueries::findNearest { if (hitInfo[pointi].hit()) { - minDistSqr[pointi] = magSqr - ( - hitInfo[pointi].hitPoint() - - samples[pointi] - ); + minDistSqr[pointi] = + hitInfo[pointi].point().distSqr(samples[pointi]); + nearestInfo[pointi] = hitInfo[pointi]; nearestSurfaces[pointi] = testI; } @@ -507,7 +503,7 @@ void Foam::searchableSurfacesQueries::findNearest { if (info[i].hit()) { - near[i] = info[i].hitPoint(); + near[i] = info[i].point(); } } @@ -551,7 +547,7 @@ void Foam::searchableSurfacesQueries::findNearest if (mag(normal[i]&normal1[i]) < 1.0-1e-6) { plane pl0(near[i], normal[i], false); - plane pl1(info[i].hitPoint(), normal1[i], false); + plane pl1(info[i].point(), normal1[i], false); plane::ray r(pl0.planeIntersect(pl1)); vector n = r.dir() / mag(r.dir()); @@ -581,7 +577,7 @@ void Foam::searchableSurfacesQueries::findNearest else { // First hit - near[i] = info[i].hitPoint(); + near[i] = info[i].point(); normal[i] = normal1[i]; constraint[i].applyConstraint(normal1[i]); } @@ -648,7 +644,7 @@ void Foam::searchableSurfacesQueries::signedDistance forAll(volType, i) { label pointi = surfIndices[i]; - scalar dist = mag(samples[pointi] - nearestInfo[pointi].hitPoint()); + scalar dist = samples[pointi].dist(nearestInfo[pointi].hitPoint()); volumeType vT = volType[i]; diff --git a/src/meshTools/topoSet/cellSources/surfaceToCell/surfaceToCell.C b/src/meshTools/topoSet/cellSources/surfaceToCell/surfaceToCell.C index 237444e5e3..f3b223ac09 100644 --- a/src/meshTools/topoSet/cellSources/surfaceToCell/surfaceToCell.C +++ b/src/meshTools/topoSet/cellSources/surfaceToCell/surfaceToCell.C @@ -270,7 +270,7 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const pointIndexHit inter = querySurf().nearest(c, span); - if (inter.hit() && (mag(inter.hitPoint() - c) < nearDist_)) + if (inter.hit() && inter.point().dist(c) < nearDist_) { addOrDelete(set, celli, add); } @@ -302,7 +302,7 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const pointIndexHit inter = querySurf().nearest(c, span); - if (inter.hit() && (mag(inter.hitPoint() - c) < nearDist_)) + if (inter.hit() && inter.point().dist(c) < nearDist_) { if ( diff --git a/src/meshTools/topoSet/faceSources/regionToFace/regionToFace.C b/src/meshTools/topoSet/faceSources/regionToFace/regionToFace.C index 0df7ba37df..53aae6f23e 100644 --- a/src/meshTools/topoSet/faceSources/regionToFace/regionToFace.C +++ b/src/meshTools/topoSet/faceSources/regionToFace/regionToFace.C @@ -180,7 +180,7 @@ void Foam::regionToFace::combine(topoSet& set, const bool add) const if (verbose_) { - Info<< " Found nearest face at " << ni.first().rawPoint() + Info<< " Found nearest face at " << ni.first().point() << " on processor " << ni.second().second() << " face " << ni.first().index() << " distance " << Foam::sqrt(ni.second().first()) << endl; diff --git a/src/meshTools/topoSet/pointSources/surfaceToPoint/surfaceToPoint.C b/src/meshTools/topoSet/pointSources/surfaceToPoint/surfaceToPoint.C index 9175aff4b9..ad7faba293 100644 --- a/src/meshTools/topoSet/pointSources/surfaceToPoint/surfaceToPoint.C +++ b/src/meshTools/topoSet/pointSources/surfaceToPoint/surfaceToPoint.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -101,7 +101,7 @@ void Foam::surfaceToPoint::combine(topoSet& set, const bool add) const pointIndexHit inter = querySurf.nearest(pt, span); - if (inter.hit() && (mag(inter.hitPoint() - pt) < nearDist_)) + if (inter.hit() && inter.point().dist(pt) < nearDist_) { addOrDelete(set, pointi, add); } diff --git a/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C b/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C index 5e84e9942a..f4ddd729e1 100644 --- a/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C +++ b/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -975,7 +975,7 @@ Foam::booleanSurface::booleanSurface { Pout<< "booleanSurface : found for point:" << outsidePoint << " nearest face:" << minFacei - << " nearest point:" << minHit.rawPoint() + << " nearest point:" << minHit.point() << endl; } @@ -1002,7 +1002,7 @@ Foam::booleanSurface::booleanSurface { FatalErrorInFunction << "Face " << facei << " has not been reached by walking from" - << " nearest point " << minHit.rawPoint() + << " nearest point " << minHit.point() << " nearest face " << minFacei << exit(FatalError); } else if (side[facei] == OUTSIDE) diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C index e73c68ba55..ba7d89a967 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -167,12 +167,12 @@ void Foam::edgeIntersections::intersectEdges const edge& e = surf1.edges()[edgeI]; // Classify point on surface1 edge. - if (mag(pHit.hitPoint() - start[i]) < surf1PointTol[e[0]]) + if (pHit.point().dist(start[i]) < surf1PointTol[e[0]]) { // Intersection is close to edge start hitType = 0; } - else if (mag(pHit.hitPoint() - end[i]) < surf1PointTol[e[1]]) + else if (pHit.point().dist(end[i]) < surf1PointTol[e[1]]) { // Intersection is close to edge end hitType = 1; @@ -737,8 +737,7 @@ void Foam::edgeIntersections::merge { intersections[nNew] = pointIndexHit ( - subHit.hit(), - subHit.rawPoint(), + subHit, faceMap[subHit.index()] ); intersectionTypes[nNew] = subClass[i]; diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C index cb00578c98..4a9115417f 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C @@ -309,7 +309,7 @@ void Foam::surfaceIntersection::classifyHit // 1. Point hits point. Do nothing. if (debug & 2) { - Pout<< "hit-type[1] " << pHit.hitPoint() << " is surf1:" + Pout<< "hit-type[1] " << pHit.point() << " is surf1:" << " end point of edge[" << edgeI << "] " << e1 << "==" << e1.line(surf1Pts) << " surf2: vertex " << f2[nearLabel] @@ -336,7 +336,7 @@ void Foam::surfaceIntersection::classifyHit if ( - mag(pHit.hitPoint() - nearPt) + pHit.hitPoint().dist(nearPt) < surf1PointTol[nearVert] ) { @@ -364,7 +364,7 @@ void Foam::surfaceIntersection::classifyHit if (debug & 2) { - Pout<< "hit-type[2] " << pHit.hitPoint() << " is surf1:" + Pout<< "hit-type[2] " << pHit.point() << " is surf1:" << " from edge[" << edgeI << "] " << e1 << " surf2: vertex " << f2[nearLabel] << " coord:" << surf2Pts[f2[nearLabel]] @@ -443,7 +443,7 @@ void Foam::surfaceIntersection::classifyHit if ( - mag(pHit.hitPoint() - nearPt) + pHit.hitPoint().dist(nearPt) < surf1PointTol[nearVert] ) { @@ -477,7 +477,7 @@ void Foam::surfaceIntersection::classifyHit if (debug & 2) { - Pout<< "hit-type[3] " << pHit.hitPoint() << " is surf1:" + Pout<< "hit-type[3] " << pHit.point() << " is surf1:" << " end point of edge[" << edgeI << "] " << e1 << "==" << e1.line(surf1Pts) << " surf2: edge[" << edge2I << "] " << e2 @@ -572,7 +572,7 @@ void Foam::surfaceIntersection::classifyHit if ( - mag(pHit.hitPoint() - nearPt) + pHit.hitPoint().dist(nearPt) < surf1PointTol[endId] ) { @@ -612,7 +612,7 @@ void Foam::surfaceIntersection::classifyHit if (debug & 2) { - Pout<< "hit-type[4] " << pHit.hitPoint() << " is surf1:" + Pout<< "hit-type[4] " << pHit.point() << " is surf1:" << " from edge[" << edgeI << "] " << e1 << "==" << e1.line(surf1Pts) << " surf2: edge[" << edge2I << "] " << e2 @@ -714,7 +714,7 @@ void Foam::surfaceIntersection::classifyHit if (debug & 2) { - Pout<< "hit-type[5] " << pHit.hitPoint() + Pout<< "hit-type[5] " << pHit.point() << " shifted to " << nearPt << " from edge[" << edgeI << "] " << e1 << "==" << e1.line(surf1Pts) @@ -738,7 +738,7 @@ void Foam::surfaceIntersection::classifyHit { if (debug & 2) { - Pout<< "hit-type[5] " << pHit.hitPoint() + Pout<< "hit-type[5] " << pHit.point() << " from edge[" << edgeI << "] " << e1 << " hits inside of surf2 face[" << surf2Facei << "]" << " - discarded" << endl; @@ -750,7 +750,7 @@ void Foam::surfaceIntersection::classifyHit // 6. Edge pierces face. 'Normal' situation. if (debug & 2) { - Pout<< "hit-type[6] " << pHit.hitPoint() + Pout<< "hit-type[6] " << pHit.point() << " from edge[" << edgeI << "] " << e1 << "==" << e1.line(surf1Pts) << " hits surf2 face[" << surf2Facei << "]" @@ -935,7 +935,7 @@ void Foam::surfaceIntersection::doCutEdges if (tolerance_ > 0) { - if (mag(pHit.hitPoint() - ptEnd) < tolDim) + if (pHit.hitPoint().dist(ptEnd) < tolDim) { // Near the end => done doTrack = false; diff --git a/src/meshTools/triSurface/orientedSurface/orientedSurface.C b/src/meshTools/triSurface/orientedSurface/orientedSurface.C index 97388d906f..a1ec87be28 100644 --- a/src/meshTools/triSurface/orientedSurface/orientedSurface.C +++ b/src/meshTools/triSurface/orientedSurface/orientedSurface.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -486,7 +486,7 @@ bool Foam::orientedSurface::orient if (curHit.distance() < minDist) { minDist = curHit.distance(); - minPoint = curHit.rawPoint(); + minPoint = curHit.point(); minFacei = facei; } } diff --git a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C index 81deec2603..5e13516813 100644 --- a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C +++ b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -96,8 +96,8 @@ Foam::pointIndexHit Foam::surfaceFeatures::edgeNearest // which one. if ( - mag(eHit.rawPoint() - start) - < mag(eHit.rawPoint() - end) + eHit.point().distSqr(start) + < eHit.point().distSqr(end) ) { endPoint = 0; @@ -108,7 +108,7 @@ Foam::pointIndexHit Foam::surfaceFeatures::edgeNearest } } - return pointIndexHit(eHit.hit(), eHit.rawPoint(), endPoint); + return pointIndexHit(eHit, endPoint); } @@ -1391,7 +1391,7 @@ Foam::Map Foam::surfaceFeatures::nearestSamples label sampleI = info.index(); - if (magSqr(info.hitPoint() - edgePoint) < maxDistSqr[sampleI]) + if (info.point().distSqr(edgePoint) < maxDistSqr[sampleI]) { nearest.insert(sampleI, surfEdgeI); } @@ -1435,7 +1435,7 @@ Foam::Map Foam::surfaceFeatures::nearestSamples meshTools::writeOBJ(objStream, samples[sampleI]); vertI++; point nearPt = - e.line(surfPoints).nearestDist(samples[sampleI]).rawPoint(); + e.line(surfPoints).nearestDist(samples[sampleI]).point(); meshTools::writeOBJ(objStream, nearPt); vertI++; @@ -1541,7 +1541,7 @@ Foam::Map Foam::surfaceFeatures::nearestEdges const edge& e = sampleEdges[sampleEdgeI]; - if (magSqr(info.hitPoint() - edgePoint) < maxDistSqr[e.start()]) + if (info.point().distSqr(edgePoint) < maxDistSqr[e.start()]) { nearest.insert ( @@ -1590,7 +1590,7 @@ Foam::Map Foam::surfaceFeatures::nearestEdges meshTools::writeOBJ(objStream, sampleEdge.centre(samplePoints)); vertI++; - meshTools::writeOBJ(objStream, iter.val().rawPoint()); + meshTools::writeOBJ(objStream, iter.val().point()); vertI++; objStream<< "l " << vertI-1 << ' ' << vertI << endl; @@ -1665,7 +1665,7 @@ void Foam::surfaceFeatures::nearestSurfEdge sample ); - edgePoint[i] = pHit.rawPoint(); + edgePoint[i] = pHit.point(); edgeEndPoint[i] = pHit.index(); } } @@ -1733,7 +1733,7 @@ void Foam::surfaceFeatures::nearestSurfEdge { edgeLabel[i] = selectedEdges[info.index()]; - pointOnFeature[i] = info.hitPoint(); + pointOnFeature[i] = info.point(); } } } diff --git a/src/meshTools/triSurface/triSurfaceSearch/triSurfaceRegionSearch.C b/src/meshTools/triSurface/triSurfaceSearch/triSurfaceRegionSearch.C index f5b8dbef34..d9dfb971ca 100644 --- a/src/meshTools/triSurface/triSurfaceSearch/triSurfaceRegionSearch.C +++ b/src/meshTools/triSurface/triSurfaceSearch/triSurfaceRegionSearch.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -240,8 +240,8 @@ void Foam::triSurfaceRegionSearch::findNearest !info[i].hit() || ( - magSqr(currentRegionHit.hitPoint() - samples[i]) - < magSqr(info[i].hitPoint() - samples[i]) + samples[i].distSqr(currentRegionHit.point()) + < samples[i].distSqr(info[i].point()) ) ) ) diff --git a/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.H b/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.H index fcb901502c..a4ce7c8c98 100644 --- a/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.H +++ b/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -157,7 +157,7 @@ public: //- Calculate nearest point on surface for single searchPoint. Returns // in pointIndexHit: // - hit() : whether nearest point found within bounding box - // - hitPoint() : coordinate of nearest point + // - point() : coordinate of nearest point // - index() : surface triangle label pointIndexHit nearest(const point& pt, const vector& span) const; diff --git a/src/meshTools/triSurface/triSurfaceTools/triSurfaceCloseness.C b/src/meshTools/triSurface/triSurfaceTools/triSurfaceCloseness.C index 8ea1217409..c47ee9e62f 100644 --- a/src/meshTools/triSurface/triSurfaceTools/triSurfaceCloseness.C +++ b/src/meshTools/triSurface/triSurfaceTools/triSurfaceCloseness.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -241,11 +241,7 @@ Foam::triSurfaceTools::writeCloseness ) { externalCloseness[fI] = - mag - ( - faceCentres[fI] - - hitInfo[ownHitI + 1].hitPoint() - ); + faceCentres[fI].dist(hitInfo[ownHitI + 1].point()); } } else if (ownHitI == hitInfo.size() - 1) @@ -263,11 +259,7 @@ Foam::triSurfaceTools::writeCloseness ) { internalCloseness[fI] = - mag - ( - faceCentres[fI] - - hitInfo[ownHitI - 1].hitPoint() - ); + faceCentres[fI].dist(hitInfo[ownHitI - 1].point()); } } else @@ -282,11 +274,7 @@ Foam::triSurfaceTools::writeCloseness ) { externalCloseness[fI] = - mag - ( - faceCentres[fI] - - hitInfo[ownHitI + 1].hitPoint() - ); + faceCentres[fI].dist(hitInfo[ownHitI + 1].point()); } if @@ -299,11 +287,7 @@ Foam::triSurfaceTools::writeCloseness ) { internalCloseness[fI] = - mag - ( - faceCentres[fI] - - hitInfo[ownHitI - 1].hitPoint() - ); + faceCentres[fI].dist(hitInfo[ownHitI - 1].point()); } } } diff --git a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C index a2062040bb..7d0645cbd4 100644 --- a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C +++ b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C @@ -959,8 +959,8 @@ Foam::surfaceLocation Foam::triSurfaceTools::cutEdge // Two cuts. Find nearest. if ( - magSqr(inters[0].rawPoint() - toPoint) - < magSqr(inters[1].rawPoint() - toPoint) + inters[0].point().distSqr(toPoint) + < inters[1].point().distSqr(toPoint) ) { cut = inters[0]; @@ -1145,9 +1145,9 @@ Foam::surfaceLocation Foam::triSurfaceTools::visitFaces triI, excludeEdgeI, // excludeEdgeI excludePointi, // excludePointi - start.rawPoint(), + start.point(), cutPlane, - end.rawPoint() + end.point() ); // If crossing an edge we expect next edge to be cut. @@ -1156,14 +1156,14 @@ Foam::surfaceLocation Foam::triSurfaceTools::visitFaces FatalErrorInFunction << "Triangle:" << triI << " excludeEdge:" << excludeEdgeI - << " point:" << start.rawPoint() + << " point:" << start.point() << " plane:" << cutPlane << " . No intersection!" << abort(FatalError); } if (cutInfo.hit()) { - scalar distSqr = magSqr(cutInfo.rawPoint()-end.rawPoint()); + scalar distSqr = cutInfo.point().distSqr(end.point()); if (distSqr < minDistSqr) { @@ -2029,7 +2029,7 @@ Foam::triSurfaceTools::sideType Foam::triSurfaceTools::surfaceSide pointHit pHit = f.nearestPointClassify(sample, points, nearType, nearLabel); - const point& nearestPoint(pHit.rawPoint()); + const point& nearestPoint = pHit.point(); if (nearType == triPointRef::NONE) { @@ -2589,7 +2589,7 @@ void Foam::triSurfaceTools::calcInterpolationWeights verts[1] = f[1]; verts[2] = f[2]; - calcInterpolationWeights(tri, nearest.rawPoint(), weights); + calcInterpolationWeights(tri, nearest.point(), weights); //Pout<< "calcScalingFactors : samplePt:" << samplePt // << " inside triangle:" << facei @@ -2631,11 +2631,7 @@ void Foam::triSurfaceTools::calcInterpolationWeights scalar s = min ( 1, - max - ( - 0, - mag(nearest.rawPoint() - p0)/mag(p1 - p0) - ) + nearest.point().dist(p0)/p1.dist(p0) ); // Interpolate @@ -2655,7 +2651,7 @@ void Foam::triSurfaceTools::calcInterpolationWeights verts[1] = f[1]; verts[2] = f[2]; - calcInterpolationWeights(tri, nearest.rawPoint(), weights); + calcInterpolationWeights(tri, nearest.point(), weights); //Pout<< "calcScalingFactors : samplePt:" << samplePt // << " distance:" << nearest.distance() @@ -2924,9 +2920,9 @@ Foam::surfaceLocation Foam::triSurfaceTools::trackToEdge start.index(), // triangle -1, // excludeEdge -1, // excludePoint - start.rawPoint(), + start.point(), cutPlane, - end.rawPoint() + end.point() ); nearest.elementType() = triPointRef::EDGE; nearest.triangle() = start.index(); @@ -2979,7 +2975,7 @@ void Foam::triSurfaceTools::track { //OFstream str("track.obj"); //label vertI = 0; - //meshTools::writeOBJ(str, hitInfo.rawPoint()); + //meshTools::writeOBJ(str, hitInfo.point()); //vertI++; // Track across surface. @@ -2997,7 +2993,7 @@ void Foam::triSurfaceTools::track cutPlane ); - //meshTools::writeOBJ(str, hitInfo.rawPoint()); + //meshTools::writeOBJ(str, hitInfo.point()); //vertI++; //str<< "l " << vertI-1 << ' ' << vertI << nl; diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C index 7f5dc457c8..80c7cb5332 100644 --- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C +++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C @@ -782,8 +782,8 @@ void Foam::distributedTriSurfaceMesh::findLine // Nearest intersection if ( - magSqr(allInfo.hitPoint()-start[segmenti]) - < magSqr(hitInfo.hitPoint()-start[segmenti]) + start[segmenti].distSqr(allInfo.point()) + < start[segmenti].distSqr(hitInfo.point()) ) { hitInfo = allInfo; @@ -1295,7 +1295,7 @@ void Foam::distributedTriSurfaceMesh::surfaceSide pointHit pHit = f.nearestPointClassify(sample, points, nearType, nearLabel); - const point& nearestPoint(pHit.rawPoint()); + const point& nearestPoint(pHit.point()); if (nearType == triPointRef::NONE) { @@ -2954,7 +2954,7 @@ const Foam::globalIndex& Foam::distributedTriSurfaceMesh::globalTris() const // if // ( // surfaceClosed_ -// && !contains(procBb_[proci], info[i].hitPoint()) +// && !contains(procBb_[proci], info[i].point()) // ) // { // // Nearest point is not on local processor so the @@ -3044,11 +3044,7 @@ const Foam::globalIndex& Foam::distributedTriSurfaceMesh::globalTris() const // if // ( // surfaceClosed_ -// && !contains -// ( -// procBb_[Pstream::myProcNo()], -// allInfo[i].hitPoint() -// ) +// && !contains(procBb_[Pstream::myProcNo()], allInfo[i].point()) // ) // { // // Nearest point is not on local processor so the @@ -3095,8 +3091,8 @@ const Foam::globalIndex& Foam::distributedTriSurfaceMesh::globalTris() const // // Nearest intersection // if // ( -// magSqr(allInfo[i].hitPoint()-samples[pointi]) -// < magSqr(info[pointi].hitPoint()-samples[pointi]) +// samples[pointi].distSqr(allInfo[i].point()) +// < samples[pointi].distSqr(info[pointi].point()) // ) // { // info[pointi] = allInfo[i]; @@ -3267,7 +3263,7 @@ void Foam::distributedTriSurfaceMesh::findNearest if ( surfaceClosed_ - && !contains(procBb_[Pstream::myProcNo()], info.hitPoint()) + && !contains(procBb_[Pstream::myProcNo()], info.point()) ) { // Nearest point is not on local processor so the @@ -3281,7 +3277,7 @@ void Foam::distributedTriSurfaceMesh::findNearest { nearestAndDist& ni = nearestInfo[i]; ni.first() = info; - ni.second() = magSqr(localPoints[i]-info.hitPoint()); + ni.second() = info.point().distSqr(localPoints[i]); } } } @@ -3437,7 +3433,7 @@ void Foam::distributedTriSurfaceMesh::findNearest if ( surfaceClosed_ - && !contains(procBb_[Pstream::myProcNo()], info.hitPoint()) + && !contains(procBb_[Pstream::myProcNo()], info.point()) ) { // See above @@ -3447,7 +3443,7 @@ void Foam::distributedTriSurfaceMesh::findNearest { nearestAndDist& ni = localBest[i]; ni.first() = info; - ni.second() = magSqr(info.hitPoint()-localSamples[i]); + ni.second() = info.point().distSqr(localSamples[i]); } } } @@ -3584,11 +3580,7 @@ void Foam::distributedTriSurfaceMesh::findNearest if ( surfaceClosed_ - && !contains - ( - procBb_[Pstream::myProcNo()], - allInfo[i].hitPoint() - ) + && !contains(procBb_[Pstream::myProcNo()], allInfo[i].point()) ) { // Nearest point is not on local processor so the @@ -3628,8 +3620,8 @@ void Foam::distributedTriSurfaceMesh::findNearest // Nearest intersection if ( - magSqr(allInfo[i].hitPoint()-samples[pointi]) - < magSqr(info[pointi].hitPoint()-samples[pointi]) + samples[pointi].distSqr(allInfo[i].point()) + < samples[pointi].distSqr(info[pointi].point()) ) { info[pointi] = allInfo[i]; @@ -3760,7 +3752,7 @@ void Foam::distributedTriSurfaceMesh::findLineAll info[pointi].setSize(1); info[pointi][0] = hitInfo[pointi]; - point pt = hitInfo[pointi].hitPoint() + smallVec[pointi]; + point pt = hitInfo[pointi].point() + smallVec[pointi]; if (((pt-start[pointi])&dirVec[pointi]) <= magSqrDirVec[pointi]) { @@ -3805,7 +3797,7 @@ void Foam::distributedTriSurfaceMesh::findLineAll info[pointi].setSize(sz+1); info[pointi][sz] = hitInfo[i]; - point pt = hitInfo[i].hitPoint() + smallVec[pointi]; + point pt = hitInfo[i].point() + smallVec[pointi]; // Check current coordinate along ray scalar d = ((pt-start[pointi])&dirVec[pointi]); diff --git a/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C b/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C index a8b81c6bf5..3fc1ac3f25 100644 --- a/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C +++ b/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -171,12 +171,12 @@ bool Foam::patchDistMethods::exact::correct // Take over hits label nHits = 0; - forAll(info, cellI) + forAll(info, celli) { - if (info[cellI].hit()) + if (info[celli].hit()) { - const point& cc = mesh_.cellCentres()[cellI]; - y[cellI] = mag(cc-info[cellI].hitPoint()); + const point& cc = mesh_.cellCentres()[celli]; + y[celli] = info[celli].point().dist(cc); nHits++; } //else @@ -194,7 +194,7 @@ bool Foam::patchDistMethods::exact::correct forAll(mesh_.cellCentres(), celli) { const point& cc = mesh_.cellCentres()[celli]; - str.writeLine(cc, info[celli].hitPoint()); + str.writeLine(cc, info[celli].point()); } } diff --git a/src/sampling/probes/patchProbes.C b/src/sampling/probes/patchProbes.C index 08515512e4..5f50142d24 100644 --- a/src/sampling/probes/patchProbes.C +++ b/src/sampling/probes/patchProbes.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2021 OpenCFD Ltd. + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -145,21 +145,16 @@ void Foam::patchProbes::findElements(const fvMesh& mesh) // the location written to the header. //const point& facePt = mesh.faceCentres()[faceI]; - const point& facePt = info.hitPoint(); + const point& facePt = info.point(); mappedPatchBase::nearInfo sampleInfo; - sampleInfo.first() = pointIndexHit - ( - true, - facePt, - facei - ); + sampleInfo.first() = pointIndexHit(true, facePt, facei); - sampleInfo.second().first() = magSqr(facePt - sample); + sampleInfo.second().first() = facePt.distSqr(sample); sampleInfo.second().second() = Pstream::myProcNo(); - nearest[probei]= sampleInfo; + nearest[probei] = sampleInfo; } } } @@ -174,7 +169,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh) forAll(nearest, samplei) { oldPoints_[samplei] = operator[](samplei); - operator[](samplei) = nearest[samplei].first().rawPoint(); + operator[](samplei) = nearest[samplei].first().point(); } if (debug) @@ -188,7 +183,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh) Info<< " " << samplei << " coord:"<< operator[](samplei) << " found on processor:" << proci << " in local face:" << locali - << " with location:" << nearest[samplei].first().rawPoint() + << " with location:" << nearest[samplei].first().point() << endl; } } diff --git a/src/sampling/sampledSet/face/faceOnlySet.C b/src/sampling/sampledSet/face/faceOnlySet.C index c7438a3e5f..9691bd9233 100644 --- a/src/sampling/sampledSet/face/faceOnlySet.C +++ b/src/sampling/sampledSet/face/faceOnlySet.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -255,7 +255,7 @@ void Foam::faceOnlySet::calcSamples & normOffset; // Pout<< "Finding next boundary : " - // << "bPoint:" << bHits[bHitI].hitPoint() + // << "bPoint:" << bHits[bHitI].point() // << " tracking:" << singleParticle.position() // << " dist:" << dist // << endl; diff --git a/src/sampling/sampledSet/patchCloud/patchCloudSet.C b/src/sampling/sampledSet/patchCloud/patchCloudSet.C index 3b3a9567fc..4358b1af1b 100644 --- a/src/sampling/sampledSet/patchCloud/patchCloudSet.C +++ b/src/sampling/sampledSet/patchCloud/patchCloudSet.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -144,11 +144,8 @@ void Foam::patchCloudSet::calcSamples // Set nearest to mesh face label nearInfo.setIndex(patchFaces[nearInfo.index()]); - nearest[sampleI].second().first() = magSqr - ( - nearInfo.hitPoint() - - sample - ); + nearest[sampleI].second().first() = + nearInfo.point().distSqr(sample); nearest[sampleI].second().second() = Pstream::myProcNo(); } } @@ -177,7 +174,7 @@ void Foam::patchCloudSet::calcSamples { meshTools::writeOBJ(str, sampleCoords_[i]); ++vertI; - meshTools::writeOBJ(str, nearest[i].first().hitPoint()); + meshTools::writeOBJ(str, nearest[i].first().point()); ++vertI; str << "l " << vertI-1 << ' ' << vertI << nl; } @@ -196,7 +193,7 @@ void Foam::patchCloudSet::calcSamples { label facei = nearInfo.index(); - samplingPts.append(nearInfo.hitPoint()); + samplingPts.append(nearInfo.point()); samplingCells.append(mesh().faceOwner()[facei]); samplingFaces.append(facei); samplingSegments.append(0); diff --git a/src/sampling/sampledSet/patchSeed/patchSeedSet.C b/src/sampling/sampledSet/patchSeed/patchSeedSet.C index b2efaa46ce..fcc633fb58 100644 --- a/src/sampling/sampledSet/patchSeed/patchSeedSet.C +++ b/src/sampling/sampledSet/patchSeed/patchSeedSet.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2018-2021 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -273,12 +273,12 @@ void Foam::patchSeedSet::calcSamples const point& cc = mesh().cellCentres()[celli]; samplingPts.append ( - info.hitPoint() + 1e-1*(cc-info.hitPoint()) + info.point() + 1e-1*(cc-info.point()) ); } else { - samplingPts.append(info.rawPoint()); + samplingPts.append(info.point()); } samplingCells.append(celli); samplingFaces.append(facei); diff --git a/src/sampling/sampledSet/sampledSet/sampledSet.C b/src/sampling/sampledSet/sampledSet/sampledSet.C index 6af532d442..0900786003 100644 --- a/src/sampling/sampledSet/sampledSet/sampledSet.C +++ b/src/sampling/sampledSet/sampledSet/sampledSet.C @@ -194,16 +194,7 @@ Foam::label Foam::sampledSet::findNearFace pointHit inter = f.nearestPoint(sample, mesh().points()); - scalar dist; - - if (inter.hit()) - { - dist = mag(inter.hitPoint() - sample); - } - else - { - dist = mag(inter.missPoint() - sample); - } + scalar dist = inter.point().dist(sample); if (dist < smallDist) { diff --git a/src/sampling/sampledSet/uniform/uniformSet.C b/src/sampling/sampledSet/uniform/uniformSet.C index 5261a515cc..064263fdb8 100644 --- a/src/sampling/sampledSet/uniform/uniformSet.C +++ b/src/sampling/sampledSet/uniform/uniformSet.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -330,7 +330,7 @@ void Foam::uniformSet::calcSamples if (debug) { Pout<< "Finding next boundary : " - << "bPoint:" << bHits[bHitI].hitPoint() + << "bPoint:" << bHits[bHitI].point() << " tracking:" << singleParticle.position() << " dist:" << dist << endl; diff --git a/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C b/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C index 2cb85c8425..a235e4f3b9 100644 --- a/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C +++ b/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C @@ -170,7 +170,7 @@ bool Foam::sampledMeshedSurface::update(const meshSearch& meshSearcher) if (info.hit()) { - near.first() = magSqr(info.hitPoint()-pt); + near.first() = info.point().distSqr(pt); near.second() = globalCells.toGlobal(info.index()); } } @@ -213,7 +213,7 @@ bool Foam::sampledMeshedSurface::update(const meshSearch& meshSearcher) if (info.hit()) { - near.first() = magSqr(info.hitPoint()-pt); + near.first() = info.point().distSqr(pt); near.second() = globalCells.toGlobal ( @@ -346,7 +346,7 @@ bool Foam::sampledMeshedSurface::update(const meshSearch& meshSearcher) if (info.distance() < minDistSqr) { minDistSqr = info.distance(); - samplePoints_[pointi] = info.rawPoint(); + samplePoints_[pointi] = info.point(); } } } @@ -385,7 +385,7 @@ bool Foam::sampledMeshedSurface::update(const meshSearch& meshSearcher) ( pt, mesh().points() - ).rawPoint(); + ).point(); } } } diff --git a/src/sampling/surface/isoSurface/isoSurfaceCell.C b/src/sampling/surface/isoSurface/isoSurfaceCell.C index 489f45a3e2..b0700f97d0 100644 --- a/src/sampling/surface/isoSurface/isoSurfaceCell.C +++ b/src/sampling/surface/isoSurface/isoSurfaceCell.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -368,7 +368,7 @@ void Foam::isoSurfaceCell::calcSnappedCc if (info.hit()) { snappedCc[celli] = snappedPoints.size(); - snappedPoints.append(info.hitPoint()); + snappedPoints.append(info.point()); //Pout<< "cell:" << celli // << " at " << mesh_.cellCentres()[celli]