Changeset 5541


Ignore:
Timestamp:
Jul 21, 2008, 12:30:26 PM (11 years ago)
Author:
ole
Message:

Resolved 64 bit issue for permutation in urs_ext.c

Location:
anuga_core/source/anuga/shallow_water
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/data_manager.py

    r5539 r5541  
    48764876    if permutation is None:
    48774877        permutation = ensure_numeric([], Float)   
    4878        
     4878
    48794879    # Call underlying C implementation urs2sts_ext.c   
    48804880    data=read_mux2(numSrc,filenames,weights,file_params,permutation,verbose)
     
    50615061        permutation = None
    50625062
    5063                
     5063
     5064    #print 'permutation', permutation
    50645065    # Read MUX2 files
    50655066    if (verbose): print 'reading mux2 file'
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r5539 r5541  
    66266626        y = points[:,1]
    66276627
     6628        #print
     6629        #print x
     6630        #print y
    66286631        for i, index in enumerate(permutation):
    66296632            # Check that STS points are stored in the correct order
     
    66326635            zone, e, n = redfearn(lat_long_points[index][0],
    66336636                                  lat_long_points[index][1])             
    6634            
     6637
     6638            #print i, [x[i],y[i]], [e,n]
    66356639            assert allclose([x[i],y[i]], [e,n])
    66366640           
     
    89408944if __name__ == "__main__":
    89418945
     8946    #suite = unittest.makeSuite(Test_Data_Manager,'test')
     8947    #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sts_read_mux2_pyI')
    89428948    suite = unittest.makeSuite(Test_Data_Manager,'test')
    8943     #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sts_read_mux2_pyI')
    8944     #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sts')
    89458949    #suite = unittest.makeSuite(Test_Data_Manager,'test_get_flow_through_cross_section_with_geo')
    89468950    #suite = unittest.makeSuite(Test_Data_Manager,'covered_')
  • anuga_core/source/anuga/shallow_water/urs_ext.c

    r5539 r5541  
    3333                   double *params,
    3434                   int *number_of_stations,
    35                    int *permutation,
     35                   long *permutation,
    3636                   int verbose);
    3737
     
    7474    // Convert Python arguments to C
    7575    if (!PyArg_ParseTuple(args, "iOOOOi",
    76                           &numSrc, &filenames, &pyweights, &file_params, &permutation, &verbose))
     76                          &numSrc, &filenames, &pyweights, &file_params,
     77                          &permutation, &verbose))
    7778    {
    7879            PyErr_SetString(PyExc_RuntimeError,
     
    155156                       (double*)file_params->data,
    156157                       &number_of_selected_stations, // Desired number of stations
    157                        (int*) permutation->data, // Ordering of selected stations
     158                       (long*) permutation->data, // Ordering of selected stations
    158159                       verbose);
    159160
     
    207208    dimensions[0] = number_of_selected_stations;
    208209    dimensions[1] = num_ts + POFFSET;
     210   
    209211    pydata = (PyArrayObject*)PyArray_FromDims(2, dimensions, PyArray_DOUBLE);
    210212    if(pydata == NULL)
     
    264266                   double *params,
    265267                   int *number_of_stations,
    266                    int *permutation,
     268                   long *permutation,
    267269                   int verbose)
    268270{
     
    404406     
    405407        // Create the Identity permutation vector
    406         permutation = (int *) malloc(number_of_selected_stations*sizeof(int));
     408        permutation = (long *) malloc(number_of_selected_stations*sizeof(long));
    407409        for (i = 0; i < number_of_selected_stations; i++)
    408410        {
    409           permutation[i] = i; 
    410         }
    411     }
    412    
    413    
     411          permutation[i] = (long) i; 
     412        }
     413    }
     414   
     415    /*
     416    printf("number_of_selected_stations = %d\n", number_of_selected_stations);
     417    for (i = 0; i < number_of_selected_stations; i++) {
     418      printf("permutation[%d] = %d\n", i, (int) permutation[i]);
     419    }   
     420    */
     421   
     422       
    414423   
    415424    /* Make array(s) to hold demuxed data for stations given in the permutation file */
     
    433442        }
    434443
    435         ista = permutation[i]; // Get global index into mux data
     444        ista = (int) permutation[i]; // Get global index into mux data
    436445       
    437446        sts_data[i][mytgs0[0].nt] = (float)mytgs0[ista].geolat;
     
    477486        {               
    478487       
    479             ista = permutation[i]; // Get global index into mux data   
     488            ista = (int) permutation[i]; // Get global index into mux data     
    480489           
    481490            /* fill the data0 array from the mux file, and weight it */
Note: See TracChangeset for help on using the changeset viewer.