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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2344 - (hide annotations)
Mon Mar 30 02:13:58 2009 UTC (10 years, 5 months ago) by jfenwick
File MIME type: text/x-python
File size: 2008 byte(s)
Change __url__ to launchpad site

1 ksteube 1811
2     ########################################################
3     #
4     # Copyright (c) 2003-2008 by University of Queensland
5     # Earth Systems Science Computational Center (ESSCC)
6     # http://www.uq.edu.au/esscc
7     #
8     # Primary Business: Queensland, Australia
9     # Licensed under the Open Software License version 3.0
10     # http://www.opensource.org/licenses/osl-3.0.php
11     #
12     ########################################################
13    
14     __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15     Earth Systems Science Computational Center (ESSCC)
16     http://www.uq.edu.au/esscc
17     Primary Business: Queensland, Australia"""
18     __license__="""Licensed under the Open Software License version 3.0
19     http://www.opensource.org/licenses/osl-3.0.php"""
20 jfenwick 2344 __url__="https://launchpad.net/escript-finley"
21 ksteube 1811
22 ksteube 1568 """
23 ksteube 1863 Author: Lutz Gross, l.gross@uq.edu.au
24     Author: John Ngui, john.ngui@uq.edu.au
25 ksteube 1568 Author: Ken Steube
26     """
27    
28 ksteube 1863 # Import the necesary modules.
29     from esys.escript import *
30     from esys.escript.linearPDEs import Poisson
31     from esys.finley import Rectangle
32     from esys.pyvisi import Scene, DataCollector, Map, Camera
33 ksteube 1568 from esys.pyvisi.constant import *
34 ksteube 1863 import os
35 ksteube 1568
36     PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
37     X_SIZE = 400
38 ksteube 1863 Y_SIZE = 300
39 ksteube 1568 JPG_RENDERER = Renderer.OFFLINE_JPG
40    
41 ksteube 1863 # generate domain:
42     mydomain = Rectangle(l0=1.,l1=1.,n0=40, n1=20)
43     # define characteristic function of Gamma
44     x = mydomain.getX()
45     gammaD = whereZero(x[0])+whereZero(x[1])
46     # define PDE and get its solution u
47     mypde = Poisson(domain=mydomain)
48     mypde.setValue(f=1,q=gammaD)
49     u = mypde.getSolution()
50    
51 ksteube 1568 # Create a Scene.
52 ksteube 1863 s = Scene(renderer = JPG_RENDERER, x_size = X_SIZE, y_size = Y_SIZE)
53 ksteube 1568
54 ksteube 1863 # Create a DataCollector reading directly from an escript object.
55     dc = DataCollector(source = Source.ESCRIPT)
56     dc.setData(sol = u)
57 ksteube 1569
58 ksteube 1568 # Create a Map.
59 ksteube 1863 Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST,
60     lut = Lut.COLOR, cell_to_point = False, outline = True)
61 ksteube 1568
62 ksteube 1863 # Create a Camera.
63     c = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
64 ksteube 1568
65 ksteube 1863 # Render the object.
66 ksteube 1568 s.render(image_name = "offscreen.jpg")

  ViewVC Help
Powered by ViewVC 1.1.26