Changeset 3591


Ignore:
Timestamp:
Sep 14, 2006, 1:26:57 PM (18 years ago)
Author:
linda
Message:

Fixed some bugs in build_submesh

Location:
anuga_core/source/anuga_parallel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga_parallel/build_submesh.py

    r3579 r3591  
    136136    trianglemap = zeros(ntriangles, 'i')
    137137    for t in range(tlower, tupper):
     138       
    138139        n = mesh.neighbours[t, 0]
    139         if n > 0:
     140        if n >= 0:
    140141            if n < tlower or n >= tupper:
    141142                trianglemap[n] = 1
    142143        n = mesh.neighbours[t, 1]
    143         if n > 0:
     144        if n >= 0:
    144145            if n < tlower or n >= tupper:
    145146                trianglemap[n] = 1
    146147        n = mesh.neighbours[t, 2]
    147         if n > 0:
     148        if n >= 0:
    148149            if n < tlower or n >= tupper:
    149150                trianglemap[n] = 1
     
    154155        if trianglemap[t]==1:
    155156            n = mesh.neighbours[t, 0]
    156             if n > 0:
     157            if n >= 0:
    157158                if (n < tlower or n >= tupper) and trianglemap[n] == 0:
    158                     trianglemap[n] = 1
     159                    trianglemap[n] = 2
    159160            n = mesh.neighbours[t, 1]
    160             if n > 0:
     161            if n >= 0:
    161162                if (n < tlower or n >= tupper) and trianglemap[n] == 0:
    162                     trianglemap[n] = 1
     163                    trianglemap[n] = 2
    163164            n = mesh.neighbours[t, 2]
    164             if n > 0:
     165            if n >= 0:
    165166                if (n < tlower or n >= tupper) and trianglemap[n] == 0:
    166                     trianglemap[n] = 1
     167                    trianglemap[n] = 2
    167168
    168169    # Build the triangle list and make note of the vertices
     
    173174    subtriangles = []
    174175    for i in range(len(trianglemap)):
    175         if trianglemap[i] == 1:
     176        if trianglemap[i] != 0:
    176177            t = list(mesh.triangles[i])
    177178            nodemap[t[0]] = 1
     
    233234#########################################################
    234235def is_in_processor(ghost_list, tlower, tupper, n):
    235     return (n in ghost_list) or (tlower <= n and tupper >= n)
     236    return (n in ghost_list) or (tlower <= n and tupper > n)
    236237
    237238def ghost_bnd_layer(ghosttri, tlower, tupper, mesh, p):
     
    242243    for t in ghosttri:
    243244        ghost_list.append(t[0])
    244 
     245   
    245246    for t in ghosttri:
    246247        n = mesh.neighbours[t[0], 0]
     
    255256        if not is_in_processor(ghost_list, tlower, tupper, n):
    256257            subboundary[t[0], 2] = 'ghost'
    257    
     258           
    258259    return subboundary
    259260
     
    411412        # Find the boundary layer formed by the ghost triangles
    412413       
    413         subbnd = ghost_bnd_layer(subtri, tupper, tlower, mesh, p)
     414        subbnd = ghost_bnd_layer(subtri, tlower, tupper, mesh, p)
    414415        ghost_bnd.append(subbnd)
    415416       
     
    423424
    424425        tlower = tupper
     426
    425427
    426428    # Record the ghost layer and communication pattern
     
    526528    submeshf = submesh_full(nodes, triangles, edges, \
    527529                            triangles_per_proc)
    528 
     530   
    529531    # Add any extra ghost boundary layer information
    530532
  • anuga_core/source/anuga_parallel/pmesh_divide.py

    r3460 r3591  
    190190    for i in range(len(triangles)):
    191191        ttriangles[i] = triangles[i]
    192        
     192   
    193193    return nodes, ttriangles, boundary, triangles_per_proc, quantities
  • anuga_core/source/anuga_parallel/run_parallel_merimbula_test.py

    r3579 r3591  
    2929import time
    3030
     31from sys import path
     32
     33print path
     34
    3135# Numeric arrays
    3236from Numeric import array, zeros, Float
     
    4852from build_local   import build_local_mesh
    4953from build_commun  import send_submesh, rec_submesh, extract_hostmesh
     54
    5055
    5156
  • anuga_core/source/anuga_parallel/test_parallel_sw_runup.py

    r3590 r3591  
     1#!/usr/bin/env python
     2
     3
    14"""Simple water flow example using ANUGA
    25
     
    4144    #--------------------------------------------------------------------------
    4245
    43 
    4446    points, vertices, boundary = rectangular_cross(10, 10) # Basic mesh
     47   
    4548    domain = Domain(points, vertices, boundary) # Create domain
    4649
     
    9598      send_submesh(submesh, triangles_per_proc, p)
    9699
     100
    97101    # Build the local mesh for processor 0
    98102    points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict = \
     
    100104
    101105    print 'Communication done'       
     106
    102107   
    103108else:
     
    109114            = rec_submesh(0)
    110115
    111 
    112 
    113116#------------------------------------------------------------------------------
    114117# Start the computations on each subpartion
     
    119122                         full_send_dict  = full_send_dict,
    120123                         ghost_recv_dict = ghost_recv_dict)
    121 
    122124
    123125# Name and dir, etc currently has to be set here as they are not
     
    142144
    143145# Associate boundary tags with boundary objects
     146#domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br,
     147#                     'ghost': None, 'exterior': Bd})
    144148domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br,
    145                      'ghost': None, 'exterior': Bd})
    146 
     149                     'ghost': None})
    147150
    148151
     
    155158   
    156159
    157 
Note: See TracChangeset for help on using the changeset viewer.