]> SALOME platform Git repositories - modules/hydrosolver.git/commitdiff
Salome HOME
fix boundary condition dialog
authorPaul RASCLE <paul.rascle@edf.fr>
Wed, 29 Mar 2017 15:08:23 +0000 (17:08 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Wed, 29 Mar 2017 15:08:23 +0000 (17:08 +0200)
src/HYDROGUI/BndConditionsDialog.py
tests/data/bnd_conditions_presets.txt

index 4baad5b1a52c06904a366f6cfdcf4f0e344a5417..9cc7dfc27b133171d26dea8e0725a66deed625e5 100755 (executable)
@@ -186,9 +186,14 @@ class BoundaryConditionsDialog(QDialog):
     def on_apply(self):
         # Save boundary conditions file
         if not self.is_valid():
+            print 'Not valid'
             return False
 
-        file_path = self.resultBndConditionsFileEdit.text()
+        if self.sameAsInputCB.isChecked():
+          file_path = self.bndConditionsFileEdit.text()
+        else:
+          file_path = self.resultBndConditionsFileEdit.text()
+        print 'File path:', file_path
         writer = boundaryConditions.BoundaryConditionWriter(file_path)
 
         conditions = []
@@ -198,7 +203,8 @@ class BoundaryConditionsDialog(QDialog):
             livbor = str(self.boundaryConditionsTable.item(row_nb, 3).text())
             litbor = str(self.boundaryConditionsTable.item(row_nb, 4).text())
             group_name = str(self.boundaryConditionsTable.item(row_nb, 5).text())
-            conditions.append(boundaryConditions.BoundaryCondition(lihbor, liubor, livbor, litbor, group_name))
+            if lihbor != "":
+              conditions.append(boundaryConditions.BoundaryCondition(lihbor, liubor, livbor, litbor, group_name))
 
         writer.write(conditions)
 
@@ -260,12 +266,9 @@ class BoundaryConditionsDialog(QDialog):
 
         if preset and self.presets.has_key(preset):
             values = self.presets[preset]
-            row_nb, is_ok = combo.property(ROW_PROPERTY_NAME).toInt()
-
-            if is_ok and row_nb >= 0 and row_nb < self.boundaryConditionsTable.rowCount():
-            #row_nb = combo.property(ROW_PROPERTY_NAME)
+            row_nb = combo.property(ROW_PROPERTY_NAME)
 
-            #if row_nb >= 0 and row_nb < self.boundaryConditionsTable.rowCount():
+            if row_nb >= 0 and row_nb < self.boundaryConditionsTable.rowCount():
                 lihbor = values[0]
                 liubor = values[1]
                 livbor = values[2]
@@ -375,15 +378,17 @@ class BoundaryConditionsDialog(QDialog):
         elif len(self.get_output_path())==0:
             QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Output file path is empty."))
         else:
-            has_empty_cells = False
+            has_empty_cells = True
             for row_nb in xrange(0, self.boundaryConditionsTable.rowCount()):
                 lihbor = str(self.boundaryConditionsTable.item(row_nb, 1).text())
                 liubor = str(self.boundaryConditionsTable.item(row_nb, 2).text())
                 livbor = str(self.boundaryConditionsTable.item(row_nb, 3).text())
                 litbor = str(self.boundaryConditionsTable.item(row_nb, 4).text())
 
-                if (not lihbor) or (not liubor) or (not livbor) or (not litbor):
-                    has_empty_cells = True
+                if lihbor and liubor and livbor and litbor:
+                    has_empty_cells = False # Full lines are OK
+                if (not lihbor) and (not liubor) and (not livbor) and (not litbor):
+                    has_empty_cells = False # Empty lines are OK
                     break
 
             if has_empty_cells:
index eb9a37b34c1a000a9bfc75442cdbbd8a2fe7b7e8..25b07c6a2247dae36ee93840ea6692822278a4ad 100644 (file)
@@ -1,4 +1,3 @@
 Closed boundaries/walls,2,2,2,2
-Incident waves,1,1,1,*
-Free T,*,*,*,4
-
+Imposed flow rate,4,5,5,5
+Imposed water level,5,4,4,4