1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "dimensionedConstants.H"
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 dictionary* dimensionedConstantsPtr_(NULL);
37 dictionary& dimensionedConstants()
39 return debug::switchSet
41 "DimensionedConstants",
42 dimensionedConstantsPtr_
47 dimensionedScalar dimensionedConstant
53 dictionary& dict = dimensionedConstants();
55 // Check that the entries exist.
56 // Note: should make FatalError robust instead!
58 if (!dict.found("unitSet"))
60 std::cerr<< "Cannot find unitSet in dictionary " << dict.name()
64 const word unitSetCoeffs(word(dict.lookup("unitSet")) + "Coeffs");
66 if (!dict.found(unitSetCoeffs))
68 std::cerr<< "Cannot find " << unitSetCoeffs << " in dictionary "
69 << dict.name() << std::endl;
72 dictionary& unitDict = dict.subDict(unitSetCoeffs);
74 dictionary& groupDict = unitDict.subDict(group);
76 return dimensionedScalar(groupDict.lookup(varName));
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 } // End namespace Foam
84 // ************************************************************************* //