From fab6342180cf3ae1170f0d1ae4ae4556ca8adb74 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 20 Jan 2017 16:04:44 +0300 Subject: [PATCH] Patch for MacOS (from SALOME forum) --- src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx | 3 +-- src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx | 22 ++++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) 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; } -- 2.39.2