dimensionSets.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Global
27  dimensionSets
28 
29 Description
30  Useful dimension sets
31 
32 SourceFiles
33  dimensionSets.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef dimensionSets_H
38 #define dimensionSets_H
39 
40 #include "scalarMatrices.H"
41 #include "dimensionedScalarFwd.H"
42 #include "PtrList.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 //- Dimensionless
52 extern const dimensionSet dimless;
53 
54 extern const dimensionSet dimMass;
55 extern const dimensionSet dimLength;
56 extern const dimensionSet dimTime;
58 extern const dimensionSet dimMoles;
59 extern const dimensionSet dimCurrent;
61 
62 extern const dimensionSet dimArea;
63 extern const dimensionSet dimVolume;
64 
65 //- Older spelling for dimVolume
66 // \deprecated(2019-01) use dimVolume instead
67 extern const dimensionSet dimVol;
68 
69 extern const dimensionSet dimDensity;
70 extern const dimensionSet dimForce;
71 extern const dimensionSet dimEnergy;
72 extern const dimensionSet dimPower;
73 
74 extern const dimensionSet dimVelocity;
75 extern const dimensionSet dimAcceleration;
77 extern const dimensionSet dimCompressibility;
78 extern const dimensionSet dimGasConstant;
80 extern const dimensionSet dimViscosity;
82 
83 
84 //- Construction of unit sets
85 class dimensionSets
86 {
87  // Private Data
88 
89  //- Set of dimensions
91 
92  //- LU decomposition of dimensions
93  scalarSquareMatrix conversion_;
94 
95  //- See above
96  labelList conversionPivots_;
97 
98  //- Is LU decomposition valid
99  bool valid_;
100 
101 public:
102 
103  // Constructors
104 
105  //- Construct from all units and set of units to use
106  //- for inversion (writing)
108  (
110  const wordList& unitNames
111  );
112 
113 
114  // Member Functions
115 
116  //- Return the units
117  const PtrList<dimensionedScalar>& units() const noexcept
118  {
119  return units_;
120  }
121 
122  //- Is there a valid inverse of the selected unit
123  bool valid() const noexcept
124  {
125  return valid_;
126  }
127 
128  //- (if valid) obtain set of coefficients of unitNames
129  void coefficients(scalarField& exponents) const;
130 };
131 
132 
133 //- Top level dictionary
134 dictionary& dimensionSystems();
135 
136 //- Set of all dimensions
137 const HashTable<dimensionedScalar>& unitSet();
138 
139 //- Set of units
140 const dimensionSets& writeUnitSet();
141 
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #endif
150 
151 // ************************************************************************* //
Foam::dimPressure
const dimensionSet dimPressure
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::dimGasConstant
const dimensionSet dimGasConstant
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
Foam::dimVelocity
const dimensionSet dimVelocity
Foam::dimEnergy
const dimensionSet dimEnergy
Foam::dimDensity
const dimensionSet dimDensity
Foam::dimensionSets::valid
bool valid() const noexcept
Is there a valid inverse of the selected unit.
Definition: dimensionSets.H:120
Foam::dimMoles
const dimensionSet dimMoles(0, 0, 0, 0, 1, 0, 0)
Definition: dimensionSets.H:55
Foam::dimensionSet
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:108
Foam::unitSet
const HashTable< dimensionedScalar > & unitSet()
Set of all dimensions.
Definition: dimensionSets.C:111
Foam::dimForce
const dimensionSet dimForce
dimensionedScalarFwd.H
Foam::dimCompressibility
const dimensionSet dimCompressibility
Foam::dimCurrent
const dimensionSet dimCurrent(0, 0, 0, 0, 0, 1, 0)
Definition: dimensionSets.H:56
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::dimArea
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:59
Foam::dimensionSets::units
const PtrList< dimensionedScalar > & units() const noexcept
Return the units.
Definition: dimensionSets.H:114
Foam::Field< scalar >
Foam::writeUnitSet
const dimensionSets & writeUnitSet()
Set of units.
Definition: dimensionSets.C:179
Foam::dimensionSystems
dictionary & dimensionSystems()
Top level dictionary.
Definition: dimensionSets.C:93
Foam::dimSpecificHeatCapacity
const dimensionSet dimSpecificHeatCapacity(dimGasConstant)
Definition: dimensionSets.H:76
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::dimensionSets::coefficients
void coefficients(scalarField &exponents) const
(if valid) obtain set of coefficients of unitNames
Definition: dimensionSets.C:270
Foam::dimPower
const dimensionSet dimPower
Foam::dimViscosity
const dimensionSet dimViscosity
Foam::dimDynamicViscosity
const dimensionSet dimDynamicViscosity
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Foam::dimensionSets::dimensionSets
dimensionSets(const HashTable< dimensionedScalar > &, const wordList &unitNames)
Definition: dimensionSets.C:227
Foam::dimAcceleration
const dimensionSet dimAcceleration
Foam::HashTable
A HashTable similar to std::unordered_map.
Definition: HashTable.H:105
Foam::SquareMatrix< scalar >
Foam::List< label >
Foam::dimTemperature
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:54
PtrList.H
Foam::dimLuminousIntensity
const dimensionSet dimLuminousIntensity(0, 0, 0, 0, 0, 0, 1)
Definition: dimensionSets.H:57
scalarMatrices.H
Foam::dimVol
const dimensionSet dimVol(dimVolume)
Older spelling for dimVolume.
Definition: dimensionSets.H:64
Foam::dimVolume
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:60
Foam::dimensionSets
Construction of unit sets.
Definition: dimensionSets.H:82
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189