Changeset 2909


Ignore:
Timestamp:
May 18, 2006, 1:06:32 PM (19 years ago)
Author:
linda
Message:

The parallel listed in the documentation is stored in the documentation/code directory

Location:
inundation/parallel
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • inundation/parallel/build_commun.py

    r2625 r2909  
    313313    return GAnodes, GAtriangles, boundary, quantities, ghost_rec, full_send
    314314
    315 
     315#########################################################
     316#
     317# Extract the submesh that will belong to the
     318# "host processor" (i.e. processor zero)
     319#
     320#  *) See the documentation for build_submesh
     321#
     322# -------------------------------------------------------
     323#
     324#  *) A dictionary containing the full_triangles,
     325# full_nodes, full_boundary, ghost_triangles, ghost_nodes,
     326# ghost_boundary, ghost_commun and full_commun belonging
     327# to processor zero are returned.
     328#
     329#########################################################
     330def extract_hostmesh(submesh, triangles_per_proc):
     331
     332    submesh_cell = {}
     333    submesh_cell["full_nodes"] = submesh["full_nodes"][0]
     334    submesh_cell["ghost_nodes"] = submesh["ghost_nodes"][0]
     335    submesh_cell["full_triangles"] = submesh["full_triangles"][0]
     336    submesh_cell["ghost_triangles"] = submesh["ghost_triangles"][0]
     337    submesh_cell["full_boundary"] = submesh["full_boundary"][0]
     338    submesh_cell["ghost_boundary"] = submesh["ghost_boundary"][0]
     339    submesh_cell["ghost_commun"] = submesh["ghost_commun"][0]
     340    submesh_cell["full_commun"] = submesh["full_commun"][0]
     341    submesh_cell["full_quan"] ={}
     342    submesh_cell["ghost_quan"]={}
     343    for k in submesh["full_quan"]:
     344        submesh_cell["full_quan"][k] = submesh["full_quan"][k][0]
     345        submesh_cell["ghost_quan"][k] = submesh["ghost_quan"][k][0]
     346
     347    numprocs = pypar.size()
     348    points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict = \
     349            build_local_mesh(submesh_cell, 0, triangles_per_proc[0], numprocs)
     350    return  points, vertices, boundary, quantities, ghost_recv_dict, \
     351           full_send_dict
     352
     353
     354
  • inundation/parallel/build_submesh.py

    r2906 r2909  
    1313
    1414import sys
    15 import pypar    # The Python-MPI interface
    1615
    1716from Numeric import zeros, Float, Int, concatenate, \
     
    540539    return submesh
    541540
    542 #########################################################
    543 #
    544 # Extract the submesh that will belong to the
    545 # "host processor" (i.e. processor zero)
    546 #
    547 #  *) See the documentation for build_submesh
    548 #
    549 # -------------------------------------------------------
    550 #
    551 #  *) A dictionary containing the full_triangles,
    552 # full_nodes, full_boundary, ghost_triangles, ghost_nodes,
    553 # ghost_boundary, ghost_commun and full_commun belonging
    554 # to processor zero are returned.
    555 #
    556 #########################################################
    557 def extract_hostmesh(submesh, triangles_per_proc):
    558 
    559     submesh_cell = {}
    560     submesh_cell["full_nodes"] = submesh["full_nodes"][0]
    561     submesh_cell["ghost_nodes"] = submesh["ghost_nodes"][0]
    562     submesh_cell["full_triangles"] = submesh["full_triangles"][0]
    563     submesh_cell["ghost_triangles"] = submesh["ghost_triangles"][0]
    564     submesh_cell["full_boundary"] = submesh["full_boundary"][0]
    565     submesh_cell["ghost_boundary"] = submesh["ghost_boundary"][0]
    566     submesh_cell["ghost_commun"] = submesh["ghost_commun"][0]
    567     submesh_cell["full_commun"] = submesh["full_commun"][0]
    568     submesh_cell["full_quan"] ={}
    569     submesh_cell["ghost_quan"]={}
    570     for k in submesh["full_quan"]:
    571         submesh_cell["full_quan"][k] = submesh["full_quan"][k][0]
    572         submesh_cell["ghost_quan"][k] = submesh["ghost_quan"][k][0]
    573 
    574     numprocs = pypar.size()
    575     points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict = \
    576             build_local_mesh(submesh_cell, 0, triangles_per_proc[0], numprocs)
    577     return  points, vertices, boundary, quantities, ghost_recv_dict, \
    578            full_send_dict
    579 
  • inundation/parallel/documentation/code/RunParallelAdvection.py

    r2906 r2909  
    1717from os import sep
    1818sys.path.append('..'+sep+'pyvolution')
     19sys.path.append('..'+sep+'parallel')
    1920
    2021# Parallel communication routines
  • inundation/parallel/documentation/code/RunParallelMerimbulaMetis.py

    r2906 r2909  
    3232from os import sep
    3333sys.path.append('..'+sep+'pyvolution')
     34sys.path.append('..'+sep+'parallel')
    3435
    3536# Numeric arrays
     
    4849
    4950from pmesh_divide  import pmesh_divide_metis
    50 from build_submesh import build_submesh, extract_hostmesh
     51from build_submesh import build_submesh
    5152from build_local   import build_local_mesh
    52 from build_commun  import send_submesh, rec_submesh
     53from build_commun  import send_submesh, rec_submesh, extract_hostmesh
    5354
    5455
     
    114115    # Build the local mesh for processor 0
    115116
    116      points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict =\
     117    points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict = \
    117118             extract_hostmesh(submesh, triangles_per_proc)
    118119
  • inundation/parallel/documentation/code/RunParallelSwMerimbulaMetis.py

    r2906 r2909  
    3030from os import sep
    3131sys.path.append('..'+sep+'pyvolution')
     32sys.path.append('..'+sep+'parallel')
    3233
    3334# Numeric arrays
     
    4445
    4546from pmesh_divide import pmesh_divide_metis
    46 from build_submesh import build_submesh, extract_hostmesh
     47from build_submesh import build_submesh
    4748from build_local   import build_local_mesh
    48 from build_commun  import send_submesh, rec_submesh
     49from build_commun  import send_submesh, rec_submesh, extract_hostmesh
    4950
    5051###############################
  • inundation/parallel/run_parallel_merimbula_test.py

    r2769 r2909  
    5151
    5252from pmesh_divide  import pmesh_divide_metis
    53 from build_submesh import build_submesh, extract_hostmesh
     53from build_submesh import build_submesh
    5454from build_local   import build_local_mesh
    55 from build_commun  import send_submesh, rec_submesh
     55from build_commun  import send_submesh, rec_submesh, extract_hostmesh
    5656
    5757
     
    109109      send_submesh(submesh, triangles_per_proc, p)
    110110
    111     hostmesh = extract_hostmesh(submesh)
    112     [points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict] = \
    113              build_local_mesh(hostmesh, 0, triangles_per_proc[0], numprocs)
     111    # Build the local mesh for processor 0
     112   
     113    points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict = \
     114              extract_hostmesh(submesh, triangles_per_proc)
    114115
    115116# read in the mesh partition that belongs to this
  • inundation/parallel/run_parallel_sw_merimbula_test.py

    r2906 r2909  
    6464
    6565from pmesh_divide import pmesh_divide_metis
    66 from build_submesh import build_submesh, extract_hostmesh
     66from build_submesh import build_submesh
    6767from build_local   import build_local_mesh
    68 from build_commun  import send_submesh, rec_submesh
     68from build_commun  import send_submesh, rec_submesh, extract_hostmesh
    6969
    7070###############################
     
    143143    # Build the local mesh for processor 0
    144144
    145     hostmesh = extract_hostmesh(submesh)
    146145    points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict = \
    147              build_local_mesh(hostmesh, 0, triangles_per_proc[0], numprocs)
     146             extract_hostmesh(submesh, triangles_per_proc)
    148147
    149148# Read in the mesh partition that belongs to this
Note: See TracChangeset for help on using the changeset viewer.