Changeset 700
- Timestamp:
- Dec 13, 2004, 5:45:14 PM (20 years ago)
- Location:
- inundation/ga/storm_surge
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/analytical solutions/Hobart.py
r699 r700 36 36 print 'Creating domain from', filename 37 37 domain = pmesh_to_domain_instance(filename, Domain) 38 print "Number of triangles = ", len(domain) 38 print 'Number of triangles = ', len(domain) 39 print 'Extent = ', domain.get_extent() 40 39 41 40 42 domain.default_order = 1 41 43 domain.smooth = True 44 42 45 43 46 #------------------------------ … … 60 63 X = domain.get_centroid_coordinates() 61 64 # Find triangle indices which are within polygon boundary only 62 indic ies = inside_polygon(X,p0)65 indices = inside_polygon(X, p0) 63 66 # Get the bed elevation at the centroid of every triangle in polygon region 64 zp = domain.get_quantity('elevation',location='centroids',indexes='indicies') 65 # Set the level to bed elevation plus depth for all triangle centroids in the polygon region 66 domain.set_quantity('level',zp+depth,location='centroids',indexes='indicies') 67 68 zp = domain.get_quantity('elevation', location='centroids', indexes=indices) 69 # Set the level to bed elevation plus depth for all triangle vertices in the polygon region 70 71 domain.set_quantity('level', zp+depth, location='centroids', indexes=indices) 72 73 74 #Alternative way which also works (I used it for testing - OMN) 75 # 76 77 #z = domain.get_quantity('elevation') 78 #from copy import copy 79 #w = copy(z) 80 #for i in indices: 81 # w[i, :] = z[i, :] + depth 82 #domain.set_quantity('level', w) 83 67 84 68 85 #------------------------------------- -
inundation/ga/storm_surge/pyvolution/quantity.py
r659 r700 110 110 msg = 'Given values are None' 111 111 raise msg 112 113 import types 112 113 import types, Numeric 114 assert type(indexes) in [types.ListType, types.NoneType, 115 Numeric.ArrayType],\ 116 'Indices must be a list or None' 117 114 118 115 119 if callable(X): … … 177 181 raise msg 178 182 183 import types, Numeric 184 assert type(indexes) in [types.ListType, types.NoneType, 185 Numeric.ArrayType],\ 186 'Indices must be a list or None' 187 179 188 if (indexes == None): 180 189 indexes = range(len(self)) 190 181 191 182 192 if location == 'centroids': -
inundation/ga/storm_surge/pyvolution/test_domain.py
r648 r700 399 399 domain.set_region([set_bottom_friction, set_top_friction]) 400 400 #print domain.quantities['friction'].get_values() 401 assert allclose(domain.quantities['friction'].get_values(), [[ 0.09, 0.09, 0.09], 402 [ 0.09, 0.09, 0.09], 403 [ 0.07, 0.07, 0.07], 404 [ 0.07, 0.07, 0.07], 405 [ 1.0, 1.0, 1.0], 406 [ 1.0, 1.0, 1.0]]) 401 assert allclose(domain.quantities['friction'].get_values(),\ 402 [[ 0.09, 0.09, 0.09], 403 [ 0.09, 0.09, 0.09], 404 [ 0.07, 0.07, 0.07], 405 [ 0.07, 0.07, 0.07], 406 [ 1.0, 1.0, 1.0], 407 [ 1.0, 1.0, 1.0]]) 407 408 408 409 domain.set_region([set_all_friction]) -
inundation/ga/storm_surge/pyvolution/test_region.py
r592 r700 48 48 domain.set_region([a, b]) 49 49 #print domain.quantities['friction'].get_values() 50 assert allclose(domain.quantities['friction'].get_values(), [[ 0.09, 0.09, 0.09], 51 [ 0.09, 0.09, 0.09], 52 [ 0.07, 0.07, 0.07], 53 [ 0.07, 0.07, 0.07], 54 [ 1.0, 1.0, 1.0], 55 [ 1.0, 1.0, 1.0]]) 50 assert allclose(domain.quantities['friction'].get_values(),\ 51 [[ 0.09, 0.09, 0.09], 52 [ 0.09, 0.09, 0.09], 53 [ 0.07, 0.07, 0.07], 54 [ 0.07, 0.07, 0.07], 55 [ 1.0, 1.0, 1.0], 56 [ 1.0, 1.0, 1.0]]) 56 57 57 58 #c = Add_Value_To_Region('all', 'friction', 10.0)
Note: See TracChangeset
for help on using the changeset viewer.