Changeset 279 for inundation/ga/storm_surge/pyvolution-1d/domain.py
- Timestamp:
- Sep 7, 2004, 5:24:43 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution-1d/domain.py
r256 r279 26 26 27 27 #Allocate space for geometric quantities 28 self.vert ex_coordinates= zeros((N, 2), Float)29 self.centroid _coordinates = zeros(N, Float)30 self.areas 28 self.vertices = zeros((N, 2), Float) 29 self.centroids = zeros(N, Float) 30 self.areas = zeros(N, Float) 31 31 for i in range(N): 32 32 xl = self.coordinates[i] 33 33 xr = self.coordinates[i+1] 34 self.vert ex_coordinates[i,0] = xl35 self.vert ex_coordinates[i,1] = xr34 self.vertices[i,0] = xl 35 self.vertices[i,1] = xr 36 36 37 37 centroid = (xl+xr)/2 38 self.centroid _coordinates[i] = centroid38 self.centroids[i] = centroid 39 39 40 40 msg = 'Coordinates should be ordered, smallest to largest' … … 43 43 self.areas[i] = (xr-xl) 44 44 45 ## print 'N', N 46 ## print 'Centroid', self.centroids 47 ## print 'Areas', self.areas 48 ## print 'Vertex_Coordinates', self.vertices 49 50 def get_centroids(self): 51 """Return all coordinates of centroids 52 Return x coordinate of centroid for each element as a N array 53 """ 54 55 return self.centroids 45 56 46 print 'N', N 47 print 'Coordinates', self.coordinates 48 print 'Centroid', self.centroid_coordinates 49 print 'Areas', self.areas 50 print 'Vertex_Coordinates', self.vertex_coordinates 51 52 def get_centroid_coordinates(self): 57 def get_vertices(self): 53 58 """Return all coordinates of centroids 54 59 Return x coordinate of centroid for each element as a N array 55 60 """ 56 61 57 return self. centroid_coordinates62 return self.vertices 58 63 59 64 def get_coordinate(self, elem_id, vertex=None): … … 64 69 65 70 if vertex is None: 66 return self.centroid _coordinates[elem_id]71 return self.centroids[elem_id] 67 72 else: 68 return self.vertex_coordinates[elem_id,vertex] 69 73 return self.vertices[elem_id,vertex] 74 75 def get_area(self, elem_id): 76 """Return area of element id 77 """ 78 79 return self.areas[elem_id] 80 70 81 71 82 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.