38 int sigStopAtWriteNow::signal_
60 sigStopAtWriteNow::signal_ =
readLabel(is);
66 os << sigStopAtWriteNow::signal_;
72 "stopAtWriteNowSignal" 78 Foam::Time const* Foam::sigStopAtWriteNow::runTimePtr_ =
nullptr;
79 struct sigaction Foam::sigStopAtWriteNow::oldAction_;
84 void Foam::sigStopAtWriteNow::sigHandler(int)
87 if (sigaction(signal_, &oldAction_,
nullptr) < 0)
90 <<
"Cannot reset " << signal_ <<
" trapping" 97 Info<<
"sigStopAtWriteNow :" 98 <<
" setting up write and stop at end of the next iteration" 132 if (sigaction(signal_, &oldAction_,
nullptr) < 0)
135 <<
"Cannot reset " << signal_ <<
" trapping" 149 if (sigWriteNow::signal_ == signal_)
152 <<
"stopAtWriteNowSignal : " << signal_
153 <<
" cannot be the same as the writeNowSignal." 154 <<
" Please change this in the etc/controlDict." 159 struct sigaction newAction;
160 newAction.sa_handler = sigHandler;
161 newAction.sa_flags = SA_NODEFER;
162 sigemptyset(&newAction.sa_mask);
163 if (sigaction(signal_, &newAction, &oldAction_) < 0)
166 <<
"Cannot set " << signal_ <<
" trapping" 172 Info<<
"sigStopAtWriteNow :" 173 <<
" 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.