File: sphereisos.py

package info (click to toggle)
python-scipy 0.3.2-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 13,572 kB
  • ctags: 20,326
  • sloc: ansic: 87,138; fortran: 51,876; python: 47,747; cpp: 2,134; objc: 384; makefile: 175; sh: 83
file content (75 lines) | stat: -rw-r--r-- 2,620 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Copyright (c) 1996, 1997, The Regents of the University of California.
# All rights reserved.  See Legal.htm for full text and disclaimer.

from Numeric import *
from scipy_base.fastumath import *
from PR import *
from mesh3d import *
from graph3d import *
from plane import *
from GistPlotter import *

def paws ( ) :
    i = raw_input ("Type in any string to continue; ^C to return to prompt. ")
    return

print "Test of slices through an imploding sphere. Type demo () to see the test."
paws ()

def demo () :
   f = PR ('./bills_plot')
   n_nodes = f.NumNodes
   n_z = f.NodesOnZones
   x = f.XNodeCoords
   y = f.YNodeCoords
   z = f.ZNodeCoords
   c = f.ZNodeVelocity
   n_zones = f.NumZones
   # Put vertices in right order for Gist
## n_z = transpose (
##    take (transpose (n_z), array ( [0, 1, 3, 2, 4, 5, 7, 6])))
   
   m1 = Mesh3d (x = x, y = y, z = z, c = c, avs = 1, hex = [n_zones, n_z])
   
   s1 = sslice (m1, .9 * max (c), varno = 1)
   s11 = sslice (m1, -1.8, varno = 1)
## pyz = Plane (array ([1., 0., 0.], Float ), zeros (3, Float))
   pyz = Plane (array ([1., 0., 0.], Float ), array ( [0.0001, 0., 0.], Float))
   pxz = Plane (array ([0., 1., 0.], Float ), array ( [0., 0.0001, 0.], Float))
   p2 = Plane (array ([1., 0., 0.], Float ), array ( [0.35, 0., 0.], Float))
   
   s2 = sslice (m1, pyz, varno = 1, opt_3d = ["wm", "s4"])
   s22 = sslice (m1, p2, varno = 1, opt_3d = ["wm", "s4"])
   s23 = sslice (m1, pxz, varno = 1, opt_3d = ["wm", "s4"])
   
## pl = GistPlotter.Plotter (" ", hcp = "talk.ps", dump = 1, dpi = 75)
## g1 = Graph3d( [s2, s22, s23], plotter = pl, color_card = "rainbowhls",
##      opt_3d = ["wm", "s4"], mask = "min", color_bar = 1, split = 0)
   g1 = Graph3d( [s2, s22, s23], color_card = "rainbowhls",
        opt_3d = ["wm", "s4"], mask = "min", color_bar = 1, split = 0,
        hardcopy = "talk.ps")
   g1.plot ()
   paws ()
   g1.change (split = 1)
   g1.plot ()
   paws ()
   g1.set_surface_list ( [s11, s2, s22, s23])
   g1.plot ()
   paws ()
   s2 = sslice (m1, .9 * min (c), varno = 1, opt_3d = "w3")
   s3 = sslice (m1, .5 * min (c), varno = 1, opt_3d = "w3")
   s4 = sslice (s2, -pyz, opt_3d = "w3")
   s5 = sslice (m1, .5 * max (c), varno = 1, opt_3d = "w3")
   s6 = sslice (s5, -pyz, opt_3d = "w3")
   g1.set_surface_list ( [s1, s2, s6])
   g1.plot ()
   paws ()
   # Do multiple slices
   slice_list = []
   for i in range (8) :
      sl = sslice (m1, .9 * min (c) + i * (.9 * max (c) - .9 * min (c)) / 8., 
         varno = 1, opt_3d = "none")
      slice_list.append (sslice (sl, pxz))
   g1.set_surface_list ( slice_list)
   g1.plot ()
   paws ()