From c5e023e735b1fbc77ff16e56b6b71311aeb6cc74 Mon Sep 17 00:00:00 2001 From: akl Date: Mon, 3 Jun 2013 10:48:54 +0000 Subject: [PATCH] Correction of implementation of 0022170 ([CEA 704] Redirect NETGEN outup in a log file) to avoid patching of "netgen" product. --- src/NETGENPlugin/NETGENPlugin_Mesher.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index 63f6c3c..b71aa80 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -3468,8 +3468,10 @@ SMESH_Mesh& NETGENPlugin_Internals::getMesh() const NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper() { + Ng_Init(); myOutputFile = getOutputFileName(); - Ng_Init( myOutputFile.c_str() ); + netgen::mycout = new ofstream ( myOutputFile.c_str() ); + cout << "NOTE: netgen output was redirected to file " << myOutputFile << endl; _ngMesh = Ng_NewMesh(); } @@ -3534,6 +3536,11 @@ void NETGENPlugin_NetgenLibWrapper::RemoveOutputFile() aFiles->length(1); std::string aFileName = SALOMEDS_Tool::GetNameFromPath( myOutputFile ) + ".out"; aFiles[0] = aFileName.c_str(); + if ( netgen::mycout) + { + delete netgen::mycout; + netgen::mycout = 0; + } SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.c_str(), aFiles.in(), true ); }