Basic AMR Reader

This reads the file format written by the AMRwriter API. It does not care if the underlying file format is IEEEIO or HDF-SDS/NetCDF.

This very simplistic API reads information about each grid stored in the AMR file into a list of AmrGrid datastructures without actually loading the associated grid data. The user can then use this information to tell the AMRreader which grids to load data for. The higher-level AmrFileReader provides its own filtering system for selecting grids by level and timestep. At this time only a C++ interface is released. C and F77 interfaces are available on request.


The API


C++ Interface

Constructors/Destructors
AmrGridReader::AmrGridReader(IObase &filehandle) constructor
The filehandle is an already open IEEEIO or HDFIO file. This initializes the reader and attaches it to that datafile.
AmrGridReader::~AmrGridReader() destructor
This flushes all of the necessary file buffers. The filehandle that the writer was bound to must be closed separately though.

Reading/Stepping through the Data
Grids are indexed from 0 to nDatasets-1 (where nDatasets are the total number of grids stored in the file). The grids are indexed in exactly the order they are stored in the file (there is no sorting of indices here). So its up to the user of the API to use the AmrGrid datastructures to select which grids to actually load data for.

There are two different types of "get" requests that can be filled. When you "getGridInfo", only the informational portions of the AmrGrid datastructure are filled out. When you "getGridData" then both the grid information and associated data will be loaded into the AmrGrid datastructure.

AmrGrid *AmrGridReader::getGridInfo(AmrGrid &grid,int index)
Fills out the informational portions of the AmrGrid datastructure. The data member of the structure is left NULL. Returns a pointer to the AmrGrid if it is successful and a NULL if it fails.
AmrGrid *AmrGridReader::getGridData(AmrGrid &grid,int index)
Fills out the informational portions of the AmrGrid datastructure and also loads the associated grid data into the data member of the AmrGrid datastructure. If the data member is NULL, it will allocate storage for it (which the user is responsible for freeing), otherwise it will load the data directly into existing storage pointed to by that member. Returns pointer to the AmrGrid if it is successful and returns NULL if it fails.
AmrGrid *AmrGridReader::getGrid(AmrGrid &grid,int index)
Performs the same function as AmrGridReader::getGridData(). Just a more convenient name.
AmrGrid *AmrGridReader::getGrid(int index)
Performs the same function as AmrGridReader::getGridData() except that it allocates a new AmrGrid datastructure to store the information and data in. The user is responsible for freeing this structure when they are done with it though.

C Interface

Not ready for primetime yet but available on request.

F77/F90 Interface

Not ready for primetime yet but available on request.
Last modified: Thu Feb 4 15:45:03 CST 1999