38 int sigStopAtWriteNow::signal_
61 sigStopAtWriteNow::signal_ =
readLabel(is);
67 os << sigStopAtWriteNow::signal_;
73 "stopAtWriteNowSignal" 79 Foam::Time const* Foam::sigStopAtWriteNow::runTimePtr_ =
nullptr;
82 struct sigaction Foam::sigStopAtWriteNow::oldAction_;
87 void Foam::sigStopAtWriteNow::sigHandler(int)
90 if (sigaction(signal_, &oldAction_,
nullptr) < 0)
93 <<
"Cannot reset " << signal_ <<
" trapping" 100 Info<<
"sigStopAtWriteNow :" 101 <<
" setting up write and stop at end of the next iteration" 135 if (sigaction(signal_, &oldAction_,
nullptr) < 0)
138 <<
"Cannot reset " << signal_ <<
" trapping" 152 if (sigWriteNow::signal_ == signal_)
155 <<
"stopAtWriteNowSignal : " << signal_
156 <<
" cannot be the same as the writeNowSignal." 157 <<
" Please change this in the etc/controlDict." 162 struct sigaction newAction;
163 newAction.sa_handler = sigHandler;
164 newAction.sa_flags = SA_NODEFER;
165 sigemptyset(&newAction.sa_mask);
166 if (sigaction(signal_, &newAction, &oldAction_) < 0)
169 <<
"Cannot set " << signal_ <<
" trapping" 175 Info<<
"sigStopAtWriteNow :" 176 <<
" Enabling writing and stopping upon signal " << signal_
Abstract base class for registered object with I/O. Used in debug symbol registration.
virtual void readData(Foam::Istream &is)
Read.
~sigStopAtWriteNow()
Destructor.
virtual void writeData(Foam::Ostream &os) const
Write.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
set endTime to stop immediately w/ writing
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Ostream & endl(Ostream &os)
Add newline and flush stream.
int optimisationSwitch(const char *name, const int defaultValue=0)
Lookup optimisation switch or add default value.
bool active() const
Is active?
addstopAtWriteNowSignalToOpt(const char *name)
addstopAtWriteNowSignalToOpt addstopAtWriteNowSignalToOpt_("stopAtWriteNowSignal")
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static void set(const bool verbose)
(re)set signal catcher
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
errorManip< error > abort(error &err)
label readLabel(Istream &is)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual ~addstopAtWriteNowSignalToOpt()
word name(const complex &)
Return a string representation of a complex.
sigStopAtWriteNow()
Construct null.
void addOptimisationObject(const char *name, simpleRegIOobject *obj)
Register optimisation switch read/write object.