From: vsr Date: Fri, 20 Jan 2017 13:04:44 +0000 (+0300) Subject: Patch for MacOS (from SALOME forum) X-Git-Tag: SHAPER_2.7.0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fab6342180cf3ae1170f0d1ae4ae4556ca8adb74;p=plugins%2Fhybridplugin.git Patch for MacOS (from SALOME forum) --- diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx index 30fdd6b..312efe3 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx @@ -1762,8 +1762,7 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, void HYBRIDPlugin_HYBRID::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]\\+ \\+" + HYBRIDPlugin_Hypothesis::GetExeName() + "\""; cmd += " | awk '{print $1}' | xargs kill -9 > /dev/null 2>&1"; diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx index 56de2c8..4d2f022 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx @@ -1076,22 +1076,15 @@ bool HYBRIDPlugin_Hypothesis::DefaultToMakeGroupsOfDomains() //function : DefaultMaximumMemory //======================================================================= -#ifndef WIN32 -#include -#else +#if defined(WIN32) #include +#elif !defined(__APPLE__) +#include #endif double HYBRIDPlugin_Hypothesis::DefaultMaximumMemory() { -#ifndef WIN32 - struct sysinfo si; - int err = sysinfo( &si ); - if ( err == 0 ) { - int 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); @@ -1103,6 +1096,13 @@ double HYBRIDPlugin_Hypothesis::DefaultMaximumMemory() statex.ullTotalVirtual / 1024 / 1024; return ( 0.7 * totMB ); } +#elif !defined(__APPLE__) + struct sysinfo si; + int err = sysinfo( &si ); + if ( err == 0 ) { + int ramMB = si.totalram * si.mem_unit / 1024 / 1024; + return ( 0.7 * ramMB ); + } #endif return 1024; }