improved the sheep

This commit is contained in:
Stephen McQuay 2011-05-18 12:59:57 -06:00
parent dc15bd17bb
commit 81d48561e6

View File

@ -13,12 +13,12 @@ import numpy as np
import interp.bootstrap
from interp.grid.gmsh import ggrid
from interp.tools import baker_exact_3D as exact
from interp.tools import *
from interp.cluster import QueueManager, get_qs
if __name__ == '__main__':
parser = OptionParser(usage = "usage: %s [options] <server> <gmsh file>")
parser = OptionParser(usage = "usage: %s [options] <server> <gmsh file> <dimension> <baker|friendly>")
parser.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False,
@ -30,11 +30,22 @@ if __name__ == '__main__':
(options, args) = parser.parse_args()
if len(args) != 2:
if len(args) != 4:
parser.print_usage()
sys.exit(1)
server, input_file = args
server, input_file, dimension, exact_type = args
dimension = int(dimension)
if dimension == 2 and exact_type == 'baker':
exact = baker_exact_2D
elif dimension == 2 and exact_type == 'friendly':
exact = friendly_exact_2D
elif dimension == 3 and exact_type == 'baker':
exact = baker_exact_3D
elif dimension == 3 and exact_type == 'friendly':
exact = friendly_exact_3D
myname = "%s-%d" % (os.uname()[1], os.getpid())
if options.verbose:
@ -48,7 +59,7 @@ if __name__ == '__main__':
if options.verbose:
print "%s: starting parse input file" % myname
g = ggrid(input_file)
g = ggrid(input_file, dimension)
g.q = np.array([exact(x) for x in g.verts])
if options.verbose:
print "%s: done parsing input file" % myname
@ -63,7 +74,7 @@ if __name__ == '__main__':
print "%s: waiting for master to tell me to start" % myname
action = minionsq.get()
if options.verbose:
print "%s: master said go!!" % myname
print "%s: got message from master: %s" % (myname, action)
if action in ('teardown', 'slay'):
break
@ -85,10 +96,9 @@ if __name__ == '__main__':
cur_error = 0.0
cur_final = 0.0
cur_exact = 0.0
duration = 0
duration = 0
resultsq.put((
i,
resultsq.put((i,
cur_qlin,
cur_error,
cur_final,