Changeset 1091


Ignore:
Timestamp:
Mar 16, 2005, 6:56:12 PM (20 years ago)
Author:
ole
Message:

Diagnostic output (if verbose is requested)

Location:
inundation/ga/storm_surge/pyvolution
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/least_squares.py

    r1004 r1091  
    2424# solution was having the user increase the size of the mesh to
    2525#       cover all the desired points.
     26#(Ole): Now we've got a pre-cropping facility.
    2627
    2728
     
    105106    #FIXME (Ole): data_origin should be extracted here
    106107    try:
    107         point_dict = load_points_file(point_file,delimiter = ',')
     108        point_dict = load_points_file(point_file,
     109                                      delimiter = ',',
     110                                      verbose=verbose)
    108111    except SyntaxError,e:
    109         point_dict = load_points_file(point_file,delimiter = ' ')
     112        point_dict = load_points_file(point_file,
     113                                      delimiter = ' ',
     114                                      verbose=verbose)
     115       
    110116    point_coordinates = point_dict['pointlist']
    111117    title_list,point_attributes = concatinate_attributelist(point_dict['attributelist']) 
     
    427433            if verbose: print 'Getting indices inside mesh boundary'           
    428434            indices = inside_polygon(point_coordinates, P, verbose = verbose)
    429 
     435           
    430436            if verbose:
     437                print 'Done'
    431438                if len(indices) != point_coordinates.shape[0]:
    432439                    print '%d points outside mesh have been cropped.'\
  • inundation/ga/storm_surge/pyvolution/test_util.py

    r1063 r1091  
    915915        polygon = [[0,0], [1,0], [0.5,-1], [2, -1], [2,1], [0,1]]
    916916        points = [ [0.5, 0.5], [1, -0.5], [1.5, 0], [0.5, 1.5], [0.5, -0.5]]
    917         res = inside_polygon( points, polygon )
     917        res = inside_polygon( points, polygon, verbose=False )
    918918
    919919        assert allclose( res, [0,1,2] )
  • inundation/ga/storm_surge/pyvolution/util.py

    r1062 r1091  
    10451045    from Numeric import array, Float, reshape, zeros, Int
    10461046   
    1047    
     1047
     1048    if verbose: print 'Checking input to inside_polygon'   
    10481049    #Input checks
    10491050    try:
     
    10761077    from util_ext import inside_polygon
    10771078
     1079    if verbose: print 'Allocating array for indices'
     1080
    10781081    indices = zeros( points.shape[0], Int )
    10791082
     1083    if verbose: print 'Calling C-version of inside poly'
    10801084    count = inside_polygon(points, polygon, indices,
    10811085                           int(closed), int(verbose))
    1082 
    1083     #print 'O', point, count
    10841086
    10851087    if one_point:
    10861088        return count == 1
    10871089    else:
     1090        if verbose: print 'Got %d points' %count
    10881091        return indices[:count]
    10891092
  • inundation/ga/storm_surge/pyvolution/util_ext.c

    r1032 r1091  
    7777  //are far away from polygon
    7878
    79 
    8079  minpx = polygon[0]; maxpx = minpx;
    8180  minpy = polygon[1]; maxpy = minpy;
     
    9493  count = 0;
    9594  for (k=0; k<M; k++) {
    96     //FIXME: Do this later
    97     //if (verbose){
    98     //  if (k %((M+10)/10)==0: print 'Doing %d of %d' %(k, M)
    99 
     95    if (verbose){
     96      if (k %((M+10)/10)==0) printf("Doing %d of %d\n", k, M);
     97    }
     98   
    10099    x = points[2*k];
    101100    y = points[2*k + 1];
     
    230229  N = polygon -> dimensions[0];  //Number of vertices in polygon
    231230
    232   //printf("M=%d, N=%d\n", M, N);
     231  if (verbose) printf("Got %d points and %d polygon vertices\n", M, N);
     232 
    233233  //Call underlying routine
    234234  count = _inside_polygon(M, N,
Note: See TracChangeset for help on using the changeset viewer.