From 465570a935abb5f7603ddc070aabd3addc5e1c03 Mon Sep 17 00:00:00 2001 From: uhz Date: Mon, 20 Mar 2017 17:02:57 +0100 Subject: [PATCH 1/8] padder: add numerical parameters in the gui + transmission to the component and then the padder executable --- src/Tools/padder/spadderpy/gui/inputdialog.py | 60 +++++++++++++------ .../padder/spadderpy/gui/plugindialog.py | 52 ++++++++++------ 2 files changed, 77 insertions(+), 35 deletions(-) diff --git a/src/Tools/padder/spadderpy/gui/inputdialog.py b/src/Tools/padder/spadderpy/gui/inputdialog.py index 138b237ac..3fd0c7fa6 100644 --- a/src/Tools/padder/spadderpy/gui/inputdialog.py +++ b/src/Tools/padder/spadderpy/gui/inputdialog.py @@ -38,6 +38,14 @@ from inputdata import InputData DEBUG_MODE=True GROUPNAME_MAXLENGTH=8 +INPUTDATA_KEY_FILES="meshfiles" +INPUTDATA_KEY_PARAM="parameters" + +PARAM_KEY_NBITER = "NbIteration" +PARAM_KEY_RMINRMAX = "RminRmax" +PARAM_NBITER_DEFAULT_VALUE = 3 +PARAM_RMINRMAX_DEFAULT_VALUE = 1.5 + class InputDialog(GenericDialog): TBL_HEADER_LABEL=["Input Mesh", "Output group name"] @@ -116,7 +124,8 @@ class InputDialog(GenericDialog): # name item. # Setup default values for numerical parameters - self.__ui.txtParamNbIter.setValue(3) + self.__ui.txtParamNbIter.setValue(PARAM_NBITER_DEFAULT_VALUE) + self.__ui.txtParamRminRmax.setValue(PARAM_RMINRMAX_DEFAULT_VALUE) # Note that PADDER does not support group name longer than 8 # characters. We apply then this limit in the gui field. @@ -138,7 +147,7 @@ class InputDialog(GenericDialog): self.__ui.txtSmeshObject.setEnabled(False) self.__ui.btnAddInput.setEnabled(False) self.__selectedMesh = None - self.__dictInputData = {} + self.__dictInputFiles = {} self.__nbConcreteMesh = 0 self.__nbSteelbarMesh = 0 @@ -231,7 +240,7 @@ class InputDialog(GenericDialog): """ # if the entry already exists, we remove it to replace by a # new one - if self.__dictInputData.has_key(meshName): + if self.__dictInputFiles.has_key(meshName): self.__delInputFromMap(meshName) inputData = InputData() @@ -240,7 +249,7 @@ class InputDialog(GenericDialog): inputData.meshType = meshType inputData.groupName = groupName # The key of the map is the mesh name - self.__dictInputData[meshName] = inputData + self.__dictInputFiles[meshName] = inputData if inputData.meshType == InputData.MESHTYPES.CONCRETE: self.__nbConcreteMesh += 1 else: @@ -272,7 +281,7 @@ class InputDialog(GenericDialog): This function removes the specified entry from the internal map (for data management purpose) """ - inputData = self.__dictInputData.pop(meshName) + inputData = self.__dictInputFiles.pop(meshName) if inputData.meshType == InputData.MESHTYPES.CONCRETE: self.__nbConcreteMesh -= 1 else: @@ -283,33 +292,51 @@ class InputDialog(GenericDialog): print "nb steelbar mesh ",self.__nbSteelbarMesh - def setData(self, listInputData=[]): + def setData(self, dictInputData={}): """ This function fills the dialog widgets with values provided by the specified data list. """ self.clear() - for inputData in listInputData: + if dictInputData.has_key(INPUTDATA_KEY_FILES): + listInputData = dictInputData["meshfiles"] + for inputData in listInputData: - meshName = inputData.meshName - meshObject = inputData.meshObject - meshType = inputData.meshType - groupName = inputData.groupName + meshName = inputData.meshName + meshObject = inputData.meshObject + meshType = inputData.meshType + groupName = inputData.groupName - self.__addInputInGui(meshName, meshObject, meshType, groupName) - self.__addInputInMap(meshName, meshObject, meshType, groupName) + self.__addInputInGui(meshName, meshObject, meshType, groupName) + self.__addInputInMap(meshName, meshObject, meshType, groupName) - if not DEBUG_MODE: - self.onSelectSmeshObject() + if not DEBUG_MODE: + self.onSelectSmeshObject() + + if dictInputData.has_key(INPUTDATA_KEY_PARAM): + dictInputParameters = dictInputData[INPUTDATA_KEY_PARAM] + if dictInputParameters.has_key(PARAM_KEY_NBITER): + self.__ui.txtParamNbIter.setValue(dictInputParameters[PARAM_KEY_NBITER]) + if dictInputParameters.has_key(PARAM_KEY_RMINRMAX): + self.__ui.txtParamRminRmax.setValue(dictInputParameters[PARAM_KEY_RMINRMAX]) def getData(self): """ This function returns a list of InputData that corresponds to the data in the dialog widgets of the current dialog. """ + # Get the list of mesh files # Note that the values() function returns a copy of the list # of values. - return self.__dictInputData.values() + dictInputData={} + dictInputData[INPUTDATA_KEY_FILES] = self.__dictInputFiles.values() + + # Get the list of additionnal parameters + dictInputParameters = {} + dictInputParameters[PARAM_KEY_NBITER] = self.__ui.txtParamNbIter.value() + dictInputParameters[PARAM_KEY_RMINRMAX] = self.__ui.txtParamRminRmax.value() + dictInputData[INPUTDATA_KEY_PARAM] = dictInputParameters + return dictInputData def checkData(self): """ @@ -328,7 +355,6 @@ class InputDialog(GenericDialog): return True - #def setParameters(self, # ============================================================================== # Basic use case diff --git a/src/Tools/padder/spadderpy/gui/plugindialog.py b/src/Tools/padder/spadderpy/gui/plugindialog.py index bb5c76abb..7d010ceb7 100644 --- a/src/Tools/padder/spadderpy/gui/plugindialog.py +++ b/src/Tools/padder/spadderpy/gui/plugindialog.py @@ -23,7 +23,8 @@ from qtsalome import QDialog, QIcon, Qt from plugindialog_ui import Ui_PluginDialog -from inputdialog import InputDialog +from inputdialog import InputDialog, INPUTDATA_KEY_FILES, INPUTDATA_KEY_PARAM +from inputdialog import PARAM_KEY_NBITER, PARAM_KEY_RMINRMAX from inputdata import InputData # __GBO__: uncomment this line and comment the previous one to use the # demo input dialog instead of the real one. @@ -95,7 +96,7 @@ class PluginDialog(QDialog): self.clear() self.setupJobManager() - + def setupJobManager(self): ''' @@ -105,8 +106,8 @@ class PluginDialog(QDialog): the initialize step, by specifing the name of the resource to be used. ''' - # We first - + # We first + configReader = ConfigReader() config = configReader.getLocalConfig() configId = config.resname @@ -140,7 +141,7 @@ class PluginDialog(QDialog): # The signal inputValidated emitted from inputDialog is # connected to the slot function onProcessInput: self.__inputDialog.inputValidated.connect( self.onProcessInput ) - + else: self.__ui.frameInput.setVisible(True) self.__ui.btnInput.setVisible(False) @@ -150,13 +151,13 @@ class PluginDialog(QDialog): def getInputFrame(self): return self.__ui.frameInput - + def __setGuiState(self,states=["CAN_SELECT"]): if "CAN_SELECT" in states: self.__ui.btnInput.setEnabled(True) else: self.__ui.btnInput.setEnabled(False) - + if "CAN_COMPUTE" in states: self.__ui.btnCompute.setEnabled(True) else: @@ -200,7 +201,7 @@ class PluginDialog(QDialog): def __log(self, message): """ This function prints the specified message in the log area - """ + """ self.__ui.txtLog.append(message) def __exportMesh(self, meshName, meshObject): @@ -218,6 +219,7 @@ class PluginDialog(QDialog): This function clears the log area and the states of the buttons """ self.__listInputData = [] + self.__dictInputParameters = {} self.__ui.txtLog.clear() self.__setGuiState(["CAN_SELECT"]) self.__isRunning = False @@ -241,7 +243,10 @@ class PluginDialog(QDialog): windows to process the validation event (see the slot onProcessInput which is connected to this event). ''' - self.__inputDialog.setData(self.__listInputData) + dictInputData = {} + dictInputData[INPUTDATA_KEY_FILES] = self.__listInputData + dictInputData[INPUTDATA_KEY_PARAM] = self.__dictInputParameters + self.__inputDialog.setData(dictInputData) self.__inputDialog.open() def onProcessInput(self): @@ -252,16 +257,19 @@ class PluginDialog(QDialog): """ # The processing simply consists in requesting the input data # from the dialog window. - self.__listInputData = self.__inputDialog.getData() + dictInputData = self.__inputDialog.getData() + self.__listInputData = dictInputData[INPUTDATA_KEY_FILES] + self.__dictInputParameters = dictInputData[INPUTDATA_KEY_PARAM] + self.__ui.lblStatusBar.setText("Input data OK") self.__log("INF: Press \"Compute\" to start the job") self.__setGuiState(["CAN_SELECT", "CAN_COMPUTE"]) - + def onCompute(self): ''' This function is the slot connected to the Compute button. It initializes a mesh computation job and start it using the - SALOME launcher. + SALOME launcher. ''' # We first have to create the list of parameters for the # initialize function. For that, we have to create the files @@ -283,14 +291,22 @@ class PluginDialog(QDialog): group_name = inputData.groupName) meshJobFileList.append(parameter) + # And to create a list of the additional parameters. + # WARN: the CORBA interface requires string values. + meshJobParameterList=[] + for inputParameterKey in self.__dictInputParameters.keys(): + value = self.__dictInputParameters[inputParameterKey] + parameter = MESHJOB.MeshJobParameter(name=inputParameterKey,value=str(value)) + meshJobParameterList.append(parameter) + jobManager = self.__getJobManager() - self.__jobid = jobManager.initialize(meshJobFileList, self.__configId) + self.__jobid = jobManager.initialize(meshJobFileList, meshJobParameterList, self.__configId) if self.__jobid < 0: self.__log("ERR: the job can't be initialized") self.__log("ERR: %s"%jobManager.getLastErrorMessage()) return self.__log("INF: the job has been initialized with jobid = "+str(self.__jobid)) - + startOk = jobManager.start(self.__jobid) if not startOk: self.__log("ERR: the job with jobid = "+str(self.__jobid)+" can't be started") @@ -326,7 +342,7 @@ class PluginDialog(QDialog): This function is the slot connected on the Publish button. It requests the mesh job manager to download the results data from the computation resource host and load the med file in - the SALOME study. + the SALOME study. """ jobManager = self.__getJobManager() state = jobManager.getState(self.__jobid) @@ -372,13 +388,13 @@ class PluginDialog(QDialog): one is running. """ self.clear() - + __dialog=None def getDialog(): """ - This function returns a singleton instance of the plugin dialog. + This function returns a singleton instance of the plugin dialog. """ global __dialog if __dialog is None: @@ -402,5 +418,5 @@ def TEST_PluginDialog(): if __name__ == "__main__": TEST_PluginDialog() - + From 1c9dd599f65f3311d67a952337983e00435658df Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Wed, 22 Mar 2017 16:56:47 +0100 Subject: [PATCH 2/8] allow actor presentation modification from PyQt modules --- src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx | 143 +++++++++++++++++++++++ src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h | 34 ++++++ src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i | 34 ++++++ 3 files changed, 211 insertions(+) diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx index f356bd9ba..e0d44ec30 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx @@ -610,6 +610,149 @@ const char* SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry, return ""; } +/*! + \brief Gets window with specified identifier + \internal + \param id window identifier + \return pointer on the window +*/ + +SUIT_ViewWindow* getWnd( const int id ) +{ + SUIT_ViewWindow* resWnd = 0; + SUIT_Session* aSession = SUIT_Session::session(); + SUIT_Application* anApplication = aSession->activeApplication(); + SalomeApp_Application* app = dynamic_cast(anApplication); + if ( app ) { + ViewManagerList vmlist = app->viewManagers(); + foreach( SUIT_ViewManager* vm, vmlist ) { + QVector vwlist = vm->getViews(); + foreach ( SUIT_ViewWindow* vw, vwlist ) { + if ( id == vw->getId() ) { + resWnd = vw; + break; + } + } + } + } + return resWnd; +} + + +actorAspect SMESH_Swig::GetActorAspect( const char* Mesh_Entry, int viewId ) +{ + class TGetActorAspect: public SALOME_Event + { + public: + typedef actorAspect TResult; + TResult myResult; + const char* _entry; + int _wid; + TGetActorAspect( const char* Mesh_Entry, int viewId ) + { + _entry = Mesh_Entry; + _wid = viewId; + } + virtual void Execute() + { + SMESH_Actor* anActor; + if (_wid) + { + SUIT_ViewWindow* w = getWnd(_wid); + anActor = SMESH::FindActorByEntry( w, _entry ); + } + else + anActor = SMESH::FindActorByEntry( _entry ); + if ( !anActor ) + { + MESSAGE("GetActorAspect: no actor corresponding to: " << _entry); + return; + } + anActor->GetSufaceColor(myResult.surfaceColor.r, + myResult.surfaceColor.g, + myResult.surfaceColor.b, + myResult.surfaceColor.delta); + anActor->GetVolumeColor(myResult.volumeColor.r, + myResult.volumeColor.g, + myResult.volumeColor.b, + myResult.volumeColor.delta); + anActor->GetEdgeColor(myResult.edgeColor.r, + myResult.edgeColor.g, + myResult.edgeColor.b); + anActor->GetNodeColor(myResult.nodeColor.r, + myResult.nodeColor.g, + myResult.nodeColor.b); + myResult.opacity= anActor->GetOpacity(); + MESSAGE("opacity: " << myResult.opacity); + } + }; + + return ProcessEvent(new TGetActorAspect( Mesh_Entry, viewId)); +} + +void SMESH_Swig::SetActorAspect( const actorAspect& actorPres, const char* Mesh_Entry, int viewId ) +{ + class TSetActorAspect: public SALOME_Event + { + public: + const char* _entry; + actorAspect _actorPres; + int _wid; + TSetActorAspect(const actorAspect& actorPres, const char* Mesh_Entry, int viewId ) + { + _entry = Mesh_Entry; + _actorPres = actorPres; + _wid = viewId; + } + virtual void Execute() + { + SMESH_Actor* anActor; + if (_wid) + { + SUIT_ViewWindow* w = getWnd(_wid); + anActor = SMESH::FindActorByEntry( w, _entry ); + } + else + anActor = SMESH::FindActorByEntry( _entry ); + if ( !anActor ) + { + MESSAGE("SetActorAspect: no actor corresponding to: " << _entry); + return; + } + anActor->SetSufaceColor(_actorPres.surfaceColor.r, + _actorPres.surfaceColor.g, + _actorPres.surfaceColor.b, + _actorPres.surfaceColor.delta); + anActor->SetVolumeColor(_actorPres.volumeColor.r, + _actorPres.volumeColor.g, + _actorPres.volumeColor.b, + _actorPres.volumeColor.delta); + anActor->SetEdgeColor(_actorPres.edgeColor.r, + _actorPres.edgeColor.g, + _actorPres.edgeColor.b); + anActor->SetNodeColor(_actorPres.nodeColor.r, + _actorPres.nodeColor.g, + _actorPres.nodeColor.b); + anActor->SetOpacity(_actorPres.opacity); + if (_wid) + { + SUIT_ViewWindow* w = getWnd(_wid); + w->repaint(); + } + else + { + SUIT_Session* aSession = SUIT_Session::session(); + SUIT_Application* anApplication = aSession->activeApplication(); + SalomeApp_Application* anApp = dynamic_cast(anApplication); + SUIT_ViewManager* vman = anApp->getViewManager(VTKViewer_Viewer::Type(),true); + vman->getActiveView()->repaint(); + } + } + }; + + ProcessVoidEvent(new TSetActorAspect(actorPres, Mesh_Entry, viewId)); +} + void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry ) { // SMESH_Actor* Mesh = smeshGUI->ReadScript(aM); diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h index c6c948fcf..86682ff5b 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h @@ -58,6 +58,37 @@ enum Ball = BallSelection }; +typedef struct +{ + double r, g, b; + int delta; +} surfaceColorStruct; + +typedef struct +{ + double r, g, b; + int delta; +} volumeColorStruct; + +typedef struct +{ + double r, g, b; +} edgeColorStruct; + +typedef struct +{ + double r, g, b; +} nodeColorStruct; + +struct actorAspect +{ + surfaceColorStruct surfaceColor; + volumeColorStruct volumeColor; + edgeColorStruct edgeColor; + nodeColorStruct nodeColor; + double opacity; +}; + class SMESH_SWIG_EXPORT SMESH_Swig { public: @@ -94,6 +125,9 @@ public: */ void SetMeshIcon( const char*, const bool, const bool ); + actorAspect GetActorAspect(const char* Mesh_Entry, int viewId = 0 ); + void SetActorAspect( const actorAspect& actorPres, const char* Mesh_Entry, int viewId = 0 ); + // --------------------- for the test purposes ----------------------- int getSelectionMode(); void select( const char *id, std::vector ids, bool append = false ); diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i index 73c08a5f1..ac732d467 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i @@ -68,6 +68,37 @@ enum Ball }; +typedef struct +{ + double r, g, b; + int delta; +} surfaceColorStruct; + +typedef struct +{ + double r, g, b; + int delta; +} volumeColorStruct; + +typedef struct +{ + double r, g, b; +} edgeColorStruct; + +typedef struct +{ + double r, g, b; +} nodeColorStruct; + +struct actorAspect +{ + surfaceColorStruct surfaceColor; + volumeColorStruct volumeColor; + edgeColorStruct edgeColor; + nodeColorStruct nodeColor; + double opacity; +}; + class SMESH_Swig { public: @@ -97,6 +128,9 @@ class SMESH_Swig void CreateAndDisplayActor( const char* Mesh_Entry ); void EraseActor( const char* Mesh_Entry, const bool allViewers = false ); + actorAspect GetActorAspect(const char* Mesh_Entry, int viewId = 0 ); + void SetActorAspect( const actorAspect& actorPres, const char* Mesh_Entry, int viewId = 0 ); + // --------------------- for the test purposes ----------------------- int getSelectionMode(); void select( const char *id, std::vector ids, bool append = false ); From 5d0e15847622859b3df81627f3c87d4b6ca1470c Mon Sep 17 00:00:00 2001 From: "Maintenance team (INV)" Date: Fri, 24 Mar 2017 12:00:15 +0300 Subject: [PATCH 3/8] RNV: Fix compilation problems on several platforms. --- src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx | 29 ++++++++++++------------ 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx index e0d44ec30..231dd33b5 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx @@ -638,22 +638,19 @@ SUIT_ViewWindow* getWnd( const int id ) return resWnd; } - -actorAspect SMESH_Swig::GetActorAspect( const char* Mesh_Entry, int viewId ) +class TGetActorAspect: public SALOME_Event { - class TGetActorAspect: public SALOME_Event +public: + typedef actorAspect TResult; + TResult myResult; + const char* _entry; + int _wid; + TGetActorAspect( const char* Mesh_Entry, int viewId ) { - public: - typedef actorAspect TResult; - TResult myResult; - const char* _entry; - int _wid; - TGetActorAspect( const char* Mesh_Entry, int viewId ) - { - _entry = Mesh_Entry; - _wid = viewId; - } - virtual void Execute() + _entry = Mesh_Entry; + _wid = viewId; + } + virtual void Execute() { SMESH_Actor* anActor; if (_wid) @@ -685,8 +682,10 @@ actorAspect SMESH_Swig::GetActorAspect( const char* Mesh_Entry, int viewId ) myResult.opacity= anActor->GetOpacity(); MESSAGE("opacity: " << myResult.opacity); } - }; +}; +actorAspect SMESH_Swig::GetActorAspect( const char* Mesh_Entry, int viewId ) +{ return ProcessEvent(new TGetActorAspect( Mesh_Entry, viewId)); } From e2ed82ab76826fe71cb635add1926e389c2fff9f Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 29 Mar 2017 14:05:00 +0300 Subject: [PATCH 4/8] Fix SIGSEGV at SALOME termination after performing SALOME_TESTS/Grids/smesh/imps_05/F0 --- doc/salome/gui/SMESH/input/skew.doc | 4 ++-- resources/CMakeLists.txt | 2 ++ resources/mesh_hide.png | Bin 0 -> 344 bytes resources/mesh_show.png | Bin 0 -> 3184 bytes src/SMESH/SMESH_Gen.cxx | 26 ++++++++++++++++++--- src/SMESH/SMESH_Hypothesis.cxx | 35 ++++++++++++++-------------- src/SMESHGUI/SMESHGUI.cxx | 4 ++-- src/SMESHGUI/SMESH_images.ts | 8 +++++++ src/SMESHUtils/SMESH_TypeDefs.hxx | 1 + 9 files changed, 56 insertions(+), 24 deletions(-) create mode 100644 resources/mesh_hide.png create mode 100644 resources/mesh_show.png diff --git a/doc/salome/gui/SMESH/input/skew.doc b/doc/salome/gui/SMESH/input/skew.doc index 036c70d83..01f3c5fea 100644 --- a/doc/salome/gui/SMESH/input/skew.doc +++ b/doc/salome/gui/SMESH/input/skew.doc @@ -3,8 +3,8 @@ \page skew_page Skew \n \b Skew mesh quality criterion reflects the angle between the lines -that join opposite sides of a quadrangle element or the greatesr angle -between three medians in triangle elements. This mesh quality +that join opposite sides of a quadrangle element or the greatest angle +between a median and a midline in a triangle element. This mesh quality criterion can be applied to elements composed of 4 and 3 nodes (quadrangles and triangles). diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index da52e0783..d2801c905 100755 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -226,6 +226,8 @@ SET(SMESH_RESOURCES_FILES mesh_extmeth_surf_offset_smooth.png mesh_extmeth_face_offset.png mesh_quality.png + mesh_show.png + mesh_hide.png ) INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA}) diff --git a/resources/mesh_hide.png b/resources/mesh_hide.png new file mode 100644 index 0000000000000000000000000000000000000000..31c505d82d1b08a54ac666f380e47837c04a9247 GIT binary patch literal 344 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 WTb=;+;gt>m0000::iterator i_sc = _mapStudyContext.begin(); for ( ; i_sc != _mapStudyContext.end(); ++i_sc ) { - delete i_sc->second->myDocument; - delete i_sc->second; - } + StudyContextStruct* context = i_sc->second; + std::map < int, SMESH_Hypothesis * >::iterator i_hyp = context->mapHypothesis.begin(); + for ( ; i_hyp != context->mapHypothesis.end(); ++i_hyp ) + { + if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second )) + h->NullifyGen(); + } + delete context->myDocument; + delete context; + } } //============================================================================= diff --git a/src/SMESH/SMESH_Hypothesis.cxx b/src/SMESH/SMESH_Hypothesis.cxx index 2d1e10c16..c4107fb38 100644 --- a/src/SMESH/SMESH_Hypothesis.cxx +++ b/src/SMESH/SMESH_Hypothesis.cxx @@ -25,20 +25,18 @@ // Author : Paul RASCLE, EDF // Module : SMESH // -#include "SMESH_Hypothesis.hxx" + +#include "SMESH_Gen.hxx" #include "SMESHDS_Mesh.hxx" -#include "SMESH_Gen.hxx" +#include "SMESH_Hypothesis.hxx" #include "SMESH_Mesh.hxx" -#include "SMESH_subMesh.hxx" - -#include "utilities.h" using namespace std; //============================================================================= /*! - * + * */ //============================================================================= @@ -63,8 +61,11 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId, SMESH_Hypothesis::~SMESH_Hypothesis() { - StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); - myStudyContext->mapHypothesis[_hypId] = 0; + if ( _gen ) + { + StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); + myStudyContext->mapHypothesis[_hypId] = 0; + } } //============================================================================= @@ -77,20 +78,20 @@ int SMESH_Hypothesis::GetDim() const { int dim = 0; switch (_type) - { - case ALGO_1D: dim = 1; break; - case ALGO_2D: dim = 2; break; - case ALGO_3D: dim = 3; break; - case ALGO_0D: dim = 0; break; - case PARAM_ALGO: - dim = ( _param_algo_dim < 0 ) ? -_param_algo_dim : _param_algo_dim; break; - } + { + case ALGO_1D: dim = 1; break; + case ALGO_2D: dim = 2; break; + case ALGO_3D: dim = 3; break; + case ALGO_0D: dim = 0; break; + case PARAM_ALGO: + dim = ( _param_algo_dim < 0 ) ? -_param_algo_dim : _param_algo_dim; break; + } return dim; } //============================================================================= /*! - * + * */ //============================================================================= diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 0f08808d0..526b6c650 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -4020,8 +4020,8 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( SMESHOp::OpPropertiesArea, "MEASURE_AREA", "ICON_MEASURE_AREA" ); createSMESHAction( SMESHOp::OpPropertiesVolume, "MEASURE_VOLUME", "ICON_MEASURE_VOLUME" ); - createSMESHAction( SMESHOp::OpHide, "HIDE" ); - createSMESHAction( SMESHOp::OpShow, "SHOW" ); + createSMESHAction( SMESHOp::OpHide, "HIDE", "ICON_HIDE" ); + createSMESHAction( SMESHOp::OpShow, "SHOW", "ICON_SHOW" ); createSMESHAction( SMESHOp::OpShowOnly, "DISPLAY_ONLY" ); createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" ); diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index fde04d78c..9531e409f 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -631,5 +631,13 @@ ICON_MEASURE_BND_BOX mesh_bounding_box.png + + ICON_SHOW + mesh_show.png + + + ICON_HIDE + mesh_hide.png + diff --git a/src/SMESHUtils/SMESH_TypeDefs.hxx b/src/SMESHUtils/SMESH_TypeDefs.hxx index 77c095cc1..c9be990f6 100644 --- a/src/SMESHUtils/SMESH_TypeDefs.hxx +++ b/src/SMESHUtils/SMESH_TypeDefs.hxx @@ -169,6 +169,7 @@ struct SMESH_TNodeXYZ : public gp_XYZ double SquareDistance(const SMDS_MeshNode* n) const { return (SMESH_TNodeXYZ( n )-*this).SquareModulus(); } bool operator==(const SMESH_TNodeXYZ& other) const { return _node == other._node; } }; +typedef SMESH_TNodeXYZ SMESH_NodeXYZ; //-------------------------------------------------- /*! From d1bb1f5d44a2566316419a238a615bc4a69e7028 Mon Sep 17 00:00:00 2001 From: rnv Date: Fri, 31 Mar 2017 10:11:44 +0300 Subject: [PATCH 5/8] Windows compatibility. --- .../padder/meshjob/impl/SPADDERPluginTester_i.cxx | 11 ++++++----- .../padder/meshjob/impl/SPADDERPluginTester_i.hxx | 12 +++++++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx index e1cd4e7d2..10b5b94c8 100644 --- a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx +++ b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx @@ -146,11 +146,12 @@ bool SPADDERPluginTester_i::testsmesh(CORBA::Long studyId) // extern "C" { - PortableServer::ObjectId * SPADDERPluginTesterEngine_factory( CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) + SPADDERPLUGINTESTERENGINE_EXPORT PortableServer::ObjectId * + SPADDERPluginTesterEngine_factory( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) { MESSAGE("PortableServer::ObjectId * SPADDERPluginTesterEngine_factory()"); SPADDERPluginTester_i * myEngine = new SPADDERPluginTester_i(orb, poa, contId, instanceName, interfaceName); diff --git a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx index 36c7637fc..9a2193d55 100644 --- a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx +++ b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx @@ -22,13 +22,23 @@ #ifndef _SPADDER_PLUGINTESTER_HXX_ #define _SPADDER_PLUGINTESTER_HXX_ +#ifdef WIN32 + #if defined SPADDERPLUGINTESTERENGINE_EXPORTS || defined SPADDERPluginTesterEngine_EXPORTS + #define SPADDERPLUGINTESTERENGINE_EXPORT __declspec( dllexport ) + #else + #define SPADDERPLUGINTESTERENGINE_EXPORT __declspec( dllimport ) + #endif +#else + #define SPADDERPLUGINTESTERENGINE_EXPORT +#endif + // include the stubs generating from SPADDERPluginTest.idl #include #include CORBA_SERVER_HEADER(SPADDERPluginTest) #include #include "SALOME_Component_i.hxx" -class SPADDERPluginTester_i: +class SPADDERPLUGINTESTERENGINE_EXPORT SPADDERPluginTester_i: public virtual POA_SPADDERPluginTest::SPADDERPluginTester, public Engines_Component_i { From 1a3a88cfc996394b2c79f2cf374c8f3c4140f036 Mon Sep 17 00:00:00 2001 From: Robin DEGEILH Date: Thu, 6 Apr 2017 11:02:36 +0200 Subject: [PATCH 6/8] bug corrections in Zcracks for V83 --- src/Tools/ZCracksPlug/__init__.py | 16 ++-- src/Tools/ZCracksPlug/casTests/launchCas.py | 10 +-- src/Tools/ZCracksPlug/main.py | 87 ++++++++----------- src/Tools/ZCracksPlug/output.py | 4 +- src/Tools/ZCracksPlug/utilityFunctions.py | 93 ++------------------- 5 files changed, 60 insertions(+), 150 deletions(-) diff --git a/src/Tools/ZCracksPlug/__init__.py b/src/Tools/ZCracksPlug/__init__.py index 61ea883f4..4ae994c94 100644 --- a/src/Tools/ZCracksPlug/__init__.py +++ b/src/Tools/ZCracksPlug/__init__.py @@ -2,15 +2,20 @@ import sys, os, shutil, pickle, tempfile import main, genereCrack, Zset import utilityFunctions as uF +os.environ['QT_QPA_PLATFORM_PLUGIN_PATH']=os.path.join(os.environ['QTDIR'],'plugins','platforms') + +if 'MESHGEMSHOME' in os.environ: + meshgemsdir=os.environ['MESHGEMSHOME'] + if len(meshgemsdir) > 0: + meshgems=meshgemsdir.split(os.sep)[-1] + uF.removeFromSessionPath('LD_LIBRARY_PATH', meshgems) + #commande="/bin/bash -c ""source $HOME/zebulon/Z8.6.6_NEW/do_config_bash""" #os.system(commande) def IHM(): - try: - from PyQt5.QtWidgets import QApplication - except: - from PyQt4.QtGui import QApplication + from PyQt5.QtWidgets import QApplication app = QApplication(sys.argv) myapp = main.ShipHolderApplication() @@ -31,8 +36,7 @@ def SCRIPT(dataFile=None, data=None, dim=3, names=None): print data - tmpdir=tempfile.mkdtemp() - uF.removeFromSessionPath('LD_LIBRARY_PATH', 'Meshgems-2111') + tmpdir=tempfile.mkdtemp(prefix='tmpZcracks') if names==None: names={'saneGeoName':'salome_sane', 'crackGeoName':'salome_crack', 'crackedGeoName':'salome_cracked'} diff --git a/src/Tools/ZCracksPlug/casTests/launchCas.py b/src/Tools/ZCracksPlug/casTests/launchCas.py index e4a4d163c..4672776ec 100644 --- a/src/Tools/ZCracksPlug/casTests/launchCas.py +++ b/src/Tools/ZCracksPlug/casTests/launchCas.py @@ -18,13 +18,13 @@ import string #tmpdir = "/local00/home/B27118/projets/Zcracks/Zcracks/casTests/tmpdir" #if not os.path.isdir(tmpdir): os.mkdir(tmpdir) -tmpdir=tempfile.mktemp(prefix='tmpZcracks') +tmpdir=tempfile.mkdtemp(prefix='tmpZcracks') print "tmpdir=", tmpdir -meshgemsdir=os.environ('MESHGEMSHOME') -if len(meshgemsdir) > 0: - meshgems=string.split(meshgemsdir,os.sep)[-1] - uF.removeFromSessionPath('LD_LIBRARY_PATH', meshgems) +#meshgemsdir=os.environ('MESHGEMSHOME') +#if len(meshgemsdir) > 0: + #meshgems=string.split(meshgemsdir,os.sep)[-1] + #uF.removeFromSessionPath('LD_LIBRARY_PATH', meshgems) def LAUNCH(listCas=[]): if type(listCas)!=list: listCas=[listCas] diff --git a/src/Tools/ZCracksPlug/main.py b/src/Tools/ZCracksPlug/main.py index e4b3e526d..4d3384de0 100644 --- a/src/Tools/ZCracksPlug/main.py +++ b/src/Tools/ZCracksPlug/main.py @@ -1,13 +1,9 @@ import sys, pickle, tempfile, shutil from os import path, getpid, environ, remove, system -try: - from PyQt5.QtCore import * - from PyQt5.QtGui import * - from PyQt5.QtWidgets import * -except: - from PyQt4.QtCore import * - from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * import utilityFunctions as uF import genereCrack, Zset, output, zcracks_ui @@ -21,8 +17,6 @@ from zcracks_ui import Ui_Zui # --------------------- -uF.removeFromSessionPath('LD_LIBRARY_PATH', 'Meshgems-2111') - def stringToFloat(string, typ=float): if str(string).replace(' ','')=='': out=[] @@ -78,25 +72,6 @@ class ShipHolderApplication(QGroupBox): self.verbose=1 - #self.connect(self.ui.CBQuad, SIGNAL("toggled(bool)"),self.pressQuad) - #self.connect(self.ui.btReset, SIGNAL("clicked()"),self.pressReset) - #self.connect(self.ui.btCancel, SIGNAL("clicked()"),self.pressCancel) - #self.connect(self.ui.btApply, SIGNAL("clicked()"),self.pressApply) - #self.connect(self.ui.btApplyClose, SIGNAL("clicked()"),self.pressApplyClose) - #self.connect(self.ui.btLoad, SIGNAL("clicked()"),self.pressCharger) - #self.connect(self.ui.btSave, SIGNAL("clicked()"),self.pressSauver) - #self.connect(self.ui.btLoadCracked, SIGNAL("clicked()"),self.pressLoadCracked) - #self.connect(self.ui.btLoadSane, SIGNAL("clicked()"),self.pressLoadSane) - - #self.connect(self.ui.btGrVol, SIGNAL("clicked()"),self.pressLoadGroupVOL) - #self.connect(self.ui.btGrFace, SIGNAL("clicked()"),self.pressLoadGroupFACE) - #self.connect(self.ui.btGrEdge, SIGNAL("clicked()"),self.pressLoadGroupEDGE) - #self.connect(self.ui.btGrNode, SIGNAL("clicked()"),self.pressLoadGroupNODE) - #self.connect(self.ui.btGrAll, SIGNAL("clicked()"),self.pressLoadGroupALL) - #self.connect(self.ui.btVisu, SIGNAL("clicked()"),self.pressVisu) - - #self.connect(self.ui.CBAdvanced, SIGNAL("toggled(bool)"),self.pressAdvanced) - self.ui.CBQuad.toggled.connect(self.pressQuad) self.ui.btReset.clicked.connect(self.pressReset) self.ui.btCancel.clicked.connect(self.pressCancel) @@ -144,9 +119,9 @@ class ShipHolderApplication(QGroupBox): def pressQuad(self): if self.ui.CBQuad.isChecked(): self.ui.CBBarsoum.setEnabled(True) - self.ui.valGradation.setText(QString('2.3')) + self.ui.valGradation.setText('2.3') else: - self.ui.valGradation.setText(QString('1.3')) + self.ui.valGradation.setText('1.3') self.ui.CBBarsoum.setChecked(False) self.ui.CBBarsoum.setEnabled(False) @@ -162,10 +137,10 @@ class ShipHolderApplication(QGroupBox): tab=onglet.findChildren(QTableWidget)[0] for irow in range(tab.rowCount()): if tab.item(irow,0) != None: - tab.item(irow,0).setText(QString('')) - self.ui.valGradation.setText(QString('1.3')) - self.ui.valLayers.setText(QString('5')) - self.ui.valIterations.setText(QString('2')) + tab.item(irow,0).setText('') + self.ui.valGradation.setText('1.3') + self.ui.valLayers.setText('6') + self.ui.valIterations.setText('2') self.ui.CBIs2D.setChecked(False) self.ui.CBRefine.setChecked(False) @@ -257,7 +232,7 @@ class ShipHolderApplication(QGroupBox): fileNames = fileDiag.selectedFiles() filedef = fileNames[0] filedef = addExtension(str(filedef), 'med') - self.ui.valCrackedName.setText(QString(filedef)) + self.ui.valCrackedName.setText(filedef) def pressLoadSane(self): @@ -268,7 +243,7 @@ class ShipHolderApplication(QGroupBox): if fileDiag.exec_() : fileNames = fileDiag.selectedFiles() filedef = fileNames[0] - self.ui.valSaneName.setText(QString(filedef)) + self.ui.valSaneName.setText(filedef) def pressCharger(self): @@ -287,23 +262,15 @@ class ShipHolderApplication(QGroupBox): for cont, obj in enumerate(self.lineEditObjects): if self.lineEditTypes[cont] in [float, int]: - obj.setText(QString(self.data['TXT'+self.lineEditNames[cont]])) + obj.setText(self.data['TXT'+self.lineEditNames[cont]]) else: - obj.setText(QString(self.data[self.lineEditNames[cont]])) + obj.setText(self.data[self.lineEditNames[cont]]) self.ui.CBQuad.setChecked(True if 'quad' in self.data.keys() and self.data['quad'] else False) self.ui.CBBarsoum.setChecked(True if 'barsoum' in self.data.keys() and self.data['barsoum'] else False) self.ui.CBIs2D.setChecked(True if 'is2D' in self.data.keys() and self.data['is2D'] else False) self.ui.CBRefine.setChecked(True if 'refine' in self.data.keys() and self.data['refine'] else False) - - - - - #if self.data['quad']: self.ui.CBQuad.setChecked(True) - #if self.data['barsoum']: self.ui.CBBarsoum.setChecked(True) - #if self.data['is2D']: self.ui.CBIs2D.setChecked(True) - #if self.data['refine']: self.ui.CBRefine.setChecked(True) self.setTableParameters() @@ -451,7 +418,7 @@ class ShipHolderApplication(QGroupBox): if tab.item(irow,0) == None: item = QTableWidgetItem() tab.setItem(irow, 0, item) - tab.item(irow,0).setText(QString(self.data['TXTcrack'][str(self.ui.tabWidget.tabText(iongl))][str(label)])) + tab.item(irow,0).setText(self.data['TXTcrack'][str(self.ui.tabWidget.tabText(iongl))][str(label)]) if str(self.ui.tabWidget.tabText(iongl)) == self.data['TXTcrack']['actif']: self.ui.tabWidget.setCurrentWidget(onglet) @@ -475,19 +442,19 @@ class ShipHolderApplication(QGroupBox): for group in objetSain.GetGroups(): if (self.GroupToLoad in ['VOL','ALL']) and (group.GetType()==SMESH.VOLUME): - groupsVOL+=group.GetName().replace(' ','')+" " + groupsVOL+=self.cleanGroupName(group) nGr+=1 if (self.GroupToLoad in ['FACE','ALL']) and (group.GetType()==SMESH.FACE): - groupsFAC+=group.GetName().replace(' ','')+" " + groupsFAC+=self.cleanGroupName(group) nGr+=1 if (self.GroupToLoad in ['EDGE','ALL']) and (group.GetType()==SMESH.EDGE): - groupsEDG+=group.GetName().replace(' ','')+" " + groupsEDG+=self.cleanGroupName(group) nGr+=1 if (self.GroupToLoad in ['NODE','ALL']) and (group.GetType()==SMESH.NODE): - groupsNOD+=group.GetName().replace(' ','')+" " + groupsNOD+=self.cleanGroupName(group) nGr+=1 if groupsVOL!='': self.ui.valGrVol.setText(groupsVOL) @@ -503,6 +470,24 @@ class ShipHolderApplication(QGroupBox): remove(f) except: pass + + def cleanGroupName(self, group): + name=group.GetName() + while name.endswith(' '): name=name[:-1] + if ' ' in name: + message('A','%s group has a space in its name --> ignored' %name) + return('') + else: + return(name+" ") + + def checkNamesSpaces(self, names): + if type(names) is str: names=[names] + ok=True + for n in names: + if ' ' in n: + message('E','%s has a space in its name, please remove it' %n, goOn=True) + ok=False + return(ok) # --------------------------------- diff --git a/src/Tools/ZCracksPlug/output.py b/src/Tools/ZCracksPlug/output.py index 8a316b0dd..00b31f59f 100644 --- a/src/Tools/ZCracksPlug/output.py +++ b/src/Tools/ZCracksPlug/output.py @@ -22,9 +22,9 @@ class output(): pass f = open(self.tmpFile,'w') f.write('\n ------------------------------\n') - f.write(' | BIENVENU DANS L\'INTERFACE |\n') + f.write(' | BIENVENUE DANS L\'INTERFACE |\n') f.write(' | ZCRACKS DE SALOME |\n') - f.write(' | VERSION ALPHA |\n') + f.write(' | VERSION BETA |\n') f.write(' ------------------------------\n\n') f.close() diff --git a/src/Tools/ZCracksPlug/utilityFunctions.py b/src/Tools/ZCracksPlug/utilityFunctions.py index 36db72580..9571fd8d9 100644 --- a/src/Tools/ZCracksPlug/utilityFunctions.py +++ b/src/Tools/ZCracksPlug/utilityFunctions.py @@ -178,7 +178,13 @@ def extendElsets(meshFile, outFile=None): smesh = smeshBuilder.New(theStudy) ([mesh], status) = smesh.CreateMeshesFromMED(meshFile) - + + if mesh.NbVolumes()>0: + case2D=False + mesh.Reorient2DBy3D( [ mesh ], mesh, 1 ) + else: + case2D=True + mesh=cleanGroups(mesh) # Node color status @@ -339,91 +345,6 @@ def getMaxAspectRatio(tmpdir): return(float(maxAR)) -#def extendElsets(meshFile): - #if not path.isfile(meshFile): - #message('E','Mesh med file is not valid') - #return(-1) - - #import SMESH, salome - ##salome.salome_init() - #theStudy = salome.myStudy - #from salome.smesh import smeshBuilder - #smesh = smeshBuilder.New(theStudy) - - #([mesh], status) = smesh.CreateMeshesFromMED(meshFile) - - ## Node color status - #nodeList=mesh.GetNodesId() - #colorList=[0]*len(nodeList) - - ## Init using SIDE0 SIDE1 - #for group in mesh.GetGroups(): - #if group.GetType()==SMESH.FACE : - #color=0 - #if group.GetName()[0:4]=='SIDE0' : - #color=1 - #elif group.GetName()[0:4]=='SIDE1' : - #color=2 - #else : continue - ## Get faces - #faces=group.GetIDs() - ## Set faces nodes to given color - #for face_id in faces : - #for face_node_id in mesh.GetElemNodes(face_id) : - #colorList[face_node_id-1]=color - - ## Propagates color using elem connectivity - ## Always propagates max color - #volElemList=mesh.GetElementsByType(SMESH.VOLUME) - #ifChanged=True - #while ifChanged : - #ifChanged=False - #minColor=100 - #maxColor=0 - #for elemId in volElemList: - #for elemNodeId in mesh.GetElemNodes(elemId) : - #nodeColor=colorList[elemNodeId-1] - #if nodeColormaxColor : maxColor=nodeColor - #if minColor!=maxColor : - #ifChanged = True - #for elemNodeId in mesh.GetElemNodes(elemId) : - #colorList[elemNodeId-1]=maxColor - - #velem0 = [] - #velem1 = [] - #for elemId in volElemList: - #elemNodesId=mesh.GetElemNodes(elemId) - #elemColor=colorList[elemNodesId[0]-1] - #if(elemColor==1) : velem0.append(elemId) - #if(elemColor==2) : velem1.append(elemId) - - #mesh.MakeGroupByIds('SIDE_co',SMESH.VOLUME,velem0) - #mesh.MakeGroupByIds('SIDE_ext',SMESH.VOLUME,velem1) - - #surfElemList=mesh.GetElementsByType(SMESH.FACE) - #selem0 = [] - #selem1 = [] - #nbelem0=0 - #nbelem1=0 - - #for elemId in surfElemList: - #elemNodesId=mesh.GetElemNodes(elemId) - #elemColor=colorList[elemNodesId[0]-1] - #if(elemColor==1) : selem0.append(elemId) - #if(elemColor==2) : selem1.append(elemId) - - #mesh.MakeGroupByIds('SIDE_co',SMESH.FACE,selem0) - #mesh.MakeGroupByIds('SIDE_ext',SMESH.FACE,selem1) - - #maxAR=0. - #for elem in volElemList: - #maxAR=max(mesh.GetAspectRatio(elem),maxAR) - #for elem in surfElemList: - #maxAR=max(mesh.GetAspectRatio(elem),maxAR) - - #mesh.ExportMED(meshFile, 0, SMESH.MED_V2_2, 1, None ,1) - #return(maxAR) def removeFromSessionPath(envVar, patern): From 4fb165eddf1815e85ed74166bb66fc6e91907e0d Mon Sep 17 00:00:00 2001 From: rnv Date: Fri, 7 Apr 2017 15:34:57 +0300 Subject: [PATCH 7/8] Increment version: 8.3.0 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2d069f66..ef42ec11a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,11 +31,11 @@ ENDIF(WIN32) STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC) SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8) -SET(${PROJECT_NAME_UC}_MINOR_VERSION 2) +SET(${PROJECT_NAME_UC}_MINOR_VERSION 3) SET(${PROJECT_NAME_UC}_PATCH_VERSION 0) SET(${PROJECT_NAME_UC}_VERSION ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION}) -SET(${PROJECT_NAME_UC}_VERSION_DEV 1) +SET(${PROJECT_NAME_UC}_VERSION_DEV 0) # Common CMake macros # =================== From 3ac75b123496cc606f086fc9b6aeb89d3c03c732 Mon Sep 17 00:00:00 2001 From: uhz Date: Fri, 7 Apr 2017 17:09:46 +0200 Subject: [PATCH 8/8] Padder : fix RmaxRmin's variable name and update default values for NbIter and RmaxRmin --- src/Tools/padder/spadderpy/gui/inputdialog.py | 14 +++++++------- src/Tools/padder/spadderpy/gui/inputframe.ui | 8 ++++---- src/Tools/padder/spadderpy/gui/plugindialog.py | 2 +- .../padder/unittests/usecase_meshJobManager.py | 14 +++++++------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Tools/padder/spadderpy/gui/inputdialog.py b/src/Tools/padder/spadderpy/gui/inputdialog.py index 3fd0c7fa6..a05007792 100644 --- a/src/Tools/padder/spadderpy/gui/inputdialog.py +++ b/src/Tools/padder/spadderpy/gui/inputdialog.py @@ -42,9 +42,9 @@ INPUTDATA_KEY_FILES="meshfiles" INPUTDATA_KEY_PARAM="parameters" PARAM_KEY_NBITER = "NbIteration" -PARAM_KEY_RMINRMAX = "RminRmax" -PARAM_NBITER_DEFAULT_VALUE = 3 -PARAM_RMINRMAX_DEFAULT_VALUE = 1.5 +PARAM_KEY_RMAXRMIN = "RmaxRmin" +PARAM_NBITER_DEFAULT_VALUE = 10 +PARAM_RMAXRMIN_DEFAULT_VALUE = 3 class InputDialog(GenericDialog): @@ -125,7 +125,7 @@ class InputDialog(GenericDialog): # Setup default values for numerical parameters self.__ui.txtParamNbIter.setValue(PARAM_NBITER_DEFAULT_VALUE) - self.__ui.txtParamRminRmax.setValue(PARAM_RMINRMAX_DEFAULT_VALUE) + self.__ui.txtParamRmaxRmin.setValue(PARAM_RMAXRMIN_DEFAULT_VALUE) # Note that PADDER does not support group name longer than 8 # characters. We apply then this limit in the gui field. @@ -317,8 +317,8 @@ class InputDialog(GenericDialog): dictInputParameters = dictInputData[INPUTDATA_KEY_PARAM] if dictInputParameters.has_key(PARAM_KEY_NBITER): self.__ui.txtParamNbIter.setValue(dictInputParameters[PARAM_KEY_NBITER]) - if dictInputParameters.has_key(PARAM_KEY_RMINRMAX): - self.__ui.txtParamRminRmax.setValue(dictInputParameters[PARAM_KEY_RMINRMAX]) + if dictInputParameters.has_key(PARAM_KEY_RMAXRMIN): + self.__ui.txtParamRminRmax.setValue(dictInputParameters[PARAM_KEY_RMAXRMIN]) def getData(self): """ @@ -334,7 +334,7 @@ class InputDialog(GenericDialog): # Get the list of additionnal parameters dictInputParameters = {} dictInputParameters[PARAM_KEY_NBITER] = self.__ui.txtParamNbIter.value() - dictInputParameters[PARAM_KEY_RMINRMAX] = self.__ui.txtParamRminRmax.value() + dictInputParameters[PARAM_KEY_RMAXRMIN] = self.__ui.txtParamRmaxRmin.value() dictInputData[INPUTDATA_KEY_PARAM] = dictInputParameters return dictInputData diff --git a/src/Tools/padder/spadderpy/gui/inputframe.ui b/src/Tools/padder/spadderpy/gui/inputframe.ui index b1ba72d96..a8882f44c 100644 --- a/src/Tools/padder/spadderpy/gui/inputframe.ui +++ b/src/Tools/padder/spadderpy/gui/inputframe.ui @@ -111,7 +111,7 @@ - Béton + Beton @@ -213,9 +213,9 @@ - + - Rmin / Rmax + Rmax / Rmin @@ -227,7 +227,7 @@ - + diff --git a/src/Tools/padder/spadderpy/gui/plugindialog.py b/src/Tools/padder/spadderpy/gui/plugindialog.py index 7d010ceb7..4fec4e8d3 100644 --- a/src/Tools/padder/spadderpy/gui/plugindialog.py +++ b/src/Tools/padder/spadderpy/gui/plugindialog.py @@ -24,7 +24,7 @@ from qtsalome import QDialog, QIcon, Qt from plugindialog_ui import Ui_PluginDialog from inputdialog import InputDialog, INPUTDATA_KEY_FILES, INPUTDATA_KEY_PARAM -from inputdialog import PARAM_KEY_NBITER, PARAM_KEY_RMINRMAX +from inputdialog import PARAM_KEY_NBITER, PARAM_KEY_RMAXRMIN from inputdata import InputData # __GBO__: uncomment this line and comment the previous one to use the # demo input dialog instead of the real one. diff --git a/src/Tools/padder/unittests/usecase_meshJobManager.py b/src/Tools/padder/unittests/usecase_meshJobManager.py index 131e7c315..3f705458f 100644 --- a/src/Tools/padder/unittests/usecase_meshJobManager.py +++ b/src/Tools/padder/unittests/usecase_meshJobManager.py @@ -83,7 +83,7 @@ PADDERTESTDIR = getPadderTestDir(defaultConfig) # padder.cfg). # def test00_parameters(): - """Test using a concrete mesh and a single steelbar mesh""" + """Test using a concrete mesh and a single steelbar mesh""" file_concrete=os.path.join(spadder.getTestDataDir(),"concrete.med") file_steelbar=os.path.join(spadder.getTestDataDir(),"ferraill.med") @@ -109,7 +109,7 @@ def test01_parameters(): file_type=MESHJOB.MED_CONCRETE, group_name="concrete") meshJobFileList.append(param) - + medfile = os.path.join(datadir,"ferraill.med") param = MESHJOB.MeshJobFile(file_name=medfile, file_type=MESHJOB.MED_STEELBAR, @@ -121,7 +121,7 @@ def test01_parameters(): file_type=MESHJOB.MED_STEELBAR, group_name="ferrtran") meshJobFileList.append(param) - + return meshJobFileList def test02_parameters(): @@ -161,7 +161,7 @@ def test03_parameters(): meshJobFileList = test03_parameters() meshJobParameterList = [] -param = MESHJOB.MeshJobParameter(name="RminRmax",value="1.5") +param = MESHJOB.MeshJobParameter(name="RmaxRmin",value="1.5") meshJobParameterList.append(param) param = MESHJOB.MeshJobParameter(name="NbIteration",value="3") meshJobParameterList.append(param) @@ -174,7 +174,7 @@ if jobid<0: msg = component.getLastErrorMessage() print "ERR: %s"%msg sys.exit(1) - + created = False nbiter = 0 while not created: @@ -217,11 +217,11 @@ while not ended: ended=True time.sleep(0.5) nbiter+=1 - + if state not in end_states: print "ERR: jobid = "+str(jobid)+" ended abnormally with state="+str(state) msg = component.getLastErrorMessage() - print "ERR: %s"%msg + print "ERR: %s"%msg else: print "OK: jobid = "+str(jobid)+" ended with state="+str(state) meshJobResults = component.finalize(jobid)