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

ConstantSourceReaction.cpp

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

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