/[escript]/branches/symbolic_from_3470/dudley/test/python/OutTest.py
ViewVC logotype

Diff of /branches/symbolic_from_3470/dudley/test/python/OutTest.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3788 by caltinay, Tue Mar 15 04:23:54 2011 UTC revision 3789 by caltinay, Tue Jan 31 04:55:05 2012 UTC
# Line 37  def  writeInFormat(fs,format,filetype): Line 37  def  writeInFormat(fs,format,filetype):
37          x=length(fs.getX())          x=length(fs.getX())
38          # generate scalar data:          # generate scalar data:
39          filename="%s/scalar.%s.%s"%(work_dir,filetype,format)          filename="%s/scalar.%s.%s"%(work_dir,filetype,format)
40          print "file ",filename," is generated"          print("file ",filename," is generated")
41          try:          try:
42             eval("x.save%s(\"%s\")"%(format.upper(),filename))             eval("x.save%s(\"%s\")"%(format.upper(),filename))
43          except StandardError, msg:          except Exception as msg:
44             print "%% failed because of ",msg             print("%% failed because of ",msg)
45          # generate vector data:          # generate vector data:
46          print "file ",filename," is generated"          print("file ",filename," is generated")
47          filename="%s/vector.%s.%s"%(work_dir,filetype,format)          filename="%s/vector.%s.%s"%(work_dir,filetype,format)
48          if d==2:          if d==2:
49             m=[1.,2.]             m=[1.,2.]
# Line 51  def  writeInFormat(fs,format,filetype): Line 51  def  writeInFormat(fs,format,filetype):
51             m=[1.,2.,3.]             m=[1.,2.,3.]
52          try:          try:
53             eval("(x*m).save%s(\"%s\")"%(format.upper(),filename))             eval("(x*m).save%s(\"%s\")"%(format.upper(),filename))
54          except StandardError, msg:          except Exception as msg:
55             print "%% failed because of ",msg             print("%% failed because of ",msg)
56          # generate tensor data:          # generate tensor data:
57          filename="%s/tensor.%s.%s"%(work_dir,filetype,format)          filename="%s/tensor.%s.%s"%(work_dir,filetype,format)
58          print "file ",filename," is generated"          print("file ",filename," is generated")
59          if d==2:          if d==2:
60             m=[[11.,12.],[21.,22.]]             m=[[11.,12.],[21.,22.]]
61          else:          else:
62             m=[[11.,12.,13.],[21.,22.,23.],[31.,32.,33.]]             m=[[11.,12.,13.],[21.,22.,23.],[31.,32.,33.]]
63          try:          try:
64             eval("(x*m).save%s(\"%s\")"%(format.upper(),filename))             eval("(x*m).save%s(\"%s\")"%(format.upper(),filename))
65          except StandardError, msg:          except Exception as msg:
66             print "%% failed because of ",msg             print("%% failed because of ",msg)
67    
68  for format in ["vtk","dx"]:  for format in ["vtk","dx"]:
69     for d in [2,3]:     for d in [2,3]:

Legend:
Removed from v.3788  
changed lines
  Added in v.3789

  ViewVC Help
Powered by ViewVC 1.1.26