SORTIE Core C++ Documentation
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clShortOutput Class Reference

Creates a tab-delimited text output file. More...

#include <OutputShort.h>

Inheritance diagram for clShortOutput:
clBehaviorBase clWorkerBase

Classes

struct  stcCoords
 Structure for holding coordinates. More...
 
struct  stcSubplotInfo
 Data structure for saving subplot data. More...
 

Public Member Functions

 clShortOutput (clSimManager *p_oSimManager)
 Constructor.
 
 ~clShortOutput ()
 Destructor.
 
void Action ()
 Collects data and writes the output file.
 
- Public Member Functions inherited from clBehaviorBase
virtual float GetBehaviorVersion ()
 Gets the behavior version number.
 
 clBehaviorBase (clSimManager *p_oSimManager)
 Constructor.
 
virtual ~clBehaviorBase ()
 Destructor.
 
virtual short int ValidateVersionNumber (float fTestVersion)
 Makes sure that the version number of a file passed is between the minimum and current version numbers.
 
virtual void RegisterTreeDataMembers ()
 Registers tree data members.
 
virtual void SetSpeciesTypeCombos (short int iNumCombos, stcSpeciesTypeCombo *p_whatCombos)
 Sets the species/type combos for a behavior.
 
virtual void SetNameData (char *cNameString)
 Sets the string for the parameter file behavior.
 
virtual short int GetNewTreeInts ()
 Gets the number of new tree integer data members this behavior wants to register.
 
virtual short int GetNewTreeFloats ()
 Gets the number of new tree float data members this behavior wants to register.
 
virtual short int GetNewTreeChars ()
 Gets the number of new tree character data members this behavior wants to register.
 
virtual short int GetNewTreeBools ()
 Gets the number of new tree bool data members this behavior wants to register.
 
virtual short int GetNumSpeciesTypeCombos ()
 Gets the number of species/type combos to which this behavior applies.
 
virtual short int GetNumBehaviorSpecies ()
 Gets the number of unique tree species to which this behavior applies.
 
struct stcSpeciesTypeCombo GetSpeciesTypeCombo (short int iIndex)
 Gets one of this behavior's type/species combos.
 
virtual short int GetBehaviorSpecies (short int iIndex)
 Gets one of the behavior's species.
 
short int GetBehaviorListNumber ()
 Gets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list.
 
void SetBehaviorListNumber (short int iNumber)
 Sets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list.
 
virtual DOMElement * GetParentParametersElement (xercesc::DOMDocument *p_oDoc)
 Formats the string for species/types query.
 
- Public Member Functions inherited from clWorkerBase
 clWorkerBase (clSimManager *p_oSimManager)
 Constructor.
 
virtual ~clWorkerBase ()
 Destructor.
 
char * GetName ()
 Gets the object's namestring.
 
void DoObjectSetup (xercesc::DOMDocument *p_oDoc, fileType iFileType)
 Triggers the setup process.
 
virtual void TimestepCleanup ()
 Performs any necessary cleanup operations at the end of a timestep.
 
virtual void EndOfRunCleanup ()
 Performs any necessary cleanup operations at the end of a run.
 
virtual void DoCommand (char *cCommand, char *cArguments)
 If a behavior has registered a command line command with the sim manager, this allows it to be called.
 

Protected Member Functions

void GetData (xercesc::DOMDocument *p_oDoc)
 Reads the desired options out of the parameter file.
 
void WriteFileHeader ()
 Writes output file header.
 
void ExtractLiveTreeInfo (xercesc::DOMDocument *p_oDoc)
 Extracts the output data relating to tree saving from the parameter file.
 
void ExtractDeadTreeInfo (xercesc::DOMDocument *p_oDoc)
 Extracts the output data relating to tree saving from the parameter file.
 
void ExtractSubplotInfo (xercesc::DOMDocument *p_oDoc)
 Extracts the subplot data from the parameter file.
 
bool TestForSave (DOMElement *p_oParentElement, const char *cNodeName)
 Tests to see if a given node exists and has an attribute called "save" equal to true.
 
void GetDeadTreeStats ()
 For a time step, collects all basal area and density information for dead trees.
 
void GetLiveTreeStats ()
 For a time step, collects all basal area and density information for live trees.
 
void DeclareDataArrays ()
 Allocates memory for all of our arrays.
 
void DeclareDataArraysForSubplots ()
 Allocates memory for those arrays pertaining to subplots.
 
void WriteTimestepData ()
 Write the data for a single time step.
 

Protected Attributes

char m_cFileName [MAX_FILENAME_SIZE]
 Output file name.
 
float ** mp_fLiveRBA
 Array for one timestep's relative basal area - # types by # species.
 
float ** mp_fLiveABA
 Array for one timestep's absolute basal area - # types by # species.
 
float ** mp_fLiveRDN
 Array for one timestep's relative density - # types by # species.
 
float ** mp_fLiveADN
 Array for one timestep's absolute density - # types by # species.
 
