Changeset 1192
- Timestamp:
- Apr 4, 2005, 11:27:27 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/mesh.py
r1191 r1192 152 152 153 153 154 def set_to_incribed_circle(self ):154 def set_to_incribed_circle(self,safety_factor = 1): 155 155 #FIXME phase out eventually 156 156 from math import sqrt 157 157 N = self.number_of_elements 158 158 V = self.vertex_coordinates 159 for i in range(N): 159 160 #initialising min and max ratio 161 i=0 162 old_rad = self.radii[i] 163 x0 = V[i, 0]; y0 = V[i, 1] 164 x1 = V[i, 2]; y1 = V[i, 3] 165 x2 = V[i, 4]; y2 = V[i, 5] 166 a = sqrt((x0-x1)**2+(y0-y1)**2) 167 b = sqrt((x1-x2)**2+(y1-y2)**2) 168 c = sqrt((x2-x0)**2+(y2-y0)**2) 169 ratio = old_rad/self.radii[i] 170 max_ratio = ratio 171 min_ratio = ratio 172 173 for i in range(N): 174 old_rad = self.radii[i] 160 175 x0 = V[i, 0]; y0 = V[i, 1] 161 176 x1 = V[i, 2]; y1 = V[i, 3] … … 164 179 b = sqrt((x1-x2)**2+(y1-y2)**2) 165 180 c = sqrt((x2-x0)**2+(y2-y0)**2) 166 167 self.radii[i]=self.areas[i]/(2*(a+b+c)) 181 self.radii[i]=self.areas[i]/(2*(a+b+c))*safety_factor 182 ratio = old_rad/self.radii[i] 183 if ratio >= max_ratio: max_ratio = ratio 184 if ratio <= min_ratio: min_ratio = ratio 185 return max_ratio,min_ratio 168 186 169 187 def build_neighbour_structure(self):
Note: See TracChangeset
for help on using the changeset viewer.