Changeset 5259


Ignore:
Timestamp:
May 1, 2008, 2:16:22 PM (17 years ago)
Author:
jack
Message:

More preparation for anugavis height quantity support: now retrieves the number of points from the NetCDF file.

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

Legend:

Unmodified
Added
Removed
  • anuga_work/development/anugavis/src/Makefile.am

    r5257 r5259  
    33# Convenience library for the core visualiser code.
    44noinst_LIBRARIES = libanugavis.a
    5 libanugavis_a_SOURCES = anugavis.h \
    6                         error.c \
     5libanugavis_a_SOURCES = error.c \
    76                        error.h \
    87                        globals.c \
     
    109                        height_quantity.c \
    1110                        height_quantity.h \
    12                         init.c
     11                        init.c \
     12                        init.h
    1313libanugavis_a_CFLAGS = @SDL_CFLAGS@ @GLU_CFLAGS@
    1414libanugavis_a_LIBADD = @LIBOBJS@
  • anuga_work/development/anugavis/src/anugavis.h

    r5255 r5259  
    1 #ifndef ANUGAVIS_H
    2 #define ANUGAVIS_H
    3 
    4 /* Start and stop the visualiser. AnugaVis_Init() returns -1 on
    5  * error. To get detailed error information, use AnugaVis_GetError().
    6  */
    7 extern int AnugaVis_Init(int width, int height, const char *swwFilePath);
    8 extern void AnugaVis_DeInit(void);
    9 
    10 /* Define (or redefine if already defined a simple height quantity with the
    11  * given offset, scale, and color. Returns 0 on success, -1 on error.
    12  */
    13 extern int AnugaVis_DefineHeightQuantity(const char *name,
    14                                          double offset, double scale,
    15                                          int red, int green, int blue);
    16 /* Undefine a given simple height quantity.
    17  */
    18 extern void AnugaVis_UndefineHeightQuantity(char *name);
    19 
    20 /* Get detailed error information. The returned string should not be
    21  * freed by the caller.
    22  */
    23 extern char* AnugaVis_GetError(void);
    24 
    25 #endif
  • anuga_work/development/anugavis/src/anugavis_simple.c

    r5255 r5259  
    1 #include <anugavis.h>
     1#include "error.h"
     2#include "init.h"
     3#include "height_quantity.h"
    24#include <stdio.h>
    3 
     5#include "globals.h"
    46int main(int argc, char *argv[]){
    57  if(argc != 2){
  • anuga_work/development/anugavis/src/error.h

    r5255 r5259  
    1414void AnugaVis_NetCDFError(int ncerr);
    1515
     16/* Get detailed error information. The returned string should not be
     17 * freed by the caller.
     18 */
     19extern char* AnugaVis_GetError(void);
     20
    1621#endif
  • anuga_work/development/anugavis/src/globals.h

    r5255 r5259  
    88  SDL_Surface *screen;
    99  int netcdfId;
     10  size_t number_of_points;
    1011  struct height_quantity_simple *heights;
    1112} ANUGAVIS;
  • anuga_work/development/anugavis/src/height_quantity.h

    r5255 r5259  
    1313};
    1414
     15/* Define (or redefine if already defined a simple height quantity with the
     16 * given offset, scale, and color. Returns 0 on success, -1 on error.
     17 */
     18extern int AnugaVis_DefineHeightQuantity(const char *name,
     19                                         double offset, double scale,
     20                                         int red, int green, int blue);
     21/* Undefine a given simple height quantity.
     22 */
     23extern void AnugaVis_UndefineHeightQuantity(char *name);
     24
    1525#endif
  • anuga_work/development/anugavis/src/init.c

    r5255 r5259  
    2121int AnugaVis_Init(int width, int height, const char *swwFilePath){
    2222  int ncstatus;
     23  int ncdimid;
    2324  if((SDL_Init(SDL_INIT_VIDEO) == -1) ||
    2425     (SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5) == -1) ||
     
    4243
    4344  if((ncstatus = nc_open(swwFilePath, NC_SHARE,
    44                          &anugavis.netcdfId)) != NC_NOERR){
    45     AnugaVis_NetCDFError(ncstatus);
    46     SDL_Quit();
    47     return -1;
    48   }
     45                         &anugavis.netcdfId)) != NC_NOERR) goto nc_err;
     46  if((ncstatus = nc_inq_dimid(anugavis.netcdfId, "number_of_points",
     47                              &ncdimid)) != NC_NOERR) goto nc_err;
     48  if((ncstatus = nc_inq_dimlen(anugavis.netcdfId, ncdimid,
     49                               &anugavis.number_of_points)) != NC_NOERR)
     50    goto nc_err;
     51
    4952  anugavis.heights = NULL;
    5053  return 0;
     54 nc_err:
     55  AnugaVis_NetCDFError(ncstatus);
     56  SDL_Quit();
     57  return -1;
    5158}
    5259
Note: See TracChangeset for help on using the changeset viewer.