unitConversion: templated degToRad and radToDeg to support vectors of angles

This commit is contained in:
Henry Weller
2021-03-28 13:36:00 +01:00
parent bf7ac24e9f
commit 516ee1675e
4 changed files with 14 additions and 12 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,10 +33,10 @@ License
using namespace Foam::vectorTools;
const Foam::scalar Foam::conformalVoronoiMesh::searchConeAngle
= Foam::cos(degToRad(30));
= Foam::cos(degToRad(30.0));
const Foam::scalar Foam::conformalVoronoiMesh::searchAngleOppositeSurface
= Foam::cos(degToRad(150));
= Foam::cos(degToRad(150.0));
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -42,15 +42,17 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Conversion from degrees to radians
inline scalar degToRad(const scalar deg)
template<class Type>
inline Type degToRad(const Type& deg)
{
return (deg*constant::mathematical::pi/180.0);
return (constant::mathematical::pi/180.0)*deg;
}
//- Conversion from radians to degrees
inline scalar radToDeg(const scalar rad)
template<class Type>
inline Type radToDeg(const Type& rad)
{
return (rad*180.0/constant::mathematical::pi);
return (180.0/constant::mathematical::pi)*rad;
}
//- Conversion from atm to Pa

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1594,7 +1594,7 @@ bool Foam::meshRefinement::isNormalGap
d /= magD;
// Check average normal with respect to intersection locations
if (mag(avg&d) > Foam::cos(degToRad(45)))
if (mag(avg&d) > Foam::cos(degToRad(45.0)))
{
return true;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -2235,7 +2235,7 @@ void Foam::snappySnapDriver::determineBaffleFeatures
// Detect baffle edges. Assume initial mesh will have 0,90 or 180
// (baffle) degree angles so smoothing should make 0,90
// to be less than 90.
const scalar baffleFeatureCos = Foam::cos(degToRad(91));
const scalar baffleFeatureCos = Foam::cos(degToRad(91.0));
autoPtr<OBJstream> baffleEdgeStr;