00001
00002
00004
00005 #include "ForestNitrogenCyclingMinimizableDirector.h"
00006
00008
00010
00011 CForestNitrogenCyclingMinimizableDirector::CForestNitrogenCyclingMinimizableDirector()
00012 {
00013
00014 double maxSimTime = 385.0;
00015 double stepSize = 0.0001;
00016 double frequency = 1.0;
00017 int nCells = 1;
00018 double moveTol = 1.0e-06;
00019
00020 m_dGammaSquared = 0.0;
00021
00022
00023 bool rateFlag = true;
00024 bool chemFlag = false;
00025 bool logsFlag = false;
00026 double timeWeight = 1.0;
00027 double rateWeight = 1.0;
00028 double chemWeight = 0.0;
00029
00030
00031
00032 _networkList.push_back(new CForestNitrogenCycleNetwork());
00033 _experimentList.push_back(new Experiment(_networkList[0],"Hubbard Brook 1"));
00034
00035 _experimentList[0]->AddDataFileToList("MonthlyMDO.dat");
00036
00037 _experimentList[0]->AddForcingFileToList("MonthlyIP.dat");
00038
00039 _moverList.push_back(new CQualityControlCashKarpMover(frequency,stepSize,moveTol));
00040 _plotterList.push_back(new GnuPlotterTimeSeriesObserver());
00041
00042 _plotterList[0]->SetTitle("Forest N Cycling Network : Hubbard Brook Experimental Forest : ODE");
00043
00044 _minimizableList.push_back(new SingleNetworkMinimizable());
00045
00046 _minimizableList[0]->Initialize(_experimentList[0],_moverList[0],nCells,rateFlag,chemFlag,logsFlag,timeWeight,rateWeight,chemWeight);
00047 _minimizableList[0]->GetConversionFactor(0)->SetFactorFixed(true);
00048 _minimizableList[0]->GetConversionFactor(0)->SetFactorValue(1.0);
00049 _minimizableList[0]->GetConversionFactor(1)->SetFactorFixed(true);
00050 _minimizableList[0]->GetConversionFactor(1)->SetFactorValue(1.0);
00051 _minimizableList[0]->GetConversionFactor(2)->SetFactorFixed(true);
00052 _minimizableList[0]->GetConversionFactor(2)->SetFactorValue(1.0);
00053 _minimizableList[0]->GetConversionFactor(3)->SetFactorFixed(true);
00054 _minimizableList[0]->GetConversionFactor(3)->SetFactorValue(1.0);
00055 _minimizableList[0]->GetConversionFactor(4)->SetFactorFixed(true);
00056 _minimizableList[0]->GetConversionFactor(4)->SetFactorValue(1.0);
00057
00058 _minimizableList[0]->Attach(_plotterList[0]);
00059
00060
00061
00062 int masterResidualsSize = 0;
00063 for(int i = 0; i < _minimizableList.size(); i++)
00064 {
00065 int subRes = _minimizableList[i]->GetNResiduals();
00066 masterResidualsSize += subRes;
00067 cout << subRes << " residuals in minimizable " << i << endl;
00068 }
00069 if(m_dGammaSquared > 0.0)
00070 {
00071 masterResidualsSize += 1;
00072 }
00073 Allocate(masterResidualsSize);
00074
00075 cout << "Master Residuals size : " << masterResidualsSize << endl;
00076
00077
00078 DefineExperiments();
00079
00080 }
00081
00082 CForestNitrogenCyclingMinimizableDirector::~CForestNitrogenCyclingMinimizableDirector()
00083 {
00084 for(int i = 0; i < _minimizableList.size(); i++)
00085 {
00086 _minimizableList[i]->Detach(_plotterList[i]);
00087 }
00088 for(i = 0; i < _plotterList.size(); i++)
00089 {
00090 delete _plotterList[i];
00091 }
00092
00093 }
00094
00095 void CForestNitrogenCyclingMinimizableDirector::DefineExperiments()
00096 {
00097
00098 }
00099
00100 double CForestNitrogenCyclingMinimizableDirector::GetParameter(int parIndex)
00101 {
00102
00103
00104 return _minimizableList[0]->GetParameter(parIndex);
00105 }
00106
00107 int CForestNitrogenCyclingMinimizableDirector::GetNParameters()
00108 {
00109
00110 return _minimizableList[0]->GetNParameters();
00111 }