00001 // TauReaction.cpp: implementation of the CTauReaction class. 00002 // 00004 00005 #include "TauReaction.h" 00006 00008 // Construction/Destruction 00010 00011 CTauReaction::CTauReaction(Chemical *pTau):Reaction("TauReaction") 00012 { 00013 this->Tau = chemicals.size(); 00014 chemicals.push_back(pTau); 00015 numberOfEachChemicalChangedByReaction.push_back(1); 00016 00017 // chemical jacobian is included for class compatibility, but you 00018 // should never ask for this element b/c it has no meaning! 00019 chemicalJacobian.push_back(new JElement(-1,-1)); 00020 00021 this->SetTeXForm(); 00022 } 00023 00024 CTauReaction::~CTauReaction() 00025 { 00026 00027 } 00028 00029 double CTauReaction::GetRate() const 00030 { 00031 return 1.0/(1.0 - chemicals[Tau]->GetAmount()); 00032 } 00033 00034 void CTauReaction::SetTeXForm() 00035 { 00036 std::stringstream stream; 00037 // TeX form of the reaction 00038 stream << "{1 \\over {1 - \\left [ " << chemicals[Tau]->GetTeXName().c_str(); 00039 stream << " \\right ] }}"; 00040 // add a NULL 00041 stream << ends; 00042 // set the TeX string equal to what's in the stream 00043 m_sTeXForm = stream.str(); 00044 // allow memory to be freed 00045 // stream.rdbuf()->freeze(0); 00046 } 00047 00048 std::vector<Reaction::JElement *> *CTauReaction::GetChemicalJacobian() 00049 { 00050 chemicalJacobian[0]->SetWithRespectTo(chemicals[Tau]->GetChemicalNumber()); 00051 chemicalJacobian[0]->SetJValue(0.0); 00052 00053 return &chemicalJacobian; 00054 }