PBC meshing can work on 2D models

This commit is contained in:
Nan Jia 2012-03-14 13:40:22 +00:00
parent 2b5ed4ab93
commit d2051e54a5
1 changed files with 11 additions and 9 deletions

View File

@ -66,11 +66,12 @@ def servoLink():
for coord in base: # calc the dimension of the bounding box for coord in base: # calc the dimension of the bounding box
box['delta'][coord] = box['max'][coord] - box['min'][coord] box['delta'][coord] = box['max'][coord] - box['min'][coord]
for extremum in ['min','max']: if box['delta'][coord] != 0.0:
rounded = round(box[extremum][coord]*1e+15/box['delta'][coord]) * \ for extremum in ['min','max']:
1e-15*box['delta'][coord] # rounding to 1e-15 of dimension rounded = round(box[extremum][coord]*1e+15/box['delta'][coord]) * \
box[extremum][coord] = {False: rounded, 1e-15*box['delta'][coord] # rounding to 1e-15 of dimension
True: 0.0}[rounded == 0.0] # get rid of -0.0 (negative zeros) box[extremum][coord] = {False: rounded,
True: 0.0}[rounded == 0.0] # get rid of -0.0 (negative zeros)
baseNode = {} baseNode = {}
linkNodes = [] linkNodes = []
@ -81,10 +82,11 @@ def servoLink():
Nmax = 0 Nmax = 0
Nmin = 0 Nmin = 0
for coord in base: # for each direction for coord in base: # for each direction
rounded = round(NodeCoords[node][coord]*1e+15/box['delta'][coord]) * \ if box['delta'][coord] != 0.0:
1e-15*box['delta'][coord] # rounding to 1e-15 of dimension rounded = round(NodeCoords[node][coord]*1e+15/box['delta'][coord]) * \
NodeCoords[node][coord] = {False: rounded, 1e-15*box['delta'][coord] # rounding to 1e-15 of dimension
True: 0.0}[rounded == 0.0] # get rid of -0.0 (negative zeros) NodeCoords[node][coord] = {False: rounded,
True: 0.0}[rounded == 0.0] # get rid of -0.0 (negative zeros)
key[coord] = "%.8e"%NodeCoords[node][coord] # translate position to string key[coord] = "%.8e"%NodeCoords[node][coord] # translate position to string
if (key[coord] == "%.8e"%box['min'][coord]): # compare to min of bounding box (i.e. is on outer face?) if (key[coord] == "%.8e"%box['min'][coord]): # compare to min of bounding box (i.e. is on outer face?)
Nmin += 1 # count outer (back) face membership Nmin += 1 # count outer (back) face membership