float *** mp_fSubRBA
 Array for one timestep's relative basal area by subplot - # subplots by

types by # species


 
float *** mp_fSubABA
 Array for one timestep's absolute basal area by subplot - # subplots by

types by # species


 
float *** mp_fSubRDN
 Array for one timestep's relative density by subplot - # subplots by

types by # species


 
float *** mp_fSubADN
 Array for one timestep's absolute density by subplot - # subplots by

types by # species


 
float *** mp_fDeadABA
 Array for one timestep's dead absolute basal area - # types by # species by

dead reason codes


 
float *** mp_fDeadADN
 Array for one timestep's dead absolute density - # types by # species by

dead reason codes


 
bool * mp_bSaveLiveRBA
 Whether to save relative basal area.
 
bool * mp_bSaveLiveABA
 Whether to save absolute basal area.
 
bool * mp_bSaveLiveRDN
 Whether to save relative density.
 
bool * mp_bSaveLiveADN
 Whether to save absolute density.
 
bool ** mp_bSaveDeadABA
 Whether to save absolute basal area.
 
bool ** mp_bSaveDeadADN
 Whether to save absolute density.
 
bool * mp_bSaveAnyLive
 Shortcut flag for whether to save any information, by type.
 
bool * mp_bSaveAnyLiveBA
 Shortcut flag for whether to save basal area information, by type.
 
bool m_bUseLive
 Shortcut flag for whether any live trees are to be saved all.
 
bool m_bUseDead
 Shortcut flag for whether any dead trees are to be saved all.
 
struct
clShortOutput::stcSubplotInfo
mp_subplots
 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_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.
 
short int m_iNumTypes
 Number of types.
 
short int m_iNumSpecies
 Number of species.
 
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.
 
- Protected Attributes inherited from clBehaviorBase
short int m_iNumSpeciesTypeCombos
 How many type/species combos a behavior will act on.
 
short int m_iNumBehaviorSpecies
 How many distinct species are in the combo list - important for filling species-specific values from parameter file.
 
short int * mp_iWhatSpecies
 List of distinct species - for filling species-specific values from parameter file.
 
stcSpeciesTypeCombomp_whatSpeciesTypeCombos
 Array of species/type combos that the behavior will act on.
 
short int m_iNewTreeInts
 The number of new tree integer data members this behavior wants to add.
 
short int m_iNewTreeFloats
 The number of new tree float data members this behavior wants to add.
 
short int m_iNewTreeChars
 The number of new tree character data members this behavior wants to add.
 
short int m_iNewTreeBools
 The number of new tree boolean data members this behavior wants to add.
 
short int m_iBehaviorListNumber
 The number of this behavior in the behavior list, to differentiate between possible multiple copies of this behavior.
 
float m_fVersionNumber
 Version number - this will be rounded to 2 digits after the decimal place.
 
std::string m_sXMLRoot
 XML root that encloses the parameters for this behavior.
 
float m_fMinimumVersionNumber
 Minimum version number - this behavior will run parameter data for a file marked between this number and the current version number, inclusive.
 
- Protected Attributes inherited from clWorkerBase
char m_cNameString [MAX_NAMESTRING_SIZE]
 Object's identifying namestring.
 
int * mp_iAllowedFileTypes
 List of the input file types this object can handle.
 
int m_iNumAllowedTypes
 Number of input file types this object can handle.
 

Additional Inherited Members

- Static Protected Attributes inherited from clWorkerBase
static clSimManagermp_oSimManager
 Pointer to the simulation manager object.
 

Detailed Description

Creates a tab-delimited text output file.

It's a shortcut if a detailed output file isn't what you need. It supports subplots - as many as you want.

This will save absolute and relative basal area and density for snags, adults, and saplings, and absolute density for seedlings. This will also save absolute basal area and density for dead trees.

The namestring of this behavior, and the name which it is called in the behavior list of the parameter file, is "ShortOutput".

Copyright 2004 Charles D. Canham.

Author
Lora E. Murphy


Edit history:
--------------—
April 28, 2004 - Submitted as beta (LEM)
June 24, 2004 - Added snag support (LEM)
October 25, 2005 - Changed the way we search for trees (LEM)
January 2, 2007 - Support for user-defined subplot resolution and made version 1.1 (LEM)
January 11, 2011 - Added dead trees (LEM)
October 4, 2011 - Added support for variable subplot cell size (LEM)

Constructor & Destructor Documentation

clShortOutput::clShortOutput ( clSimManager p_oSimManager)

Constructor.

Parameters
p_oSimManagerSim Manager object.
clShortOutput::~clShortOutput ( )

Destructor.

Member Function Documentation

void clShortOutput::Action ( )
virtual

Collects data and writes the output file.

Reimplemented from clBehaviorBase.

void clShortOutput::DeclareDataArrays ( )
protected

Allocates memory for all of our arrays.

void clShortOutput::DeclareDataArraysForSubplots ( )
protected

Allocates memory for those arrays pertaining to subplots.

