1 |
|
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 |
__url__="http://www.uq.edu.au/esscc/escript-finley" |
21 |
|
22 |
""" |
23 |
Author: Lutz Gross, l.gross@uq.edu.au |
24 |
Author: John Ngui, john.ngui@uq.edu.au |
25 |
Author: Ken Steube |
26 |
""" |
27 |
|
28 |
# 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 |
from esys.pyvisi.constant import * |
34 |
import os |
35 |
|
36 |
PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images" |
37 |
X_SIZE = 400 |
38 |
Y_SIZE = 300 |
39 |
JPG_RENDERER = Renderer.OFFLINE_JPG |
40 |
|
41 |
# 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 |
# Create a Scene. |
52 |
s = Scene(renderer = JPG_RENDERER, x_size = X_SIZE, y_size = Y_SIZE) |
53 |
|
54 |
# Create a DataCollector reading directly from an escript object. |
55 |
dc = DataCollector(source = Source.ESCRIPT) |
56 |
dc.setData(sol = u) |
57 |
|
58 |
# Create a Map. |
59 |
Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST, |
60 |
lut = Lut.COLOR, cell_to_point = False, outline = True) |
61 |
|
62 |
# Create a Camera. |
63 |
c = Camera(scene = s, viewport = Viewport.SOUTH_WEST) |
64 |
|
65 |
# Render the object. |
66 |
s.render(image_name = "offscreen.jpg") |