Salome HOME
correction cas tests et traces
authorPaul RASCLE <paul.rascle@edf.fr>
Tue, 11 Apr 2017 07:53:38 +0000 (09:53 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Tue, 11 Apr 2017 07:53:38 +0000 (09:53 +0200)
doc/salome/examples/h011_normalCaseManualInterpolZ.py
doc/salome/examples/h014_caseDigueManualInterpolZ.py
doc/salome/examples/h015_normalCaseManualTelemac.py
doc/salome/examples/h017_interpolationLineaire.py
doc/salome/examples/h018_streamInterpolation.py
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_Entity.cxx
src/HYDROTools/controls.py
src/HYDROTools/interpolZ.py

index ec0a17ecab50207b538ae1a9df04d0c365c775fb..74231688224682f8d1b05557eaa82fbd8e71fe8e 100644 (file)
@@ -359,8 +359,6 @@ geompy.addToStudyInFather( HYDRO_garonne_1, bordDroiteDomaine, 'bordDroiteDomain
 # --- basic properties control: edges length, surfaces
 
 controlGeomProps(geompy, riveGauche,  29149.36918,  35948828.352061)
-#controlGeomProps(geompy, litMineur,   30337.5484919,  3263628.55399)
-#controlGeomProps(geompy, riveDroite,  32012.3432411, 26177085.4601)
 controlGeomProps(geompy, litMineur,   30337.548492,  3488480.304388)
 controlGeomProps(geompy, riveDroite,  32012.343241, 25998769.23615)
 
@@ -443,10 +441,6 @@ SectionsGaronne_3 = garonne_1.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMES
 garonne_1.SetAutoColor( 1 )
 garonne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
 
-#controlMeshStats(garonne_1, 1763, 180, 3360)
-#controlSubMeshStats(litMineur_2, 48)
-#controlSubMeshStats(riveDroite_1, 1360)
-#controlSubMeshStats(riveGauche_1, 1952)
 controlMeshStats(garonne_1, 3888, 475, 7597)
 controlSubMeshStats(litMineur_2, 2384)
 controlSubMeshStats(riveDroite_1, 2342)
@@ -478,7 +472,10 @@ zUndef = 90
 
 # --- Z interpolation on the bathymety/altimetry on the mesh nodes
 statz = interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef)
-refstatz = {'riveDroite': (10.88, 32.61), 'riveGauche': (7.72, 71.86, 0.5), 'litMineur': (2.06, 25.41)}
+#print statz
+refstatz = {'riveDroite': (10.88, 32.61, 24.17, 5.12, 17.57, 31.33, 0.2),
+            'riveGauche': (7.72, 71.86, 24.51, 12.18, 12.90, 60.36, 0.2),
+             'litMineur': (2.06, 25.41, 13.93, 4.33, 8.47, 21.78)}
 controlStatZ(statz, refstatz)
 
 # --- add a field on nodes of type double with z values, named "BOTTOM"
index d5469b30eaf4a6474a04e52da3f8490f880158f2..d7b99c2322fc6361cb95ab1f9e6ed8618bd24938 100644 (file)
@@ -421,20 +421,6 @@ SectionsDigue = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
 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,  39490.835288, 35845737.590926)
 controlGeomProps(geompy, digue,       10341.466108,   103090.760662)
 controlGeomProps(geompy, litMineur,   30337.548492,  3488480.304388)
@@ -496,12 +482,6 @@ isDone = garonne_2.SplitQuadObject( garonne_2, 1 )
 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)
 
@@ -512,16 +492,10 @@ riveDroite_1 = garonne_2.GroupOnGeom(riveDroite,'riveDroite',SMESH.FACE)
 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)
 
 
@@ -536,11 +510,6 @@ except OSError:
 garonne_2.SetAutoColor( 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)
@@ -574,7 +543,11 @@ zUndef = 90
 
 # --- Z interpolation on the bathymety/altimetry on the mesh nodes
 statz = interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef)