This must occur after the information has been extracted from the parameter file because we need to know how many subplots there are.

void clShortOutput::ExtractDeadTreeInfo ( xercesc::DOMDocument *  p_oDoc)
protected

Extracts the output data relating to tree saving from the parameter file.

Parameters
p_oDocDOM tree of parsed input file.
void clShortOutput::ExtractLiveTreeInfo ( xercesc::DOMDocument *  p_oDoc)
protected

Extracts the output data relating to tree saving from the parameter file.

Parameters
p_oDocDOM tree of parsed input file.
void clShortOutput::ExtractSubplotInfo ( xercesc::DOMDocument *  p_oDoc)
protected

Extracts the subplot data from the parameter file.

Parameters
p_oDocDOM tree of parsed input file.
void clShortOutput::GetData ( xercesc::DOMDocument *  p_oDoc)
protectedvirtual

Reads the desired options out of the parameter file.

Parameters
p_oDocDOM tree of the parsed input file.

Implements clWorkerBase.

void clShortOutput::GetDeadTreeStats ( )
protected

For a time step, collects all basal area and density information for dead trees.

void clShortOutput::GetLiveTreeStats ( )
protected

For a time step, collects all basal area and density information for live trees.

bool clShortOutput::TestForSave ( DOMElement *  p_oParentElement,
const char *  cNodeName 
)
protected

Tests to see if a given node exists and has an attribute called "save" equal to true.

Parameters
p_oParentElementPointer to the parent element of the node in question.
cNodeNameTag name of the node.
Returns
True if the save attribute is true; if the node does not exist or is equal to false, false is returned.
void clShortOutput::WriteFileHeader ( )
protected

Writes output file header.

void clShortOutput::WriteTimestepData ( )
protected

Write the data for a single time step.

Member Data Documentation

bool clShortOutput::m_bUseDead
protected

Shortcut flag for whether any dead trees are to be saved all.

bool clShortOutput::m_bUseLive
protected

Shortcut flag for whether any live trees are to be saved all.

char clShortOutput::m_cFileName[MAX_FILENAME_SIZE]
protected

Output file name.

If it already exists, new data is appended at the end

float clShortOutput::m_fXCellLength
protected

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

float clShortOutput::m_fYCellLength
protected

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

short int clShortOutput::m_iNumSpecies
protected

Number of species.

short int clShortOutput::m_iNumSubplotsToSave
protected

Number of subplots we're saving data for.

short int clShortOutput::m_iNumTypes
protected

Number of types.

short int clShortOutput::m_iNumXCells
protected

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

short int clShortOutput::m_iNumYCells
protected

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

bool* clShortOutput::mp_bSaveAnyLive
protected

Shortcut flag for whether to save any information, by type.

bool* clShortOutput::mp_bSaveAnyLiveBA
protected

Shortcut flag for whether to save basal area information, by type.

bool** clShortOutput::mp_bSaveDeadABA
protected

Whether to save absolute basal area.

Ignored for seedlings. Array size # types by # dead reason codes.

bool** clShortOutput::mp_bSaveDeadADN
protected

Whether to save absolute density.

Array size # types by # dead reason codes.

bool* clShortOutput::mp_bSaveLiveABA
protected

Whether to save absolute basal area.

Ignored for seedlings. Array size # types.

bool* clShortOutput::mp_bSaveLiveADN
protected

Whether to save absolute density.

Array size # types.

bool* clShortOutput::mp_bSaveLiveRBA
protected

Whether to save relative basal area.

Ignored for seedlings. Array size # types.

bool* clShortOutput::mp_bSaveLiveRDN
protected

Whether to save relative density.

Array size # types.

float*** clShortOutput::mp_fDeadABA
protected

Array for one timestep's dead absolute basal area - # types by # species by

dead reason codes

float*** clShortOutput::mp_fDeadADN
protected

Array for one timestep's dead absolute density - # types by # species by

dead reason codes

float** clShortOutput::mp_fLiveABA
protected

Array for one timestep's absolute basal area - # types by # species.

float** clShortOutput::mp_fLiveADN
protected

Array for one timestep's absolute density - # types by # species.

float** clShortOutput::mp_fLiveRBA
protected

Array for one timestep's relative basal area - # types by # species.

float** clShortOutput::mp_fLiveRDN
protected

Array for one timestep's relative density - # types by # species.

float*** clShortOutput::mp_fSubABA
protected

Array for one timestep's absolute basal area by subplot - # subplots by

types by # species

float*** clShortOutput::mp_fSubADN
protected

Array for one timestep's absolute density by subplot - # subplots by

types by # species

float*** clShortOutput::mp_fSubRBA
protected

Array for one timestep's relative basal area by subplot - # subplots by

types by # species

float*** clShortOutput::mp_fSubRDN
protected

Array for one timestep's relative density by subplot - # subplots by

types by # species

struct clShortOutput::stcSubplotInfo * clShortOutput::mp_subplots
protected

An array of stcSubplotInfos, one for each subplot to save.


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