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-------------------------------------------------------------------------------
10License
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
26Global
27 dimensionSets
28
29Description
30 Useful dimension sets
31
32SourceFiles
33 dimensionSets.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef dimensionSets_H
38#define dimensionSets_H
39
40#include "scalarMatrices.H"
42#include "PtrList.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51//- Dimensionless
52extern const dimensionSet dimless;
54extern const dimensionSet dimMass;
56extern const dimensionSet dimTime;
58extern const dimensionSet dimMoles;
61
62extern const dimensionSet dimArea;
63extern const dimensionSet dimVolume;
65//- Older spelling for dimVolume
66// \deprecated(2019-01) use dimVolume instead
67extern const dimensionSet dimVol;
68
69extern const dimensionSet dimDensity;
70extern const dimensionSet dimForce;
71extern const dimensionSet dimEnergy;
72extern const dimensionSet dimPower;
73
74extern const dimensionSet dimVelocity;
75extern const dimensionSet dimAcceleration;
78extern const dimensionSet dimGasConstant;
80extern const dimensionSet dimViscosity;
83
84//- Construction of unit sets
85class 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
101public:
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
118 {
119 return units_;
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
134dictionary& dimensionSystems();
135
136//- Set of all dimensions
137const HashTable<dimensionedScalar>& unitSet();
138
139//- Set of units
140const dimensionSets& writeUnitSet();
141
142
143// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144
145} // End namespace Foam
146
147// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148
149#endif
150
151// ************************************************************************* //
A HashTable similar to std::unordered_map.
Definition: HashTable.H:123
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:109
Construction of unit sets.
Definition: dimensionSets.H:83
const PtrList< dimensionedScalar > & units() const noexcept
Return the units.
void coefficients(scalarField &exponents) const
(if valid) obtain set of coefficients of unitNames
bool valid() const noexcept
Is there a valid inverse of the selected unit.
Namespace for OpenFOAM.
const dimensionSet dimPressure
const dimensionSet dimViscosity
const dimensionSet dimPower
const dimensionSet dimless
Dimensionless.
const dimensionSet dimCompressibility
const dimensionSet dimEnergy
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
const dimensionSet dimCurrent(0, 0, 0, 0, 0, 1, 0)
Definition: dimensionSets.H:56
const dimensionSet dimMoles(0, 0, 0, 0, 1, 0, 0)
Definition: dimensionSets.H:55
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:59
const dimensionSet dimVelocity
const dimensionSet dimGasConstant
dictionary & dimensionSystems()
Top level dictionary.
Definition: dimensionSets.C:93
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const dimensionSet dimSpecificHeatCapacity(dimGasConstant)
Definition: dimensionSets.H:76
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:54
const HashTable< dimensionedScalar > & unitSet()
Set of all dimensions.
const dimensionSet dimForce
const dimensionSets & writeUnitSet()
Set of units.
const dimensionSet dimDynamicViscosity
const direction noexcept
Definition: Scalar.H:223
const dimensionSet dimAcceleration
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:60
const dimensionSet dimDensity
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:51
const dimensionSet dimVol(dimVolume)
Older spelling for dimVolume.
Definition: dimensionSets.H:64
const dimensionSet dimLuminousIntensity(0, 0, 0, 0, 0, 0, 1)
Definition: dimensionSets.H:57