/[escript]/trunk/escript/py_src/runmodel.py
ViewVC logotype

Annotation of /trunk/escript/py_src/runmodel.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 614 - (hide annotations)
Wed Mar 22 01:37:07 2006 UTC (13 years, 7 months ago) by elspeth
File MIME type: text/x-python
File size: 1330 byte(s)
Corrected spelling of 'license' in url so that the link actually points to the license.

1 gross 250 #!/usr/bin/python
2     # $Id$
3 elspeth 609
4     __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
5     http://www.access.edu.au
6     Primary Business: Queensland, Australia"""
7 elspeth 614 __license__="""Licensed under the Open Software License version 3.0
8     http://www.opensource.org/licenses/osl-3.0.php"""
9 elspeth 609
10 elspeth 269 from esys.escript import modelframe
11 gross 250
12     #commandline utility to take an xml file, parse it, and run a simulation.
13     # invoke this by doing ./runmodel.py <filename.xml>
14    
15     import optparse
16    
17     parser = optparse.OptionParser(usage="\n%prog [options]\n%prog files...")
18     parser.add_option('-f', '--file', dest='filename',
19     help='the FILE', metavar='FILE')
20     parser.add_option('-n', '--old-name', action="store",
21     help='the old filename, used in aup',
22     dest='old_name', default='')
23     def main():
24     (options, args) = parser.parse_args()
25     if options.filename and args:
26     parser.usage("Please only specifiy 1 file if using --file=")
27     if options.filename:
28     files = [(file(options.filename), options.filename)]
29     elif args:
30     files = [(file(arg), arg) for arg in args]
31     else:
32 gross 260 parser.usage
33 gross 250
34     for f, filename in files:
35    
36     simstring = f.read()
37     sim = modelframe.parse(simstring)
38     print sim
39 elspeth 269 sim.run()
40 gross 250
41     if __name__=='__main__':
42     main()
43    

  ViewVC Help
Powered by ViewVC 1.1.26