Ignore:
Timestamp:
Jul 18, 2008, 2:49:09 PM (16 years ago)
Author:
ole
Message:

Verified that urs_ext.c runs on 32 bit system and added comments towards
add permutation array to the c-code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/urs_ext.c

    r5530 r5531  
    116116        if (!fname)
    117117        {
    118           //printf("error\n");         
     118          //printf("error\n");         
    119119            PyErr_SetString(PyExc_ValueError, "filename not a string");
    120120            return NULL;
     
    256256{
    257257    FILE *fp;
    258     int nsta, nsta0, i, isrc, ista;
     258    int nsta, nsta0, i, isrc, ista, k;
    259259    struct tgsrwg *mytgs=0, *mytgs0=0;
    260260    char *muxFileName;                                                                 
     
    299299    }
    300300
    301     /* loop over remaining sources, check compatibility, and read them into
    302     *muxData */
    303         for (isrc = 0; isrc < numSrc; isrc++)
     301    /* loop over all sources, read headers and check compatibility */
     302    for (isrc = 0; isrc < numSrc; isrc++)
    304303    {
    305304        muxFileName = muxFileNameArray[isrc];
     
    376375
    377376    /* make array(s) to hold the demuxed data */
    378     //FIXME: This can be reduced to only contain stations in order file
     377    //FIXME: This can be reduced to only contain stations given in permutation file
    379378    sts_data = (float**)malloc(nsta0*sizeof(float *));
    380379    if (sts_data == NULL)
     
    432431
    433432        /* loop over stations */
     433        /* This is where we should only take stations with indices in the permutation array
     434           (and in that order) */
     435       
     436        //for i in range(len(permution)):
     437        //     ista = permutation[i]
     438        //     use ista with mux data
     439        //     use i with the processed data to be returned         
     440        i=0;
     441       
    434442        for(ista = 0; ista < nsta0; ista++)
    435443        {               
     
    438446
    439447            /* weight appropriately and add */
    440             for(i = 0; i < mytgs0[ista].nt; i++)
     448            for(k = 0; k < mytgs0[ista].nt; k++)
    441449            {
    442                 if((isdata(sts_data[ista][i])) && isdata(temp_sts_data[i]))
     450                if((isdata(sts_data[ista][k])) && isdata(temp_sts_data[k]))
    443451                {
    444                     sts_data[ista][i] += temp_sts_data[i] * weights[isrc];
    445                     //printf("%d,%d,%f\n",ista,i,sts_data[ista][i]);
     452                    sts_data[ista][k] += temp_sts_data[k] * weights[isrc];
     453                    //printf("%d,%d,%f\n",ista,k,sts_data[ista][k]);
    446454                }
    447455                else
    448456                {
    449                     sts_data[ista][i] = NODATA;
     457                    sts_data[ista][k] = NODATA;
    450458                }
    451459            }
Note: See TracChangeset for help on using the changeset viewer.