OpenFOAM: API Guide
v2112
The open source CFD toolbox
globals.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 OpenFOAM Foundation
9
Copyright (C) 2018-2020 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
Description
28
Define the globals used in the OpenFOAM library.
29
It is important that these are constructed in the appropriate order to
30
avoid the use of unconstructed data in the global namespace.
31
32
\*---------------------------------------------------------------------------*/
33
34
#include <new>
35
#include <iostream>
36
#include <cstdlib>
37
38
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39
// Setup an error handler for the global new operator
40
41
namespace
Foam
42
{
43
44
void
newError
()
45
{
46
std::cerr<<
47
"new cannot satisfy memory request.\n"
48
"This does not necessarily mean you have run out of virtual memory.\n"
49
"It could be due to a stack violation caused "
50
"by e.g. bad use of pointers or an out-of-date shared library"
51
<<
std::endl
;
52
53
std::abort
();
54
}
55
56
void (*
old_new_handler
)() = std::set_new_handler(
newError
);
57
58
}
// End namespace Foam
59
60
61
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62
// The nullObject singleton and a dummy zero singleton
63
64
#include "
nullObject.C
"
65
#include "
zero.C
"
66
67
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68
// Global IO streams
69
70
#include "
IOstreams.C
"
71
72
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73
74
#include "
JobInfo.H
"
75
bool
Foam::JobInfo::constructed
(
false
);
76
77
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78
// Global error definitions (initialised by construction)
79
80
#include "
messageStream.C
"
81
#include "
error.C
"
82
#include "
IOerror.C
"
83
#include "
token.C
"
84
85
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86
// Read the debug and info switches
87
88
#include "
debug.C
"
89
90
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91
// Read file modification checking switches
92
93
#include "
regIOobject.C
"
94
95
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96
// Read parallel communication switches
97
98
#include "UPstream.C"
99
100
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101
// Read constants
102
103
#include "
constants.C
"
104
#include "
dimensionedConstants.C
"
105
106
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107
// Create the jobInfo file in the $FOAM_JOB_DIR/runningJobs directory
108
109
#include "
JobInfo.C
"
110
111
// ************************************************************************* //
IOerror.C
error.C
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition:
Ostream.H:369
constants.C
messageStream.C
token.C
IOstreams.C
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:33
zero.C
Foam::abort
errorManip< error > abort(error &err)
Definition:
errorManip.H:144
regIOobject.C
Foam::newError
void newError()
Definition:
globals.C:44
debug.C
Class for handling debugging switches.
Foam::JobInfo::constructed
static bool constructed
Global value for constructed job info.
Definition:
JobInfo.H:101
nullObject.C
JobInfo.H
Foam::old_new_handler
void(* old_new_handler)()
Definition:
globals.C:56
dimensionedConstants.C
JobInfo.C
src
OpenFOAM
global
globals.C
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.