find/replace pi/180.0 -> degToRad() and 180.0/pi -> radToDeg()

- note left utilities/mesh/advanced/collapseEdges/collapseEdges.C as-is.
  It looks suspicious, but the change was recent, so maybe it means something
This commit is contained in:
Mark Olesen
2009-10-19 13:53:25 +02:00
parent 61a577c860
commit ffc9d0d97b
29 changed files with 71 additions and 94 deletions

View File

@ -445,12 +445,12 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
scalar minCos = Foam::cos(degToRad(featureAngle));
scalar concaveAngle = defaultConcaveAngle;
args.optionReadIfPresent("concaveAngle", concaveAngle);
scalar concaveSin = Foam::sin(concaveAngle*constant::mathematical::pi/180.0);
scalar concaveSin = Foam::sin(degToRad(concaveAngle));
bool snapMeshDict = args.optionFound("snapMesh");
bool overwrite = args.optionFound("overwrite");

View File

@ -539,9 +539,8 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar radAngle = featureAngle*constant::mathematical::pi/180.0;
scalar minCos = Foam::cos(radAngle);
scalar minSin = Foam::sin(radAngle);
scalar minCos = Foam::cos(degToRad(featureAngle));
scalar minSin = Foam::sin(degToRad(featureAngle));
bool readSet = args.optionFound("set");
bool geometry = args.optionFound("geometry");

View File

@ -434,7 +434,7 @@ if (pFaces[WEDGE].size() && pFaces[WEDGE][0].size())
{
// Distribute the points to be +/- 2.5deg from the x-z plane
scalar tanTheta = Foam::tan(2.5*constant::mathematical::pi/180.0);
scalar tanTheta = Foam::tan(degToRad(2.5));
SLList<face>::iterator iterf = pFaces[WEDGE][0].begin();
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();

View File

@ -91,7 +91,7 @@ void simpleMarkFeatures
labelList& multiCellFeaturePoints
)
{
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
scalar minCos = Foam::cos(degToRad(featureAngle));
const polyBoundaryMesh& patches = mesh.boundaryMesh();
@ -387,7 +387,7 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
scalar minCos = Foam::cos(degToRad(featureAngle));
Info<< "Feature:" << featureAngle << endl
<< "minCos :" << minCos << endl

View File

@ -99,7 +99,7 @@ void starMesh::createCoupleMatches()
<< coupleI << ". STAR couple ID: "
<< couples_[coupleI].coupleID() << endl
<< "The angle between face normals is "
<< Foam::acos(faceAreaAngle)/constant::mathematical::pi*180
<< radToDeg(Foam::acos(faceAreaAngle))
<< " deg." << endl
<< "master cell: " << fp.masterCell()
<< " STAR number: " << starCellID_[fp.masterCell()]

View File

@ -51,8 +51,7 @@ wedge::wedge(const dictionary& dict)
axis_(coeffDict_.lookup("axis")),
angle_
(
readScalar(coeffDict_.lookup("angle"))
*constant::mathematical::pi/180.0
degToRad(readScalar(coeffDict_.lookup("angle")))
)
{}

View File

@ -93,7 +93,7 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.optionFound("overwrite");
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
scalar minCos = Foam::cos(degToRad(featureAngle));
Info<< "Feature:" << featureAngle << endl
<< "minCos :" << minCos << endl

View File

@ -410,7 +410,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
// Severe nonorthogonality threshold
const scalar severeNonorthogonalityThreshold =
::cos(nonOrthThreshold_/180.0*constant::mathematical::pi);
::cos(degToRad(nonOrthThreshold_));
scalar minDDotS = GREAT;
@ -472,9 +472,8 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
if (debug || report)
{
Info<< " Mesh non-orthogonality Max: "
<< ::acos(minDDotS)/constant::mathematical::pi*180.0
<< " average: " <<
::acos(sumDDotS/neiSize)/constant::mathematical::pi*180.0
<< radToDeg(::acos(minDDotS))
<< " average: " << radToDeg(::acos(sumDDotS/neiSize))
<< endl;
}
}
@ -839,7 +838,7 @@ bool Foam::primitiveMesh::checkFaceAngles
<< exit(FatalError);
}
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::mathematical::pi);
const scalar maxSin = Foam::sin(degToRad(maxDeg));
const pointField& p = points();
const faceList& fcs = faces();
@ -915,8 +914,7 @@ bool Foam::primitiveMesh::checkFaceAngles
if (nConcave > 0)
{
scalar maxConcaveDegr =
Foam::asin(Foam::min(1.0, maxEdgeSin))
*180.0/constant::mathematical::pi;
radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin)));
if (debug || report)
{

View File

@ -200,7 +200,7 @@ bool Foam::primitiveMesh::checkMeshMotion
) << "Severe non-orthogonality in mesh motion for face "
<< faceI
<< " between cells " << own[faceI] << " and " << nei[faceI]
<< ": Angle = " << ::acos(dDotS)/constant::mathematical::pi*180.0
<< ": Angle = " << radToDeg(::acos(dDotS))
<< " deg." << endl;
nDotProductErrors++;

