Ignore:
Timestamp:
Jul 7, 2008, 12:18:29 PM (15 years ago)
Author:
ole
Message:

Added verbose flag to c code

File:
1 edited

Legend:

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

    r5469 r5470  
    2929   
    3030    Python call:
    31     read_mux2(numSrc,filenames,weights,file_params,write)
     31    read_mux2(numSrc,filenames,weights,file_params,verbose)
    3232
    3333    NOTE:
     
    4343  float *weights;
    4444  long numSrc;
    45   long write;
     45  long verbose;
    4646
    4747  float **cdata;
     
    5858  // Convert Python arguments to C
    5959  if (!PyArg_ParseTuple(args, "iOOOi",
    60                         &numSrc,&filenames,&pyweights,&file_params,&write)) {                   
     60                        &numSrc,&filenames,&pyweights,&file_params,&verbose)) {                 
    6161                       
    6262    PyErr_SetString(PyExc_RuntimeError,
     
    117117
    118118  // Read in mux2 data from file
    119   cdata=_read_mux2((int)numSrc,muxFileNameArray,weights,(double*)file_params->data,(int)write);
     119  cdata=_read_mux2((int)numSrc,muxFileNameArray,weights,(double*)file_params->data,(int)verbose);
    120120
    121121
     
    181181  free(weights);
    182182  free(muxFileNameArray);
     183  free(cdata);
    183184  return  PyArray_Return(pydata);
    184185
    185186}
    186187
    187 float** _read_mux2(int numSrc, char **muxFileNameArray, float *weights, double *params, int write)
     188float** _read_mux2(int numSrc, char **muxFileNameArray, float *weights, double *params, int verbose)
    188189{
    189190   FILE *fp;
     
    225226   }   
    226227                     
    227    
    228    /* open the first muxfile */
    229    if((fp=fopen(muxFileNameArray[0],"r"))==NULL)
    230    {
     228   if (verbose){
     229     printf("Reading mux header information\n");
     230   }
     231   
     232   /* Open the first muxfile */
     233   if((fp=fopen(muxFileNameArray[0],"r"))==NULL){
    231234      fprintf(stderr, "cannot open file %s\n", muxFileNameArray[0]);
    232235      exit(-1); 
    233236   }
    234237 
    235    /* read in the header */
    236    /*first read the number of stations*/   
     238   /* Read in the header */
     239   /* First read the number of stations*/   
    237240   fread(&nsta0,sizeof(int),1,fp);
    238241   
     
    364367         exit(-1); 
    365368       }
     369       
     370     if (verbose){
     371       printf("Reading mux file %s\n",muxFileName);
     372     }
    366373
    367374     offset=sizeof(int)+nsta0*(sizeof(struct tgsrwg)+2*sizeof(int));
Note: See TracChangeset for help on using the changeset viewer.