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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 614 - (show annotations)
Wed Mar 22 01:37:07 2006 UTC (13 years, 8 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 #!/usr/bin/python
2 # $Id$
3
4 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
5 http://www.access.edu.au
6 Primary Business: Queensland, Australia"""
7 __license__="""Licensed under the Open Software License version 3.0
8 http://www.opensource.org/licenses/osl-3.0.php"""
9
10 from esys.escript import modelframe
11
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 parser.usage
33
34 for f, filename in files:
35
36 simstring = f.read()
37 sim = modelframe.parse(simstring)
38 print sim
39 sim.run()
40
41 if __name__=='__main__':
42 main()
43

  ViewVC Help
Powered by ViewVC 1.1.26