Changeset 5264


Ignore:
Timestamp:
May 1, 2008, 3:50:15 PM (17 years ago)
Author:
jack
Message:

AnugaVis? loads volume data from NetCDF file.

Location:
anuga_work/development/anugavis/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/anugavis/src/anugavis_simple.c

    r5263 r5264  
    1414    return 1;
    1515  }
    16 
    17   printf("points: %d\nvertices: %d\nvolumes: %d\n",
    18          anugavis.number_of_points,
    19          anugavis.number_of_vertices,
    20          anugavis.number_of_volumes);
    21 
    2216  if(AnugaVis_DefineHeightQuantity("elevation", 0, 1, 128, 128, 128) == -1){
    2317    printf("AnugaVis_DefineHeightQuantity() Error: %s\n", AnugaVis_GetError());
  • anuga_work/development/anugavis/src/globals.h

    r5263 r5264  
    1313  float *x;
    1414  float *y;
    15   float *cells;
     15  int *volumes;
    1616  struct height_quantity_simple *heights;
    1717} ANUGAVIS;
  • anuga_work/development/anugavis/src/init.c

    r5263 r5264  
    2929  anugavis.x = NULL;
    3030  anugavis.y = NULL;
    31   anugavis.cells = NULL;
     31  anugavis.volumes = NULL;
    3232  anugavis.heights = NULL;
    3333  if((SDL_Init(SDL_INIT_VIDEO) == -1) ||
     
    6767     ((anugavis.y = xmalloc(sizeof(float) * anugavis.number_of_points,
    6868                            "AnugaVis_Init()")) == NULL) ||
     69     ((anugavis.volumes = xmalloc(sizeof(int)
     70                                  * anugavis.number_of_volumes
     71                                  * anugavis.number_of_vertices,
     72                                  "AnugaVis_Init()")) == NULL) ||
    6973     (nc_get_var_float_by_name(anugavis.netcdfId, "x",
    7074                               anugavis.x) != NC_NOERR) ||
    7175     (nc_get_var_float_by_name(anugavis.netcdfId, "y",
    72                                anugavis.y) != NC_NOERR)){
     76                               anugavis.y) != NC_NOERR) ||
     77     (nc_get_var_int_by_name(anugavis.netcdfId, "volumes",
     78                             anugavis.volumes) != NC_NOERR)){
    7379    nc_close(anugavis.netcdfId);
    7480    if(anugavis.x != NULL) free(anugavis.x);
    7581    if(anugavis.y != NULL) free(anugavis.y);
     82    if(anugavis.volumes != NULL) free(anugavis.volumes);
    7683    SDL_Quit();
    7784    return -1;
     
    8693  free(anugavis.x);
    8794  free(anugavis.y);
     95  free(anugavis.volumes);
    8896  SDL_Quit();
    8997}
  • anuga_work/development/anugavis/src/netcdf_util.c

    r5263 r5264  
    1919  return status;
    2020}
     21
     22int nc_get_var_int_by_name(int ncid, const char *name, int *ip){
     23  int status;
     24  int varid;
     25  if(((status = nc_inq_varid(ncid, name, &varid)) != NC_NOERR) ||
     26     ((status = nc_get_var_int(ncid, varid, ip)) != NC_NOERR))
     27    AnugaVis_NetCDFError(status);
     28  return status;
     29}
  • anuga_work/development/anugavis/src/netcdf_util.h

    r5263 r5264  
    55extern int nc_inq_dimlen_by_name(int ncid, const char *name, size_t *size);
    66extern int nc_get_var_float_by_name(int ncid, const char *name, float *fp);
     7extern int nc_get_var_int_by_name(int ncid, const char *name, int *ip);
    78
    89#endif
Note: See TracChangeset for help on using the changeset viewer.