Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
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
27Note
28 Included by global/globals.C
29
30\*---------------------------------------------------------------------------*/
33
34// * * * * * * * * * * * * * * * File Static Data * * * * * * * * * * * * * //
35
36namespace Foam
39}
40
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
45{
46 return debug::switchSet
47 (
48 "DimensionedConstants",
50 );
51}
52
53
55(
56 const word& group,
57 const word& varName
58)
59{
60 dictionary& dict = dimensionedConstants();
61
62 // Check that the entries exist.
63 // Note: should make FatalError robust instead!
64
65 if (!dict.found("unitSet"))
66 {
67 std::cerr
68 << "Cannot find unitSet in dictionary " << dict.name()
69 << std::endl;
70 }
71
72 const word unitSetCoeffs(dict.get<word>("unitSet") + "Coeffs");
73
74 const dictionary* unitDictPtr = dict.findDict(unitSetCoeffs);
75
76 if (!unitDictPtr)
77 {
78 std::cerr
79 << "Cannot find " << unitSetCoeffs << " in dictionary "
80 << dict.name() << std::endl;
81 }
82
83 return dimensionedScalar(varName, unitDictPtr->subDict(group));
84}
85
86
87// ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition dictionary.C:441
A class for handling words, derived from Foam::string.
Definition word.H:66
Dictionary reading and supplying the dimensioned constants used within OpenFOAM, particularly for the...
dictionary & switchSet(const char *subDictName, dictionary *&subDictPtr)
Internal function to lookup a sub-dictionary from controlDict.
Definition debug.C:179
Namespace for OpenFOAM.
dictionary * dimensionedConstantsPtr_(nullptr)
dimensionedScalar dimensionedConstant(const word &group, const word &varName)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dictionary & dimensionedConstants()
dictionary dict