def controlGeomProps(geompy, geomShape, refLength, refArea):
"""
compare area and length of a geometric face with a reference,
- with relative precision of 1.E-3
+ with relative precision of 1.E-3
"""
props = geompy.BasicProperties(geomShape)
print " Wires length: ", props[0]
print " Wires length: ", refLength
print " Surface area: ", refArea
print " Volume : ", 0.
- raise ValueError("Bad length or area")
+ raise ValueError("Bad length or area")
# -------------------------------------
references['Entity_Node'] = nbNodes
references['Entity_Edge'] = nbEdges
references['Entity_Triangle'] = nbTriangles
-
+
mesures = aMesh.GetMeshInfo()
#print mesures
d= {}
or (d[key] > (1.0 + tolerance)*references[key]):
print aMesh.GetName()
print key, ": value: ", d[key], " reference: ", references[key]
- raise ValueError("Bad number of nodes or elements")
-
+ raise ValueError("Bad number of nodes or elements")
+
# -------------------------------------
def controlSubMeshStats(aSubMesh, nbItems):
if (nbItems < (1.0 - tolerance)*nbRef) \
or (nbItems > (1.0 + tolerance)*nbRef):
print aSubMesh.GetName()
- print "value: ", nbItems, " reference: ", nbRef
- raise ValueError("Bad number of nodes or elements")
-
+ print "value: ", nbRef, " reference: ", nbItems
+ raise ValueError("Bad number of nodes or elements")
+
# -------------------------------------
def controlStatZ(statz,refstatz):
"""
- Compare min and max of z of regions with a reference,
- with a precision of 0.05m.
+ 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.
"""
- tolerance = 0.05 # metres
for nomreg, valsref in refstatz.iteritems():
vals = statz[nomreg]
- 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
- raise ValueError("z interpolation error")
-
-from MEDLoader import MEDLoader, MEDCouplingFieldDouble, ON_NODES, DataArrayDouble, MEDFileMesh
+ 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
+ print "reference: ", valsref, "tolerance for mean, std dev: ", tolerance, "and ", 10*tolerance, "for other values: OK"
+
+
+import MEDLoader
+from MEDLoader import MEDCouplingFieldDouble, ON_NODES, DataArrayDouble, MEDFileMesh
import os, time
def controlTelemacResult(aMedFile, refs):
print nomreg
print "value: ", vals, " reference: ", valsref
raise ValueError("error in Telemac result")
-
+