///////////////////////////////////////////////////////////////////////////// // GetData() ///////////////////////////////////////////////////////////////////////////// void clCarbonValueCalculator::GetData( xercesc::DOMDocument * p_oDoc ) { try { clTreePopulation * p_oPop = ( clTreePopulation * ) mp_oSimManager->GetPopulationObject( "treepopulation" ); GetParameterFileData(p_oDoc, p_oPop); FormatQueryString(p_oPop); SetupGrid(); GetBiomassCodes(p_oPop); Action(); } catch ( modelErr & err ) { throw( err ); } catch ( modelMsg & msg ) { throw( msg ); } //non-fatal error catch ( ... ) { modelErr stcErr; stcErr.iErrorCode = UNKNOWN; stcErr.sFunction = "clCarbonValueCalculator::GetData" ; throw( stcErr ); } }
///////////////////////////////////////////////////////////////////////////// // GetData() ///////////////////////////////////////////////////////////////////////////// void clRipleysKCalculator::GetData( xercesc::DOMDocument * p_oDoc ) { try { clTreePopulation * p_oPop = ( clTreePopulation * ) mp_oSimManager->GetPopulationObject( "treepopulation" ); m_iNumTotalSpecies = p_oPop->GetNumberOfSpecies(); m_iNumXCells = p_oPop->GetNumXCells(); m_iNumYCells = p_oPop->GetNumYCells(); GetParameterFileData(p_oDoc); GetTreeCodes(p_oPop); SetUpSearching(p_oPop); SetupGrid(); //Calculate Ripley's K for the initial conditions Action(); } catch ( modelErr & err ) { throw( err ); } catch ( modelMsg & msg ) { throw( msg ); } //non-fatal error catch ( ... ) { modelErr stcErr; stcErr.iErrorCode = UNKNOWN; stcErr.sFunction = "clRipleysKCalculator::GetData" ; throw( stcErr ); } }
/////////////////////////////////////////////////////////////////////////////// // GetData ///////////////////////////////////////////////////////////////////////////// void clLightDepSeedSurvival::GetData( xercesc::DOMDocument * p_oDoc ) { try { //Make sure the light org object got a chance to do setup, which it //wouldn't have if this is the only light behavior around if (!m_bUseStormLight) { if ( mp_oLightOrg->GetMaxTreeHeight() <= 0 ) { mp_oLightOrg->DoSetup( mp_oSimManager, p_oDoc ); } } GetParameterFileData( p_oDoc ); GetTreeDataMemberCodes(); SetupGrid(); DoLightSetup(); } catch ( modelErr & err ) { throw( err ); } catch ( modelMsg & msg ) { throw( msg ); } //non-fatal error catch ( ... ) { modelErr stcErr; stcErr.iErrorCode = UNKNOWN; strcpy( stcErr.cFunction, "clLightDepSeedSurvival::GetData" ); throw( stcErr ); } }
///////////////////////////////////////////////////////////////////////////// // GetData() ///////////////////////////////////////////////////////////////////////////// void clBoleVolumeCalculator::GetData( xercesc::DOMDocument * p_oDoc ) { try { GetParameterFileData(p_oDoc); FormatQueryString(); PopulateTaperTable(); Action(); } catch ( modelErr & err ) { throw( err ); } catch ( modelMsg & msg ) { throw( msg ); } //non-fatal error catch ( ... ) { modelErr stcErr; stcErr.iErrorCode = UNKNOWN; stcErr.sFunction = "clBoleVolumeCalculator::GetData" ; throw( stcErr ); } }
/////////////////////////////////////////////////////////////////////////////// // GetData ///////////////////////////////////////////////////////////////////////////// void clSubstrateDepSeedSurvival::GetData(xercesc::DOMDocument * p_oDoc) { try { GetParameterFileData(p_oDoc); //Set up the grids SetupGrids(); } catch (modelErr& err) { throw(err); } catch (modelMsg & msg) { throw(msg); } //non-fatal error catch (...) { modelErr stcErr; stcErr.iErrorCode = UNKNOWN; stcErr.sFunction = "clSubstrateDepSeedSurvival::GetData"; throw(stcErr); } }
////////////////////////////////////////////////////////////////////////////// // DoShellSetup() ////////////////////////////////////////////////////////////////////////////// void clConstantRadialGrowth::DoShellSetup(xercesc::DOMDocument *p_oDoc) { try { short int iNumSpecies = mp_oGrowthOrg->GetNumberOfSpecies(); mp_fAdultConstRadInc = new double[iNumSpecies]; //Read the base variables GetParameterFileData(p_oDoc); } catch (modelErr&err) {throw(err);} catch (modelMsg &msg) {throw(msg);} //non-fatal error catch (...) { modelErr stcErr; stcErr.iErrorCode = UNKNOWN; stcErr.sFunction = "clRelativeGrowth::GetNameData"; throw(stcErr); } }
///////////////////////////////////////////////////////////////////////////// // GetData() ///////////////////////////////////////////////////////////////////////////// void clStormKilledPartitionedBiomass::GetData( xercesc::DOMDocument * p_oDoc ) { try { clTreePopulation * p_oPop = ( clTreePopulation * ) mp_oSimManager->GetPopulationObject( "treepopulation" ); int i; for (i = 0; i < m_iNumSpeciesTypeCombos; i++) { if (mp_whatSpeciesTypeCombos[i].iType != clTreePopulation::snag) { modelErr stcErr; stcErr.iErrorCode = BAD_DATA; stcErr.sMoreInfo = "Storm Killed Partitioned Biomass can only be applied to snags."; stcErr.sFunction = "clStormKilledPartitionedBiomass::GetData"; throw(stcErr); } } GetTreeCodes(p_oPop); GetParameterFileData(p_oDoc, p_oPop); FormatQueryString(p_oPop); SetupGrid(p_oPop); Action(); } catch ( modelErr & err ) { throw( err ); } catch ( modelMsg & msg ) { throw( msg ); } //non-fatal error catch ( ... ) { modelErr stcErr; stcErr.iErrorCode = UNKNOWN; stcErr.sFunction = "clStormKilledPartitionedBiomass::GetData" ; throw( stcErr ); } }
////////////////////////////////////////////////////////////////////////////// // DoShellSetup() ////////////////////////////////////////////////////////////////////////////// void clRelativeGrowth::DoShellSetup( DOMDocument * p_oDoc ) { try { clTreePopulation * p_oPop = ( clTreePopulation * ) mp_oSimManager->GetPopulationObject( "treepopulation" ); DOMElement * p_oElement = GetParentParametersElement(p_oDoc); doubleVal * p_fTempValues; //for getting species-specific values short int iNumSpecies = mp_oGrowthOrg->GetNumberOfSpecies(), i; //Set up our doubleVal array that will extract values only for the species //assigned to this behavior p_fTempValues = new doubleVal[m_iNumBehaviorSpecies]; for ( i = 0; i < m_iNumBehaviorSpecies; i++ ) p_fTempValues[i].code = mp_iWhatSpecies[i]; m_iNumberYearsPerTimestep = mp_oSimManager->GetNumberOfYearsPerTimestep(); //Declare the arrays we'd like read if (diameter_auto == m_iGrowthMethod || diameter_only == m_iGrowthMethod) { mp_fAsympDiamGrowth = new double[iNumSpecies]; mp_fSlopeDiamGrowthResponse = new double[iNumSpecies]; } else { mp_fAsympHeightGrowth = new double[iNumSpecies]; mp_fSlopeHeightGrowthResponse = new double[iNumSpecies]; } mp_fExp = new double[iNumSpecies]; if ( m_bConstRadialLimited ) { mp_fAdultConstRadInc = new double[iNumSpecies]; } if ( m_bConstBasalAreaLimited ) { mp_fAdultConstBAInc = new double[iNumSpecies]; } //Read the base variables GetParameterFileData( p_oDoc ); if (diameter_auto == m_iGrowthMethod || diameter_only == m_iGrowthMethod) { //Get the diameter exponent FillSpeciesSpecificValue( p_oElement, "gr_relGrowthDiamExp", "gr_rgdeVal", p_fTempValues, m_iNumBehaviorSpecies, p_oPop, true ); } else { //Get the height exponent FillSpeciesSpecificValue( p_oElement, "gr_relHeightGrowthHeightExp", "gr_rhgheVal", p_fTempValues, m_iNumBehaviorSpecies, p_oPop, true ); } //Transfer to the appropriate array buckets for ( i = 0; i < m_iNumBehaviorSpecies; i++ ) mp_fExp[p_fTempValues[i].code] = p_fTempValues[i].val; //Make sure all species/type combos have "Light" registered for ( int i = 0; i < m_iNumSpeciesTypeCombos; i++ ) { if ( -1 == mp_oGrowthOrg->GetLightCode(mp_whatSpeciesTypeCombos[i].iSpecies, mp_whatSpeciesTypeCombos[i].iType ) ) { modelErr stcErr; stcErr.sFunction = "clRelativeGrowth::DoShellSetup"; std::stringstream s; s << "Type/species combo species=" << mp_whatSpeciesTypeCombos[i].iSpecies << " type=" << mp_whatSpeciesTypeCombos[i].iType << " does not have a required light behavior."; stcErr.sMoreInfo = s.str(); stcErr.iErrorCode = BAD_DATA; throw( stcErr ); } } delete[] p_fTempValues; } catch ( modelErr & err ) { throw( err ); } catch ( modelMsg & msg ) { throw( msg ); } //non-fatal error catch ( ... ) { modelErr stcErr; stcErr.iErrorCode = UNKNOWN; stcErr.sFunction = "clRelativeGrowth::DoShellSetup" ; throw( stcErr ); } }
////////////////////////////////////////////////////////////////////////////// // DoShellSetup() ////////////////////////////////////////////////////////////////////////////// void clDoubleMMRelGrowth::DoShellSetup( DOMDocument * p_oDoc ) { doubleVal * p_fTempValues = NULL; try { short int iNumSpecies = mp_oGrowthOrg->GetNumberOfSpecies(), i; m_iNumberYearsPerTimestep = mp_oSimManager->GetNumberOfYearsPerTimestep(); //Declare the arrays we'd like read mp_fAsympDiamGrowth = new double[iNumSpecies]; mp_fSlopeDiamGrowthResponse = new double[iNumSpecies]; mp_fResourceInfluence = new double[iNumSpecies]; //Read the base variables with the base class function GetParameterFileData( p_oDoc ); //Now read this behavior's additional parameter DOMElement * p_oElement = GetParentParametersElement(p_oDoc); p_fTempValues = new doubleVal[m_iNumBehaviorSpecies]; clTreePopulation *p_oPop = (clTreePopulation*) mp_oSimManager->GetPopulationObject("treepopulation"); for ( i = 0; i < m_iNumBehaviorSpecies; i++ ) p_fTempValues[i].code = mp_iWhatSpecies[i]; FillSpeciesSpecificValue( p_oElement, "gr_diamDoubleMMResourceInfluence", "gr_ddmmriVal", p_fTempValues, m_iNumBehaviorSpecies, p_oPop, true ); for ( i = 0; i < m_iNumBehaviorSpecies; i++ ) { mp_fResourceInfluence[p_fTempValues[i].code] = p_fTempValues[i].val; } //UNSCALE the slope of growth response parameter to undo what the base //function did because we don't want it for ( i = 0; i < m_iNumBehaviorSpecies; i++ ) if ( mp_fSlopeDiamGrowthResponse[mp_iWhatSpecies[i]] != 0.0 ) mp_fSlopeDiamGrowthResponse[mp_iWhatSpecies[i]] = ( 1 / mp_fSlopeDiamGrowthResponse[mp_iWhatSpecies[i]] ) * mp_fAsympDiamGrowth[mp_iWhatSpecies[i]]; //Make sure all species/type combos have "Light" registered for ( i = 0; i < m_iNumSpeciesTypeCombos; i++ ) { if ( -1 == mp_oGrowthOrg->GetLightCode( mp_whatSpeciesTypeCombos[i].iSpecies, mp_whatSpeciesTypeCombos[i].iType ) ) { modelErr stcErr; stcErr.sFunction = "clDoubleMMRelGrowth::DoShellSetup" ; std::stringstream s; s << "Type/species combo species=" << mp_whatSpeciesTypeCombos[i].iSpecies << " type=" << mp_whatSpeciesTypeCombos[i].iType << " does not have a required light behavior."; stcErr.sMoreInfo = s.str(); stcErr.iErrorCode = BAD_DATA; throw( stcErr ); } } //Get the "Resource" grid mp_oResourceGrid = mp_oSimManager->GetGridObject( "Resource" ); if ( NULL == mp_oResourceGrid ) { modelErr stcErr; stcErr.sFunction = "clDoubleMMRelGrowth::DoShellSetup" ; stcErr.sMoreInfo = "Can't find required grid object \"Resources\"."; stcErr.iErrorCode = CANT_FIND_OBJECT; throw( stcErr ); } m_iResourceCode = mp_oResourceGrid->GetFloatDataCode( "Resource" ); if ( -1 == m_iResourceCode ) { modelErr stcErr; stcErr.sFunction = "clDoubleMMRelGrowth::DoShellSetup" ; stcErr.sMoreInfo = "Grid object \"Resources\" is set up incorrectly."; stcErr.iErrorCode = CANT_FIND_OBJECT; throw( stcErr ); } delete[] p_fTempValues; } catch ( modelErr & err ) { delete[] p_fTempValues; throw( err ); } catch ( modelMsg & msg ) { delete[] p_fTempValues; throw( msg ); } //non-fatal error catch ( ... ) { delete[] p_fTempValues; modelErr stcErr; stcErr.iErrorCode = UNKNOWN; stcErr.sFunction = "clDoubleMMRelGrowth::DoShellSetup" ; throw( stcErr ); } }