added an extra option
This commit is contained in:
parent
854545a92b
commit
0edc8c192e
@ -27,12 +27,13 @@ def get_mesh(source, destination, use_structured_grid = False):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
|
|
||||||
parser.add_option("-o",
|
parser.add_option("-o",
|
||||||
"--output-file",
|
"--order",
|
||||||
dest="output",
|
dest="order",
|
||||||
type='str',
|
type='int',
|
||||||
default = '/tmp/for_qhull.txt',
|
default = 3,
|
||||||
help = "qhull output file")
|
help = "how many extra verts (%default)")
|
||||||
|
|
||||||
parser.add_option("-e",
|
parser.add_option("-e",
|
||||||
"--extra-verts",
|
"--extra-verts",
|
||||||
@ -72,19 +73,16 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
(mesh_source, mesh_dest) = get_mesh(options.source_total, options.destination_total, options.structured)
|
(mesh_source, mesh_dest) = get_mesh(options.source_total, options.destination_total, options.structured)
|
||||||
|
|
||||||
open(options.output, 'w').write(mesh_source.for_qhull())
|
|
||||||
if options.verbose:
|
|
||||||
print >> sys.stderr, "options: %s, args: %s" % (options, args)
|
|
||||||
print >> sys.stderr, "wrote source mesh output to %s" % options.output
|
|
||||||
|
|
||||||
errors = []
|
errors = []
|
||||||
success = 0
|
success = 0
|
||||||
|
|
||||||
for X in mesh_dest.verts:
|
for X in mesh_dest.verts:
|
||||||
|
|
||||||
answer = mesh_source.run_baker(X)
|
answer = mesh_source.run_baker(X, order = options.order, extra_points = options.extra)
|
||||||
|
|
||||||
if answer['abc'] == None:
|
if answer['abc'] == None:
|
||||||
|
print "None"
|
||||||
errors.append(0)
|
errors.append(0)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -97,8 +95,9 @@ if __name__ == '__main__':
|
|||||||
print "exact : %0.4f" % exact
|
print "exact : %0.4f" % exact
|
||||||
print "qlin : %0.4f" % answer['qlin']
|
print "qlin : %0.4f" % answer['qlin']
|
||||||
print "q_final : %0.4f" % answer['final']
|
print "q_final : %0.4f" % answer['final']
|
||||||
print "qlinerr : %1.4f" % (exact - answer['qlin'],)
|
print "error w/o : %1.4f" % (exact - answer['qlin'],)
|
||||||
print "q_final_err : %0.4f" % (exact - answer['final'],)
|
print "error w/ : %0.4f" % (exact - answer['final'],)
|
||||||
|
print
|
||||||
cur_error = np.abs(answer['final'] - exact)
|
cur_error = np.abs(answer['final'] - exact)
|
||||||
errors.append(cur_error)
|
errors.append(cur_error)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user