Changeset 8565


Ignore:
Timestamp:
Sep 9, 2012, 8:51:01 AM (13 years ago)
Author:
steve
Message:

calc_sides using zip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/pmesh2domain.py

    r8564 r8565  
    183183
    184184
    185 def calc_sides(triangles):
     185def calc_sides_old(triangles):
    186186    '''Build dictionary mapping from sides (2-tuple of points)
    187187    to left hand side neighbouring triangle
     
    219219    return sides
    220220
    221 def calc_sides_zip(triangles):
     221def calc_sides(triangles):
    222222    '''Build dictionary mapping from sides (2-tuple of points)
    223223    to left hand side neighbouring triangle
     
    234234    c = triangles[:,2]
    235235
    236     id = num.arange(len(triangles))
    237     face = num.ones(len(triangles),num.int)
    238 
    239     sides.update(dict(zip(zip(a,b),zip(id,2*face))))
    240     sides.update(dict(zip(zip(b,c),zip(id,0*face))))
    241     sides.update(dict(zip(zip(c,a),zip(id,1*face))))
     236    id = 3*num.arange(len(triangles))
     237
     238    sides.update(dict(zip(zip(a,b),id+2)))
     239    sides.update(dict(zip(zip(b,c),id+0)))
     240    sides.update(dict(zip(zip(c,a),id+1)))
    242241
    243242    return sides
Note: See TracChangeset for help on using the changeset viewer.