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/>.
25 Foam::abortCalculation
28 Watches for presence of the named file in the $FOAM_CASE directory
29 and aborts the calculation if it is present.
31 Currently the following action types are supported:
40 \*---------------------------------------------------------------------------*/
42 #ifndef abortCalculation_H
43 #define abortCalculation_H
45 #include "pointFieldFwd.H"
46 #include "NamedEnum.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 // Forward declaration of classes
58 /*---------------------------------------------------------------------------*\
59 Class abortCalculation Declaration
60 \*---------------------------------------------------------------------------*/
62 class abortCalculation
68 //- Enumeration defining the type of action
71 noWriteNow, /*!< stop immediately without writing data */
72 writeNow, /*!< write data and stop immediately */
73 nextWrite /*!< stop the next time data are written */
80 //- Name of the abort file unless otherwise specified
83 const objectRegistry& obr_;
85 //- The fully-qualified name of the abort file
89 static const NamedEnum<actionType, 3> actionTypeNames_;
91 //- The type of action
95 // Private Member Functions
97 //- Remove abort file.
98 void removeFile() const;
100 //- Disallow default bitwise copy construct
101 abortCalculation(const abortCalculation&);
103 //- Disallow default bitwise assignment
104 void operator=(const abortCalculation&);
109 //- Runtime type information
115 //- Construct for given objectRegistry and dictionary.
119 const objectRegistry&,
121 const bool loadFromFilesUnused = false
126 virtual ~abortCalculation();
131 //- Return name of the abort file
132 virtual const word& name() const
137 //- Read the dictionary settings
138 virtual void read(const dictionary&);
140 //- Execute, check existence of abort file and take action
141 virtual void execute();
143 //- Execute at the final time-loop, used for cleanup
146 //- Execute, check existence of abort file and take action
147 virtual void write();
149 //- Update for changes of mesh - does nothing
150 virtual void updateMesh(const mapPolyMesh&)
153 //- Update for changes of mesh - does nothing
154 virtual void movePoints(const pointField&)
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 } // End namespace Foam
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 // ************************************************************************* //