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

ConstantSinkReaction.cpp

Go to the documentation of this file.
00001 // ConstantSinkReaction.cpp: implementation of the CConstantSinkReaction class.
00002 //
00004 
00005 #include "ConstantSinkReaction.h"
00006 
00008 // Construction/Destruction
00010 
00011 CConstantSinkReaction::CConstantSinkReaction(Chemical *ChangedChemical, RateConstant *k_sink, std::string reactionName)
00012 :Reaction(reactionName)
00013 {
00014         // stoichiometry
00015         this->ChangedChemical = chemicals.size();
00016         chemicals.push_back(ChangedChemical);
00017         numberOfEachChemicalChangedByReaction.push_back(-1);
00018 
00019         // rates
00020         this->k_sink = rateConstants.size();
00021         rateConstants.push_back(k_sink);
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 
00031 CConstantSinkReaction::~CConstantSinkReaction()
00032 {
00033 
00034 }
00035 
00036 double CConstantSinkReaction::GetRate() const
00037 {
00038         return rateConstants[k_sink]->GetValue();
00039 }
00040 
00041 void CConstantSinkReaction::SetTeXForm()
00042 {
00043         strstream stream;
00044         // TeX form of the reaction
00045         stream << rateConstants[k_sink]->GetTeXName().c_str();
00046         stream << ends;
00047         // set the TeX string equal to what's in the stream
00048         m_sTeXForm = stream.str();
00049         // allow memory to be freed
00050         stream.rdbuf()->freeze(0);
00051 }
00052 
00053 std::vector<Reaction::JElement *> *CConstantSinkReaction::GetChemicalJacobian()
00054 {
00055         chemicalJacobian[0]->SetWithRespectTo(chemicals[ChangedChemical]->GetChemicalNumber());
00056         chemicalJacobian[0]->SetJValue(0.0);
00057         
00058         return &chemicalJacobian;
00059 }

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