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 
38 #ifndef dimensionSets_H
39 #define dimensionSets_H
40 
41 #include "scalarMatrices.H"
42 #include "dimensionedScalarFwd.H"
43 #include "PtrList.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 //- Dimensionless
53 extern const dimensionSet dimless;
54 
55 extern const dimensionSet dimMass;
56 extern const dimensionSet dimLength;
57 extern const dimensionSet dimTime;
59 extern const dimensionSet dimMoles;
60 extern const dimensionSet dimCurrent;
62 
63 extern const dimensionSet dimArea;
64 extern const dimensionSet dimVolume;
65 
66 //- Older spelling for dimVolume
67 // \deprecated(2019-01) use dimVolume instead
68 extern const dimensionSet dimVol;
69 
70 extern const dimensionSet dimDensity;
71 extern const dimensionSet dimForce;
72 extern const dimensionSet dimEnergy;
73 extern const dimensionSet dimPower;
74 
75 extern const dimensionSet dimVelocity;
76 extern const dimensionSet dimAcceleration;
78 extern const dimensionSet dimCompressibility;
79 extern const dimensionSet dimGasConstant;
81 extern const dimensionSet dimViscosity;
83 
84 
85 //- Construction of unit sets
86 class dimensionSets
87 {
88  // Private data
89 
90  //- Set of dimensions
92 
93  //- LU decomposition of dimensions
94  scalarSquareMatrix conversion_;
95 
96  //- See above
97  labelList conversionPivots_;
98 
99  //- Is LU decomposition valid
100  bool valid_;
101 
102 public:
103 
104  // Constructors
105 
106  //- Construct from all units and set of units to use
107  //- for inversion (writing)
109  (
111  const wordList& unitNames
112  );
113 
114  // Member Functions
115 
116  //- Return the units
117  const PtrList<dimensionedScalar>& units() const
118  {
119  return units_;
120  }
121 
122  //- Is there a valid inverse of the selected unit
123  bool valid() const
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::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
Definition: dimensionSets.H:50
Foam::dimGasConstant
const dimensionSet dimGasConstant
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::dimVelocity
const dimensionSet dimVelocity
Foam::dimEnergy
const dimensionSet dimEnergy
Foam::dimDensity
const dimensionSet dimDensity
Foam::dimMoles
const dimensionSet dimMoles(0, 0, 0, 0, 1, 0, 0)
Definition: dimensionSets.H:56
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:65
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:57
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:54
Foam::dimArea
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:60
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:77
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:62
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:52
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::dimensionSets::units
const PtrList< dimensionedScalar > & units() const
Return the units.
Definition: dimensionSets.H:114
Foam::dimTemperature
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:55
PtrList.H
Foam::dimLuminousIntensity
const dimensionSet dimLuminousIntensity(0, 0, 0, 0, 0, 0, 1)
Definition: dimensionSets.H:58
scalarMatrices.H
Foam::dimVol
const dimensionSet dimVol(dimVolume)
Older spelling for dimVolume.
Definition: dimensionSets.H:65
Foam::dimensionSets::valid
bool valid() const
Is there a valid inverse of the selected unit.
Definition: dimensionSets.H:120
Foam::dimVolume
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:61
Foam::dimensionSets
Construction of unit sets.
Definition: dimensionSets.H:83