Changeset 5531


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

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

Legend:

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

    r5529 r5531  
    7676
    7777
    78         domain.distribute_to_vertices_and_edges()               
     78        domain.distribute_to_vertices_and_edges()               
    7979        self.initial_stage = copy.copy(domain.quantities['stage'].vertex_values)
    8080
     
    580580        for t in self.domain.evolve(yieldstep = 1.0, finaltime = 4.0):
    581581           
    582             #########self.domain.write_time(track_speeds=True)
     582            #########self.domain.write_time(track_speeds=True)
    583583            stage = self.domain.quantities['stage'].vertex_values
    584584
     
    69026902
    69036903    def test_file_boundary_stsIII(self):
    6904         """Read correct points from order file
     6904        """Read correct points from ordering file
    69056905        """
    69066906        from anuga.shallow_water import Domain
     
    84908490    def test_get_mesh_and_quantities_from_sww_file(self):
    84918491        """test_get_mesh_and_quantities_from_sww_file(self):
    8492         """     
    8493        
    8494         # Generate a test sww file with non trivial georeference
    8495        
    8496         import time, os
     8492        """     
     8493       
     8494        # Generate a test sww file with non trivial georeference
     8495       
     8496        import time, os
    84978497        from Numeric import array, zeros, allclose, Float, concatenate
    84988498        from Scientific.IO.NetCDF import NetCDFFile
     
    85248524
    85258525       
    8526         # Read it
     8526        # Read it
    85278527
    85288528        # Get mesh and quantities from sww file
     
    85418541
    85428542        # Check that time has been recovered
    8543         assert allclose(time, range(t_end+1))
     8543        assert allclose(time, range(t_end+1))
    85448544
    85458545        # Check that quantities have been recovered
    85468546        # (sww files use single precision)
    85478547        z=domain.get_quantity('elevation').get_values(location='unique vertices')
    8548         assert allclose(quantities['elevation'], z)
     8548        assert allclose(quantities['elevation'], z)
    85498549
    85508550        for q in ['stage', 'xmomentum', 'ymomentum']:
  • 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.