Ignore:
Timestamp:
May 28, 2007, 10:10:21 AM (18 years ago)
Author:
duncan
Message:

generalising so info without attributes can be used

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/load_mesh/loadASCII.py

    r4165 r4496  
    486486
    487487    #<vertex #> <x> <y> [attributes]   
    488     index = 0 
     488    index = 0
    489489    for vert in vertices:
    490490        attlist = ""
    491         for att in vertices_attributes[index]:
    492             attlist = attlist + str(att)+" "
     491       
     492        if vertices_attributes == []:
     493            attlist = ""
     494        else:
     495            for att in vertices_attributes[index]:
     496                attlist = attlist + str(att)+" "
    493497        attlist.strip()
    494498        fd.write(str(index) + " "
     
    511515        neighbors = ""
    512516        tri = triangles[index]
    513         for neighbor in triangle_neighbors[index]:
    514             if neighbor:
    515                 neighbors += str(neighbor) + " "
    516             else:
    517                 if neighbor == 0:
    518                     neighbors +=  "0 "
     517        if triangle_neighbors == []:
     518            neighbors = "-1 -1 -1 "
     519        else:
     520            for neighbor in triangle_neighbors[index]:
     521                if neighbor:
     522                    neighbors += str(neighbor) + " "
    519523                else:
    520                     neighbors +=  "-1 "
     524                    if neighbor == 0:
     525                        neighbors +=  "0 "
     526                    else:
     527                        neighbors +=  "-1 "
    521528        #Warning even though a list is past, only the first value
    522529        #is written.  There's an assumption that the list only
     
    525532        # with triangle, and it seems to have the option of returning
    526533        # more than one value for triangle attributex
    527         if triangles_attributes[index] == ['']:
     534        if triangles_attributes == [] or triangles_attributes[index] == ['']:
    528535            att = ""
    529536        else:
Note: See TracChangeset for help on using the changeset viewer.