Salome HOME
adaptation cas tests
[modules/hydro.git] / doc / salome / examples / h013_caseDigueManualMesh.py
index 234958df88c038db6ac318db550b8c7368a2ceb9..04289548a250e21753c5f75cbe359e1f24355b39 100644 (file)
@@ -8,14 +8,14 @@ import salome
 
 salome.salome_init()
 theStudy = salome.myStudy
-  
+
 #----------------------
-# --- HYDRO 
+# --- HYDRO
 #----------------------
 
 from HYDROPy import *
-from PyQt4.QtCore import *
-from PyQt4.QtGui import *
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
 
 hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() )
 
@@ -344,24 +344,42 @@ garonne_2.SetBoundaryPolyline( domaine );
 
 # Start the algorithm of the partition and assignment
 garonne_2.Update();
-garonne_2_litMineur = hydro_doc.FindObjectByName( "garonne_2_Reg_1" );
-garonne_2_Zone_1 = hydro_doc.FindObjectByName( "garonne_2_Zone_1" );
+
+garonne_2_litMineur = hydro_doc.FindObjectByName( "garonne_2_Reg_1" )
+garonne_2_Zone_1 = hydro_doc.FindObjectByName( "garonne_2_Zone_1" )
 garonne_2_Zone_1.SetMergeType( HYDROData_Zone.Merge_ZMIN )
-garonne_2_litMineur.AddZone( garonne_2_Zone_1 );
-garonne_2_riveDroite = hydro_doc.FindObjectByName( "garonne_2_Reg_2" );
-garonne_2_Zone_2 = hydro_doc.FindObjectByName( "garonne_2_Zone_2" );
-garonne_2_riveDroite.AddZone( garonne_2_Zone_2 );
-garonne_2_Zone_3 = hydro_doc.FindObjectByName( "garonne_2_Zone_3" );
-garonne_2_riveDroite.AddZone( garonne_2_Zone_3 );
-garonne_2_riveGauche = hydro_doc.FindObjectByName( "garonne_2_Reg_3" );
-garonne_2_Zone_4 = hydro_doc.FindObjectByName( "garonne_2_Zone_4" );
-garonne_2_riveGauche.AddZone( garonne_2_Zone_4 );
-garonne_2_Zone_5 = hydro_doc.FindObjectByName( "garonne_2_Zone_5" );
-garonne_2_riveGauche.AddZone( garonne_2_Zone_5 );
-garonne_2_digue = hydro_doc.FindObjectByName( "garonne_2_Reg_4" );
-garonne_2_Zone_6 = hydro_doc.FindObjectByName( "garonne_2_Zone_6" );
+garonne_2_Zone_1.SetColor( QColor( 192, 137, 64 ))
+garonne_2_litMineur.AddZone( garonne_2_Zone_1 )
+
+garonne_2_riveDroite = hydro_doc.FindObjectByName( "garonne_2_Reg_2" )
+garonne_2_Zone_2 = hydro_doc.FindObjectByName( "garonne_2_Zone_2" )
+garonne_2_Zone_2.SetColor( QColor( 64, 192, 98 ))
+garonne_2_riveDroite.AddZone( garonne_2_Zone_2 )
+
+garonne_2_Zone_3 = hydro_doc.FindObjectByName( "garonne_2_Zone_3" )
+garonne_2_Zone_3.SetMergeType( HYDROData_Zone.Merge_Object )
+Cloud_02 = hydro_doc.FindObjectByName( "Cloud_02" )
+garonne_2_Zone_3.SetMergeObject( Cloud_02 )
+garonne_2_Zone_3.SetColor( QColor( 64, 66, 192 ))
+garonne_2_riveDroite.AddZone( garonne_2_Zone_3 )
+
+garonne_2_riveGauche = hydro_doc.FindObjectByName( "garonne_2_Reg_3" )
+garonne_2_Zone_4 = hydro_doc.FindObjectByName( "garonne_2_Zone_4" )
+garonne_2_Zone_4.SetMergeType( HYDROData_Zone.Merge_Object )
+Cloud_02 = hydro_doc.FindObjectByName( "Cloud_02" )
+garonne_2_Zone_4.SetMergeObject( Cloud_02 )
+garonne_2_Zone_4.SetColor( QColor( 64, 192, 164 ))
+garonne_2_riveGauche.AddZone( garonne_2_Zone_4 )
+
+garonne_2_Zone_5 = hydro_doc.FindObjectByName( "garonne_2_Zone_5" )
+garonne_2_Zone_5.SetColor( QColor( 192, 149, 64 ))
+garonne_2_riveGauche.AddZone( garonne_2_Zone_5 )
+
+garonne_2_digue = hydro_doc.FindObjectByName( "garonne_2_Reg_4" )
+garonne_2_Zone_6 = hydro_doc.FindObjectByName( "garonne_2_Zone_6" )
 garonne_2_Zone_6.SetMergeType( HYDROData_Zone.Merge_ZMAX )
