Salome HOME
Merge multi-study removal branch.
[plugins/ghs3dplugin.git] / src / GHS3DPlugin / GHS3DPlugin_Hypothesis.cxx
index 2672ddcdab37d975f2e194913a5768b4ec85f99c..f3dbdfd8f4f23044b4e2e4b6872f7962daae8ae9 100644 (file)
@@ -137,7 +137,7 @@ bool GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains(const GHS3DPlugin_Hypothes
 //function : SetMaximumMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis::SetMaximumMemory(long MB)
+void GHS3DPlugin_Hypothesis::SetMaximumMemory(float MB)
 {
   if ( myMaximumMemory != MB ) {
     myMaximumMemory = MB;
@@ -150,7 +150,7 @@ void GHS3DPlugin_Hypothesis::SetMaximumMemory(long MB)
 //           * automatic memory adjustment mode. Default is zero
 //=======================================================================
 
-long GHS3DPlugin_Hypothesis::GetMaximumMemory() const
+float GHS3DPlugin_Hypothesis::GetMaximumMemory() const
 {
   return myMaximumMemory;
 }
@@ -159,7 +159,7 @@ long GHS3DPlugin_Hypothesis::GetMaximumMemory() const
 //function : SetInitialMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis::SetInitialMemory(long MB)
+void GHS3DPlugin_Hypothesis::SetInitialMemory(float MB)
 {
   if ( myInitialMemory != MB ) {
     myInitialMemory = MB;
@@ -171,7 +171,7 @@ void GHS3DPlugin_Hypothesis::SetInitialMemory(long MB)
 //function : GetInitialMemory
 //=======================================================================
 
-long GHS3DPlugin_Hypothesis::GetInitialMemory() const
+float GHS3DPlugin_Hypothesis::GetInitialMemory() const
 {
   return myInitialMemory;
 }
@@ -851,29 +851,29 @@ bool GHS3DPlugin_Hypothesis::DefaultToMakeGroupsOfDomains()
 //function : DefaultMaximumMemory
 //=======================================================================
 
-#ifndef WIN32
-#include <sys/sysinfo.h>
-#else
+#if defined(WIN32)
 #include <windows.h>
+#elif !defined(__APPLE__)
+#include <sys/sysinfo.h>
 #endif
 
-long  GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
+float 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);
   long err = GlobalMemoryStatusEx (&statex);
   if (err != 0) {
     double totMB = (double)statex.ullAvailPhys / 1024. / 1024.;
-    return (long)( 0.7 * totMB );
+    return (float)( 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;
@@ -883,7 +883,7 @@ long  GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
 //function : DefaultInitialMemory
 //=======================================================================
 
-long  GHS3DPlugin_Hypothesis::DefaultInitialMemory()
+float GHS3DPlugin_Hypothesis::DefaultInitialMemory()
 {
   return DefaultMaximumMemory();
 }
@@ -892,7 +892,7 @@ long  GHS3DPlugin_Hypothesis::DefaultInitialMemory()
 //function : DefaultOptimizationLevel
 //=======================================================================
 
-short  GHS3DPlugin_Hypothesis::DefaultOptimizationLevel()
+short GHS3DPlugin_Hypothesis::DefaultOptimizationLevel()
 {
   return Medium;
 }
@@ -1461,7 +1461,7 @@ bool GHS3DPlugin_Hypothesis::SetParametersByDefaults(const TDefaults&  dflts,
 
 std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
                                                  const bool                    hasShapeToMesh,
-                                                 const bool                    forExucutable)
+                                                 const bool                    forExecutable)
 {
   std::string cmd = GetExeName();
   // check if any option is overridden by hyp->myTextOption
@@ -1485,13 +1485,13 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
   // Default memory is defined at MG-Tetra installation but it may be not enough,
   // so allow to use about all available memory
   if ( max_memory ) {
-    long aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
+    float aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
     cmd += " --max_memory ";
     if ( aMaximumMemory < 0 ) cmd += SMESH_Comment( DefaultMaximumMemory() );
     else                      cmd += SMESH_Comment( aMaximumMemory );
   }
   if ( auto_memory && !useBndRecovery ) {
-    long aInitialMemory = hyp ? hyp->myInitialMemory : -1;
+    float aInitialMemory = hyp ? hyp->myInitialMemory : -1;
     cmd += " --automatic_memory ";
     if ( aInitialMemory > 0 ) cmd += SMESH_Comment( aInitialMemory );
     else                      cmd += "100";
@@ -1523,7 +1523,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
 
   // to create internal nodes
   if ( no_int_points && !toCreateNewNodes ) {
-    if ( forExucutable )
+    if ( forExecutable )
       cmd += " --no_internal_points";
     else
       cmd += " --internalpoints no";
@@ -1546,7 +1546,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
 
   // to remove initial central point.
   if ( rem && hyp && hyp->myToRemoveCentralPoint) {
-    if ( forExucutable )
+    if ( forExecutable )
       cmd += " --no_initial_central_point";
     else
       cmd += " --centralpoint no";
@@ -1559,7 +1559,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
 
   // to define volumic gradation.
   if ( gra && hyp ) {
-    if ( forExucutable )
+    if ( forExecutable )
       cmd += " -Dcpropa=" + SMESH_Comment( hyp->myGradation );
     else
       cmd += " --gradation " + SMESH_Comment( hyp->myGradation );