Changeset 3193 for inundation/pmesh/test_mesh_interface.py
- Timestamp:
- Jun 21, 2006, 3:33:49 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pmesh/test_mesh_interface.py
r3126 r3193 3 3 import tempfile 4 4 import unittest 5 import os 6 from mesh import importMeshFromFile 5 7 from mesh_interface import * 6 8 from load_mesh.loadASCII import * … … 221 223 'FAILED!') 222 224 225 def test_create_mesh_from_regions4(self): 226 227 file_name = tempfile.mktemp(".tsh") 228 229 # These are the absolute values 230 density_outer = 1000 231 min_outer = 0 232 max_outer = 1000 233 polygon_outer = [[min_outer,min_outer],[max_outer,min_outer], 234 [max_outer,max_outer],[min_outer,max_outer]] 235 236 density_inner1 = 10000000 237 inner_buffer = 100 238 min_inner1 = min_outer + inner_buffer 239 max_inner1 = max_outer - inner_buffer 240 inner1_polygon = [[min_inner1,min_inner1],[max_inner1,min_inner1], 241 [max_inner1,max_inner1],[min_inner1,max_inner1]] 242 243 244 boundary_tags = {'walls':[0,1],'bom':[2]} 245 246 interior_regions = [(inner1_polygon, density_inner1)] 247 create_mesh_from_regions(polygon_outer 248 , boundary_tags 249 , density_outer 250 , interior_regions=interior_regions 251 ,filename=file_name 252 #,verbose=True 253 ,verbose=False 254 ) 255 256 m = importMeshFromFile(file_name) 257 258 #print "file_name",file_name 259 self.failUnless(len(m.meshTriangles) <= 900, 260 'Test mesh interface failed!') 261 self.failUnless(len(m.meshTriangles) >= 200, 262 'Test mesh interface failed!') 263 264 create_mesh_from_regions(polygon_outer 265 , boundary_tags 266 , interior_regions=interior_regions 267 ,filename=file_name 268 #,verbose=True 269 ,verbose=False 270 ) 271 272 m = importMeshFromFile(file_name) 273 274 #print "len(m.meshTriangles)",len(m.meshTriangles) 275 self.failUnless(len(m.meshTriangles) <= 100, 276 'Test mesh interface failed!') 277 278 os.remove(file_name) 279 280 def test_create_mesh_from_regions5(self): 281 282 file_name = tempfile.mktemp(".tsh") 283 284 # These are the absolute values 285 density_outer = 10000000 286 min_outer = 0 287 max_outer = 1000 288 polygon_outer = [[min_outer,min_outer],[max_outer,min_outer], 289 [max_outer,max_outer],[min_outer,max_outer]] 290 291 density_inner1 = 1000 292 inner_buffer = 100 293 min_inner1 = min_outer + inner_buffer 294 max_inner1 = max_outer - inner_buffer 295 inner1_polygon = [[min_inner1,min_inner1],[max_inner1,min_inner1], 296 [max_inner1,max_inner1],[min_inner1,max_inner1]] 297 298 299 boundary_tags = {'walls':[0,1],'bom':[2]} 300 301 interior_regions = [(inner1_polygon, density_inner1)] 302 create_mesh_from_regions(polygon_outer 303 , boundary_tags 304 , density_outer 305 , interior_regions=interior_regions 306 ,filename=file_name 307 #,verbose=True 308 ,verbose=False 309 ) 310 311 m = importMeshFromFile(file_name) 312 #print "file_name",file_name 313 #print "len(m.meshTriangles",len(m.meshTriangles) 314 self.failUnless(len(m.meshTriangles) <= 2000, 315 'Test mesh interface failed!') 316 317 self.failUnless(len(m.meshTriangles) >= 900, 318 'Test mesh interface failed!') 319 320 os.remove(file_name) 321 223 322 def test_create_mesh_from_regions_interior_regions(self): 224 323 """Test that create_mesh_from_regions fails when an interior region is … … 254 353 boundary_tags, 255 354 10000000, 256 interior_regions=interior_regions )355 interior_regions=interior_regions,verbose=False) 257 356 except: 258 357 pass … … 287 386 boundary_tags, 288 387 10000000, 289 interior_regions=interior_regions )388 interior_regions=interior_regions,verbose=False) 290 389 291 390 … … 337 436 boundary_tags, 338 437 10000000, 339 poly_geo_reference=geo_ref_poly )438 poly_geo_reference=geo_ref_poly,verbose=False) 340 439 341 440
Note: See TracChangeset
for help on using the changeset viewer.