AmrFileReader

The AmrGridReader only provides unfiltered access to the grids stored in the AMR datafile. For a real visualization application, it is necessary to filter through these grids to present only what is relevant for a particular domain and timestep. The AmrFileReader provides that sort of filtering capability.

The AmrFileReader selects all grids that are active at a particular timestep in the evolution sequence. It also allows you to mask out sets of levels (for example only show levels 1-3 of a 7 level hierarchy). Since the stepping of grids proceeds at different paces at different levels, the timestep is a global quantity that refers to the finest granularity of stepping that can occur during the evolution (the integer timesteps of the deepest level of refinement). The API is intelligent enough to only reload data from grids that have changed when a different timestep has been selected since deeper-level grids will change more rapidly than their parent grids.


The API


C++ Interface

Constructors/Destructors
AmrFileReader::AmrFileReader(IObase &filehandle) constructor
The filehandle is an already open IEEEIO or HDFIO file. This initializes the reader and attaches it to that datafile.
AmrFileReader::~AmrFileReader() destructor
This flushes all of the necessary file buffers. The filehandle that the reader was bound to must be closed separately though.
Queries about File Contents
int AmrFileReader::nLevels()
Returns the number of levels in the AMR hierarchy. This is the deepest the hierarchy gets in this particular datafile as opposed to the number of levels present at this time in the evolution (this distinction is important for adaptive depth schemes where the number of levels will change depending on the demands of the solver).
AmrFileReader::getTimeRange(int &mintime,int &maxtime)
Gets the range of integer timesteps stored in the file. The nonzero mintime exists to support schemes where the evolution is broken up among several files.
Filters
The filter methods listed below select grids based on the criteria of time and level number. Grids selected by the filter are referred to as active grids.

AmrFileReader::setTime(int time)
Sets the current timestep to select the data hierarchy for. The timestep is defined with respect to the rate at which grids change at the deepest level of the AMR hierarchy stored in the file. Selecting a particular timestep selects a snapshot of the hieararchy at a particular time in the evolution.
AmrFileReader::hideLevel(int level)
By default all levels are visible and are read in when the getGrids() method is called. You can hide individual levels using this method. This is useful when loading the entire hierarchy is either too confusing, too slow, or too large for the workstation to handle.
AmrFileReader::showLevel(int level)
Shows a level that has otherwise been hidden.
AmrFileReader::showAllLevels()
A convenience method for making all of the levels visible.
Getting the Data
int AmrFileReader::getGrids(FlexArray<AmrGrid> &g)
Gets all currently active grids and puts them into a FlexArray of AmrGrid datastructures. An active grid is one that is currently selected by the setTime() and show/hideLevel() filters. The FlexArray is a simple template class for arrays that grow automatically to accomodate new elements. If you or your compiler do not like templates, then you can use the two-step static allocation method (getNumGrids()/getGrids()) defined below. This method returns the number of active grids.
int AmrFileReader::getNumGrids()
Returns the total number of active grids currently selected by the setTime() and show/hideLevel() filters. This is used to determine how large of an array of AmrGrid structures to allocate in order to receive the data using the getGrids() method call since this array length is static.
int AmrFileReader::getGrids(AmrGrid *grids)
This method reads the grid information and data for all currently active grids into the pre-allocated array of grids passed to it. The API will allocate memory for the grids upon reading the data, but it is the responsibility of the programmer to dispose of the array of grids and the data stored within these datastructures once they are done with it.
Utility and Debugging Methods
AmrFileReader::setDataLoadingOff()
This causes the getGrids() methods to read in the informational part of the AmrGrid datastructures, but not load any data. This is useful for just aquiring bounding box information or estimating the memory/computational requirements for loading the entire hierarchy.
AmrFileReader::setDataLoadingOn()
This causes the getGrids() methods to read both the informational and data part of the AmrGrid datastructures. This is the default state for this API.
printGridInfo()
Prints information about all grids in file to STDERR. Used only for debugging.
printActiveGrids()
Prints information about all active grids to STDERR. Used only for debugging.
int debug This is a public variable that can be set to a nonzero value in order to print additional debugging information for each method call. This printing is turned off when it is set to zero.

C Interface

Not ready yet.

F77/F90 Interface

Not ready yet.
Last modified: Thu Feb 4 17:49:33 CST 1999