unitConversions.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Global
25  unitConversions
26 
27 Description
28  Useful unit conversions
29 
30 SourceFiles
31  unitConversions.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef unitConversions_H
36 #define unitConversions_H
37 
38 #include "unitConversion.H"
39 #include "dimensionSets.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 extern const unitConversion unitless;
49 
50 extern const unitConversion unitAny;
51 extern const unitConversion unitNone;
52 
53 extern const unitConversion unitFraction;
54 extern const unitConversion unitPercent;
55 
56 extern const unitConversion unitRadians;
57 extern const unitConversion unitRotations;
58 extern const unitConversion unitDegrees;
59 
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 //- Convert degrees to radians
64 scalar degToRad(const scalar deg);
65 
66 //- Convert radians to degrees
67 scalar radToDeg(const scalar rad);
68 
69 //- Add a unit conversion
70 void addUnits(const word& name, const unitConversion& units);
71 
72 //- Get the table of unit conversions
73 const HashTable<unitConversion>& units();
74 
75 
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78 } // End namespace Foam
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 #endif
83 
84 // ************************************************************************* //
Useful dimension sets.
Namespace for OpenFOAM.
scalar radToDeg(const scalar rad)
Convert radians to degrees.
scalar degToRad(const scalar deg)
Convert degrees to radians.
const unitConversion unitAny
const unitConversion unitPercent
const unitConversion unitNone
const HashTable< unitConversion > & units()
Get the table of unit conversions.
void addUnits(const word &name, const unitConversion &units)
Add a unit conversion.
const unitConversion unitRadians
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
const unitConversion unitless
const unitConversion unitRotations
const unitConversion unitDegrees
const unitConversion unitFraction