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

Contents of /trunk-mpi-branch/doc/examples/pyvisi/seriesofreads.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1295 - (show annotations)
Mon Sep 10 06:07:09 2007 UTC (11 years, 7 months ago) by ksteube
File MIME type: text/x-python
File size: 1854 byte(s)
Have now merged latest trunk features into MPI branch in preparation for
ending the MPI branch.
Compiles but has run time problems in bandwith reduction.

1 """
2 Author: John Ngui, john.ngui@uq.edu.au
3 """
4
5 # Import the necessary modules.
6 from esys.pyvisi import Scene, DataCollector, Contour, Camera
7 from esys.pyvisi.constant import *
8 import os
9
10 PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
11 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
12 X_SIZE = 400
13 Y_SIZE = 300
14
15 SCALAR_FIELD_POINT_DATA_1 = "lava"
16 SCALAR_FIELD_POINT_DATA_2 = "talus"
17 FILE_2D = "phi_talus_lava."
18
19 IMAGE_NAME = "seriesofreads"
20 JPG_RENDERER = Renderer.ONLINE_JPG
21
22 # Create a Scene.
23 s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
24 y_size = Y_SIZE)
25
26 # Create a DataCollector reading from a XML file.
27 dc1 = DataCollector(source = Source.XML)
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
37 # but specifying a different scalar field.
38 dc2 = DataCollector(source = Source.XML)
39 dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)
40
41 # Create a second Contour.
42 mosc2 = Contour(scene = s, data_collector = dc2,
43 viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
44 outline = True)
45 mosc2.generateContours(0)
46
47 # Create a Camera.
48 cam1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
49
50 # Read in one file one after another and render the object.
51 for i in range(99, 104):
52 dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
53 FILE_2D + "%04d.vtu") % i)
54 dc2.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
55 FILE_2D + "%04d.vtu") % i)
56
57 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, \
58 IMAGE_NAME + "%04d.jpg") % i)

  ViewVC Help
Powered by ViewVC 1.1.26