/[escript]/trunk/doc/SConscript
ViewVC logotype

Contents of /trunk/doc/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5353 - (show annotations)
Fri Dec 12 03:22:41 2014 UTC (4 years, 4 months ago) by jduplessis
File size: 8996 byte(s)
adding dc_forward example
1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2014 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 import os
18 Import('*')
19
20 from subprocess import PIPE, Popen
21
22 haveMPL=False # do we have matplotlib?
23 haveGD=False # does matplotlib have griddata?
24
25 mplmagicversion='0.98.5'
26
27 # check for matplotlib
28 if env['pythoncmd']=='python':
29 try:
30 import matplotlib
31 haveMPL=True
32 mplversion=matplotlib.__version__
33 from matplotlib.mlab import griddata
34 haveGD=True
35 except ImportError:
36 pass
37 else:
38 # we need to fire up the external command
39 p=Popen([env['pythoncmd'], '-c', 'from __future__ import print_function;import matplotlib;print(matplotlib.__version__);from matplotlib.mlab import griddata;print("1")'], stdout=PIPE)
40 try:
41 mplversion=p.stdout.readline().strip()
42 haveMPL=True
43 hgd=p.stdout.readline().strip()
44 haveGD=True
45 except IOError:
46 pass
47 p.wait()
48
49 if not haveMPL:
50 env['warnings'].append("matplotlib not found, will skip some unit tests")
51 else:
52 if mplversion<mplmagicversion:
53 env['warnings'].append("matplotlib found, but version too early. Some unit tests will be skipped.")
54
55 example_files_allow_mpi = []
56 example_files_no_mpi = []
57 example_deps = []
58 skipped_tests = []
59
60 def sortOutExample(name, needsGMSH=False, needsMPL=False, needsMagicMPL=False, needsGD=False, allowsMPI=True):
61 if needsMagicMPL: needsMPL=True
62 if needsGD: needsMPL=True
63 if needsGMSH: allowsMPI=False
64
65 if needsGMSH and not env['gmsh']:
66 skipped_tests.append(name)
67 return
68
69 if (not needsGMSH or env['gmsh']) and (not needsMPL or haveMPL) and (not needsMagicMPL or mplversion>=mplmagicversion) and (not needsGD or haveGD):
70 if allowsMPI:
71 example_files_allow_mpi.append(name)
72 else:
73 example_files_no_mpi.append(name)
74 else:
75 example_deps.append(name)
76
77 # these are the release examples in example subdirectory:
78 #
79 #_deps is for files which end in .py and are required for
80 # testing but should not be invoked directly themselves
81
82 sortOutExample('usersguide/lid_driven_cavity.py')
83 sortOutExample('usersguide/mount.py')
84 sortOutExample('usersguide/heatedblock.py')
85 sortOutExample('usersguide/helmholtz.py')
86 sortOutExample('usersguide/fluid.py')
87 sortOutExample('usersguide/poisson.py')
88 sortOutExample('usersguide/diffusion.py')
89 sortOutExample('usersguide/poisson_vtk.py')
90 sortOutExample('usersguide/darcy.py')
91 sortOutExample('usersguide/slip.py')
92 sortOutExample('usersguide/int_save.py')
93 sortOutExample('usersguide/wave.py', needsMPL=True)
94 sortOutExample('usersguide/trapezoid.py', needsGMSH=True, allowsMPI=False)
95 sortOutExample('usersguide/quad.py', needsGMSH=True)
96 sortOutExample('usersguide/brick.py', needsGMSH=True)
97 sortOutExample('usersguide/refine.py', needsGMSH=True)
98 sortOutExample('usersguide/poisson_matplotlib.py', needsGD=True, allowsMPI=False)
99
100 sortOutExample('geotutorial/steadystate_variablek.py')
101 sortOutExample('geotutorial/steadystate.py')
102 sortOutExample('geotutorial/forward_euler.py')
103 sortOutExample('geotutorial/myfirstscript.py')
104 sortOutExample('geotutorial/backward_euler.py')
105
106 example_deps.append('cookbook/cblib.py')
107 sortOutExample('cookbook/example01a.py')
108 sortOutExample('cookbook/example01b.py', needsMPL=True)
109 sortOutExample('cookbook/example01c.py', needsMPL=True, allowsMPI=False)
110 sortOutExample('cookbook/example02.py', needsMPL=True, allowsMPI=False)
111 sortOutExample('cookbook/example03a.py', needsGD=True, allowsMPI=False)
112 sortOutExample('cookbook/example03b.py')
113 sortOutExample('cookbook/example04a.py', needsGMSH=True)
114 sortOutExample('cookbook/example04b.py', needsGMSH=True, needsGD=True)
115 sortOutExample('cookbook/example05a.py', needsGMSH=True, needsGD=True)
116 sortOutExample('cookbook/example05b.py', needsGMSH=True, needsGD=True)
117 sortOutExample('cookbook/example05c.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
118 sortOutExample('cookbook/example06.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
119 sortOutExample('cookbook/example07a.py', needsMagicMPL=True, allowsMPI=False)
120 sortOutExample('cookbook/example07b.py', needsMagicMPL=True, allowsMPI=False)
121 sortOutExample('cookbook/example08a.py', needsMagicMPL=True, allowsMPI=False)
122 sortOutExample('cookbook/example08b.py', needsMagicMPL=True, allowsMPI=False)
123 sortOutExample('cookbook/example08c.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
124 sortOutExample('cookbook/example09m.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
125 sortOutExample('cookbook/example09a.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
126 #sortOutExample('cookbook/example09b.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
127 sortOutExample('cookbook/example10a.py', needsMagicMPL=True, allowsMPI=False)
128 sortOutExample('cookbook/example10b.py', needsMagicMPL=True, allowsMPI=False)
129 sortOutExample('cookbook/example10m.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
130 #sortOutExample('cookbook/example10c_0.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
131 #sortOutExample('cookbook/example10c_1.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
132 sortOutExample('cookbook/example11a.py', needsMagicMPL=True, allowsMPI=False)
133 sortOutExample('cookbook/example11b.py', needsMagicMPL=True, allowsMPI=False)
134
135 sortOutExample('inversion/create_netcdf.py')
136 sortOutExample('inversion/grav_ermapper.py')
137 sortOutExample('inversion/grav_netcdf.py')
138 sortOutExample('inversion/gravmag_netcdf.py')
139 sortOutExample('inversion/gravmag_nodriver.py')
140 sortOutExample('inversion/mag_netcdf.py')
141 sortOutExample('inversion/plot_ermapper.py', needsMPL=True, allowsMPI=False)
142 sortOutExample('inversion/plot_netcdf.py', needsMPL=True, allowsMPI=False)
143 sortOutExample('inversion/dc_forward.py', needsGMSH=True)
144 example_deps.append('inversion/content.txt')
145 example_deps.append('inversion/data/GravitySmall')
146 example_deps.append('inversion/data/MagneticSmall')
147 example_deps.append('inversion/data/QLDWestGravity')
148 example_deps.append('inversion/data/QLDWestMagnetic')
149 example_deps.append('inversion/data/GravitySmall.ers')
150 example_deps.append('inversion/data/MagneticSmall.ers')
151 example_deps.append('inversion/data/QLDWestGravity.ers')
152 example_deps.append('inversion/data/QLDWestMagnetic.ers')
153 example_deps.append('inversion/data/GravitySmall.nc')
154 example_deps.append('inversion/data/MagneticSmall.nc')
155 example_deps.append('inversion/data/QLDWestGravity.nc')
156 example_deps.append('inversion/data/QLDWestMagnetic.nc')
157 example_deps.append('inversion/data/HalfSphere_v1.4.msh')
158
159
160
161
162 if len(skipped_tests)>0:
163 env['warnings'].append("gmsh not available. Skipping tests %s!"%' '.join(skipped_tests))
164
165 example_files = example_files_allow_mpi + example_files_no_mpi + example_deps
166
167 ex2=[os.path.join("examples", str(x)) for x in example_files]
168
169 #=============================================================================
170
171 local_env = env.Clone()
172 src_dir = local_env.Dir('.').srcnode().abspath
173 release_dir=os.path.join(env['prefix'],'release','doc')
174 Export('release_dir')
175
176 dir_cmd = "cd "+src_dir+" && "
177
178 # Need to use explicit tar/zip rather than the builder due to problems getting
179 # it not to put unwanted path components in the archive file
180 # --transform on tar is not supported on savanna
181 zip_path=os.path.join(release_dir, 'escript_examples.zip')
182 zip = local_env.Command(zip_path, None, dir_cmd+"zip "+zip_path+" "+" ".join(ex2))
183 env.Alias('examples_zipfile', zip)
184
185 tar_path=os.path.join(release_dir, 'escript_examples.tar.gz')
186 tar = local_env.Command(tar_path, None, dir_cmd+"tar -czf "+tar_path+" "+" ".join(ex2))
187 env.Alias('examples_tarfile', tar)
188
189 #env=Environment(TARFLAGS = "-c -z",chdir=src_dir)
190 #if 'Tar' in dir(env):
191 # tar=env.Tar(tar_path, example_files, chdir=src_dir)
192 # env.Alias('examples_tarfile', tar)
193
194 local_env.SConscript(dirs = ['#/doc/cookbook'], variant_dir='cookbook', duplicate=1)
195 local_env.SConscript(dirs = ['#/doc/user'], variant_dir='user', duplicate=1)
196 local_env.SConscript(dirs = ['#/doc/inversion'], variant_dir='inversion', duplicate=1)
197 local_env.SConscript(dirs = ['#/doc/epydoc'], variant_dir='epydoc', duplicate=1)
198 local_env.SConscript(dirs = ['#/doc/sphinx_api'], variant_dir='sphinx_api', duplicate=1)
199 local_env.SConscript(dirs = ['#/doc/doxygen'], variant_dir='doxygen', duplicate=1)
200 local_env.SConscript(dirs = ['#/doc/install'], variant_dir='install', duplicate=1)
201 local_env.SConscript(dirs = ['#/doc/examples'], variant_dir='examples', duplicate=1, exports=['example_files_allow_mpi', 'example_files_no_mpi', 'example_deps'])
202

  ViewVC Help
Powered by ViewVC 1.1.26