00001 // CurrentToCurrentRatioChemical.cpp: implementation of the CCurrentToCurrentRatioChemical class. 00002 // numerator has to be 0th element of chemRefVector, 00003 // denominator has to be 1th element of chemRefVector 00004 // computes Current:Current ratio 00006 00007 #include "CurrentToCurrentRatioChemical.h" 00008 00010 // Construction/Destruction 00012 00013 CCurrentToCurrentRatioChemical::CCurrentToCurrentRatioChemical(int chemicalNumber, std::string name, std::vector<Chemical *> chemRefVector) 00014 :CAlgebraicChemical(chemicalNumber,name,chemRefVector) 00015 { 00016 00017 } 00018 00019 CCurrentToCurrentRatioChemical::~CCurrentToCurrentRatioChemical() 00020 { 00021 00022 } 00023 00024 void CCurrentToCurrentRatioChemical::ComputeAmount() 00025 { 00026 double tempnumerator = 0.0; 00027 double tempdenominator = 0.0; 00028 tempnumerator = m_vpChemRefVector[0]->GetAmount(); 00029 tempdenominator = m_vpChemRefVector[1]->GetAmount(); 00030 00031 amount = tempnumerator/tempdenominator; 00032 } 00033 00034 void CCurrentToCurrentRatioChemical::ComputeInitialAmount() 00035 { 00036 double tempnumerator = 0.0; 00037 double tempdenominator = 0.0; 00038 tempnumerator = m_vpChemRefVector[0]->GetInitialAmount(); 00039 tempdenominator = m_vpChemRefVector[1]->GetInitialAmount(); 00040 initialAmount = tempnumerator/tempdenominator; 00041 } 00042 00043 void CCurrentToCurrentRatioChemical::ComputeErrorInInitialAmount() 00044 { 00045 double errornumerator; 00046 double valuenumerator; 00047 double errordenominator; 00048 double valuedenominator; 00049 00050 errornumerator = m_vpChemRefVector[0]->GetErrorInInitialAmount(); 00051 valuenumerator = m_vpChemRefVector[0]->GetInitialAmount(); 00052 errordenominator = m_vpChemRefVector[1]->GetErrorInInitialAmount(); 00053 valuedenominator = m_vpChemRefVector[1]->GetInitialAmount(); 00054 00055 errornumerator = errornumerator*errornumerator; 00056 valuenumerator = valuenumerator*valuenumerator; 00057 errordenominator = errordenominator*errordenominator; 00058 valuedenominator = valuedenominator*valuedenominator; 00059 00060 errorInInitialAmount = sqrt(errornumerator/valuedenominator + errordenominator/valuenumerator); 00061 }