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. More...
 
 ~clShortOutput ()
 Destructor. More...
 
void Action ()
 Collects data and writes the output file. More...
 
- Public Member Functions inherited from clBehaviorBase
virtual float GetBehaviorVersion ()
 Gets the behavior version number. More...
 
 clBehaviorBase (clSimManager *p_oSimManager)
 Constructor. More...
 
virtual ~clBehaviorBase ()
 Destructor. More...
 
virtual short int ValidateVersionNumber (float fTestVersion)
 Makes sure that the version number of a file passed is between the minimum and current version numbers. More...
 
virtual void RegisterTreeDataMembers ()
 Registers tree data members. More...
 
virtual void SetSpeciesTypeCombos (short int iNumCombos, stcSpeciesTypeCombo *p_whatCombos)
 Sets the species/type combos for a behavior. More...
 
virtual void SetNameData (std::string sNameString)
 Sets the string for the parameter file behavior. More...
 
virtual short int GetNewTreeInts ()
 Gets the number of new tree integer data members this behavior wants to register. More...
 
virtual short int GetNewTreeFloats ()
 Gets the number of new tree float data members this behavior wants to register. More...
 
virtual short int GetNewTreeChars ()
 Gets the number of new tree character data members this behavior wants to register. More...
 
virtual short int GetNewTreeBools ()
 Gets the number of new tree bool data members this behavior wants to register. More...
 
virtual short int GetNumSpeciesTypeCombos ()
 Gets the number of species/type combos to which this behavior applies. More...
 
virtual short int GetNumBehaviorSpecies ()
 Gets the number of unique tree species to which this behavior applies. More...
 
struct stcSpeciesTypeCombo GetSpeciesTypeCombo (short int iIndex)
 Gets one of this behavior's type/species combos. More...
 
virtual short int GetBehaviorSpecies (short int iIndex)
 Gets one of the behavior's species. More...
 
short int GetBehaviorListNumber ()
 Gets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list. More...
 
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. More...
 
std::string FormatSpeciesTypeQueryString ()
 Formats the string for species/types query. More...
 
virtual DOMElement * GetParentParametersElement (xercesc::DOMDocument *p_oDoc)
 This will get the correct set of parameters for this behavior based on the behavior list position number. More...
 
- Public Member Functions inherited from clWorkerBase
 clWorkerBase (clSimManager *p_oSimManager)
 Constructor. More...
 
virtual ~clWorkerBase ()
 Destructor. More...
 
std::string GetName ()
 Gets the object's namestring. More...
 
clSimManagerGetSimManager ()
 
void DoObjectSetup (xercesc::DOMDocument *p_oDoc, fileType iFileType)
 Triggers the setup process. More...
 
virtual void TimestepCleanup ()
 Performs any necessary cleanup operations at the end of a timestep. More...
 
virtual void EndOfRunCleanup ()
 Performs any necessary cleanup operations at the end of a run. More...
 

Protected Member Functions

void GetData (xercesc::DOMDocument *p_oDoc)
 Reads the desired options out of the parameter file. More...
 
void WriteFileHeader ()
 Writes output file header. More...
 
void ExtractLiveTreeInfo (xercesc::DOMDocument *p_oDoc)
 Extracts the output data relating to tree saving from the parameter file. More...
 
void ExtractDeadTreeInfo (xercesc::DOMDocument *p_oDoc)
 Extracts the output data relating to tree saving from the parameter file. More...
 
void ExtractSubplotInfo (xercesc::DOMDocument *p_oDoc)
 Extracts the subplot data from the parameter file. More...
 
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. More...
 
void GetDeadTreeStats ()
 For a time step, collects all basal area and density information for dead trees. More...
 
void GetLiveTreeStats ()
 For a time step, collects all basal area and density information for live trees. More...
 
void DeclareDataArrays ()
 Allocates memory for all of our arrays. More...
 
void DeclareDataArraysForSubplots ()
 Allocates memory for those arrays pertaining to subplots. More...
 
void WriteTimestepData ()
 Write the data for a single time step. More...
 
- Protected Member Functions inherited from clWorkerBase
void AssembleFileCode (int iFileType, int iFileVersion, char *cCode)
 Creates the proper identifying filecode for an XML file. More...
 

Protected Attributes