View File

@ -44,8 +44,7 @@ namespace Foam
}
// Angle for polys to be considered splitHexes.
const Foam::scalar Foam::topoCellLooper::featureCos =
Foam::cos(10.0*constant::mathematical::pi/180.0);
const Foam::scalar Foam::topoCellLooper::featureCos = Foam::cos(degToRad(10.0));
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -192,7 +192,7 @@ Foam::undoableMeshCutter::undoableMeshCutter
faceRemover_
(
mesh,
Foam::cos(30.0/180.0*constant::mathematical::pi)
Foam::cos(degToRad(30.0))
)
{}

View File

@ -248,7 +248,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
<< " between cells " << mesh.faceOwner()[faceI]
<< " and " << nei
<< ": Angle = "
<< ::acos(dDotS)/constant::mathematical::pi*180.0
<< radToDeg(::acos(dDotS))
<< " deg." << endl;
}
@ -269,7 +269,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
<< " between cells " << mesh.faceOwner()[faceI]
<< " and " << nei
<< ": Angle = "
<< ::acos(dDotS)/constant::mathematical::pi*180.0
<< radToDeg(::acos(dDotS))
<< " deg." << endl;
}
@ -368,8 +368,7 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Severe nonorthogonality threshold
const scalar severeNonorthogonalityThreshold =
::cos(orthWarn/180.0*constant::mathematical::pi);
const scalar severeNonorthogonalityThreshold = ::cos(degToRad(orthWarn));
// Calculate coupled cell centre
@ -504,9 +503,8 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
if (nDDotS > 0)
{
Info<< "Mesh non-orthogonality Max: "
<< ::acos(minDDotS)/constant::mathematical::pi*180.0
<< " average: " <<
::acos(sumDDotS/nDDotS)/constant::mathematical::pi*180.0
<< radToDeg(::acos(minDDotS))
<< " average: " << radToDeg(::acos(sumDDotS/nDDotS))
<< endl;
}
}
@ -1258,7 +1256,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
<< abort(FatalError);
}
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::mathematical::pi);
const scalar maxSin = Foam::sin(degToRad(maxDeg));
const faceList& fcs = mesh.faces();
@ -1338,8 +1336,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
if (maxEdgeSin > SMALL)
{
scalar maxConcaveDegr =
Foam::asin(Foam::min(1.0, maxEdgeSin))
*180.0/constant::mathematical::pi;
radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin)));
Info<< "There are " << nConcave
<< " faces with concave angles between consecutive"

View File

@ -345,7 +345,8 @@ void surfaceInterpolation::makeCorrectionVectors() const
// Calculate the non-orthogonality for meshes with 1 face or more
if (returnReduce(magSf.size(), sumOp<label>()) > 0)
{
NonOrthogCoeff =
NonOrthogCoeff = radToDeg
(
asin
(
min
@ -353,7 +354,8 @@ void surfaceInterpolation::makeCorrectionVectors() const
(sum(magSf*mag(corrVecs))/sum(magSf)).value(),
1.0
)
)*180.0/constant::mathematical::pi;
)
);
}
if (debug)

