Adding control of netgen log file
This commit is contained in:
parent
61e4da3b0d
commit
3d82214289
@ -4437,18 +4437,7 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper():
|
|||||||
_ngcerr = NULL;
|
_ngcerr = NULL;
|
||||||
if ( !getenv( "KEEP_NETGEN_OUTPUT" ))
|
if ( !getenv( "KEEP_NETGEN_OUTPUT" ))
|
||||||
{
|
{
|
||||||
// redirect all netgen output (mycout,myerr,cout) to _outputFileName
|
setOutputFile(getOutputFileName());
|
||||||
_outputFileName = getOutputFileName();
|
|
||||||
_ngcout = netgen::mycout;
|
|
||||||
_ngcerr = netgen::myerr;
|
|
||||||
netgen::mycout = new ofstream ( _outputFileName.c_str() );
|
|
||||||
netgen::myerr = netgen::mycout;
|
|
||||||
_coutBuffer = std::cout.rdbuf();
|
|
||||||
#ifdef _DEBUG_
|
|
||||||
std::cout << "NOTE: netgen output is redirected to file " << _outputFileName << std::endl;
|
|
||||||
#else
|
|
||||||
std::cout.rdbuf( netgen::mycout->rdbuf() );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setMesh( Ng_NewMesh() );
|
setMesh( Ng_NewMesh() );
|
||||||
@ -4569,6 +4558,27 @@ std::string NETGENPlugin_NetgenLibWrapper::getOutputFileName()
|
|||||||
|
|
||||||
return aGenericName.ToCString();
|
return aGenericName.ToCString();
|
||||||
}
|
}
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Set output file name for netgen log
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void NETGENPlugin_NetgenLibWrapper::setOutputFile(std::string outputfile)
|
||||||
|
{
|
||||||
|
// redirect all netgen output (mycout,myerr,cout) to _outputFileName
|
||||||
|
_outputFileName = outputfile;
|
||||||
|
_ngcout = netgen::mycout;
|
||||||
|
_ngcerr = netgen::myerr;
|
||||||
|
netgen::mycout = new ofstream ( _outputFileName.c_str() );
|
||||||
|
netgen::myerr = netgen::mycout;
|
||||||
|
_coutBuffer = std::cout.rdbuf();
|
||||||
|
#ifdef _DEBUG_
|
||||||
|
std::cout << "NOTE: netgen output is redirected to file " << _outputFileName << std::endl;
|
||||||
|
#else
|
||||||
|
std::cout.rdbuf( netgen::mycout->rdbuf() );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
|
@ -105,6 +105,7 @@ struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
|
|||||||
|
|
||||||
static void RemoveTmpFiles();
|
static void RemoveTmpFiles();
|
||||||
static int& instanceCounter();
|
static int& instanceCounter();
|
||||||
|
void setOutputFile(std::string);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string getOutputFileName();
|
std::string getOutputFileName();
|
||||||
|
@ -202,6 +202,11 @@ bool NETGENPlugin_NETGEN_3D_SA::Compute(TopoDS_Shape &aShape, SMESH_Mesh& aMesh,
|
|||||||
int endWith = netgen::MESHCONST_OPTVOLUME;
|
int endWith = netgen::MESHCONST_OPTVOLUME;
|
||||||
int Netgen_NbOfNodes=0;
|
int Netgen_NbOfNodes=0;
|
||||||
|
|
||||||
|
// Changing netgen log_file putting it next to new_element_file
|
||||||
|
fs::path netgen_log_file = fs::path(new_element_file).remove_filename() / fs::path("NETGEN.out");
|
||||||
|
|
||||||
|
ngLib.setOutputFile(netgen_log_file.string());
|
||||||
|
|
||||||
NETGENPlugin_NETGEN_3D::computeFillNgMesh(aMesh, aShape, nodeVec, ngLib, helper, Netgen_NbOfNodes);
|
NETGENPlugin_NETGEN_3D::computeFillNgMesh(aMesh, aShape, nodeVec, ngLib, helper, Netgen_NbOfNodes);
|
||||||
|
|
||||||
netgen::OCCGeometry occgeo;
|
netgen::OCCGeometry occgeo;
|
||||||
|
Loading…
Reference in New Issue
Block a user