-refstatz = {'riveDroite': (10.88, 32.61), 'riveGauche': (7.72, 71.86, 0.5), '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, 71.39, 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"
index fb40ad449c9060502035d6397706ee734c3add0f..a7bb594e822328a6e49bcdb146cd8d36a6099267 100644 (file)
@@ -475,7 +475,10 @@ zUndef = 80
 
 # --- Z interpolation on the bathymety/altimetry on the mesh nodes
 statz = interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef)
-refstatz = {'riveDroite': (10.88, 32.61), 'riveGauche': (7.72, 71.86, 0.5), 'litMineur': (2.06, 25.41)}
+#print statz
+refstatz = {'riveDroite': (10.88, 32.61, 24.17, 5.12, 17.57, 31.33, 0.2),
+            'riveGauche': (7.72, 71.86, 24.51, 12.18, 12.90, 60.36, 0.2),
+             'litMineur': (2.06, 25.41, 13.93, 4.33, 8.47, 21.78)}
 controlStatZ(statz, refstatz)
 
 # --- add a field on nodes of type double with z values, named "BOTTOM"
index 471471e1e7f91c506ccb3ad93bfa44920d2d533f..88e77ad7cfff65f9361b216344466999f00c0f04 100644 (file)
@@ -282,10 +282,6 @@ import SALOMEDS
 
 geompy = geomBuilder.New(theStudy)
 
-#geomObj_1 = geompy.CreateGroup(HYDRO_etude, geompy.ShapeType["EDGE"])
-#geompy.UnionIDs(geomObj_1, [7, 9])
-#geomObj_3 = geompy.CreateGroup(HYDRO_etude, geompy.ShapeType["EDGE"])
-#geompy.UnionIDs(geomObj_3, [4, 11, 17, 24, 26, 28, 14, 19, 20, 22, 31, 39, 41, 33, 35, 37])
 etude_domaine_Outer = geompy.CreateGroup(HYDRO_etude_1, geompy.ShapeType["EDGE"])
 geompy.UnionIDs(etude_domaine_Outer, [3, 6, 8, 10])
 domaine = geompy.CreateGroup(HYDRO_etude_1, geompy.ShapeType["FACE"])
@@ -369,7 +365,8 @@ zUndef = 90
 
 # --- Z interpolation Z sur la bathymetrie/altimetrie aux noeuds du maillage
 statz = interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef, interpolMethod)
-refstatz = {'domaine': (27.101, 168.257)}
+#print statz
+refstatz = {'domaine': (27.10, 168.28, 91.77, 46.047, 28.637, 161.17)}
 controlStatZ(statz, refstatz)
 
 # --- add a field on nodes of type double with z values, named "BOTTOM"
index f606b7dc124006d873c2dcaf1832a1472c37f576..04cb1ba46159f128b1952e84a664c3d0b6c1e815 100644 (file)
@@ -474,7 +474,10 @@ zUndef = 110
 
 # --- Z interpolation on the bathymety/altimetry on the mesh nodes
 statz = interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef)
-refstatz = {'riveDroite': (99.8278, 100.8), 'riveGauche': (100.0, 100.0), 'litMineur': (80.4541, 100.8)}
+#print statz
+refstatz = {'riveDroite': (99.83, 100.80, 100.09, 0.21, 99.98, 100.64),
+            'riveGauche': (100.0, 100.0, 100.0, 0.0, 100.0, 100.0),
+            'litMineur': (80.45, 100.80, 92.85, 4.83, 84.43, 100.0)}
 controlStatZ(statz, refstatz)
 
 # --- add a field on nodes of type double with z values, named "BOTTOM"
index c8e80a8e47813801b9ba440e157504671ccd4d3c..6db6d6462a27f3365c09bc1b81a1bd50e3605f39 100644 (file)
@@ -804,7 +804,7 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
       }
       else
       {
-       DEBTRACE("aZoneInterpolator == NULL");
+       //DEBTRACE("aZoneInterpolator == NULL");
         aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint );
       }
     }