View File

@ -165,9 +165,8 @@ Foam::multiHoleInjector::~multiHoleInjector()
void Foam::multiHoleInjector::setTangentialVectors()
{
scalar pi180 = constant::mathematical::pi/180.0;
scalar alpha = xyAngle_*pi180;
scalar phi = zAngle_*pi180;
scalar alpha = degToRad(xyAngle_);
scalar phi = degToRad(zAngle_);
vector xp(cos(alpha), sin(alpha), 0.0);
vector zp(cos(alpha)*sin(phi), sin(alpha)*sin(phi), cos(phi));
@ -184,11 +183,11 @@ void Foam::multiHoleInjector::setTangentialVectors()
// Info << "zp = " << zp << endl;
scalar angle = 0.0;
scalar u = umbrellaAngle_*pi180/2.0;
scalar u = degToRad(umbrellaAngle_/2.0);
for (label i=0; i<nHoles_; i++)
{
angle += angleSpacing_[i];
scalar v = angle*pi180;
scalar v = degToRad(angle);
direction_[i] = cos(v)*sin(u)*xp + sin(v)*sin(u)*yp + cos(u)*zp;
vector dp = direction_[i] - (direction_[i] & zp)*direction_[i];
if (mag(dp) > SMALL)

View File

@ -293,7 +293,7 @@ Foam::spray::spray
angleOfWedge_ = constant::mathematical::pi - acos(arcCos);
Info<< "Calculated angle of wedge is "
<< angleOfWedge_*180/constant::mathematical::pi << " deg."
<< radToDeg(angleOfWedge_) << " deg."
<< endl;
}
else

View File

@ -110,9 +110,7 @@ scalar blobsSwirlInjector::d0
scalar c = rndGen_.scalar01();
angle_ = coneAngle_[n]/2.0 + c*coneInterval_[n];
angle_ *= constant::mathematical::pi/180.0;
angle_ = degToRad(coneAngle_[n]/2.0 + c*coneInterval_[n]);
scalar injectedMassFlow = it.massFlowRate(t);

View File

@ -2480,10 +2480,10 @@ void Foam::autoLayerDriver::mergePatchFacesUndo
)
{
scalar minCos =
Foam::cos(layerParams.featureAngle()*constant::mathematical::pi/180.0);
Foam::cos(degToRad(layerParams.featureAngle()));
scalar concaveCos =
Foam::cos(layerParams.concaveAngle()*constant::mathematical::pi/180.0);
Foam::cos(degToRad(layerParams.concaveAngle()));
Info<< nl
<< "Merging all faces of a cell" << nl
@ -2602,7 +2602,7 @@ void Foam::autoLayerDriver::addLayers
(
pp,
meshEdges,
layerParams.featureAngle()*constant::mathematical::pi/180.0,
degToRad(layerParams.featureAngle()),
patchDisp,
patchNLayers,
@ -2688,7 +2688,7 @@ void Foam::autoLayerDriver::addLayers
maxPatchNameLen = max(maxPatchNameLen, label(patchName.size()));
}
Info<< nl
Info<< nl
<< setf(ios_base::left) << setw(maxPatchNameLen) << "patch"
<< setw(0) << " faces layers avg thickness[m]" << nl
<< setf(ios_base::left) << setw(maxPatchNameLen) << " "
@ -3289,7 +3289,7 @@ void Foam::autoLayerDriver::doLayers
<< "Doing initial balancing" << nl
<< "-----------------------" << nl
<< endl;
scalarField cellWeights(mesh.nCells(), 1);
forAll(numLayers, patchI)
{
@ -3302,7 +3302,7 @@ void Foam::autoLayerDriver::doLayers
}
}
}
// Balance mesh (and meshRefinement). No restriction on face zones
// and baffles.
autoPtr<mapDistributePolyMesh> map = meshRefiner_.balance
@ -3313,7 +3313,7 @@ void Foam::autoLayerDriver::doLayers
decomposer,
distributor
);
//{
// globalIndex globalCells(mesh.nCells());
//

View File

