Changeset 415 for inundation/ga/storm_surge/pyvolution/pmesh2domain.py
- Timestamp:
- Oct 18, 2004, 1:53:59 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/pmesh2domain.py
r389 r415 8 8 9 9 10 def pmesh_to_domain_instance(fileName, DomainClass, tags = None,setting_function = None):10 def pmesh_to_domain_instance(fileName, DomainClass, setting_function = None): 11 11 """ 12 12 """ 13 #FIXME: The current design doesn't seem to accomadate tags14 # being passed into the domain at this point.15 16 13 import sys 17 14 from domain import Domain 18 15 19 vertex_coordinates, volumes, marker_dict, vertex_quantity_dict = \16 vertex_coordinates, volumes, marker_dict, vertex_quantity_dict ,tagged_elements_dict = \ 20 17 pmesh_to_domain(fileName, 21 18 setting_function=setting_function) 22 19 23 20 assert issubclass(DomainClass, Domain), "DomainClass is not a subclass of Domain." 24 domain = DomainClass(vertex_coordinates, volumes, marker_dict) 21 domain = DomainClass(vertex_coordinates, volumes, marker_dict, 22 tagged_elements = tagged_elements_dict ) 25 23 26 24 # set the water level to be the elevation … … 44 42 triangle list: [(point1,point2, point3),(p5,p4, p1),...] (Tuples of integers) 45 43 triangle neighbor list: [(triangle1,triangle2, triangle3),(t5,t4, t1),...] (Tuples of integers) -1 means there's no triangle neighbor 46 triangle attribute list: [T1att, T2att, ...] (list of floats)44 triangle attribute list: [T1att, T2att, ...] (list of strings) 47 45 """ 48 46 … … 69 67 for quantity, value_vector in map (None, point_titles, point_atts): 70 68 vertex_quantity_dict[quantity] = value_vector 71 marker_dict = pmesh_dict_to_marker_dict(volumes, mesh_dict, 72 vertex_coordinates) 73 74 return vertex_coordinates, volumes, marker_dict, vertex_quantity_dict 69 marker_dict = pmesh_dict_to_marker_dict(mesh_dict) 70 tagged_elements_dict = build_tagged_elements_dictionary(mesh_dict) 71 return vertex_coordinates, volumes, marker_dict, vertex_quantity_dict,tagged_elements_dict 75 72 76 73 77 74 75 def build_tagged_elements_dictionary(mesh_dict): 76 """Build the dictionary of element tags. 77 tagged_elements is a dictionary of element arrays, 78 keyed by tag: 79 { (tag): [e1, e2, e3..] } 80 """ 81 tri_atts = mesh_dict['generatedtriangleattributelist'] 82 #print "tri_atts", tri_atts 83 tagged_elements = {} 84 for tri_att_index in range(len(tri_atts)): 85 tagged_elements.setdefault(tri_atts[tri_att_index][0],[]).append(tri_att_index) 86 #print "DSG pm2do tagged_elements", tagged_elements 87 return tagged_elements 78 88 79 89 #FIXME: The issue is whether this format should be stored in the tsh file … … 85 95 #using netCDF. 86 96 87 88 def pmesh_dict_to_marker_dict(triangles,mesh_dict,Vertices): 97 def pmesh_dict_to_marker_dict(mesh_dict): 89 98 """ Convert the pmesh dictionary (mesh_dict) description of boundary tags 90 99 to a dictionary of markers, indexed with volume id and face number. 91 100 """ 101 triangles = mesh_dict['generatedtrianglelist'] 92 102 sides = calc_sides(triangles) 93 103 marker_dict = {}
Note: See TracChangeset
for help on using the changeset viewer.