sigStopAtWriteNow.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2016-2019 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 Class
28  Foam::sigStopAtWriteNow
29 
30 Description
31  Signal handler to write and stop the job.
32  The interrupt is defined by OptimisationSwitches::stopAtWriteNowSignal
33 
34 SourceFiles
35  sigStopAtWriteNow.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef sigStopAtWriteNow_H
40 #define sigStopAtWriteNow_H
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward Declarations
48 class Time;
49 
50 /*---------------------------------------------------------------------------*\
51  Class sigStopAtWriteNow Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 {
56  // Private Data
57 
58  //- Signal number to use
59  static int signal_;
60 
61 
62  // Private Member Functions
63 
64  //- Handler for caught signals
65  static void sigHandler(int);
66 
67 
68 public:
69 
70  //- Allow setter access to signal_
71  friend class addstopAtWriteNowSignalToOpt;
72 
73 
74  // Constructors
75 
76  //- Construct null
78 
79  //- Construct from components
80  sigStopAtWriteNow(const Time& runTime, bool verbose=false);
81 
82 
83  //- Destructor
85 
86 
87  // Member Functions
88 
89  //- Is active?
90  static bool active();
91 
92  //- Signal number being used
93  static int signalNumber();
94 
95  //- Set/reset signal handler
96  static void set(bool verbose=false);
97 };
98 
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 } // End namespace Foam
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 #endif
107 
108 // ************************************************************************* //
Foam::sigStopAtWriteNow::set
static void set(bool verbose=false)
Set/reset signal handler.
Definition: sigStopAtWriteNow.C:150
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::sigStopAtWriteNow::active
static bool active()
Is active?
Definition: sigStopAtWriteNow.C:138
Foam::sigStopAtWriteNow
Signal handler to write and stop the job. The interrupt is defined by OptimisationSwitches::stopAtWri...
Definition: sigStopAtWriteNow.H:53
Foam::sigStopAtWriteNow::~sigStopAtWriteNow
~sigStopAtWriteNow()
Destructor.
Definition: sigStopAtWriteNow.C:125
Foam::addstopAtWriteNowSignalToOpt
Definition: sigStopAtWriteNow.C:57
Foam::sigStopAtWriteNow::sigStopAtWriteNow
sigStopAtWriteNow()
Construct null.
Definition: sigStopAtWriteNow.C:112
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::sigStopAtWriteNow::signalNumber
static int signalNumber()
Signal number being used.
Definition: sigStopAtWriteNow.C:144