smesh = smeshBuilder.New(theStudy)
-def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef):
+def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef, interpolMethod = 0):
"""
interpolZ takes a 2D (x,y) mesh and calls the active instance of module HYDRO
to interpolate the bathymetry/altimetry on the mesh nodes, to produce the Z value of each node.
dicoGroupeRegion: python dictionary giving the coorespondance of mesh groups to HYDRO regions.
Key: face group name, value: region name in the HYDRO Case
zUndef: Z value to use for nodes outside the regions (there must be none if the case is correct).
+ interpolMethod: integer value, default 0 = nearest point on bathymetry, 1 = linear interpolation
return <fichierMaillage>Z.med : med file with Z value on nodes
return <fichierMaillage>F.med : an exact copy of <fichierMaillage>Z.med
"""
([maillagePlat], status) = smesh.CreateMeshesFromMED(fichierMaillage)
groups = maillagePlat.GetGroups()
+ grpns = [grp for grp in groups if grp.GetType() == SMESH.NODE]
+ if len(grpns) == 0:
+ print "Problem! There are no groups of nodes in the mesh!"
+ print "Please create at least the groups of nodes corresponding to each region of the HYDRO case"
+ return {}
+
+
for grp in groups:
if grp.GetType() == SMESH.NODE:
grpName = grp.GetName()
#print xyz
vx.append(xyz[0])
vy.append(xyz[1])
- vz = cas.GetAltitudesForPoints( vx, vy, region )
+ vz = cas.GetAltitudesForPoints( vx, vy, region, interpolMethod )
minz = min(vz)
maxz = max(vz)
statz[grp.GetName()] = (minz, maxz)