std::string m_sFileName
 Output file name. More...
 
float ** mp_fLiveRBA
 Array for one timestep's relative basal area - # types by # species. More...
 
float ** mp_fLiveABA
 Array for one timestep's absolute basal area - # types by # species. More...
 
float ** mp_fLiveRDN
 Array for one timestep's relative density - # types by # species. More...
 
float ** mp_fLiveADN
 Array for one timestep's absolute density - # types by # species. More...
 
float *** mp_fSubRBA
 Array for one timestep's relative basal area by subplot - # subplots by

types by # species

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

types by # species

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

types by # species

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

types by # species

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

dead reason codes

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

dead reason codes

More...
 
bool * mp_bSaveLiveRBA
 Whether to save relative basal area. More...
 
bool * mp_bSaveLiveABA
 Whether to save absolute basal area. More...
 
bool * mp_bSaveLiveRDN
 Whether to save relative density. More...
 
bool * mp_bSaveLiveADN
 Whether to save absolute density. More...
 
bool ** mp_bSaveDeadABA
 Whether to save absolute basal area. More...
 
bool ** mp_bSaveDeadADN
 Whether to save absolute density. More...
 
bool * mp_bSaveAnyLive
 Shortcut flag for whether to save any information, by type. More...
 
bool * mp_bSaveAnyLiveBA
 Shortcut flag for whether to save basal area information, by type. More...
 
bool m_bUseLive
 Shortcut flag for whether any live trees are to be saved all. More...
 
bool m_bUseDead
 Shortcut flag for whether any dead trees are to be saved all. More...
 
struct clShortOutput::stcSubplotInfomp_subplots
 An array of stcSubplotInfos, one for each subplot to save. More...
 
short int m_iNumSubplotsToSave
 Number of subplots we're saving data for. More...
 
short int m_iNumXCells
 Number of plot cells in the X direction - for subplots. More...
 
short int m_iNumYCells
 Number of plot cells in the Y direction - for subplots. More...
 
short int m_iNumTypes
 Number of types. More...
 
short int m_iNumSpecies
 Number of species. More...
 
float m_fXCellLength
 Length of subplot cells in X direction - defaults to match tree population. More...
 
float m_fYCellLength
 Length of subplot cells in Y direction - defaults to match tree population. More...
 
- Protected Attributes inherited from clBehaviorBase
short int m_iNumSpeciesTypeCombos
 How many type/species combos a behavior will act on. More...
 
short int m_iNumBehaviorSpecies
 How many distinct species are in the combo list - important for filling species-specific values from parameter file. More...
 
short int * mp_iWhatSpecies
 List of distinct species - for filling species-specific values from parameter file. More...
 
stcSpeciesTypeCombomp_whatSpeciesTypeCombos
 Array of species/type combos that the behavior will act on. More...
 
short int m_iNewTreeInts
 The number of new tree integer data members this behavior wants to add. More...
 
short int m_iNewTreeFloats
 The number of new tree float data members this behavior wants to add. More...
 
short int m_iNewTreeChars
 The number of new tree character data members this behavior wants to add. More...
 
short int m_iNewTreeBools
 The number of new tree boolean data members this behavior wants to add. More...
 
short int m_iBehaviorListNumber
 The number of this behavior in the behavior list, to differentiate between possible multiple copies of this behavior. More...
 
float m_fVersionNumber
 Version number - this will be rounded to 2 digits after the decimal place. More...
 
std::string m_sXMLRoot
 XML root that encloses the parameters for this behavior. More...
 
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. More...
 
- Protected Attributes inherited from clWorkerBase
std::string m_sNameString
 If a behavior has registered a command line command with the sim manager, this allows it to be called. More...
 
clSimManagermp_oSimManager
 Pointer to the simulation manager object. More...
 
int * mp_iAllowedFileTypes
 List of the input file types this object can handle. More...
 
int m_iNumAllowedTypes
 Number of input file types this object can handle. More...
 

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::clShortOutput ( clSimManager p_oSimManager)

Constructor.

Parameters
p_oSimManagerSim Manager object.

◆ ~clShortOutput()

clShortOutput::~clShortOutput ( )

Destructor.

Member Function Documentation

◆ Action()

void clShortOutput::Action ( )
virtual

Collects data and writes the output file.

