/[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 637 - (show annotations)
Thu Mar 23 10:55:31 2006 UTC (13 years, 6 months ago) by gross
File MIME type: text/x-python
File size: 1674 byte(s)
more copyright statements added
1 #!/usr/bin/python
2 # $Id$
3
4 """
5 commandline utility to take an xml file, parse it, and run a simulation.
6 invoke this by doing ./runmodel.py <filename.xml>
7
8 @var __author__: name of author
9 @var __copyright__: copyrights
10 @var __license__: licence agreement
11 @var __url__: url entry point on documentation
12 @var __version__: version
13 @var __date__: date of the version
14 """
15
16 __author__="Elspeth Thorne, e.thorne@uq.edu.au"
17 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
18 http://www.access.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 __url__="http://www.iservo.edu.au/esys"
23 __version__="$Revision$"
24 __date__="$Date$"
25
26
27 from esys.escript import modelframe
28 import optparse
29
30 parser = optparse.OptionParser(usage="\n%prog [options]\n%prog files...")
31 parser.add_option('-f', '--file', dest='filename',
32 help='the FILE', metavar='FILE')
33 parser.add_option('-n', '--old-name', action="store",
34 help='the old filename, used in aup',
35 dest='old_name', default='')
36 def main():
37 (options, args) = parser.parse_args()
38 if options.filename and args:
39 parser.usage("Please only specifiy 1 file if using --file=")
40 if options.filename:
41 files = [(file(options.filename), options.filename)]
42 elif args:
43 files = [(file(arg), arg) for arg in args]
44 else:
45 parser.usage
46
47 for f, filename in files:
48
49 simstring = f.read()
50 sim = modelframe.parse(simstring)
51 print sim
52 sim.run()
53
54 if __name__=='__main__':
55 main()
56

  ViewVC Help
Powered by ViewVC 1.1.26