mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: vector mag(), magSqr() methods - complementary to dist(), distSqr()
ENH: use direct access to pointHit as point(), use dist(), distSqr() - if the pointHit has already been checked for hit(), can/should simply use point() noexcept access subsequently to avoid redundant checks. Using vector distSqr() methods provides a minor optimization (no itermediate temporary), but can also make for clearer code. ENH: copy construct pointIndexHit with different index - symmetric with constructing from a pointHit with an index STYLE: prefer pointHit point() instead of rawPoint()
This commit is contained in:
committed by
Andrew Heather
parent
5ec435aca3
commit
27c2cdc040
@ -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
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user