/[escript]/trunk/doc/examples/pyvisi/seriesofreads.py
ViewVC logotype

Diff of /trunk/doc/examples/pyvisi/seriesofreads.py

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

revision 1147 by ksteube, Wed May 16 06:39:11 2007 UTC revision 1148 by jongui, Wed May 16 22:45:33 2007 UTC
# Line 1  Line 1 
1  # Import the necessary modules.  # Import the necessary modules.
2  from esys.pyvisi import Scene, DataCollector, Contour, Camera  from esys.pyvisi import Scene, DataCollector, Contour, Camera
3  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
4    import os
5    
6  PYVISI_EXAMPLE_MESHES_PATH = "data_meshes/"  PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
7  PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images/"  PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
8  X_SIZE = 400  X_SIZE = 400
9  Y_SIZE = 300  Y_SIZE = 300
10    
# Line 24  s = Scene(renderer = JPG_RENDERER, num_v Line 25  s = Scene(renderer = JPG_RENDERER, num_v
25  # be assigned when the DataCollector is created, although the same file is  # be assigned when the DataCollector is created, although the same file is
26  # read again in the for-loop.    # read again in the for-loop.  
27  dc1 = DataCollector(source = Source.XML)  dc1 = DataCollector(source = Source.XML)
28  dc1.setFileName(file_name = PYVISI_EXAMPLE_MESHES_PATH + FIRST_FILE_NAME)  dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
29            FIRST_FILE_NAME))
30  dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_1)  dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_1)
31    
32  # Create a Contour.  # Create a Contour.
# Line 37  mosc1.generateContours(0) Line 39  mosc1.generateContours(0)
39  # file must always be assigned when the DataCollector is created,  # file must always be assigned when the DataCollector is created,
40  # although the same file is read again in the for-loop.    # although the same file is read again in the for-loop.  
41  dc2 = DataCollector(source = Source.XML)  dc2 = DataCollector(source = Source.XML)
42  dc2.setFileName(file_name = PYVISI_EXAMPLE_MESHES_PATH + FIRST_FILE_NAME)  dc2.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
43            FIRST_FILE_NAME))
44  dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)  dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)
45    
46  # Create a second Contour.  # Create a second Contour.
# Line 47  mosc2 = Contour(scene = s, data_collecto Line 50  mosc2 = Contour(scene = s, data_collecto
50  mosc2.generateContours(0)  mosc2.generateContours(0)
51    
52  # Create a Camera.  # Create a Camera.
53  cam1 = Camera(scene = s, data_collector = dc1, viewport = Viewport.SOUTH_WEST)  cam1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
54    
55  # Read in one file one after another and render the object.  # Read in one file one after another and render the object.
56  for i in range(99, 104):  for i in range(99, 104):
57      dc1.setFileName(file_name =  PYVISI_EXAMPLE_MESHES_PATH + FILE_2D +      dc1.setFileName(file_name =  os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
58              "%04d.vtu" % i)              FILE_2D + "%04d.vtu") % i)
59      dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_1)      dc2.setFileName(file_name =  os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
60      dc2.setFileName(file_name =  PYVISI_EXAMPLE_MESHES_PATH + FILE_2D +              FILE_2D + "%04d.vtu") % i)
             "%04d.vtu" % i)  
     dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)  
61    
62      s.render(PYVISI_EXAMPLE_IMAGES_PATH + IMAGE_NAME + "%04d.jpg" % i)      s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, \
63                IMAGE_NAME + "%04d.jpg") % i)

Legend:
Removed from v.1147  
changed lines
  Added in v.1148

  ViewVC Help
Powered by ViewVC 1.1.26