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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1387 - (show annotations)
Fri Jan 11 07:45:26 2008 UTC (11 years, 7 months ago) by trankine
Original Path: temp/doc/examples/pyvisi/poisson_with_pyvisi.py
File MIME type: text/x-python
File size: 1268 byte(s)
Restore the trunk that existed before the windows changes were committed to the (now moved to branches) old trunk.
1 """
2 Author: Lutz Gross, l.gross@uq.edu.au
3 Author: John Ngui, john.ngui@uq.edu.au
4 """
5
6 # Import the necesary modules.
7 from esys.escript import *
8 from esys.escript.linearPDEs import Poisson
9 from esys.finley import Rectangle
10 from esys.pyvisi import Scene, DataCollector, Map, Camera
11 from esys.pyvisi.constant import *
12 import os
13
14 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
15 X_SIZE = 400
16 Y_SIZE = 300
17 JPG_RENDERER = Renderer.ONLINE_JPG
18
19 # generate domain:
20 mydomain = Rectangle(l0=1.,l1=1.,n0=40, n1=20)
21 # define characteristic function of Gamma
22 x = mydomain.getX()
23 gammaD = whereZero(x[0])+whereZero(x[1])
24 # define PDE and get its solution u
25 mypde = Poisson(domain=mydomain)
26 mypde.setValue(f=1,q=gammaD)
27 u = mypde.getSolution()
28
29 # Create a Scene.
30 s = Scene(renderer = JPG_RENDERER, x_size = X_SIZE, y_size = Y_SIZE)
31
32 # Create a DataCollector reading directly from an escript object.
33 dc = DataCollector(source = Source.ESCRIPT)
34 dc.setData(sol = u)
35
36 # Create a Map.
37 Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST,
38 lut = Lut.COLOR, cell_to_point = False, outline = True)
39
40 # Create a Camera.
41 c = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
42
43 # Render the object.
44 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "poisson.jpg"))

  ViewVC Help
Powered by ViewVC 1.1.26