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

Resolved 64 bit issue for permutation in urs_ext.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.