pFlowToVTK now manages when Ctrl+C is used by user

This commit is contained in:
HRN 2025-02-06 10:51:13 +03:30
parent 63bd9c9993
commit edb02ecfc7
1 changed files with 18 additions and 2 deletions

View File

@ -17,6 +17,7 @@ Licence:
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include <csignal>
#include "vocabs.hpp"
#include "systemControl.hpp"
@ -31,9 +32,23 @@ Licence:
//#include "readControlDict.hpp"
bool bindaryOutput__;
static pFlow::uniquePtr<pFlow::PFtoVTK::fileSeries> timeSeriesPtr=nullptr;
void signal_handler(int signal)
{
if(signal == SIGINT)
{
pFlow::output<<"\nPressing Ctrl+C ....\n";
timeSeriesPtr.reset(nullptr);
fatalExit;
}
}
int main(int argc, char** argv )
{
std::signal(SIGINT, signal_handler);
pFlow::word outFolder = (pFlow::CWD()/pFlow::word("VTK")).wordPath();
pFlow::commandLine cmds(
@ -127,7 +142,8 @@ int main(int argc, char** argv )
{
pFlow::PFtoVTK::fileSeries timeSeries{pFlow::fileSystem(outFolder)};
timeSeriesPtr = pFlow::makeUnique<pFlow::PFtoVTK::fileSeries>(pFlow::fileSystem(outFolder));
auto& timeSeries = timeSeriesPtr();
pFlow::word fileName;
pFlow::wordList geomFileNames;
pFlow::wordList surfNames;