clOutput Class Reference

OUTPUT - Version 1.1. More...

#include <Output.h>

Inheritance diagram for clOutput:

clBehaviorBase clWorkerBase List of all members.

Public Member Functions

 clOutput (clSimManager *p_oSimManager)
 Constructor.
 ~clOutput ()
 Destructor.
void Action ()
 Performs output data collection file writing.
void GetDetailedOutputFilename (char *cReturnFile)
 Gets the detailed output filename.
void GetTimestepFilename (int iTimestep, int iSubplot, char *cFilename)
 Figures out the filename for the detailed output timestep file and places it in cFilename.

Protected Member Functions

void GetData (xercesc::DOMDocument *p_oDoc)
 Reads in the parameter file values.
void WriteDetailedOutputHeader ()
 Writes the detailed output header file.
void WriteTimestepHeader (const char *cFilename)
 Sets up the timestep file and writes the header data.
void WriteTimestepFooter (const char *cFilename)
 Writes the closing tag for the timestep file.
void WriteTreeData (char **p_cFilename)
 Appends the tree data to the file.
void WriteGridData (const char *cFilename)
 Appends the grid data to the file.
void ExtractTreeInfo (xercesc::DOMDocument *p_oDoc)
 Extracts the output data relating to tree saving.
void ExtractGridInfo (xercesc::DOMDocument *p_oDoc)
 Extracts the output data relating to grid saving.
void ExtractSubplotInfo (xercesc::DOMDocument *p_oDoc)
 Extracts the subplot data.
void AddToBuffer (char *cBuf, char *cToAdd, FILE *out, int iBufferSize)
 Adds a string to a buffer string.

Protected Attributes

char m_cFileRoot [MAX_FILENAME_SIZE]
 Root name of the detailed output file with no file extension on it.
char m_cTarball [MAX_FILENAME_SIZE]
 Root detailed output file name plus extension for /tarball (gzip'ed and tar'ed).
clOutput::stcTreeOutputInfo ** mp_treeSettings
 Defines what tree output data to save Array of stcTreeOutputInfo's, number of species by number of types.
clOutput::stcGridOutputInfomp_gridSettings
 Data structure for defining what grid output data to save array of stcGridOutputInfo's, one for each grid object that we're saving data for.
short int m_iNumGridsToSave
 number of grid objects we're saving data for
clOutput::stcSubplotInfomp_subplots
 Data structure for saving subplot data.An array of stcSubplotInfos, one for each subplot to save.
short int m_iNumSubplotsToSave
 Number of subplots we're saving data for.
short int m_iNumSpecies
 Number of species.
short int m_iNumTypes
 Number of types.
short int m_iNumXCells
 Number of plot cells in the X direction.
short int m_iNumYCells
 Number of plot cells in the Y direction.

Classes

struct  stcGridOutputInfo
 Data structure for defining what grid output data to save. More...
struct  stcSubplotInfo
 Data structure for saving subplot data. More...
struct  stcTreeOutputInfo
 Defines what tree output data to save. More...

Detailed Description

OUTPUT - Version 1.1.

This is a behavior which saves output from the model run. It would normally be run last in a timestep.

This behavior supports saving tree data and generic grid data. Tree data is defined separately for each type (seed, seedling, sapling, adult, or dead).

For grids, a map can be saved at a specified resolution (which does not have to match the calculation resolution) at any given timestep interval.

Filenames must be specified for the detailed output file. The user can also define subplots. Each of these is stored in its own separate file.

Note - all file writing is done using the old C library functions instead of the newer C++ functions (fstream and family). The code was originally written with C++ functions and ran unacceptably slow.

The behavior's namestring and parameter file callstring are both "output".

NEEDED: Support for different grid resolutions.

Copyright 2003 Charles D. Canham.

Author:
Lora E. Murphy

Changes:
-----------------
April 28, 2004 - Submitted as beta (LEM)
October 24, 2005 - Changed the way we search for trees; the results should be the same.
May 10, 2006 - Added support for subplots and updated to version 1.1 (LEM)


Constructor & Destructor Documentation

clOutput::clOutput ( clSimManager p_oSimManager  ) 

Constructor.

Parameters:
p_oSimManager Sim Manager object.


Member Function Documentation

void clOutput::Action (  )  [virtual]

Performs output data collection file writing.

It begins by examining all of the desired output types and seeing which ones are ready for updating for this timestep.

Reimplemented from clBehaviorBase.

void clOutput::GetDetailedOutputFilename ( char *  cReturnFile  )  [inline]

Gets the detailed output filename.

Parameters:
cReturnFile Address to place the filename. The filename will not be longer than MAX_FILENAME_SIZE.

void clOutput::GetTimestepFilename ( int  iTimestep,
int  iSubplot,
char *  cFilename 
)

Figures out the filename for the detailed output timestep file and places it in cFilename.

cFilename should be big enough to hold the maximum filename size; this function will not check to make sure it is. This will produce the name for subplots as well.

Parameters:
iTimestep Timestep.
iSubplot Index of the subplot - -1 = no subplot.
cFilename Place to put the completed filename.

void clOutput::GetData ( xercesc::DOMDocument *  p_oDoc  )  [protected, virtual]

Reads in the parameter file values.

Parameters:
p_oDoc DOM tree of parsed input file.
Exceptions:
modelErr if the filename is too long.

Implements clWorkerBase.

void clOutput::WriteTimestepHeader ( const char *  cFilename  )  [protected]

Sets up the timestep file and writes the header data.

Parameters:
cFilename to write to.

void clOutput::WriteTimestepFooter ( const char *  cFilename  )  [protected]

Writes the closing tag for the timestep file.

Parameters:
cFilename to write to.

void clOutput::WriteTreeData ( char **  p_cFilename  )  [protected]

Appends the tree data to the file.

Parameters:
p_cFilename Array of files to write to. The first is the whole plot, the rest are subplots in order.

void clOutput::WriteGridData ( const char *  cFilename  )  [protected]

Appends the grid data to the file.

Why is this here when grid reading is in the grid object? Because we don't necessarily want to save the whole grid. Output may have a subset of data members to save. Subset or no, all data members are always saved in the settings list so that the map can be used as input.

Parameters:
cFilename to write to.

void clOutput::ExtractTreeInfo ( xercesc::DOMDocument *  p_oDoc  )  [protected]

Extracts the output data relating to tree saving.

Parameters:
p_oDoc DOM tree of parsed input file.

void clOutput::ExtractGridInfo ( xercesc::DOMDocument *  p_oDoc  )  [protected]

Extracts the output data relating to grid saving.

Parameters:
p_oDoc DOM tree of parsed input file.

void clOutput::ExtractSubplotInfo ( xercesc::DOMDocument *  p_oDoc  )  [protected]

Extracts the subplot data.

Parameters:
p_oDoc DOM tree of parsed input file.

void clOutput::AddToBuffer ( char *  cBuf,
char *  cToAdd,
FILE *  out,
int  iBufferSize 
) [inline, protected]

Adds a string to a buffer string.

If the buffer is full, it is flushed to file before the new string is added.

Parameters:
cBuf Buffer string.
cToAdd String to add to buffer.
out File to flush buffer to.
iBufferSize Size of the buffer.


Member Data Documentation

struct clOutput::stcSubplotInfo * clOutput::mp_subplots [protected]

Data structure for saving subplot data.An array of stcSubplotInfos, one for each subplot to save.

They get the same data saved as the plot as a whole.


The documentation for this class was generated from the following file:
Generated on Thu May 24 09:30:44 2007 for SORTIE Core C++ Documentation by  doxygen 1.5.2