OpenFOAM: Rationalized the naming of scalar limits

In early versions of OpenFOAM the scalar limits were simple macro replacements and the
names were capitalized to indicate this.  The scalar limits are now static
constants which is a huge improvement on the use of macros and for consistency
the names have been changed to camel-case to indicate this and improve
readability of the code:

    GREAT -> great
    ROOTGREAT -> rootGreat
    VGREAT -> vGreat
    ROOTVGREAT -> rootVGreat
    SMALL -> small
    ROOTSMALL -> rootSmall
    VSMALL -> vSmall
    ROOTVSMALL -> rootVSmall

The original capitalized are still currently supported but their use is
deprecated.
This commit is contained in:
Henry Weller
2018-01-25 09:46:37 +00:00
parent 2c882ab4a7
commit fc2b2d0c05
729 changed files with 2822 additions and 2809 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -132,11 +132,11 @@ labelList countBins
label index = -1;
if (Foam::mag(val - min) < SMALL)
if (Foam::mag(val - min) < small)
{
index = 0;
}
else if (val >= max - SMALL)
else if (val >= max - small)
{
index = nBins - 1;
}
@ -366,7 +366,7 @@ int main(int argc, char *argv[])
<< endl;
if (triQ[minIndex] < SMALL)
if (triQ[minIndex] < small)
{
WarningInFunction
<< triQ[minIndex] << ". This might give problems in"

View File

@ -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-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -226,7 +226,7 @@ static bool insertSorted
{
scalar w = sortedWeights[sortedI];
if (mag(w - weight) < SMALL)
if (mag(w - weight) < small)
{
WarningInFunction
<< "Trying to insert weight " << weight << " which is close to"
@ -585,7 +585,7 @@ static labelPair getSpanPoints
{
const pointField& localPoints = surf.localPoints();
scalar maxDist = -GREAT;
scalar maxDist = -great;
labelPair maxPair;
forAll(outsideVerts, i)

View File

@ -67,8 +67,8 @@ void Foam::extractCloseness
// Find all intersections (in order)
searchSurf.findLineAll(start, end, allHitinfo);
scalarField internalCloseness(start.size(), GREAT);
scalarField externalCloseness(start.size(), GREAT);
scalarField internalCloseness(start.size(), great);
scalarField externalCloseness(start.size(), great);
forAll(allHitinfo, fi)
{

View File

@ -209,8 +209,8 @@ void Foam::extractPointCloseness
// Find all intersections (in order)
searchSurf.findLineAll(start, end, allHitinfo);
scalarField internalCloseness(points.size(), GREAT);
scalarField externalCloseness(points.size(), GREAT);
scalarField internalCloseness(points.size(), great);
scalarField externalCloseness(points.size(), great);
i = 0;
forAll(points, pi)

View File

@ -197,7 +197,7 @@ int main(int argc, char *argv[])
dictionary trimDict = surfaceDict.subDict("trimFeatures");
scalar minLen =
trimDict.lookupOrAddDefault<scalar>("minLen", -GREAT);
trimDict.lookupOrAddDefault<scalar>("minLen", -great);
label minElem = trimDict.lookupOrAddDefault<label>("minElem", 0);

View File

@ -75,7 +75,7 @@ Foam::scalar Foam::calcVertexNormalWeight
const vector e1 = points[f[index]] - points[f[f.fcIndex(index)]];
const vector e2 = points[f[index]] - points[f[f.rcIndex(index)]];
return mag(fN)/(magSqr(e1)*magSqr(e2) + VSMALL);
return mag(fN)/(magSqr(e1)*magSqr(e2) + vSmall);
}
@ -91,9 +91,9 @@ Foam::point Foam::randomPointInPlane(const plane& p)
const scalar perturbY = refPt.y() + 1e-3;
const scalar perturbZ = refPt.z() + 1e-3;
if (mag(planeCoeffs[2]) < SMALL)
if (mag(planeCoeffs[2]) < small)
{
if (mag(planeCoeffs[1]) < SMALL)
if (mag(planeCoeffs[1]) < small)
{
const scalar x =
-1.0
@ -162,7 +162,7 @@ Foam::triadField Foam::calcVertexCoordSys
const point& pt = points[pI];
const vector& normal = pointNormals[meshPointMap[pI]];
if (mag(normal) < SMALL)
if (mag(normal) < small)
{
pointCoordSys[meshPointMap[pI]] = triad::unset;
continue;
@ -219,7 +219,7 @@ Foam::vectorField Foam::calcVertexNormals(const triSurface& surf)
pointNormals[pI] += weight*fN;
}
pointNormals[pI] /= mag(pointNormals[pI]) + VSMALL;
pointNormals[pI] /= mag(pointNormals[pI]) + vSmall;
}
return pointNormals;
@ -289,7 +289,7 @@ Foam::triSurfacePointScalarField Foam::calcCurvature
const vector eN = f.normal(points);
const vector e1 = (e0 ^ eN);
if (magSqr(eN) < ROOTVSMALL)
if (magSqr(eN) < rootVSmall)
{
continue;
}
@ -405,7 +405,7 @@ Foam::triSurfacePointScalarField Foam::calcCurvature
forAll(curvaturePointField, pI)
{
pointFundamentalTensors[pI] /= (accumulatedWeights[pI] + SMALL);
pointFundamentalTensors[pI] /= (accumulatedWeights[pI] + small);
vector2D principalCurvatures = eigenValues(pointFundamentalTensors[pI]);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -68,7 +68,7 @@ int main(int argc, char *argv[])
const pointField& localPoints = surf1.localPoints();
label minIndex = -1;
scalar minDist = GREAT;
scalar minDist = great;
forAll(localPoints, pointi)
{
@ -94,7 +94,7 @@ int main(int argc, char *argv[])
const pointField& points = surf1.points();
minIndex = -1;
minDist = GREAT;
minDist = great;
forAll(surf1, facei)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -125,7 +125,7 @@ void greenRefine
// const edge& e = surf.edges()[edgeIndex];
// vector eVec = e.vec(surf.localPoints());
// eVec /= mag(eVec) + SMALL;
// eVec /= mag(eVec) + small;
// const labelList& pEdges = surf.pointEdges()[pointIndex];
//
@ -134,7 +134,7 @@ void greenRefine
// const edge& nearE = surf.edges()[pEdges[eI]];
// vector nearEVec = nearE.vec(surf.localPoints());
// nearEVec /= mag(nearEVec) + SMALL;
// nearEVec /= mag(nearEVec) + small;
// const scalar dot = eVec & nearEVec;
// const scalar minCos = degToRad(angle);
@ -177,8 +177,8 @@ void createBoundaryEdgeTrees
treeBoundBox(UList<point>(surf.localPoints())).extend(rndGen, 1e-4)
);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
bEdgeTrees.set
(
@ -292,7 +292,7 @@ int main(int argc, char *argv[])
const IOdictionary dict(dictIO);
const scalar dist(args.argRead<scalar>(1));
const scalar matchTolerance(max(1e-6*dist, SMALL));
const scalar matchTolerance(max(1e-6*dist, small));
const label maxIters = 100;
Info<< "Hooking distance = " << dist << endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -115,15 +115,15 @@ int main(int argc, char *argv[])
Random rand(57373);
while ((magSqr(eVal) < VSMALL) && pertI < 10)
while ((magSqr(eVal) < vSmall) && pertI < 10)
{
WarningInFunction
<< "No eigenValues found, shape may have symmetry, "
<< "perturbing inertia tensor diagonal" << endl;
J.xx() *= 1.0 + SMALL*rand.scalar01();
J.yy() *= 1.0 + SMALL*rand.scalar01();
J.zz() *= 1.0 + SMALL*rand.scalar01();
J.xx() *= 1.0 + small*rand.scalar01();
J.yy() *= 1.0 + small*rand.scalar01();
J.zz() *= 1.0 + small*rand.scalar01();
eVal = eigenValues(J);
@ -136,9 +136,9 @@ int main(int argc, char *argv[])
if
(
(mag(eVec.x() ^ eVec.y()) > (1.0 - SMALL))
&& (mag(eVec.y() ^ eVec.z()) > (1.0 - SMALL))
&& (mag(eVec.z() ^ eVec.x()) > (1.0 - SMALL))
(mag(eVec.x() ^ eVec.y()) > (1.0 - small))
&& (mag(eVec.y() ^ eVec.z()) > (1.0 - small))
&& (mag(eVec.z() ^ eVec.x()) > (1.0 - small))
)
{
// Make the eigenvectors a right handed orthogonal triplet
@ -167,7 +167,7 @@ int main(int argc, char *argv[])
principal[1] = eVec.y();
principal[2] = eVec.z();
scalar maxMagDotProduct = -GREAT;
scalar maxMagDotProduct = -great;
// Matching axis indices, first: cartesian, second:principal
@ -249,7 +249,7 @@ int main(int argc, char *argv[])
match =Pair<label>(-1, -1);
maxMagDotProduct = -GREAT;
maxMagDotProduct = -great;
forAll(cartesian, cI)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -193,7 +193,7 @@ int main(int argc, char *argv[])
dictionary dict;
dict.add("bounds", meshBb[Pstream::myProcNo()]);
dict.add("distributionType", distType);
dict.add("mergeDistance", SMALL);
dict.add("mergeDistance", small);
localIOdictionary ioDict
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -250,7 +250,7 @@ scalar minEdgeLen(const triSurface& surf, const label pointi)
const labelList& pEdges = surf.pointEdges()[pointi];
scalar minLen = GREAT;
scalar minLen = great;
forAll(pEdges, i)
{
@ -578,7 +578,7 @@ void calcPointVecs
scalar magMidVec = mag(midVec);
if (magMidVec > SMALL)
if (magMidVec > small)
{
midVec /= magMidVec;
@ -876,7 +876,7 @@ int main(int argc, char *argv[])
// the edge and then interpolate this to the (border)point.
//
vectorField borderPointVec(surf.nPoints(), vector(GREAT, GREAT, GREAT));
vectorField borderPointVec(surf.nPoints(), vector(great, great, great));
calcPointVecs(surf, faceToEdge, faceToPoint, borderPointVec);
@ -929,7 +929,7 @@ int main(int argc, char *argv[])
{
const point& pt = newPoints[f[fp]];
if (mag(pt) >= GREAT/2)
if (mag(pt) >= great/2)
{
Info<< "newTri:" << facei << " verts:" << f
<< " vert:" << f[fp] << " point:" << pt << endl;