From 2fa118e3c01f6864d9f6d66c021850e5f6c814b1 Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 18 Jun 2007 06:45:20 +0000 Subject: [PATCH] Restore code lost in revision 1.9.6.5 --- src/GHS3DPlugin_GHS3D.cxx | 54 ++++++++------------------------------- 1 file changed, 11 insertions(+), 43 deletions(-) diff --git a/src/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin_GHS3D.cxx index 2e5ef82..047b5d5 100644 --- a/src/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin_GHS3D.cxx @@ -497,43 +497,6 @@ static bool findLineContaing(const TCollection_AsciiString& theText, return found; } -//================================================================================ -/*! - * \brief Decrease amount of memory GHS3D may use until it can allocate it - * \param nbMB - memory size to adjust - * \param aLogFileName - file for GHS3D output - * \retval bool - false if GHS3D can not run for any reason - */ -//================================================================================ - -static void adjustMemory(int & nbMB, const TCollection_AsciiString & aLogFileName) -{ - // the second call to ghs3d hangs up until C-d RET typed in terminal, - // if SALOME was launched with args, so we check memory allocation ourself - try { - char* buf = new char[ nbMB * 1024 * 1024 ]; - delete [] buf; - } - catch (...) { - nbMB = int( double(nbMB) * 0.75 ); - adjustMemory( nbMB, aLogFileName ); - } -// TCollection_AsciiString cmd( "ghs3d -m " ); -// cmd += nbMB; -// cmd += " 1>"; -// cmd += aLogFileName; - -// system( cmd.ToCString() ); // run - -// // analyse log file -// TCollection_AsciiString foundLine; -// if ( findLineContaing( "UNABLE TO ALLOCATE MEMORY",aLogFileName,foundLine)) -// { -// nbMB = int( double(nbMB) * 0.75 ); -// adjustMemory( nbMB, aLogFileName ); -// } -} - //============================================================================= /*! *Here we are going to use the GHS3D mesher @@ -651,11 +614,9 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, struct sysinfo si; int err = sysinfo( &si ); if ( !err ) { - int MB = ( si.freeram + si.freeswap ) * si.mem_unit / 1024 / 1024; - MB = int( double( MB ) * 0.9 ); - adjustMemory( MB, aLogFileName ); - memory = "-m "; - memory += MB; + int freeMem = si.totalram * si.mem_unit / 1024 / 1024; + memory = "-m "; + memory += int( 0.7 * freeMem ); } #endif @@ -741,7 +702,14 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, OSD_File( aBadResFileName ).Remove(); OSD_File( aBbResFileName ).Remove(); } + /*if ( _iShape == _nbShape )*/ { + cout << aResultFileName.ToCString() << " Output file "; + if ( !Ok ) + cout << "not "; + cout << "treated !" << endl; + cout << endl; + } } - + return Ok; } -- 2.39.2