index 79444df5ae8c18a65365d170c783d2ae2aec16f7..a8222673200ca513b032e57beb941ce7a15c1930 100644 (file)
@@ -489,7 +489,7 @@ void HYDROData_Entity::SetReferenceObjects( const HYDROData_SequenceOfObjects& t
 Handle(HYDROData_Entity) HYDROData_Entity::GetReferenceObject( const int theTag,
                                                                const int theIndex ) const
 {
-  DEBTRACE("GetReferenceObject " << theTag << " " << theIndex);
+  //DEBTRACE("GetReferenceObject " << theTag << " " << theIndex);
   Handle(HYDROData_Entity) aRes;
 
   Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
@@ -579,7 +579,7 @@ void HYDROData_Entity::ClearReferenceObjects( const int theTag )
 Handle(TDataStd_ReferenceList) HYDROData_Entity::getReferenceList( const int theTag,
                                                                    const bool theIsCreate ) const
 {
-  DEBTRACE("getReferenceList " << theTag << " " << theIsCreate);
+  //DEBTRACE("getReferenceList " << theTag << " " << theIsCreate);
   TDF_Label aLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
 
   Handle(TDataStd_ReferenceList) aRefs;
index ff1f418efc6acf7ccdb345b5ea5a41788fa15686..72246bc44133406dfb07011d1b3a2f3f71608033 100644 (file)
@@ -67,22 +67,28 @@ def controlSubMeshStats(aSubMesh, nbItems):
 
 def controlStatZ(statz,refstatz):
   """
-  Compare min and max of z of regions with a reference,
-  with a precision of 0.05m by default.
+  Compare min, max, mean, standard deviation, percentile 5 and 95 of z of regions with a reference,
+  with a precision of 0.05m by default and 1.0m for min and max.
   """
   for nomreg, valsref in refstatz.iteritems():
     vals = statz[nomreg]
-    tolerance =0.05
-    if len(valsref) > 2:
-      tolerance = valsref[2]
-    if abs(vals[0] - valsref[0]) > tolerance \
-    or abs(vals[1] - valsref[1]) > tolerance:
+    tolerance =0.1
+    if len(valsref) > 6:
+      tolerance = valsref[6]
+    if abs(vals[0] - valsref[0]) > 10*tolerance \
+    or abs(vals[1] - valsref[1]) > 10*tolerance \
+    or abs(vals[2] - valsref[2]) > tolerance \
+    or abs(vals[3] - valsref[3]) > tolerance \
+    or abs(vals[4] - valsref[4]) > 10*tolerance \
+    or abs(vals[5] - valsref[5]) > 10*tolerance :
       print nomreg
-      print "value: ", vals, " reference: ", valsref, "tolerance: ", tolerance
+      print "value: ", vals
+      print "reference: ", valsref, "tolerance for mean, std dev: ", tolerance, "and ", 10*tolerance, "for other values"
       raise ValueError("z interpolation error")
     else:
       print nomreg
-      print "value: ", vals, " reference: ", valsref, "tolerance: ", tolerance, " OK"
+      print "value: ", vals
+      print "reference: ", valsref, "tolerance for mean, std dev: ", tolerance, "and ", 10*tolerance, "for other values: OK"
 
 
 import MEDLoader
index 946ad23d477fd023ae2f4fe1c0555a49dac63fdc..bf6a48eedfea40fb08e4d407d76f44a3e94a0c42 100644 (file)
@@ -36,6 +36,8 @@ salome.salome_init()
 theStudy = salome.myStudy
 theStudyId = salome.myStudyId
 
+import numpy as np
+
 # -----------------------------------------------------------------------------
 
 from med import medfile
@@ -225,9 +227,14 @@ def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef, interpolMethod
       vx.append(xyz[0])
       vy.append(xyz[1])
     vz = cas.GetAltitudesForPoints( vx, vy, region, interpolMethod )
-    minz = min(vz)
-    maxz = max(vz)
-    statz[grp.GetName()] = (minz, maxz)
+    minz = np.amin(vz)
+    maxz = np.amax(vz)
+    meanz = np.mean(vz)
+    stdz = np.std(vz)
+    v05z = np.percentile(vz,05)
+    v95z = np.percentile(vz,95)
+    
+    statz[grp.GetName()] = (minz, maxz, meanz, stdz, v05z, v95z)
 
 
     for i,nodeId in enumerate(nodesIds):