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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1085 - (show annotations)
Thu Apr 12 05:36:31 2007 UTC (15 years, 11 months ago) by jongui
File MIME type: text/x-python
File size: 2291 byte(s)
More minor fixes to Camera.
1 # Import the necessary modules.
2 from esys.pyvisi import Scene, DataCollector, Contour, Camera
3 from esys.pyvisi.constant import *
4
5 PYVISI_EXAMPLE_MESHES_PATH = "data_meshes/"
6 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images/"
7 X_SIZE = 400
8 Y_SIZE = 300
9
10 SCALAR_FIELD_POINT_DATA_1 = "lava"
11 SCALAR_FIELD_POINT_DATA_2 = "talus"
12 FILE_2D = "phi_talus_lava."
13 FIRST_FILE_NAME = "phi_talus_lava.0099.vtu"
14
15 IMAGE_NAME = "seriesofreads"
16 JPG_RENDERER = Renderer.ONLINE_JPG
17
18
19 # Create a Scene.
20 s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
21 y_size = Y_SIZE)
22
23 # Create a DataCollector reading from a XML file. An initial file must always
24 # be assigned when the DataCollector is created, although the same file is
25 # read again in the for-loop.
26 dc1 = DataCollector(source = Source.XML)
27 dc1.setFileName(file_name = PYVISI_EXAMPLE_MESHES_PATH + FIRST_FILE_NAME)
28 dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_1)
29
30 # Create a Contour.
31 mosc1 = Contour(scene = s, data_collector = dc1,
32 viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
33 outline = True)
34 mosc1.generateContours(0)
35
36 # Create a second DataCollector reading from the same XML file. An initial
37 # file must always be assigned when the DataCollector is created,
38 # although the same file is read again in the for-loop.
39 dc2 = DataCollector(source = Source.XML)
40 dc2.setFileName(file_name = PYVISI_EXAMPLE_MESHES_PATH + FIRST_FILE_NAME)
41 dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)
42
43 # Create a second Contour.
44 mosc2 = Contour(scene = s, data_collector = dc2,
45 viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
46 outline = True)
47 mosc2.generateContours(0)
48
49 # Create a Camera.
50 cam1 = Camera(scene = s, data_collector = dc1, viewport = Viewport.SOUTH_WEST)
51
52 # Read in one file one after another and render the object.
53 for i in range(99, 104):
54 dc1.setFileName(file_name = PYVISI_EXAMPLE_MESHES_PATH + FILE_2D +
55 "%04d.vtu" % i)
56 dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_1)
57 dc2.setFileName(file_name = PYVISI_EXAMPLE_MESHES_PATH + FILE_2D +
58 "%04d.vtu" % i)
59 dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)
60
61 s.render(PYVISI_EXAMPLE_IMAGES_PATH + IMAGE_NAME + "%04d.jpg" % i)

  ViewVC Help
Powered by ViewVC 1.1.26