From: vsr Date: Fri, 20 Jan 2017 13:02:41 +0000 (+0300) Subject: Patch for MacOS (from SALOME forum) X-Git-Tag: SHAPER_2.7.0~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=43e8b66516774ddace43e8771b224bd3bbf90044;p=plugins%2Fghs3dplugin.git Patch for MacOS (from SALOME forum) --- diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index 55117ae..13acae7 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -2040,8 +2040,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, void GHS3DPlugin_GHS3D::CancelCompute() { _computeCanceled = true; -#ifdef WIN32 -#else +#if !defined WIN32 && !defined __APPLE__ std::string cmd = "ps xo pid,args | grep " + _genericName; //cmd += " | grep -e \"^ *[0-9]\\+ \\+" + GHS3DPlugin_Hypothesis::GetExeName() + "\""; cmd += " | awk '{print $1}' | xargs kill -9 > /dev/null 2>&1"; diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx index 2f2650e..e5f3c4d 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx @@ -851,22 +851,15 @@ bool GHS3DPlugin_Hypothesis::DefaultToMakeGroupsOfDomains() //function : DefaultMaximumMemory //======================================================================= -#ifndef WIN32 -#include -#else +#if defined(WIN32) #include +#elif !defined(__APPLE__) +#include #endif -long GHS3DPlugin_Hypothesis::DefaultMaximumMemory() +long GHS3DPlugin_Hypothesis::DefaultMaximumMemory() { -#ifndef WIN32 - struct sysinfo si; - long err = sysinfo( &si ); - if ( err == 0 ) { - long ramMB = si.totalram * si.mem_unit / 1024 / 1024; - return ( 0.7 * ramMB ); - } -#else +#if defined(WIN32) // See http://msdn.microsoft.com/en-us/library/aa366589.aspx MEMORYSTATUSEX statex; statex.dwLength = sizeof (statex); @@ -875,6 +868,13 @@ long GHS3DPlugin_Hypothesis::DefaultMaximumMemory() double totMB = (double)statex.ullAvailPhys / 1024. / 1024.; return (long)( 0.7 * totMB ); } +#elif !defined(__APPLE__) + struct sysinfo si; + long err = sysinfo( &si ); + if ( err == 0 ) { + long ramMB = si.totalram * si.mem_unit / 1024 / 1024; + return ( 0.7 * ramMB ); + } #endif return 1024; }