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() )
# 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")
garonne_2_entry = garonne_2.Export( theStudy._get_StudyId() )
#----------------------
-# --- Geometry
+# --- Geometry
#----------------------
# Get geometry shape and print debug information
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
-#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"])
-#geompy.UnionIDs(garonne_2_digue_Left_Bank, [43])
-#garonne_2_digue_Outlet = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
-#geompy.UnionIDs(garonne_2_digue_Outlet, [46])
-#garonne_2_digue_Inlet = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
-#geompy.UnionIDs(garonne_2_digue_Inlet, [50])
-#garonne_2_litMineur_Outer = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
-#geompy.UnionIDs(garonne_2_litMineur_Outer, [7, 9])
-#garonne_2_digue_Right_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
-#geompy.UnionIDs(garonne_2_digue_Right_Bank, [48])
-
-controlGeomProps(geompy, riveGauche, 39489.5116033, 35889668.8348)
-controlGeomProps(geompy, digue, 10340.1424233, 102887.6201)
-controlGeomProps(geompy, litMineur, 30337.5484919, 3646827.74981)
-controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601)
+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
isDone = garonne_2.ReorientObject( garonne_2 )
# --- geometrical groups of edges
-#garonne_2_litMineur_Outer_1 = garonne_2.GroupOnGeom(garonne_2_litMineur_Outer,'garonne_2_litMineur_Outer',SMESH.EDGE)
-#garonne_2_domaineEtendu_Outer_1 = garonne_2.GroupOnGeom(garonne_2_domaineEtendu_Outer,'garonne_2_domaineEtendu_Outer',SMESH.EDGE)
-#aval_1 = garonne_2.GroupOnGeom(aval,'aval',SMESH.EDGE)
-#amont_1 = garonne_2.GroupOnGeom(amont,'amont',SMESH.EDGE)
-#bordGaucheDomaine_1 = garonne_2.GroupOnGeom(bordGaucheDomaine,'bordGaucheDomaine',SMESH.EDGE)
-#bordDroiteDomaine_1 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.EDGE)
SectionsGaronne_2 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.EDGE)
SectionsDigue_2 = garonne_2.GroupOnGeom(SectionsDigue,'SectionsDigue',SMESH.EDGE)
digue_1 = garonne_2.GroupOnGeom(digue,'digue',SMESH.FACE)
# --- geometrical groups of nodes
-#garonne_2_litMineur_Outer_2 = garonne_2.GroupOnGeom(garonne_2_litMineur_Outer,'garonne_2_litMineur_Outer',SMESH.NODE)
-#garonne_2_domaineEtendu_Outer_2 = garonne_2.GroupOnGeom(garonne_2_domaineEtendu_Outer,'garonne_2_domaineEtendu_Outer',SMESH.NODE)
riveGauche_2 = garonne_2.GroupOnGeom(riveGauche,'riveGauche',SMESH.NODE)
litMineur_3 = garonne_2.GroupOnGeom(litMineur,'litMineur',SMESH.NODE)
riveDroite_2 = garonne_2.GroupOnGeom(riveDroite,'riveDroite',SMESH.NODE)
digue_2 = garonne_2.GroupOnGeom(digue,'digue',SMESH.NODE)
-#aval_2 = garonne_2.GroupOnGeom(aval,'aval',SMESH.NODE)
-#amont_2 = garonne_2.GroupOnGeom(amont,'amont',SMESH.NODE)
-#bordGaucheDomaine_2 = garonne_2.GroupOnGeom(bordGaucheDomaine,'bordGaucheDomaine',SMESH.NODE)
-#bordDroiteDomaine_2 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE)
SectionsGaronne_3 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE)
-med_file = r'/garonne_2.med'
+med_file = r'/tmp/garonne_2.med'
try:
os.remove(med_file)
garonne_2.SetAutoColor( 1 )
garonne_2.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
-controlMeshStats(garonne_2, 5247, 717, 10075)
+controlMeshStats(garonne_2, 6190, 691, 12201)
controlSubMeshStats(litMineur_2, 2384)
-controlSubMeshStats(riveDroite_1, 2348)
-controlSubMeshStats(riveGauche_1, 5343)
-controlSubMeshStats(digue_1, 0)
+controlSubMeshStats(riveDroite_1, 2400)
+controlSubMeshStats(riveGauche_1, 6585)
+controlSubMeshStats(digue_1, 832)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
#----------------------
-# --- Z interpolation with HYDRO
+# --- Z interpolation with HYDRO
#----------------------
from salome.hydrotools.interpolZ import interpolZ, createZfield2
riveGauche = 'garonne_2_riveGauche',
digue = 'garonne_2_digue',
)
-# --- value to use for Z when the node is not in a region (used to detect problems)
+# --- value to use for Z when the node is not in a region (used to detect problems)
zUndef = 90
# --- Z interpolation on the bathymety/altimetry on the mesh nodes
statz = interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef)
-refstatz = {'riveDroite': (10.88, 32.47999954), 'riveGauche': (7.72, 71.38999939), 'litMineur': (2.06, 25.41), 'digue': (14.10,27.09)}
+#print statz
+refstatz = {'riveDroite': (10.88, 32.61, 24.09, 5.13, 17.57, 31.33, 0.2),
+ 'riveGauche': (7.72, 72.40, 21.59, 8.37, 16.71, 35.71, 0.2),
+ 'litMineur': (2.06, 25.41, 13.93, 4.33, 8.47, 21.78),
+ 'digue': (14.10, 27.09, 22.01, 2.56, 18.15, 25.02)}
controlStatZ(statz, refstatz)
# --- add a field on nodes of type double with z values, named "BOTTOM"