-garonne_2_digue.AddZone( garonne_2_Zone_6 );
+garonne_2_Zone_6.SetColor( QColor( 64, 192, 177 ))
+garonne_2_digue.AddZone( garonne_2_Zone_6 )
 
 garonne_2_litMineur.SetName("garonne_2_litMineur")
 garonne_2_riveDroite.SetName("garonne_2_riveDroite")
@@ -372,7 +390,7 @@ garonne_2_digue.SetName("garonne_2_digue")
 garonne_2_entry = garonne_2.Export( theStudy._get_StudyId() )
 
 #----------------------
-# --- Geometry 
+# --- Geometry
 #----------------------
 
 # Get geometry shape and print debug information
@@ -396,14 +414,14 @@ geompy.addToStudyInFather( HYDRO_garonne_2, litMineur, 'litMineur' )
 geompy.addToStudyInFather( HYDRO_garonne_2, riveDroite, 'riveDroite' )
 
 SectionsGaronne = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
-geompy.UnionIDs(SectionsGaronne, [4, 11])
+geompy.UnionIDs(SectionsGaronne, [7, 9])
 geompy.addToStudyInFather( HYDRO_garonne_2, SectionsGaronne, 'SectionsGaronne' )
 
 SectionsDigue = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
-geompy.UnionIDs(SectionsDigue, [46, 50])
+geompy.UnionIDs(SectionsDigue, [40, 35])
 geompy.addToStudyInFather( HYDRO_garonne_2, SectionsDigue, 'SectionsDigue' )
 
-# --- recreate subshapes already exported from HYDRO to get access from Python 
+# --- recreate subshapes already exported from HYDRO to get access from Python
 #garonne_2_domaineEtendu_Outer = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
 #geompy.UnionIDs(garonne_2_domaineEtendu_Outer, [4, 11, 17, 24, 26, 28, 14, 19, 20, 22, 31, 39, 41, 33, 35, 37])
 #garonne_2_digue_Left_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
@@ -417,13 +435,13 @@ geompy.addToStudyInFather( HYDRO_garonne_2, SectionsDigue, 'SectionsDigue' )
 #garonne_2_digue_Right_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
 #geompy.UnionIDs(garonne_2_digue_Right_Bank, [48])
 
-controlGeomProps(geompy, riveGauche,  39493.270283, 35845790.613557)
-controlGeomProps(geompy, digue,       10343.901103,   103037.738504)
+controlGeomProps(geompy, riveGauche,  39490.835288, 35845737.590926)
+controlGeomProps(geompy, digue,       10341.466108,   103090.760662)
 controlGeomProps(geompy, litMineur,   30337.548492,  3488480.304388)
 controlGeomProps(geompy, riveDroite,  32012.343241, 25998769.23615)
 
 #----------------------
-# --- Meshing 
+# --- Meshing
 #----------------------
 
 import  SMESH, SALOMEDS
@@ -506,9 +524,22 @@ digue_2 = garonne_2.GroupOnGeom(digue,'digue',SMESH.NODE)
 #bordDroiteDomaine_2 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE)
 SectionsGaronne_3 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE)
 
+
+med_file = r'/tmp/garonne_2.med'
+
+try:
+  os.remove(med_file)
+except OSError:
+  pass
+
 garonne_2.SetAutoColor( 1 )
-garonne_2.ExportMED( r'/tmp/garonne_2.med', 0, SMESH.MED_V2_2, 1, None ,1)
+garonne_2.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
 
+#controlMeshStats(garonne_2, 5247, 717, 10075)
+#controlSubMeshStats(litMineur_2, 2384)
+#controlSubMeshStats(riveDroite_1, 2348)
+#controlSubMeshStats(riveGauche_1, 5343)
+#controlSubMeshStats(digue_1, 0)
 controlMeshStats(garonne_2, 6190, 691, 12201)
 controlSubMeshStats(litMineur_2, 2384)
 controlSubMeshStats(riveDroite_1, 2400)