/[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 1103 - (show annotations)
Wed Apr 18 04:31:06 2007 UTC (12 years ago) by jongui
File MIME type: text/x-python
File size: 1183 byte(s)
Some updates.
1 # Import the necesary modules.
2 from esys.escript import *
3 from esys.escript.linearPDEs import Poisson
4 from esys.finley import Rectangle
5 from esys.pyvisi import Scene, DataCollector, Map, Camera
6 from esys.pyvisi.constant import *
7
8 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images/"
9 X_SIZE = 400
10 Y_SIZE = 300
11 JPG_RENDERER = Renderer.ONLINE_JPG
12
13 # generate domain:
14 mydomain = Rectangle(l0=1.,l1=1.,n0=40, n1=20)
15 # define characteristic function of Gamma^D
16 x = mydomain.getX()
17 gammaD = whereZero(x[0])+whereZero(x[1])
18 # define PDE and get its solution u
19 mypde = Poisson(domain=mydomain)
20 mypde.setValue(f=1,q=gammaD)
21 u = mypde.getSolution()
22
23 # Create a Scene.
24 s = Scene(renderer = JPG_RENDERER, x_size = X_SIZE, y_size = Y_SIZE)
25
26 # Create a DataCollector reading directly from an escript object.
27 dc = DataCollector(source = Source.ESCRIPT)
28 dc.setData(sol = u)
29
30 # Create a Map.
31 Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST,
32 lut = Lut.COLOR, cell_to_point = False, outline = True)
33
34 # Create a Camera.
35 c = Camera(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST)
36
37 # Render the object.
38 s.render(image_name = PYVISI_EXAMPLE_IMAGES_PATH + "poisson.jpg")

  ViewVC Help
Powered by ViewVC 1.1.26