Changeset 7872
- Timestamp:
- Jun 24, 2010, 10:38:40 PM (14 years ago)
- Location:
- trunk/anuga_core/source/anuga
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/config.py
r7865 r7872 172 172 ################################################################################ 173 173 174 use_extensions = True # Use C-extensions175 174 use_psyco = True # Use psyco optimisations 176 175 -
trunk/anuga_core/source/anuga/file/test_csv.py
r7871 r7872 7 7 8 8 from csv_file import load_csv_as_array, load_csv_as_dict, store_parameters, \ 9 load_csv_as_matrix, load_csv_as_polygons 9 load_csv_as_matrix, load_csv_as_polygons, \ 10 load_csv_as_building_polygons 10 11 11 12 class Test_csv(unittest.TestCase): -
trunk/anuga_core/source/anuga/file/test_sww.py
r7871 r7872 8 8 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular 9 9 from anuga.shallow_water.shallow_water_domain import Domain 10 from sww import load_sww_as_domain, weed, get_mesh_and_quantities_from_file 10 from sww import load_sww_as_domain, weed, get_mesh_and_quantities_from_file, \ 11 Write_sww 11 12 from Scientific.IO.NetCDF import NetCDFFile 12 13 13 from anuga.config import netcdf_mode_w 14 from anuga.config import netcdf_mode_w, netcdf_float 14 15 15 16 # boundary functions … … 290 291 # 291 292 # 293 294 DEFAULT_ZONE = 0 # Not documented anywhere what this should be. 292 295 293 296 filename = tempfile.mktemp("_data_manager.sww") -
trunk/anuga_core/source/anuga/geometry/aabb.py
r7861 r7872 12 12 13 13 class AABB: 14 """Axially-aligned bounding box class. 15 Defines a box which can check for intersections with other boxes, 16 or if a point lies within it. 14 """ Axially-aligned bounding box class. 15 An axially aligned bounding box (or AABB) defines a box-shaped region 16 of the plane which contains any other arbitrary geometry. 17 It is useful because intersections can be tested against it very 18 rapidly. Once all misses are trivially rejected, a more expensive 19 collision detection can be done against the remaining geometry. 20 21 This class defines a box which can check for intersections with other 22 boxes, or points. It can also subdivide itself, returning 23 smaller AABBs. This can be used as the basis of a recursive tree 24 structure for optimising geometry searches. 17 25 """ 18 26 -
trunk/anuga_core/source/anuga/geometry/quad.py
r7866 r7872 17 17 18 18 class Cell(): 19 """ class Cell20 21 One cell in the plane.19 """ One cell in the plane. 20 A cell is defined by an AABB, and can have smaller AABB children. 21 The children can be rapidly searched for intersections in log(n) time. 22 22 """ 23 23 … … 38 38 39 39 def __repr__(self): 40 """ String representation of the quadtree. """ 40 41 ret_str = '%s: leaves: %d' \ 41 42 % (self.name , len(self.leaves)) … … 84 85 #return 85 86 86 # option 2 - try splitting 2 ways - no diff noticed in practise 87 # option 2 - try splitting 2 ways - no performance difference 88 # noticed in practise between this and the above option. 87 89 if subregion1.is_trivial_in(new_region): 88 90 self.children = [Cell(subregion1, self), \ … … 160 162 161 163 def test_leaves(self, point): 162 """ Test all leaves to see if they intersect x. 164 """ Test all leaves on this node to see if they intersect x. 165 Does not recurse into children. 163 166 x is a point to test 164 167 return a list of leaves that intersect x -
trunk/anuga_core/source/anuga/pmesh/mesh.py
r7711 r7872 608 608 self.generateMesh(mode = "Q", minAngle=20.0) 609 609 610 # Depreciated611 def addRegionEN(self, x,y):612 log.critical("deprecated, use add_region")613 return self.add_region(x,y)614 615 610 616 611 def add_vertices(self, point_data): -
trunk/anuga_core/source/anuga/pmesh/mesh_quadtree.py
r7866 r7872 1 1 """ 2 General functions used in fit and interpolate.2 Quadtree representation of 2D mesh geometry. 3 3 4 4 Ole Nielsen, Stephen Roberts, Duncan Gray … … 78 78 """ 79 79 Find the triangle (element) that the point x is in. 80 81 Does a coherent quadtree traversal to return a single triangle that the 82 point falls within. The traversal begins at the last triangle found. 83 If this fails, it checks the triangles beneath it in the tree, and then 84 begins traversing up through the tree until it reaches the root. 85 86 This results in performance which varies between constant time and O(n), 87 depending on the geometry. 80 88 81 89 Inputs: -
trunk/anuga_core/source/anuga/shallow_water/test_data_manager.py
r7866 r7872 505 505 # Check contents 506 506 # Get NetCDF 507 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append507 fid = NetCDFFile(sww.filename, netcdf_mode_r) 508 508 509 509 # Get the variables … … 605 605 sww.store_timestep() 606 606 607 608 607 #Check contents 609 608 #Get NetCDF 610 609 fid = NetCDFFile(sww.filename, netcdf_mode_r) 611 612 610 613 611 # Get the variables … … 645 643 """ 646 644 647 lat_long_points=[[6.01,97.0],[6.02,97.0],[6.05,96.9],[6.0,97.0]] 648 bounding_polygon=[[6.0,97.0],[6.01,97.0],[6.02,97.0],[6.02,97.02],[6.00,97.02]] 645 lat_long_points=[[6.01, 97.0], [6.02, 97.0], [6.05, 96.9], [6.0, 97.0]] 646 bounding_polygon=[[6.0, 97.0], [6.01, 97.0], [6.02,97.0], \ 647 [6.02,97.02], [6.00,97.02]] 649 648 tide = 0.35 650 649 time_step_count = 50 -
trunk/anuga_core/source/anuga/utilities/compile.py
r7276 r7872 324 324 """ 325 325 326 from anuga.config import use_extensions327 328 326 from os.path import splitext 329 327 … … 331 329 332 330 C=False 333 if use_extensions: 331 try: 332 s = 'import %s' %root 333 exec(s) 334 except: 334 335 try: 335 s = 'import %s' %root 336 #print s 337 exec(s) 336 open(filename) 338 337 except: 338 msg = 'C extension %s cannot be opened' %filename 339 print msg 340 else: 341 print '------- Trying to compile c-extension %s' %filename 342 339 343 try: 340 open(filename)344 compile(filename) 341 345 except: 342 msg = 'C extension %s cannot be opened' %filename 343 print msg 344 else: 345 print '------- Trying to compile c-extension %s' %filename 346 346 print 'WARNING: Could not compile C-extension %s'\ 347 %filename 348 else: 347 349 try: 348 compile(filename)350 exec('import %s' %root) 349 351 except: 350 print 'WARNING: Could not compile C-extension %s'\ 351 %filename 352 msg = 'C extension %s seems to compile OK, ' 353 msg += 'but it can still not be imported.' 354 raise msg 352 355 else: 353 try: 354 exec('import %s' %root) 355 except: 356 msg = 'C extension %s seems to compile OK, ' 357 msg += 'but it can still not be imported.' 358 raise msg 359 else: 360 C=True 361 else: 362 C=True 356 C=True 357 else: 358 C=True 363 359 364 360 if not C: 365 361 pass 366 print 'NOTICE: C-extension %s not used' % filename362 print 'NOTICE: C-extension %s not used' % filename 367 363 368 364 return C -
trunk/anuga_core/source/anuga/utilities/sww_merge.py
r7822 r7872 16 16 Merge a list of sww files into a single file. 17 17 18 May be useful for parallel runs. Note that some advanced information 19 and custom quantities may not be exported. 18 May be useful for parallel runs. Note that colinear points and 19 edges are not merged: there will essentially be multiple meshes within 20 the one sww file. 20 21 21 The sww files to be merged must have exactly the same timesteps. 22 The sww files to be merged must have exactly the same timesteps. Note 23 that some advanced information and custom quantities may not be 24 exported. 22 25 23 26 swwfiles is a list of .sww files to merge.
Note: See TracChangeset
for help on using the changeset viewer.