Changeset 7872


Ignore:
Timestamp:
Jun 24, 2010, 10:38:40 PM (14 years ago)
Author:
hudson
Message:

Fixed a few unit test errors.

Location:
trunk/anuga_core/source/anuga
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/config.py

    r7865 r7872  
    172172################################################################################
    173173
    174 use_extensions = True # Use C-extensions
    175174use_psyco = True      # Use psyco optimisations
    176175
  • trunk/anuga_core/source/anuga/file/test_csv.py

    r7871 r7872  
    77
    88from 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
    1011
    1112class Test_csv(unittest.TestCase):
  • trunk/anuga_core/source/anuga/file/test_sww.py

    r7871 r7872  
    88from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular
    99from anuga.shallow_water.shallow_water_domain import Domain
    10 from sww import load_sww_as_domain, weed, get_mesh_and_quantities_from_file
     10from sww import load_sww_as_domain, weed, get_mesh_and_quantities_from_file, \
     11                Write_sww
    1112from Scientific.IO.NetCDF import NetCDFFile
    1213
    13 from anuga.config import netcdf_mode_w
     14from anuga.config import netcdf_mode_w, netcdf_float
    1415
    1516# boundary functions
     
    290291        #
    291292        # 
     293
     294        DEFAULT_ZONE = 0 # Not documented anywhere what this should be.
    292295       
    293296        filename = tempfile.mktemp("_data_manager.sww")
  • trunk/anuga_core/source/anuga/geometry/aabb.py

    r7861 r7872  
    1212
    1313class 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.
    1725    """
    1826   
  • trunk/anuga_core/source/anuga/geometry/quad.py

    r7866 r7872  
    1717           
    1818class Cell():
    19     """class Cell
    20 
    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.
    2222    """
    2323 
     
    3838   
    3939    def __repr__(self):
     40        """ String representation of the quadtree. """
    4041        ret_str = '%s: leaves: %d' \
    4142               % (self.name , len(self.leaves))   
     
    8485                    #return               
    8586
    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.
    8789            if subregion1.is_trivial_in(new_region):
    8890                self.children = [Cell(subregion1, self), \
     
    160162 
    161163    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.
    163166            x is a point to test
    164167            return a list of leaves that intersect x
  • trunk/anuga_core/source/anuga/pmesh/mesh.py

    r7711 r7872  
    608608        self.generateMesh(mode = "Q", minAngle=20.0)
    609609       
    610     # Depreciated
    611     def addRegionEN(self, x,y):
    612         log.critical("deprecated, use add_region")
    613         return self.add_region(x,y)
    614 
    615610   
    616611    def add_vertices(self, point_data):
  • trunk/anuga_core/source/anuga/pmesh/mesh_quadtree.py

    r7866 r7872  
    11"""
    2 General functions used in fit and interpolate.
     2    Quadtree representation of 2D mesh geometry.
    33
    44   Ole Nielsen, Stephen Roberts, Duncan Gray
     
    7878        """
    7979        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.
    8088
    8189        Inputs:
  • trunk/anuga_core/source/anuga/shallow_water/test_data_manager.py

    r7866 r7872  
    505505        # Check contents
    506506        # Get NetCDF
    507         fid = NetCDFFile(sww.filename, netcdf_mode_r)  # Open existing file for append
     507        fid = NetCDFFile(sww.filename, netcdf_mode_r)
    508508
    509509        # Get the variables
     
    605605        sww.store_timestep()
    606606
    607 
    608607        #Check contents
    609608        #Get NetCDF
    610609        fid = NetCDFFile(sww.filename, netcdf_mode_r)
    611 
    612610
    613611        # Get the variables
     
    645643        """
    646644
    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]]
    649648        tide = 0.35
    650649        time_step_count = 50
  • trunk/anuga_core/source/anuga/utilities/compile.py

    r7276 r7872  
    324324    """
    325325
    326     from anuga.config import use_extensions
    327 
    328326    from os.path import splitext
    329327
     
    331329   
    332330    C=False
    333     if use_extensions:
     331    try:
     332        s = 'import %s' %root
     333        exec(s)
     334    except:
    334335        try:
    335             s = 'import %s' %root
    336             #print s
    337             exec(s)
     336            open(filename)
    338337        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       
    339343            try:
    340                 open(filename)
     344                compile(filename)
    341345            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:
    347349                try:
    348                     compile(filename)
     350                    exec('import %s' %root)
    349351                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
    352355                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
    363359           
    364360    if not C:
    365361        pass
    366         print 'NOTICE: C-extension %s not used' %filename
     362        print 'NOTICE: C-extension %s not used' % filename
    367363
    368364    return C
  • trunk/anuga_core/source/anuga/utilities/sww_merge.py

    r7822 r7872  
    1616        Merge a list of sww files into a single file.
    1717       
    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.
    2021       
    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.
    2225       
    2326        swwfiles is a list of .sww files to merge.
Note: See TracChangeset for help on using the changeset viewer.