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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1203 - (hide annotations)
Thu Jun 21 23:17:16 2007 UTC (12 years, 2 months ago) by jongui
File MIME type: text/x-python
File size: 1268 byte(s)
Made some minor changes to the exampels.
1 jongui 1203 """
2     Author: Lutz Gross, l.gross@uq.edu.au
3     Author: John Ngui, john.ngui@uq.edu.au
4     """
5    
6 ksteube 1147 # 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 jongui 1148 import os
13 ksteube 1147
14 jongui 1148 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
15 ksteube 1147 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 jongui 1153 # define characteristic function of Gamma
22 ksteube 1147 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 jongui 1148 c = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
42 ksteube 1147
43     # Render the object.
44 jongui 1148 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "poisson.jpg"))

  ViewVC Help
Powered by ViewVC 1.1.26