@ -681,8 +681,8 @@ void Foam::autoRefineDriver::mergePatchFaces
meshRefiner_.mergePatchFaces
(
Foam::cos(45*constant::mathematical::pi/180.0),
Foam::cos(45*constant::mathematical::pi/180.0),
Foam::cos(degToRad(45.0)),
Foam::cos(degToRad(45.0)),
meshRefiner_.meshedPatches()
);
@ -691,7 +691,7 @@ void Foam::autoRefineDriver::mergePatchFaces
meshRefiner_.checkData();
}
meshRefiner_.mergeEdges(Foam::cos(45*constant::mathematical::pi/180.0));
meshRefiner_.mergeEdges(Foam::cos(degToRad(45.0)));
if (debug)
{

View File

@ -192,7 +192,7 @@ Foam::layerParameters::layerParameters
),
layerTerminationCos_
(
Foam::cos(0.5*featureAngle_*constant::mathematical::pi/180.0)
Foam::cos(degToRad(0.5*featureAngle_))
),
maxThicknessToMedialRatio_
(
@ -200,8 +200,7 @@ Foam::layerParameters::layerParameters
),
minMedianAxisAngleCos_
(
Foam::cos(readScalar(dict.lookup("minMedianAxisAngle")))
*constant::mathematical::pi/180.0
Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle"))))
),
nBufferCellsNoExtrude_
(
@ -269,7 +268,7 @@ Foam::layerParameters::layerParameters
),
layerTerminationCos_
(
Foam::cos(0.5*featureAngle_*constant::mathematical::pi/180.0)
Foam::cos(degToRad(0.5*featureAngle_))
),
maxThicknessToMedialRatio_
(
@ -277,8 +276,7 @@ Foam::layerParameters::layerParameters
),
minMedianAxisAngleCos_
(
Foam::cos(readScalar(dict.lookup("minMedianAxisAngle")))
*constant::mathematical::pi/180.0
Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle"))))
),
nBufferCellsNoExtrude_
(

View File

@ -65,7 +65,7 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
}
else
{
curvature_ = Foam::cos(featAngle*constant::mathematical::pi/180.0);
curvature_ = Foam::cos(degToRad(featAngle));
}
}

View File

@ -247,7 +247,7 @@ Foam::Map<Foam::label> Foam::meshRefinement::findEdgeConnectedProblemCells
nearestRegion[i]
);
scalar angle = perpendicularAngle[region]/180.0*constant::mathematical::pi;
scalar angle = degToRad(perpendicularAngle[region]);
if (angle >= 0)
{

View File

@ -72,12 +72,12 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle()
// find angles
scalar tmp = (r3&r1)/(mag(r3)*mag(r1));
angle_ = acos(tmp)*180.0/constant::mathematical::pi;
angle_ = radToDeg(acos(tmp));
// check if the vectors define an exterior or an interior arcEdge
if (((r1 ^ r2)&(r1 ^ r3)) < 0.0)
{
angle_ = 360 - angle_;
angle_ = 360.0 - angle_;
}
vector tempAxis;
@ -159,7 +159,7 @@ Foam::vector Foam::arcEdge::position(const scalar lambda) const
Foam::scalar Foam::arcEdge::length() const
{
return angle_*radius_*constant::mathematical::pi/180.0;
return degToRad(angle_*radius_);
}

View File

@ -66,8 +66,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const
scalar magS = mag(s);
scalar cosDDotS =
Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))
*180.0/constant::mathematical::pi;
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
result[own[faceI]] = max(cosDDotS, result[own[faceI]]);
@ -92,8 +91,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const
scalar magS = mag(s);
scalar cosDDotS =
Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))
*180.0/constant::mathematical::pi;
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
result[faceCells[faceI]] = max(cosDDotS, result[faceCells[faceI]]);
}
@ -207,8 +205,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const
scalar magS = mag(s);
scalar cosDDotS =
Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))
*180.0/constant::mathematical::pi;
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
result[faceI] = cosDDotS;
}
@ -233,8 +230,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const
scalar magS = mag(s);
scalar cosDDotS =
Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))
*180.0/constant::mathematical::pi;
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
result[globalFaceI++] = cosDDotS;
}

