foamVersion.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) 2017-2019 OpenCFD Ltd.
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 Namespace
27  Foam::foamVersion
28 
29 Description
30  Namespace for OpenFOAM version information
31 
32 Note
33  Compile-time version information is conveyed by the \b OPENFOAM define
34  provided in the wmake rules "General/general".
35  The foamVersion.H file is located directly in the src/OpenFOAM/include
36  directory for easier use by external packages and to allow easier
37  modification during packaging.
38 
39 SourceFiles
40  foamVersion.C
41  global.Cver
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef foamVersion_H
46 #define foamVersion_H
47 
48 #include "stdFoam.H"
49 #include <string>
50 
51 //- The directory name for user-resources within the HOME directory
52 //
53 // Default: ".OpenFOAM"
54 // Used by foamEtcFiles(), stringOps::expand(), Foam::JobInfo
55 #define FOAM_RESOURCE_USER_CONFIG_DIRNAME ".OpenFOAM"
56 
57 //- The env name for site-resources to obtain a site-resources directory.
58 //
59 // Default: "WM_PROJECT_SITE"
60 // Used by foamEtcFiles() and stringOps::expand()
61 #define FOAM_RESOURCE_SITE_ENVNAME "WM_PROJECT_SITE"
62 
63 //- The env name for determining a fallback directory name for site-resources
64 //- when the directory corresponding to FOAM_RESOURCE_SITE_ENVNAME is empty.
65 // The fallback search appends "/site" to the directory.
66 //
67 // Default: "WM_PROJECT_DIR"
68 // Used by foamEtcFiles() and stringOps::expand()
69 #define FOAM_RESOURCE_SITE_FALLBACK_ENVNAME "WM_PROJECT_DIR"
70 
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 namespace Foam
75 {
76  //- Version information
77  namespace foamVersion
78  {
79  //- OpenFOAM api number (integer) corresponding to the value of OPENFOAM
80  //- at the time of compilation.
81  // The value is 0 if OPENFOAM was not defined.
82  extern const int api;
83 
84  //- OpenFOAM patch number as a std::string
85  extern const std::string patch;
86 
87  //- OpenFOAM build information as a std::string
88  extern const std::string build;
89 
90  //- OpenFOAM build architecture information
91  //- (machine endian, label/scalar sizes) as a std::string
92  extern const std::string buildArch;
93 
94  //- OpenFOAM version (name or stringified number) as a std::string
95  extern const std::string version;
96 
97  //- Test if the patch string appears to be in use,
98  //- which is when it is defined (non-zero).
99  bool patched();
100 
101  //- Extract label size (in bytes) from "label=" tag in string
102  unsigned labelByteSize(const std::string& str);
103 
104  //- Extract scalar size (in bytes) from "scalar=" tag in string
105  unsigned scalarByteSize(const std::string& str);
106 
107  //- Print information about version, build, arch to Info
108  //
109  // Eg,
110  // \code
111  // Using: OpenFOAM-<VER> (API) - visit www.openfoam.com
112  // Build: <BUILD> (patch=...)
113  // Arch: <ARCH_INFO>
114  // \endcode
115  //
116  // \param full includes Arch information
117  void printBuildInfo(const bool full=true);
118  }
119 }
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 // Compatibility names (1806 and earlier).
125 // Historically assumed to be called within the Foam namespace, they are
126 // thus defined without the Foam namespace qualifier.
127 //
128 // - FOAMversion: c-string
129 // - FOAMbuild: c-string
130 // - FOAMbuildArch: std::string
131 
132 #define FOAMversion foamVersion::version.c_str()
133 #define FOAMbuild foamVersion::build.c_str()
134 #define FOAMbuildArch foamVersion::buildArch
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
Foam::foamVersion::build
const std::string build
OpenFOAM build information as a std::string.
FOAM_RESOURCE_SITE_FALLBACK_ENVNAME
#define FOAM_RESOURCE_SITE_FALLBACK_ENVNAME
Definition: foamVersion.H:69
FOAM_RESOURCE_SITE_ENVNAME
#define FOAM_RESOURCE_SITE_ENVNAME
The env name for site-resources to obtain a site-resources directory.
Definition: foamVersion.H:61
Foam::foamVersion::api
const int api
FOAM_RESOURCE_USER_CONFIG_DIRNAME
#define FOAM_RESOURCE_USER_CONFIG_DIRNAME
The directory name for user-resources within the HOME directory.
Definition: foamVersion.H:55
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::foamVersion::version
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
Foam::foamVersion::patched
bool patched()
Definition: foamVersion.C:35
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::foamVersion::labelByteSize
unsigned labelByteSize(const std::string &str)
Extract label size (in bytes) from "label=" tag in string.
stdFoam.H
Foam::foamVersion::buildArch
const std::string buildArch
Foam::foamVersion::printBuildInfo
void printBuildInfo(const bool full=true)
Print information about version, build, arch to Info.
Definition: foamVersion.C:46
Foam::foamVersion::scalarByteSize
unsigned scalarByteSize(const std::string &str)
Extract scalar size (in bytes) from "scalar=" tag in string.