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 -------------------------------------------------------------------------------
11 License
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 
27 Note
28  Included by global/globals.C
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "dimensionedConstants.H"
33 
34 // * * * * * * * * * * * * * * * File Static Data * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
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 {
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 // ************************************************************************* //
dictionary dict
dictionary & switchSet(const char *subDictName, dictionary *&subDictPtr)
Internal function to lookup a sub-dictionary from controlDict.
Definition: debug.C:179
Dictionary reading and supplying the dimensioned constants used within OpenFOAM, particularly for the...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
dictionary & dimensionedConstants()
constexpr const char *const group
Group name for atomic constants.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensionedScalar dimensionedConstant(const word &group, const word &varName)
dictionary * dimensionedConstantsPtr_(nullptr)
Namespace for OpenFOAM.