From: gdd Date: Tue, 8 Oct 2013 14:27:10 +0000 (+0000) Subject: InitialMemory and MaxMemory options type are now double instead of long. X-Git-Tag: V7_3_0a1~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=27d79623670e19ee3ac4ac7208a6e924f4ac5ca2;p=plugins%2Fhybridplugin.git InitialMemory and MaxMemory options type are now double instead of long. There is still a bug in the SetValue() method of the SMESHGUI_SpinBox (value is not set). --- diff --git a/idl/GHS3DPlugin_Algorithm.idl b/idl/GHS3DPlugin_Algorithm.idl index 3cefea0..e369a41 100644 --- a/idl/GHS3DPlugin_Algorithm.idl +++ b/idl/GHS3DPlugin_Algorithm.idl @@ -82,15 +82,15 @@ module GHS3DPlugin * Maximal size of memory to be used by the algorithm (in Megabytes). * Negative value means not to use this option */ - void SetMaximumMemory(in long MB) raises (SALOME::SALOME_Exception); - long GetMaximumMemory(); + void SetMaximumMemory(in double MB) raises (SALOME::SALOME_Exception); + double GetMaximumMemory(); /*! * Initial size of memory to be used by the algorithm (in Megabytes) in * automatic memory adjustment mode. Default is zero. * Negative value means not to use this option */ - void SetInitialMemory(in long MB) raises (SALOME::SALOME_Exception); - long GetInitialMemory(); + void SetInitialMemory(in double MB) raises (SALOME::SALOME_Exception); + double GetInitialMemory(); /*! * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium */ diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx index 9dcfb90..e462a06 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx @@ -136,7 +136,7 @@ bool GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains(const GHS3DPlugin_Hypothes //function : SetMaximumMemory //======================================================================= -void GHS3DPlugin_Hypothesis::SetMaximumMemory(int MB) +void GHS3DPlugin_Hypothesis::SetMaximumMemory(double MB) { if ( myMaximumMemory != MB ) { myMaximumMemory = MB; @@ -149,7 +149,7 @@ void GHS3DPlugin_Hypothesis::SetMaximumMemory(int MB) // * automatic memory adjustment mode. Default is zero //======================================================================= -int GHS3DPlugin_Hypothesis::GetMaximumMemory() const +double GHS3DPlugin_Hypothesis::GetMaximumMemory() const { return myMaximumMemory; } @@ -158,7 +158,7 @@ int GHS3DPlugin_Hypothesis::GetMaximumMemory() const //function : SetInitialMemory //======================================================================= -void GHS3DPlugin_Hypothesis::SetInitialMemory(int MB) +void GHS3DPlugin_Hypothesis::SetInitialMemory(double MB) { if ( myInitialMemory != MB ) { myInitialMemory = MB; @@ -170,7 +170,7 @@ void GHS3DPlugin_Hypothesis::SetInitialMemory(int MB) //function : GetInitialMemory //======================================================================= -int GHS3DPlugin_Hypothesis::GetInitialMemory() const +double GHS3DPlugin_Hypothesis::GetInitialMemory() const { return myInitialMemory; } @@ -852,14 +852,14 @@ bool GHS3DPlugin_Hypothesis::DefaultToMakeGroupsOfDomains() #include #endif -int GHS3DPlugin_Hypothesis::DefaultMaximumMemory() +double GHS3DPlugin_Hypothesis::DefaultMaximumMemory() { #ifndef WIN32 struct sysinfo si; int err = sysinfo( &si ); if ( err == 0 ) { int ramMB = si.totalram * si.mem_unit / 1024 / 1024; - return (int) ( 0.7 * ramMB ); + return ( 0.7 * ramMB ); } #else // See http://msdn.microsoft.com/en-us/library/aa366589.aspx @@ -871,7 +871,7 @@ int GHS3DPlugin_Hypothesis::DefaultMaximumMemory() statex.ullTotalPhys / 1024 / 1024 + statex.ullTotalPageFile / 1024 / 1024 + statex.ullTotalVirtual / 1024 / 1024; - return (int) ( 0.7 * totMB ); + return ( 0.7 * totMB ); } #endif return 1024; @@ -881,7 +881,7 @@ int GHS3DPlugin_Hypothesis::DefaultMaximumMemory() //function : DefaultInitialMemory //======================================================================= -int GHS3DPlugin_Hypothesis::DefaultInitialMemory() +double GHS3DPlugin_Hypothesis::DefaultInitialMemory() { return DefaultMaximumMemory(); } @@ -1121,15 +1121,15 @@ std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load) else load.clear(ios::badbit | load.rdstate()); - isOK = (load >> i); + isOK = (load >> d); if (isOK) - myMaximumMemory = i; + myMaximumMemory = d; else load.clear(ios::badbit | load.rdstate()); - isOK = (load >> i); + isOK = (load >> d); if (isOK) - myInitialMemory = i; + myInitialMemory = d; else load.clear(ios::badbit | load.rdstate()); @@ -1480,7 +1480,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h // Default memory is defined at ghs3d installation but it may be not enough, // so allow to use about all available memory if ( m ) { - int aMaximumMemory = hyp ? hyp->myMaximumMemory : -1; + double aMaximumMemory = hyp ? hyp->myMaximumMemory : -1; cmd += " -m "; if ( aMaximumMemory < 0 ) cmd += DefaultMaximumMemory(); @@ -1488,7 +1488,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h cmd += aMaximumMemory; } if ( M && !useBndRecovery ) { - int aInitialMemory = hyp ? hyp->myInitialMemory : -1; + double aInitialMemory = hyp ? hyp->myInitialMemory : -1; cmd += " -M "; if ( aInitialMemory > 0 ) cmd += aInitialMemory; diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx index 23983fa..eb0c1f8 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx @@ -134,14 +134,14 @@ public: /*! * Maximal size of memory to be used by the algorithm (in Megabytes) */ - void SetMaximumMemory(int MB); - int GetMaximumMemory() const; + void SetMaximumMemory(double MB); + double GetMaximumMemory() const; /*! * Initial size of memory to be used by the algorithm (in Megabytes) in * automatic memory adjustment mode. Default is zero */ - void SetInitialMemory(int MB); - int GetInitialMemory() const; + void SetInitialMemory(double MB); + double GetInitialMemory() const; /*! * Optimization level: 0-none, 1-light, 2-medium, 3-standard+, 4-strong. Default is medium */ @@ -289,8 +289,8 @@ public: static bool DefaultMeshHoles(); static bool DefaultToMakeGroupsOfDomains(); - static int DefaultMaximumMemory(); - static int DefaultInitialMemory(); + static double DefaultMaximumMemory(); + static double DefaultInitialMemory(); static short DefaultOptimizationLevel(); static std::string DefaultWorkingDirectory(); static bool DefaultKeepFiles(); @@ -339,8 +339,8 @@ private: bool myToMeshHoles; bool myToMakeGroupsOfDomains; - int myMaximumMemory; - int myInitialMemory; + double myMaximumMemory; + double myInitialMemory; short myOptimizationLevel; bool myKeepFiles; std::string myWorkingDirectory; diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx index 3f5bed7..0e2f6b8 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx @@ -115,7 +115,7 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMakeGroupsOfDomains() //function : SetMaximumMemory //======================================================================= -void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Long MB) +void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Double MB) throw ( SALOME::SALOME_Exception ) { if ( MB == 0 ) @@ -129,7 +129,7 @@ void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Long MB) //function : GetMaximumMemory //======================================================================= -CORBA::Long GHS3DPlugin_Hypothesis_i::GetMaximumMemory() +CORBA::Double GHS3DPlugin_Hypothesis_i::GetMaximumMemory() { ASSERT(myBaseImpl); return this->GetImpl()->GetMaximumMemory(); @@ -139,7 +139,7 @@ CORBA::Long GHS3DPlugin_Hypothesis_i::GetMaximumMemory() //function : SetInitialMemory //======================================================================= -void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Long MB) +void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Double MB) throw ( SALOME::SALOME_Exception ) { if ( MB == 0 ) @@ -153,7 +153,7 @@ void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Long MB) //function : GetInitialMemory //======================================================================= -CORBA::Long GHS3DPlugin_Hypothesis_i::GetInitialMemory() +CORBA::Double GHS3DPlugin_Hypothesis_i::GetInitialMemory() { ASSERT(myBaseImpl); return this->GetImpl()->GetInitialMemory(); diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx index 10aa011..a23952c 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx @@ -65,14 +65,14 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i: /*! * Maximal size of memory to be used by the algorithm (in Megabytes) */ - void SetMaximumMemory(CORBA::Long MB) throw ( SALOME::SALOME_Exception ); - CORBA::Long GetMaximumMemory(); + void SetMaximumMemory(CORBA::Double MB) throw ( SALOME::SALOME_Exception ); + CORBA::Double GetMaximumMemory(); /*! * Initial size of memory to be used by the algorithm (in Megabytes) in * automatic memory adjustment mode. Default is zero */ - void SetInitialMemory(CORBA::Long MB) throw ( SALOME::SALOME_Exception ); - CORBA::Long GetInitialMemory(); + void SetInitialMemory(CORBA::Double MB) throw ( SALOME::SALOME_Exception ); + CORBA::Double GetInitialMemory(); /*! * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium */ diff --git a/src/GUI/GHS3DPluginGUI_AdvWidget_QTD.ui b/src/GUI/GHS3DPluginGUI_AdvWidget_QTD.ui index 35b70cb..1913752 100644 --- a/src/GUI/GHS3DPluginGUI_AdvWidget_QTD.ui +++ b/src/GUI/GHS3DPluginGUI_AdvWidget_QTD.ui @@ -43,16 +43,6 @@ - - - - - 1 - 0 - - - - @@ -60,8 +50,15 @@ + + + + MB + + + - + 1 @@ -70,10 +67,13 @@ - - - - MB + + + + + 1 + 0 + diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx index 5f97baf..a03361f 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx @@ -416,13 +416,11 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame() myAdvWidget->maxMemoryCheck->setText(tr( "MAX_MEMORY_SIZE" )); myAdvWidget->initialMemoryCheck->setText(tr( "INIT_MEMORY_SIZE" )); - myAdvWidget->maxMemorySpin ->setMinimum( 1 ); - myAdvWidget->maxMemorySpin ->setMaximum( maxAvailableMemory() ); - myAdvWidget->maxMemorySpin ->setSingleStep( 10 ); - - myAdvWidget->initialMemorySpin->setMinimum( 1 ); - myAdvWidget->initialMemorySpin->setMaximum( maxAvailableMemory() ); - myAdvWidget->initialMemorySpin->setSingleStep( 10 ); + myAdvWidget->maxMemorySpin->RangeStepAndValidator(20.0, 1e6, 10.0); + myAdvWidget->maxMemorySpin->setValue( 128.0 ); + + myAdvWidget->initialMemorySpin->RangeStepAndValidator(0.0, 1e6, 10.0); + myAdvWidget->initialMemorySpin->setValue( 100.0 ); myAdvWidget->initialMemoryLabel ->setText (tr( "MEGABYTE" )); myAdvWidget->maxMemoryLabel ->setText (tr( "MEGABYTE" )); diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h index 29a68d7..64a3442 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h @@ -143,7 +143,8 @@ typedef struct { bool myToMeshHoles,myToMakeGroupsOfDomains,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint, myLogInStandardOutput, myRemoveLogOnSuccess; - int myMaximumMemory,myInitialMemory,myOptimizationLevel; + double myMaximumMemory,myInitialMemory; + int myOptimizationLevel; QString myName,myWorkingDir,myTextOption; double myGradation; short myVerboseLevel;