clOutput Class Reference

OUTPUT - Version 1.3. 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.
string GetDetailedOutputFilename ()
 Gets the detailed output filename.
string GetTimestepFilename (int iTimestep, int iSubplot)
 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 (string sFilename)
 Sets up the timestep file and writes the header data.
void WriteTimestepFooter (string sFilename)
 Writes the closing tag for the timestep file.
void WriteTreeData (string *p_sFilename)
 Appends the tree data to the file.
void WriteGridData (string sFilename)
 Appends the grid data to the file.
void ExtractLiveTreeInfo (xercesc::DOMDocument *p_oDoc)
 Extracts the output data relating to tree saving.
void ExtractDeadTreeInfo (xercesc::DOMDocument *p_oDoc)
 Extracts the output data relating to dead 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 MakeMasterTreeSettings ()
 Makes the master tree settings, for writing to the treemap header.
void WriteTree (clTree *p_oTree, char *cBuf, char *cTemp, FILE *oOut)
 Writes the XML for a single tree.
void WriteGhost (clDeadTree *p_oTree, char *cBuf, char *cTemp, FILE *oOut)
 Writes the XML for a single dead tree.
void AddToBuffer (char *cBuf, char *cToAdd, FILE *out, int iBufferSize)
 Adds a string to a buffer string.

Protected Attributes

string m_sFileRoot
 Root name of the detailed output file with no file extension on it.
string m_sTarball
 Root detailed output file name plus extension for tarball (gzip'ed and tar'ed).
struct
clOutput::stcTreeOutputInfo ** 
mp_treeSettings
 Defines what tree output data to save.
struct
clOutput::stcTreeOutputInfo ** 
mp_masterTreeSettings
 Compiled settings across live and dead trees for tree map writing - if any tree type/species, live or dead, saves a data member, it will be here, so that it can be written.
struct
clOutput::stcTreeOutputInfo *** 
mp_deadTreeSettings
 Array for dead trees, # species by # types by # dead reason codes.
struct
clOutput::stcGridOutputInfo
mp_gridSettings
 Data structure for defining what grid output data to save.
short int m_iNumGridsToSave
 number of grid objects we're saving data for
struct clOutput::stcSubplotInfomp_subplots
 Data structure for saving subplot data.
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 - for subplots.
short int m_iNumYCells
 Number of plot cells in the Y direction - for subplots.
float m_fXCellLength
 Length of subplot cells in X direction - defaults to match tree population.
float m_fYCellLength
 Length of subplot cells in Y direction - defaults to match tree population.

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.3.

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).

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".

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)
June 20, 2007 - Changed to strings along with Linux port (LEM)
January 2, 2008 - Support for user-defined subplot resolution and made version 1.2 (LEM)
January 24, 2008 - Made all path separators forward slashes for gzip and tar - this fixes a bug with escape characters (LEM)
January 25, 2011 - Added support for dead trees (LEM)

Constructor & Destructor Documentation

clOutput::clOutput ( clSimManager p_oSimManager  ) 

Constructor.

Parameters:
p_oSimManager Sim Manager object.

clOutput::~clOutput (  ) 

Destructor.


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.

string clOutput::GetDetailedOutputFilename (  )  [inline]

Gets the detailed output filename.

Returns:
Detailed output filename.

string clOutput::GetTimestepFilename ( int  iTimestep,
int  iSubplot 
)

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

This will produce the name for subplots as well.

Parameters:
iTimestep Timestep.
iSubplot Index of the subplot - -1 = no subplot.
Returns:
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::WriteDetailedOutputHeader (  )  [protected]

Writes the detailed output header file.

void clOutput::WriteTimestepHeader ( string  sFilename  )  [protected]

Sets up the timestep file and writes the header data.

Parameters:
sFilename to write to.

void clOutput::WriteTimestepFooter ( string  sFilename  )  [protected]

Writes the closing tag for the timestep file.

Parameters:
sFilename to write to.

void clOutput::WriteTreeData ( string *  p_sFilename  )  [protected]

Appends the tree data to the file.

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

void clOutput::WriteGridData ( string  sFilename  )  [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:
sFilename to write to.

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

Extracts the output data relating to tree saving.

Parameters:
p_oDoc DOM tree of parsed input file.

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

Extracts the output data relating to dead 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::MakeMasterTreeSettings (  )  [protected]

Makes the master tree settings, for writing to the treemap header.

void clOutput::WriteTree ( clTree p_oTree,
char *  cBuf,
char *  cTemp,
FILE *  oOut 
) [protected]

Writes the XML for a single tree.

Parameters:
p_oTree The tree to write.
cBuf The buffer to write to.
cTemp Temp char string.
oOut File to write.

void clOutput::WriteGhost ( clDeadTree p_oTree,
char *  cBuf,
char *  cTemp,
FILE *  oOut 
) [protected]

Writes the XML for a single dead tree.

Parameters:
p_oTree The tree to write.
cBuf The buffer to write to.
cTemp Temp char string.
oOut File to write.

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

string clOutput::m_sFileRoot [protected]

Root name of the detailed output file with no file extension on it.

string clOutput::m_sTarball [protected]

Root detailed output file name plus extension for tarball (gzip'ed and tar'ed).

Defines what tree output data to save.

Array of stcTreeOutputInfo's, number of species by number of types

Compiled settings across live and dead trees for tree map writing - if any tree type/species, live or dead, saves a data member, it will be here, so that it can be written.

Array for dead trees, # species by # types by # dead reason codes.

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 clOutput::m_iNumGridsToSave [protected]

number of grid objects we're saving data for

Data structure for saving subplot data.

They get the same data saved as the plot as a whole.An array of stcSubplotInfos, one for each subplot to save

short int clOutput::m_iNumSubplotsToSave [protected]

Number of subplots we're saving data for.

short int clOutput::m_iNumSpecies [protected]

Number of species.

short int clOutput::m_iNumTypes [protected]

Number of types.

short int clOutput::m_iNumXCells [protected]

Number of plot cells in the X direction - for subplots.

short int clOutput::m_iNumYCells [protected]

Number of plot cells in the Y direction - for subplots.

float clOutput::m_fXCellLength [protected]

Length of subplot cells in X direction - defaults to match tree population.

float clOutput::m_fYCellLength [protected]

Length of subplot cells in Y direction - defaults to match tree population.


The documentation for this class was generated from the following file:

Generated on Tue Apr 19 13:56:14 2011 for SORTIE Core C++ Documentation by  doxygen 1.5.6