--- /dev/null
+
+def replace( lines, pattern, subst ):
+ for i in range( 0, len( lines ) ):
+ line = lines[i]
+ if pattern in lines[i]:
+ if isinstance( subst, list ):
+ del lines[i]
+ for s in subst:
+ new_line = line.replace( pattern, repr(s) )
+ lines.insert( i, new_line )
+ elif isinstance( subst, dict ):
+ del lines[i]
+ name = pattern[1:-1]
+ lines.insert( i, "%s = {}\n" % name )
+ keys = subst.keys()
+ keys.sort()
+ i = i+1
+ for k in keys:
+ v = subst[k]
+ lines.insert( i, "%s[%s] = %s\n" % (name, repr(k), repr(v) ) )
+ i = i+1
+ else:
+ new_line = line.replace( pattern, repr(subst) )
+ lines[i] = new_line
+
+
+def generate( path, calc_case, med_file, med_groups_regions, z_undef, interp ):
+ f = open( path, "w" )
+ tf = open( "interpolz.template", "r" )
+ templ = tf.readlines()
+
+ replace( templ, "<case_name_from_dlg>", calc_case )
+ replace( templ, "<MED_file_path_from_dlg>", med_file )
+ replace( templ, "<dictGroupRegion>", med_groups_regions )
+ replace( templ, "<z_undef_value_from_dlg>", z_undef )
+ replace( templ, "<interpolation_method_value_from_dlg>", interp )
+
+ for line in templ:
+ f.write( line )
+ f.close()
+
+
+
+generate( "test_interpolz.py", "case_1", "mesh.med", {"group_1":"reg_1", "group_2":"reg_2"}, -9999, "linear" )
--- /dev/null
+\94\94\94Z interpolation with HYDRO\94\94\94
+
+from salome.hydrotools.interpolZ import interpolZ
+
+# Calculation case name in HYDRO
+caseName = <case_name_from_dlg>
+
+# MED file 2D(x,y) of the case produced by SMESH
+medFile = <MED_file_path_from_dlg>
+
+# Dictionary [med group name] = region name
+<dictGroupRegion>
+
+# Value to use for Z when the node is not in a region (used to detect problems)
+zUndef = <z_undef_value_from_dlg>
+
+# Interpolation method
+interpolMethod = <interpolation_method_value_from_dlg>
+
+# Z interpolation on the bathymetry/altimetry on the mesh nodes
+statZ = interpolZ(caseName, medFile, dictGroupRegion, zUndef,interpolMethod)