Merge pull request #158 from PhasicFlow/develop

pFlowToVTK now manages when Ctrl+C is used by user
This commit is contained in:
PhasicFlow 2025-02-06 11:05:21 +03:30 committed by GitHub
commit f84484881c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
#include <csignal>
#include "vocabs.hpp" #include "vocabs.hpp"
#include "systemControl.hpp" #include "systemControl.hpp"
@ -31,9 +32,23 @@ Licence:
//#include "readControlDict.hpp" //#include "readControlDict.hpp"
bool bindaryOutput__; 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 ) int main(int argc, char** argv )
{ {
std::signal(SIGINT, signal_handler);
pFlow::word outFolder = (pFlow::CWD()/pFlow::word("VTK")).wordPath(); pFlow::word outFolder = (pFlow::CWD()/pFlow::word("VTK")).wordPath();
pFlow::commandLine cmds( pFlow::commandLine cmds(
@ -126,8 +141,9 @@ 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::word fileName;
pFlow::wordList geomFileNames; pFlow::wordList geomFileNames;
pFlow::wordList surfNames; pFlow::wordList surfNames;