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 Foam_dimensionSets_H
38 #define Foam_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;
76 extern const dimensionSet dimPressure;
78 extern const dimensionSet dimGasConstant;
80 extern const dimensionSet dimViscosity;
82 
83 
84 /*---------------------------------------------------------------------------*\
85  Class dimensionSets Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 //- Construction of unit sets
90 {
91  // Private Data
92 
93  //- Set of dimensions
95 
96  //- LU decomposition of dimensions
97  scalarSquareMatrix conversion_;
98 
99  //- See above
100  labelList conversionPivots_;
101 
102  //- Is LU decomposition valid
103  bool valid_;
104 
105 public:
106 
107  // Constructors
108 
109  //- Construct from all units and set of units to use
110  //- for inversion (writing)
112  (
114  const wordList& unitNames
115  );
116 
117 
118  // Member Functions
119 
120  //- Return the units
122  {
123  return units_;
124  }
125 
126  //- Is there a valid inverse of the selected unit
127  bool good() const noexcept { return valid_; }
128 
129  //- Is there a valid inverse of the selected unit
130  bool valid() const noexcept { return valid_; }
131 
132  //- (if valid) obtain set of coefficients of unitNames
133  void coefficients(scalarField& exponents) const;
134 };
135 
136 
137 //- Top level dictionary
139 
140 //- Set of all dimensions
142 
143 //- Set of units
144 const dimensionSets& writeUnitSet();
145 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #endif
154 
155 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const dimensionSet dimViscosity
const dimensionSet dimSpecificHeatCapacity(dimGasConstant)
Definition: dimensionSets.H:77
void coefficients(scalarField &exponents) const
(if valid) obtain set of coefficients of unitNames
const dimensionSet dimVol(dimVolume)
Older spelling for dimVolume.
Definition: dimensionSets.H:65
const dimensionSet dimless
Dimensionless.
const dimensionSet dimDynamicViscosity
dimensionSets(const HashTable< dimensionedScalar > &, const wordList &unitNames)
Construct from all units and set of units to use for inversion (writing)
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:58
const dimensionSet dimAcceleration
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:105
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:52
const HashTable< dimensionedScalar > & unitSet()
Set of all dimensions.
A HashTable similar to std::unordered_map.
Definition: HashTable.H:108
const dimensionSet dimPressure
const dimensionSet dimPower
const direction noexcept
Definition: Scalar.H:258
const dimensionSet dimForce
const dimensionSet dimMoles(0, 0, 0, 0, 1, 0, 0)
Definition: dimensionSets.H:53
const dimensionSet dimEnergy
const dimensionSet dimDensity
dictionary & dimensionSystems()
Top level dictionary.
Definition: dimensionSets.C:86
const PtrList< dimensionedScalar > & units() const noexcept
Return the units.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
const dimensionSet dimCurrent(0, 0, 0, 0, 0, 1, 0)
Definition: dimensionSets.H:54
const dimensionSet dimGasConstant
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
const dimensionSet dimLuminousIntensity(0, 0, 0, 0, 0, 0, 1)
Definition: dimensionSets.H:55
const dimensionSets & writeUnitSet()
Set of units.
bool valid() const noexcept
Is there a valid inverse of the selected unit.
const dimensionSet dimCompressibility
bool good() const noexcept
Is there a valid inverse of the selected unit.
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:57
Namespace for OpenFOAM.
const dimensionSet dimVelocity
Construction of unit sets.
Definition: dimensionSets.H:89