From 4242950881879157c0fea3fbd5096b428061a088 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 7 Jun 2017 17:32:30 +0300 Subject: [PATCH] 23447: EDF 10549 - Problem with python hypothesis Set memory as float instead of integer --- idl/GHS3DPlugin_Algorithm.idl | 8 ++-- src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx | 14 +++---- src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx | 20 ++++----- src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx | 16 ++++---- src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx | 8 ++-- src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx | 8 ++-- src/GUI/GHS3DPluginGUI_AdvWidget_QTD.ui | 43 +++++++++++++------- src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx | 8 ++-- src/GUI/GHS3DPluginGUI_HypothesisCreator.h | 4 +- 9 files changed, 71 insertions(+), 58 deletions(-) diff --git a/idl/GHS3DPlugin_Algorithm.idl b/idl/GHS3DPlugin_Algorithm.idl index a697472..262d082 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 float MB) raises (SALOME::SALOME_Exception); + float 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 float MB) raises (SALOME::SALOME_Exception); + float GetInitialMemory(); /*! * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium */ diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index a01a90e..b792999 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -1654,7 +1654,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, // MG-Tetra for domain indication SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( theMesh )); - // make prisms on quadrangles + // make prisms on quadrangles and viscous layers if ( theMesh.NbQuadrangles() > 0 || _viscousLayersHyp ) { vector components; @@ -1678,12 +1678,12 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, proxyMesh.reset( new SMESH_ProxyMesh( components )); } // build viscous layers - else if ( _viscousLayersHyp ) - { - proxyMesh = _viscousLayersHyp->Compute( theMesh, theShape ); - if ( !proxyMesh ) - return false; - } + // else if ( _viscousLayersHyp ) + // { + // proxyMesh = _viscousLayersHyp->Compute( theMesh, theShape ); + // if ( !proxyMesh ) + // return false; + // } int anInvalidEnforcedFlags = 0; Ok = writeGMFFile(&mgTetra, diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx index e5f3c4d..eeafd0b 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx @@ -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; } @@ -857,7 +857,7 @@ bool GHS3DPlugin_Hypothesis::DefaultToMakeGroupsOfDomains() #include #endif -long GHS3DPlugin_Hypothesis::DefaultMaximumMemory() +float GHS3DPlugin_Hypothesis::DefaultMaximumMemory() { #if defined(WIN32) // See http://msdn.microsoft.com/en-us/library/aa366589.aspx @@ -866,7 +866,7 @@ long GHS3DPlugin_Hypothesis::DefaultMaximumMemory() 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; @@ -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; } @@ -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"; diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx index afcc808..f2e5a8a 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(long MB); - long GetMaximumMemory() const; + void SetMaximumMemory(float MB); + float GetMaximumMemory() const; /*! * Initial size of memory to be used by the algorithm (in Megabytes) in * automatic memory adjustment mode. Default is zero */ - void SetInitialMemory(long MB); - long GetInitialMemory() const; + void SetInitialMemory(float MB); + float GetInitialMemory() const; /*! * Optimization level: 0-none, 1-light, 2-medium, 3-standard+, 4-strong. Default is medium */ @@ -290,8 +290,8 @@ public: static bool DefaultMeshHoles(); static bool DefaultToMakeGroupsOfDomains(); - static long DefaultMaximumMemory(); - static long DefaultInitialMemory(); + static float DefaultMaximumMemory(); + static float DefaultInitialMemory(); static short DefaultOptimizationLevel(); static std::string DefaultWorkingDirectory(); static bool DefaultKeepFiles(); @@ -338,8 +338,8 @@ protected: bool myToMeshHoles; bool myToMakeGroupsOfDomains; - long myMaximumMemory; - long myInitialMemory; + float myMaximumMemory; + float 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 da36903..2da4c10 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx @@ -109,7 +109,7 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMakeGroupsOfDomains() //function : SetMaximumMemory //======================================================================= -void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Long MB) +void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Float MB) throw ( SALOME::SALOME_Exception ) { if ( MB == 0 ) @@ -123,7 +123,7 @@ void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Long MB) //function : GetMaximumMemory //======================================================================= -CORBA::Long GHS3DPlugin_Hypothesis_i::GetMaximumMemory() +CORBA::Float GHS3DPlugin_Hypothesis_i::GetMaximumMemory() { ASSERT(myBaseImpl); return this->GetImpl()->GetMaximumMemory(); @@ -133,7 +133,7 @@ CORBA::Long GHS3DPlugin_Hypothesis_i::GetMaximumMemory() //function : SetInitialMemory //======================================================================= -void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Long MB) +void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Float MB) throw ( SALOME::SALOME_Exception ) { if ( MB == 0 ) @@ -147,7 +147,7 @@ void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Long MB) //function : GetInitialMemory //======================================================================= -CORBA::Long GHS3DPlugin_Hypothesis_i::GetInitialMemory() +CORBA::Float 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 d48a49d..d515002 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::Float MB) throw ( SALOME::SALOME_Exception ); + CORBA::Float 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::Float MB) throw ( SALOME::SALOME_Exception ); + CORBA::Float 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 6d1ab70..e589dc5 100644 --- a/src/GUI/GHS3DPluginGUI_AdvWidget_QTD.ui +++ b/src/GUI/GHS3DPluginGUI_AdvWidget_QTD.ui @@ -31,6 +31,12 @@ + + + 0 + 0 + + MB @@ -52,34 +58,46 @@ + + + 0 + 0 + + MB - + - - 1 + + 0 0 - - 999999999 + + 1000000.000000000000000 + + + 10.000000000000000 - + - - 1 + + 0 0 - - 999999999 + + 1000000.000000000000000 + + + 10.000000000000000 @@ -218,11 +236,6 @@ QDoubleSpinBox
SMESHGUI_SpinBox.h
- - SalomeApp_IntSpinBox - QLineEdit -
SalomeApp_IntSpinBox.h
-
SMESH_AdvOptionsWdg QWidget diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx index 0c989d2..95dd905 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx @@ -1365,11 +1365,11 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const myCreateNewNodesCheck ->setChecked ( data.myToCreateNewNodes ); myAdvWidget->maxMemoryCheck ->setChecked ( data.myMaximumMemory > 0 ); - myAdvWidget->maxMemorySpin ->setValue ( qMax( (int)data.myMaximumMemory, - myAdvWidget->maxMemorySpin->minimum() )); + myAdvWidget->maxMemorySpin ->setValue ( qMax( data.myMaximumMemory, + (float)myAdvWidget->maxMemorySpin->minimum() )); myAdvWidget->initialMemoryCheck ->setChecked ( data.myInitialMemory > 0 ); - myAdvWidget->initialMemorySpin ->setValue ( qMax( (int)data.myInitialMemory, - myAdvWidget->initialMemorySpin->minimum() )); + myAdvWidget->initialMemorySpin ->setValue ( qMax( data.myInitialMemory, + (float)myAdvWidget->initialMemorySpin->minimum() )); myAdvWidget->workingDirectoryLineEdit ->setText ( data.myWorkingDir ); myAdvWidget->keepWorkingFilesCheck ->setChecked ( data.myKeepFiles ); myAdvWidget->verboseLevelSpin ->setValue ( data.myVerboseLevel ); diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h index 4d7ce75..84d03ff 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h @@ -144,8 +144,8 @@ typedef struct { bool myToMeshHoles,myToMakeGroupsOfDomains,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint, myLogInStandardOutput, myRemoveLogOnSuccess; - long myMaximumMemory; - long myInitialMemory; + float myMaximumMemory; + float myInitialMemory; int myOptimizationLevel; QString myName,myWorkingDir,myTextOption; double myGradation; -- 2.39.2