Reimplemented from clBehaviorBase.

◆ DeclareDataArrays()

void clShortOutput::DeclareDataArrays ( )
protected

Allocates memory for all of our arrays.

◆ DeclareDataArraysForSubplots()

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.

◆ ExtractDeadTreeInfo()

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.

◆ ExtractLiveTreeInfo()

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.

◆ ExtractSubplotInfo()

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

Extracts the subplot data from the parameter file.

Parameters
p_oDocDOM tree of parsed input file.

◆ GetData()

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.

◆ GetDeadTreeStats()

void clShortOutput::GetDeadTreeStats ( )
protected

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

◆ GetLiveTreeStats()

void clShortOutput::GetLiveTreeStats ( )
protected

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

◆ TestForSave()

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.

◆ WriteFileHeader()

void clShortOutput::WriteFileHeader ( )
protected

Writes output file header.

◆ WriteTimestepData()

void clShortOutput::WriteTimestepData ( )
protected

Write the data for a single time step.

Member Data Documentation

◆ m_bUseDead

bool clShortOutput::m_bUseDead
protected

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

◆ m_bUseLive

bool clShortOutput::m_bUseLive
protected

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

◆ m_fXCellLength

float clShortOutput::m_fXCellLength
protected

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

◆ m_fYCellLength

float clShortOutput::m_fYCellLength
protected

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

◆ m_iNumSpecies

short int clShortOutput::m_iNumSpecies
protected

Number of species.

◆ m_iNumSubplotsToSave

short int clShortOutput::m_iNumSubplotsToSave
protected

Number of subplots we're saving data for.

◆ m_iNumTypes

short int clShortOutput::m_iNumTypes
protected

Number of types.

◆ m_iNumXCells

short int clShortOutput::m_iNumXCells
protected

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

◆ m_iNumYCells

short int clShortOutput::m_iNumYCells
protected

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

◆ m_sFileName

std::string clShortOutput::m_sFileName
protected

Output file name.

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

◆ mp_bSaveAnyLive

bool* clShortOutput::mp_bSaveAnyLive
protected

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

◆ mp_bSaveAnyLiveBA

bool* clShortOutput::mp_bSaveAnyLiveBA
protected

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

◆ mp_bSaveDeadABA

bool** clShortOutput::mp_bSaveDeadABA
protected

Whether to save absolute basal area.

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

◆ mp_bSaveDeadADN

bool** clShortOutput::mp_bSaveDeadADN
protected

Whether to save absolute density.

Array size # types by # dead reason codes.

◆ mp_bSaveLiveABA

bool* clShortOutput::mp_bSaveLiveABA
protected

Whether to save absolute basal area.

Ignored for seedlings. Array size # types.

◆ mp_bSaveLiveADN

bool* clShortOutput::mp_bSaveLiveADN
protected

Whether to save absolute density.

Array size # types.

◆ mp_bSaveLiveRBA

bool* clShortOutput::mp_bSaveLiveRBA
protected

Whether to save relative basal area.

Ignored for seedlings. Array size # types.

◆ mp_bSaveLiveRDN

bool* clShortOutput::mp_bSaveLiveRDN
protected

Whether to save relative density.

Array size # types.

◆ mp_fDeadABA

float*** clShortOutput::mp_fDeadABA
protected

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

dead reason codes

◆ mp_fDeadADN

float*** clShortOutput::mp_fDeadADN
protected

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

dead reason codes

◆ mp_fLiveABA

float** clShortOutput::mp_fLiveABA
protected

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

◆ mp_fLiveADN

float** clShortOutput::mp_fLiveADN
protected

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

◆ mp_fLiveRBA

float** clShortOutput::mp_fLiveRBA
protected

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

◆ mp_fLiveRDN

float** clShortOutput::mp_fLiveRDN
protected

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

◆ mp_fSubABA

float*** clShortOutput::mp_fSubABA
protected

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

types by # species

◆ mp_fSubADN

float*** clShortOutput::mp_fSubADN
protected

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

types by # species

◆ mp_fSubRBA

float*** clShortOutput::mp_fSubRBA
protected

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

types by # species

◆ mp_fSubRDN

float*** clShortOutput::mp_fSubRDN
protected

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

types by # species

◆ mp_subplots

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: