Changeset 2092


Ignore:
Timestamp:
Nov 29, 2005, 1:58:09 PM (18 years ago)
Author:
jack
Message:

pmesh_divide_metis doesn't catch fire anymore when called with n_procs = 1. It now assigns all
the triangles to the one processor. Could probably be made more efficient.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/parallel/pmesh_divide.py

    r2090 r2092  
    1111#  Authors: Linda Stals and Matthew Hardy, June 2005
    1212#  Modified: Linda Stals, Nov 2005
     13#            Jack Kelly, Nov 2005
    1314#
    1415#
     
    310311    # Prepare variables for the metis call
    311312    n_tri = len(domain.triangles)
    312     n_vert = len(domain.coordinates)
    313     t_list = domain.triangles.copy()
    314     t_list = reshape(t_list, (-1,))
    315    
    316     # The 1 here is for triangular mesh elements.
    317     edgecut, epart, npart = partMeshNodal(n_tri, n_vert, t_list, 1, n_procs)
    318    
    319     # print edgecut
     313    if n_procs != 1: #Because metis chokes on it...
     314        n_vert = len(domain.coordinates)
     315        t_list = domain.triangles.copy()
     316        t_list = reshape(t_list, (-1,))
     317   
     318        # The 1 here is for triangular mesh elements.
     319        edgecut, epart, npart = partMeshNodal(n_tri, n_vert, t_list, 1, n_procs)
     320        del edgecut
     321        del npart
     322        # print edgecut
     323        # print npart
     324    else:
     325        epart = [0] * n_tri
     326
    320327    # print epart
    321     # print npart
    322 
    323     del edgecut
    324     del npart
     328
    325329
    326330    # Assign triangles to processes, according to what metis told us.
Note: See TracChangeset for help on using the changeset viewer.