22170: [CEA 704] Redirect NETGEN outup in a log file
redirect cout-output to the file as well
This commit is contained in:
parent
d3f5a4cc76
commit
f5389785da
@ -3592,13 +3592,17 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
|
|||||||
{
|
{
|
||||||
Ng_Init();
|
Ng_Init();
|
||||||
|
|
||||||
|
// redirect all netgen output (mycout,myerr,cout) to _outputFileName
|
||||||
_isComputeOk = false;
|
_isComputeOk = false;
|
||||||
_outputFileName = getOutputFileName();
|
_outputFileName = getOutputFileName();
|
||||||
netgen::mycout = new ofstream ( _outputFileName.c_str() );
|
netgen::mycout = new ofstream ( _outputFileName.c_str() );
|
||||||
netgen::myerr = netgen::mycout;
|
netgen::myerr = netgen::mycout;
|
||||||
|
_coutBuffer = std::cout.rdbuf();
|
||||||
#ifdef _DEBUG_
|
#ifdef _DEBUG_
|
||||||
cout << "NOTE: netgen output is redirected to file " << _outputFileName << endl;
|
cout << "NOTE: netgen output is redirected to file " << _outputFileName << endl;
|
||||||
#endif
|
#endif
|
||||||
|
std::cout.rdbuf( netgen::mycout->rdbuf() );
|
||||||
|
|
||||||
_ngMesh = Ng_NewMesh();
|
_ngMesh = Ng_NewMesh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3613,6 +3617,7 @@ NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
|
|||||||
Ng_DeleteMesh( _ngMesh );
|
Ng_DeleteMesh( _ngMesh );
|
||||||
Ng_Exit();
|
Ng_Exit();
|
||||||
NETGENPlugin_Mesher::RemoveTmpFiles();
|
NETGENPlugin_Mesher::RemoveTmpFiles();
|
||||||
|
std::cout.rdbuf( _coutBuffer );
|
||||||
#ifdef _DEBUG_
|
#ifdef _DEBUG_
|
||||||
if( _isComputeOk )
|
if( _isComputeOk )
|
||||||
#endif
|
#endif
|
||||||
|
@ -91,6 +91,8 @@ struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
|
|||||||
std::string getOutputFileName();
|
std::string getOutputFileName();
|
||||||
void removeOutputFile();
|
void removeOutputFile();
|
||||||
std::string _outputFileName;
|
std::string _outputFileName;
|
||||||
|
|
||||||
|
std::streambuf* _coutBuffer; // to re-/store cout.rdbuf()
|
||||||
};
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user