View File

@ -72,8 +72,8 @@ Foam::vector Foam::toroidalCS::localToGlobal
) const
{
// Notation: r = local.x()
scalar theta = local.y()*constant::mathematical::pi/180.0;
scalar phi = local.z()*constant::mathematical::pi/180.0;
scalar theta = degToRad(local.y());
scalar phi = degToRad(local.z());
scalar rprime = radius_ + local.x()*sin(phi);

View File

@ -271,8 +271,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
const labelList& nei = mesh.faceNeighbour();
// Severe nonorthogonality threshold
const scalar severeNonorthogonalityThreshold =
::cos(orthWarn/180.0*constant::mathematical::pi);
const scalar severeNonorthogonalityThreshold = ::cos(degToRad(orthWarn));
scalar minDDotS = GREAT;
@ -303,8 +302,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
Pout<< "Severe non-orthogonality for face " << faceI
<< " between cells " << own[faceI]
<< " and " << nei[faceI]
<< ": Angle = "
<< ::acos(dDotS)/constant::mathematical::pi*180.0
<< ": Angle = " << radToDeg(::acos(dDotS))
<< " deg." << endl;
}
@ -329,8 +327,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
<< faceI
<< " between cells " << own[faceI] << " and "
<< nei[faceI]
<< ": Angle = "
<< ::acos(dDotS)/constant::mathematical::pi*180.0
<< ": Angle = " << radToDeg(::acos(dDotS))
<< " deg." << endl;
}
@ -376,9 +373,8 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
if (neiSize > 0)
{
Info<< "Mesh non-orthogonality Max: "
<< ::acos(minDDotS)/constant::mathematical::pi*180.0
<< " average: " <<
::acos(sumDDotS/neiSize)/constant::mathematical::pi*180.0
<< radToDeg(::acos(minDDotS))
<< " average: " << radToDeg(::acos(sumDDotS/neiSize))
<< endl;
}
}
@ -780,7 +776,7 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles
<< abort(FatalError);
}
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::mathematical::pi);
const scalar maxSin = Foam::sin(degToRad(maxDeg));
const faceList& fcs = mesh.faces();
@ -860,8 +856,7 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles
if (maxEdgeSin > SMALL)
{
scalar maxConcaveDegr =
Foam::asin(Foam::min(1.0, maxEdgeSin))
*180.0/constant::mathematical::pi;
radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin)));
Info<< "There are " << nConcave
<< " faces with concave angles between consecutive"

View File

@ -56,8 +56,7 @@ Foam::topoSetSource::addToUsageTable Foam::shapeToCell::usage_
// Angle for polys to be considered splitHexes.
Foam::scalar Foam::shapeToCell::featureCos =
Foam::cos(10.0*Foam::constant::mathematical::pi/180.0);
Foam::scalar Foam::shapeToCell::featureCos = Foam::cos(degToRad(10.0));
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -43,8 +43,7 @@ License
defineTypeNameAndDebug(Foam::edgeIntersections, 0);
Foam::scalar Foam::edgeIntersections::alignedCos_ =
Foam::cos(89.0*Foam::constant::mathematical::pi/180.0);
Foam::scalar Foam::edgeIntersections::alignedCos_ = Foam::cos(degToRad(89.0));
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -490,8 +490,7 @@ Foam::labelList Foam::surfaceFeatures::selectFeatureEdges
void Foam::surfaceFeatures::findFeatures(const scalar includedAngle)
{
scalar minCos =
Foam::cos((180.0 - includedAngle)*constant::mathematical::pi/180.0);
scalar minCos = Foam::cos(degToRad(180.0 - includedAngle));
const labelListList& edgeFaces = surf_.edgeFaces();
const vectorField& faceNormals = surf_.faceNormals();

View File

@ -128,7 +128,7 @@ int main(int argc, char *argv[])
fileName pointsFile(runTime.constantPath()/"points.tmp");
OFstream pFile(pointsFile);
scalar a(0.1*constant::mathematical::pi/180.0);
scalar a(degToRad(0.1));
tensor rotateZ =
tensor
(