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

UnaryDegradationReaction.cpp

Go to the documentation of this file.
00001 // UnaryDegradationReaction.cpp: implementation of the UnaryDegradationReaction class.
00002 //
00004 
00005 #include "UnaryDegradationReaction.h"
00006 
00008 // Construction/Destruction
00010 
00011 UnaryDegradationReaction::UnaryDegradationReaction(Chemical *UnstableChemical, RateConstant *k_deg, std::string reactionName)
00012 :Reaction(reactionName)
00013 {
00014         // stoichiometry
00015         this->UnstableChemical = chemicals.size();
00016         chemicals.push_back(UnstableChemical);
00017         numberOfEachChemicalChangedByReaction.push_back(-1);
00018         
00019         // rates
00020         this->k_deg = rateConstants.size();
00021         rateConstants.push_back(k_deg);
00022 
00023         // put enough dummy chemicalJacobian elements on the vector 
00024         // - they are recomputed every time you ask for the chemicalJacobian
00025         chemicalJacobian.push_back(new JElement(-1,-1));
00026 
00027         this->SetTeXForm();
00028 }
00029 
00030 UnaryDegradationReaction::~UnaryDegradationReaction()
00031 {
00032 
00033 }
00034 
00035 double UnaryDegradationReaction::GetRate() const
00036 {
00037         return rateConstants[k_deg]->GetValue() * chemicals[UnstableChemical]->GetAmount();
00038 }
00039 
00040 void UnaryDegradationReaction::SetTeXForm()
00041 {
00042         std::stringstream stream;
00043         // TeX form of the reaction
00044         stream << rateConstants[k_deg]->GetTeXName().c_str();
00045         stream << "\\left [" << chemicals[UnstableChemical]->GetTeXName().c_str();
00046         stream << "\\right ]";
00047         // add a NULL
00048         stream << ends;
00049         // set the TeX string equal to what's in the stream
00050         m_sTeXForm = stream.str();
00051         // allow memory to be freed
00052 //      stream.rdbuf()->freeze(0);
00053 }
00054 
00055 std::vector<Reaction::JElement *> *UnaryDegradationReaction::GetChemicalJacobian()
00056 {
00057         chemicalJacobian[0]->SetWithRespectTo(chemicals[UnstableChemical]->GetChemicalNumber());
00058         chemicalJacobian[0]->SetJValue(rateConstants[k_deg]->GetValue());
00059         
00060         return &chemicalJacobian;
00061 }

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