00001 // AlgebraicChemical.cpp: implementation of the CAlgebraicChemical class. 00002 // 00004 00005 #include "AlgebraicChemical.h" 00006 00008 // Construction/Destruction 00010 00011 CAlgebraicChemical::CAlgebraicChemical(int chemicalNumber, std::string name, std::vector<Chemical *> chemRefVector) 00012 { 00013 int i; 00014 this->chemicalNumber = chemicalNumber; 00015 this->name = name; 00016 // load up reference vector 00017 for(i = 0; i < chemRefVector.size(); i++) 00018 { 00019 m_vpChemRefVector.push_back(chemRefVector[i]); 00020 } 00021 this->SetTeXName(); 00022 } 00023 00024 CAlgebraicChemical::CAlgebraicChemical(int chemicalNumber, std::string name, std::vector<Chemical *> chemRefVector, std::vector<RateConstant *> rateRefVector) 00025 { 00026 int i; 00027 this->chemicalNumber = chemicalNumber; 00028 this->name = name; 00029 // load up reference vectors 00030 for(i = 0; i < chemRefVector.size(); i++) 00031 { 00032 m_vpChemRefVector.push_back(chemRefVector[i]); 00033 } 00034 for(i = 0; i < rateRefVector.size(); i++) 00035 { 00036 m_vpRateRefVector.push_back(rateRefVector[i]); 00037 } 00038 this->SetTeXName(); 00039 } 00040 00041 00042 CAlgebraicChemical::~CAlgebraicChemical() 00043 { 00044 // don't delete the ref vectors here - pointers to chemicals 00045 // get deleted elsewhere 00046 } 00047 00048 void CAlgebraicChemical::SetAll() 00049 { 00050 this->SetAmount(0); 00051 this->SetInitialAmount(0); 00052 this->SetErrorInInitialAmount(0); 00053 } 00054 00055 void CAlgebraicChemical::SetAmount(double amount) 00056 { 00057 this->ComputeAmount(); 00058 } 00059 00060 void CAlgebraicChemical::SetInitialAmount(double initialAmount) 00061 { 00062 this->ComputeInitialAmount(); 00063 } 00064 00065 void CAlgebraicChemical::SetErrorInInitialAmount(double errorInInitialAmount) 00066 { 00067 this->ComputeErrorInInitialAmount(); 00068 } 00069 00070 void CAlgebraicChemical::IncrementAmount(double change) 00071 { 00072 // do nothing 00073 } 00074 00075 void CAlgebraicChemical::Reset() 00076 { 00077 // should be relatively safe - if a global ChemicalReset() is 00078 // called, the reference chemicals will have been updated first 00079 // since they must be created first and will thus occupy a lower 00080 // position in the list 00081 this->ComputeInitialAmount(); 00082 amount = initialAmount; 00083 }