mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Rationalize the "pos" function
"pos" now returns 1 if the argument is greater than 0, otherwise it returns 0. This is consistent with the common mathematical definition of the "pos" function: https://en.wikipedia.org/wiki/Sign_(mathematics) However the previous implementation in which 1 was also returned for a 0 argument is useful in many situations so the "pos0" has been added which returns 1 if the argument is greater or equal to 0. Additionally the "neg0" has been added which returns 1 if if the argument is less than or equal to 0.
This commit is contained in:
committed by
Andrew Heather
parent
639305e960
commit
56bfc75949
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -109,10 +109,10 @@ bool Foam::triSurfaceSearch::checkUniqueHit
|
||||
surface().faceNormals()[edgeFacei];
|
||||
|
||||
const label signCurrHit =
|
||||
pos(currHitNormal & lineVec);
|
||||
pos0(currHitNormal & lineVec);
|
||||
|
||||
const label signExistingHit =
|
||||
pos(existingHitNormal & lineVec);
|
||||
pos0(existingHitNormal & lineVec);
|
||||
|
||||
if (signCurrHit == signExistingHit)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user