Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

OneGeneInhibitoryAveragingDirector.cpp

Go to the documentation of this file.
00001 // OneGeneInhibitoryAveragingDirector.cpp: implementation of the COneGeneInhibitoryAveragingDirector class.
00002 //
00004 
00005 #include "OneGeneInhibitoryAveragingDirector.h"
00006 
00008 // Construction/Destruction
00010 
00011 COneGeneInhibitoryAveragingDirector::COneGeneInhibitoryAveragingDirector()
00012 {
00013         double maxSimTime = 90.0;
00014         int intTime = (int) maxSimTime + 2;
00015         double stepSize = 0.0001;
00016         double frequency = 1.0;
00017         int seed1 = 9785781;
00018         int seed2 = 89762209;
00019         int nCells = 1;
00020         
00021         
00022         // create a runnable to compare to (differential equation)
00023         m_vpRxnNetworks.push_back(new OneGeneInhibitoryNetwork());
00024         m_vpRxnMovers.push_back(new CQualityControlRungeKuttaMover(frequency,stepSize));
00025         int nChemicals = m_vpRxnNetworks[0]->GetNumberOfChemicals();
00026         m_vpCellObservers.push_back(new CellAverageObserver(nChemicals,intTime,1));
00027         m_vpRunnables.push_back(new CRunnable());
00028         m_vpRunnables[0]->SetComponents(m_vpRxnNetworks[0],m_vpRxnMovers[0],m_vpCellObservers[0]);
00029         // create an observer for the runnable
00030         m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver());
00031         m_vpGnuPlotters[0]->AddChemicalNumberToList(2);
00032         m_vpGnuPlotters[0]->AddChemicalNumberToList(3);
00033         // attach the observer
00034         m_vpRunnables[0]->Attach(m_vpGnuPlotters[0]);
00035 
00036         // pure stochastic simulation
00037         m_vpRxnNetworks.push_back(new OneGeneInhibitoryNetwork());
00038         m_vpRxnMovers.push_back(new CContinuousTimeMonteCarloMover(seed1,frequency));
00039         nChemicals = m_vpRxnNetworks[1]->GetNumberOfChemicals();
00040         m_vpCellObservers.push_back(new CellAverageObserver(nChemicals,intTime,1));
00041         m_vpRunnables.push_back(new CRunnable());
00042         m_vpRunnables[1]->SetComponents(m_vpRxnNetworks[1],m_vpRxnMovers[1],m_vpCellObservers[1]);
00043         // create an observer for the runnable
00044         m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver());
00045         m_vpGnuPlotters[1]->AddChemicalNumberToList(2);
00046         m_vpGnuPlotters[1]->AddChemicalNumberToList(3);
00047         // attach the observer
00048         m_vpRunnables[1]->Attach(m_vpGnuPlotters[1]);
00049         
00050 
00051         // mixed simulation
00052         double tol = 1.0e-06;
00053         intVector stocRxn;
00054         stocRxn.push_back(0);
00055         stocRxn.push_back(1);
00056         m_vpRxnNetworks.push_back(new CMixedReactionNetwork(new OneGeneInhibitoryNetwork(),stocRxn));
00057         m_vpRxnMovers.push_back(new CMixedReactionMover(seed2,new CQualityControlRungeKuttaMover(frequency,stepSize),tol));
00058         nChemicals = m_vpRxnNetworks[2]->GetNumberOfChemicals();
00059         m_vpCellObservers.push_back(new CellAverageObserver(nChemicals,intTime,1));
00060         m_vpRunnables.push_back(new CRunnable());
00061         m_vpRunnables[2]->SetComponents(m_vpRxnNetworks[2],m_vpRxnMovers[2],m_vpCellObservers[2]);
00062         // create an observer for the runnable
00063         m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver());
00064         m_vpGnuPlotters[2]->AddChemicalNumberToList(2);
00065         m_vpGnuPlotters[2]->AddChemicalNumberToList(3);
00066         // attach the observer
00067         m_vpRunnables[2]->Attach(m_vpGnuPlotters[2]);
00068 }
00069 
00070 COneGeneInhibitoryAveragingDirector::~COneGeneInhibitoryAveragingDirector()
00071 {
00072         // delete the runnables
00073         for(int i = 0; i < m_vpRunnables.size(); i++)
00074         {
00075                 delete m_vpRunnables[i];
00076         }
00077         // delete the movers
00078         for(int i = 0; i < m_vpRxnMovers.size(); i++)
00079         {
00080                 delete m_vpRxnMovers[i];
00081         }
00082         // delete the cell observers
00083         for(int i = 0; i < m_vpCellObservers.size(); i++)
00084         {
00085                 delete m_vpCellObservers[i];
00086         }
00087         // delete the networks
00088         for(int i = 0; i < m_vpRxnNetworks.size(); i++)
00089         {
00090                 delete m_vpRxnNetworks[i];
00091         }
00092 }
00093 
00094 void COneGeneInhibitoryAveragingDirector::Execute()
00095 {
00096         // run the simulations
00097         for(int i = 0; i < m_vpRunnables.size(); i++)
00098         {
00099                 m_vpRunnables[i]->Run();
00100         }
00101 }
00102 

Generated on Mon Nov 3 09:38:03 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002