The open source CFD toolbox
dimensionedConstants.C
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-2016 OpenFOAM Foundation
9 Copyright (C) 2018 OpenCFD Ltd.
10-------------------------------------------------------------------------------
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
30
31// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32
33namespace Foam
34{
36}
37
38
39// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40
42{
43 return debug::switchSet
44 (
45 "DimensionedConstants",
47 );
48}
49
50
52(
53 const word& group,
54 const word& varName
55)
56{
58
59 // Check that the entries exist.
60 // Note: should make FatalError robust instead!
61
62 if (!dict.found("unitSet"))
63 {
64 std::cerr
65 << "Cannot find unitSet in dictionary " << dict.name()
66 << std::endl;
67 }
68
69 const word unitSetCoeffs(dict.get<word>("unitSet") + "Coeffs");
70
71 const dictionary* unitDictPtr = dict.findDict(unitSetCoeffs);
72
73 if (!unitDictPtr)
74 {
75 std::cerr
76 << "Cannot find " << unitSetCoeffs << " in dictionary "
77 << dict.name() << std::endl;
78 }
79
80 return dimensionedScalar(varName, unitDictPtr->subDict(group));
81}
82
83
84// ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:460
A class for handling words, derived from Foam::string.
Definition: word.H:68
Dictionary reading and supplying the dimensioned constants used within OpenFOAM, particularly for the...
Namespace for OpenFOAM.
dictionary * dimensionedConstantsPtr_(nullptr)
dimensionedScalar dimensionedConstant(const word &group, const word &varName)
dictionary & dimensionedConstants()
dictionary dict