/////////////////////////////////////////////////////////////////////////////
// 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 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 );
  }
}
////////////////////////////////////////////////////////////////////////////
// DoShellSetup()
////////////////////////////////////////////////////////////////////////////
void clWeibullClimateQuadratGrowth::DoShellSetup( xercesc::DOMDocument * p_oDoc )
{
  try
  {
    clTreePopulation * p_oPop = ( clTreePopulation * ) mp_oSimManager->GetPopulationObject( "treepopulation" );
    FormatQuery( p_oPop );
    ReadParameterFile( p_oDoc, p_oPop );
    ValidateData( p_oPop );
    SetupGrid( p_oPop );
  }
  catch ( modelErr & err )
  {
    throw( err );
  }
  catch ( modelMsg & msg )
  {
    throw( msg );
  } //non-fatal error
  catch ( ... )
  {
    modelErr stcErr;
    stcErr.iErrorCode = UNKNOWN;
    strcpy( stcErr.cFunction, "clWeibullClimateQuadratGrowth::DoShellSetup" );
    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 );
  }
}
示例#5
0
void CRecBinViewer::Fill (const TCHAR *root) 
{	
    UpdateList ();
	if (m_pGridCtrl)
	{		
		m_pGridCtrl->SetRowCount(m_List.size () +1);
		SetupGrid ();
	}	
}
示例#6
0
/**
 * Set up the class to create line features on a terrain.
 *
 * \param pHFGrid The heightfield you will generate the contour lines on.
 * \param fset The featureset to receive the polylines.
 * \return True if successful.
 */
bool ContourConverter::Setup(vtHeightFieldGrid3d *pHFGrid, vtFeatureSetLineString *fset)
{
	if (!pHFGrid)
		return false;

	if (!SetupGrid(pHFGrid))
		return false;

	m_pLS = fset;
	return true;
}
示例#7
0
void CDriveViewer::Fill (const TCHAR *root) 
{
	//GetDrives (m_Array);
	gPool.StopThread(DRIVES_THREAD);
	gPool.StartThreadAndWait(DRIVES_THREAD, this, &CDriveViewer::GetDrives);
	
	if (!m_pGridCtrl)
		return;

	if (!m_bGetState) {
		gFolderStateMan.LoadState (CONST_MYCOMPUTER, m_State);
		m_bGetState = true;
	}
	
	CGuard guard(m_lock);
	Sort ();
	m_pGridCtrl->SetRowCount(m_Array.size () +1);
	SetupGrid ();	
}
/////////////////////////////////////////////////////////////////////////////
// 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 );
  }
}
示例#9
0
int main(int argc, char* argv[]){

// Start timing!
	boost::timer::cpu_timer myTimer;
	
	cout << endl;
	cout << "BEGIN" << endl;
	
// BEGIN: setup	

	FIELDCONTAINER field;
	DATA params;
	GRIDINFO grid;
	LAPLACIANSTENCIL stencil;
	
	

	// Read in parameter files & populate "params"
	GetParams(argc,argv,&params);
	CheckParams(&params);
	
	if( params.flag == 0){
	
		// Use info to setup "grid" and "field" struct
		SetupGrid(&grid, &params);
		SetupField(&params, &field);
		SetupLaplacianStencil(&params, &stencil);
		
		// Print params to screen & logfile
		ofstream logout;
		logout.open(params.OutDir + params.RunID + "_log.dat");
		PrintParams(cout, &params, &stencil, 0);	
		PrintParams(logout, &params, &stencil, 0);	
		logout.close();
		
// END: setup	

// BEGIN: solving

		// Setup initial conditions
		InitialConditions(&params, &grid, &field);
		// Solve field equation
		SolveKG3D(&params, &grid, &field, &stencil);
		// Delete arrays
		field.CleanField(&field);
	
// END: solving

// BEGIN: feedback

		myTimer.stop();
		params.TotalRunTime = myTimer.elapsed().wall / 1e6;
		logout.open(params.OutDir + params.RunID + "_log.dat",std::ofstream::app);
		PrintParams(cout, &params, &stencil, 1);	
		PrintParams(logout, &params, &stencil, 1);	
		logout.close();
		
// END: feedback
		
	} // END if( params.flag == 0){}

	
}// end main()