Remove extraneous parentheses

This commit is contained in:
Ray Speth 2015-07-27 17:41:21 -04:00
parent 89c751f217
commit c3c80f79fb
38 changed files with 137 additions and 137 deletions

View file

@ -344,7 +344,7 @@ public:
* @return Returns a pointer to the top of the column * @return Returns a pointer to the top of the column
*/ */
doublereal* ptrColumn(size_t j) { doublereal* ptrColumn(size_t j) {
return &(m_data[m_nrows*j]); return &m_data[m_nrows*j];
} }
//! Return a const pointer to the top of column j, columns are contiguous //! Return a const pointer to the top of column j, columns are contiguous
@ -355,7 +355,7 @@ public:
* @return Returns a const pointer to the top of the column * @return Returns a const pointer to the top of the column
*/ */
const doublereal* ptrColumn(size_t j) const { const doublereal* ptrColumn(size_t j) const {
return &(m_data[m_nrows*j]); return &m_data[m_nrows*j];
} }
protected: protected:

View file

@ -512,7 +512,7 @@ void deepStdVectorPointerCopy(const std::vector<D*> &fromVec, std::vector<D*> &t
toVec.resize(is); toVec.resize(is);
for (size_t i = 0; i < is; i++) { for (size_t i = 0; i < is; i++) {
if (fromVec[i]) { if (fromVec[i]) {
toVec[i] = new D(*(fromVec[i])); toVec[i] = new D(*fromVec[i]);
} else { } else {
toVec[i] = 0; toVec[i] = 0;
} }

View file

@ -350,8 +350,8 @@ public:
return *this; return *this;
} }
Func1::operator=(right); Func1::operator=(right);
m_f1 = &(m_f1->duplicate()); m_f1 = &m_f1->duplicate();
m_f2 = &(m_f2->duplicate()); m_f2 = &m_f2->duplicate();
m_f1->setParent(this); m_f1->setParent(this);
m_f2->setParent(this); m_f2->setParent(this);
m_parent = 0; m_parent = 0;
@ -413,8 +413,8 @@ public:
return *this; return *this;
} }
Func1::operator=(right); Func1::operator=(right);
m_f1 = &(m_f1->duplicate()); m_f1 = &m_f1->duplicate();
m_f2 = &(m_f2->duplicate()); m_f2 = &m_f2->duplicate();
m_f1->setParent(this); m_f1->setParent(this);
m_f2->setParent(this); m_f2->setParent(this);
m_parent = 0; m_parent = 0;
@ -475,8 +475,8 @@ public:
return *this; return *this;
} }
Func1::operator=(right); Func1::operator=(right);
m_f1 = &(m_f1->duplicate()); m_f1 = &m_f1->duplicate();
m_f2 = &(m_f2->duplicate()); m_f2 = &m_f2->duplicate();
m_f1->setParent(this); m_f1->setParent(this);
m_f2->setParent(this); m_f2->setParent(this);
m_parent = 0; m_parent = 0;
@ -538,7 +538,7 @@ public:
return *this; return *this;
} }
Func1::operator=(right); Func1::operator=(right);
m_f1 = &(m_f1->duplicate()); m_f1 = &m_f1->duplicate();
m_f1->setParent(this); m_f1->setParent(this);
m_parent = 0; m_parent = 0;
return *this; return *this;
@ -614,7 +614,7 @@ public:
return *this; return *this;
} }
Func1::operator=(right); Func1::operator=(right);
m_f1 = &(m_f1->duplicate()); m_f1 = &m_f1->duplicate();
m_f1->setParent(this); m_f1->setParent(this);
m_parent = 0; m_parent = 0;
return *this; return *this;
@ -675,8 +675,8 @@ public:
return *this; return *this;
} }
Func1::operator=(right); Func1::operator=(right);
m_f1 = &(m_f1->duplicate()); m_f1 = &m_f1->duplicate();
m_f2 = &(m_f2->duplicate()); m_f2 = &m_f2->duplicate();
m_f1->setParent(this); m_f1->setParent(this);
m_f2->setParent(this); m_f2->setParent(this);
m_parent = 0; m_parent = 0;
@ -743,8 +743,8 @@ public:
return *this; return *this;
} }
Func1::operator=(right); Func1::operator=(right);
m_f1 = &(m_f1->duplicate()); m_f1 = &m_f1->duplicate();
m_f2 = &(m_f2->duplicate()); m_f2 = &m_f2->duplicate();
m_f1->setParent(this); m_f1->setParent(this);
m_f2->setParent(this); m_f2->setParent(this);
m_parent = 0; m_parent = 0;
@ -1038,7 +1038,7 @@ public:
return *this; return *this;
} }
Func1::operator=(right); Func1::operator=(right);
m_func = &(right.m_func->duplicate()); m_func = &right.m_func->duplicate();
return *this; return *this;
} }

View file

@ -329,7 +329,7 @@ XML_Node::XML_Node(const std::string& nm, XML_Node* const parent_) :
if (!parent_) { if (!parent_) {
m_root = this; m_root = this;
} else { } else {
m_root = &(parent_->root()); m_root = &parent_->root();
} }
} }

View file

@ -786,7 +786,7 @@ int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob)
/* /*
* Get the ThermoPhase object - assume volume phase * Get the ThermoPhase object - assume volume phase
*/ */
ThermoPhase* tPhase = &(mphase->phase(iphase)); ThermoPhase* tPhase = &mphase->phase(iphase);
size_t nelem = tPhase->nElements(); size_t nelem = tPhase->nElements();
/* /*
@ -1146,7 +1146,7 @@ int vcs_Cantera_update_vprob(MultiPhase* mphase, VCS_PROB* vprob)
vprob->Vol = mphase->volume(); vprob->Vol = mphase->volume();
for (size_t iphase = 0; iphase < totNumPhases; iphase++) { for (size_t iphase = 0; iphase < totNumPhases; iphase++) {
ThermoPhase* tPhase = &(mphase->phase(iphase)); ThermoPhase* tPhase = &mphase->phase(iphase);
vcs_VolPhase* volPhase = vprob->VPhaseList[iphase]; vcs_VolPhase* volPhase = vprob->VPhaseList[iphase];
/* /*
* Set the electric potential of the volume phase from the * Set the electric potential of the volume phase from the

View file

@ -359,7 +359,7 @@ void vcs_VolPhase::setMoleFractions(const double* const xmol)
void vcs_VolPhase::_updateMoleFractionDependencies() void vcs_VolPhase::_updateMoleFractionDependencies()
{ {
if (TP_ptr) { if (TP_ptr) {
TP_ptr->setState_PX(Pres_, &(Xmol_[m_MFStartIndex])); TP_ptr->setState_PX(Pres_, &Xmol_[m_MFStartIndex]);
} }
if (!m_isIdealSoln) { if (!m_isIdealSoln) {
m_UpToDate_AC = false; m_UpToDate_AC = false;

View file

@ -152,9 +152,9 @@ int VCS_SOLVE::vcs_elem_rearrange(double* const aw, double* const sa,
if (jr != k) { if (jr != k) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- "); plogf(" --- ");
plogf("%-2.2s", (m_elementName[k]).c_str()); plogf("%-2.2s", m_elementName[k].c_str());
plogf("(%9.2g) replaces ", m_elemAbundancesGoal[k]); plogf("(%9.2g) replaces ", m_elemAbundancesGoal[k]);
plogf("%-2.2s", (m_elementName[jr]).c_str()); plogf("%-2.2s", m_elementName[jr].c_str());
plogf("(%9.2g) as element %3d", m_elemAbundancesGoal[jr], jr); plogf("(%9.2g) as element %3d", m_elemAbundancesGoal[jr], jr);
plogendl(); plogendl();
} }

View file

@ -53,7 +53,7 @@ void VCS_SOLVE::vcs_inest(double* const aw, double* const sa, double* const sm,
tmp += m_formulaMatrix(kspec,j) * m_molNumSpecies_old[kspec]; tmp += m_formulaMatrix(kspec,j) * m_molNumSpecies_old[kspec];
} }
plogf("%s ", pprefix); plogf("%s ", pprefix);
plogf(" %-9.9s", (m_elementName[j]).c_str()); plogf(" %-9.9s", m_elementName[j].c_str());
plogf(" %12.3g %12.3g\n", m_elemAbundancesGoal[j], tmp); plogf(" %12.3g %12.3g\n", m_elemAbundancesGoal[j], tmp);
} }
} }
@ -436,7 +436,7 @@ int VCS_SOLVE::vcs_inest_TP()
* Record time * Record time
*/ */
m_VCount->T_Time_inest += tickTock.secondsWC(); m_VCount->T_Time_inest += tickTock.secondsWC();
(m_VCount->T_Calls_Inest)++; m_VCount->T_Calls_Inest++;
return retn; return retn;
} }

View file

@ -752,7 +752,7 @@ double VCS_SOLVE::vcs_phaseStabilityTest(const size_t iph)
} }
if (delFrac[k] < 0.0) { if (delFrac[k] < 0.0) {
if (2.0 * damp * (-delFrac[k]) > fracDelta_old[k]) { if (2.0 * damp * (-delFrac[k]) > fracDelta_old[k]) {
damp = fracDelta_old[k] / (2.0 * (-delFrac[k])); damp = fracDelta_old[k] / (2.0 * -delFrac[k]);
} }
} }
if (delFrac[k] > 0.0) { if (delFrac[k] > 0.0) {
@ -763,7 +763,7 @@ double VCS_SOLVE::vcs_phaseStabilityTest(const size_t iph)
} }
damp = std::max(damp, 0.000001); damp = std::max(damp, 0.000001);
for (size_t k = 0; k < nsp; k++) { for (size_t k = 0; k < nsp; k++) {
fracDelta_new[k] = fracDelta_old[k] + damp * (delFrac[k]); fracDelta_new[k] = fracDelta_old[k] + damp * delFrac[k];
} }
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {

View file

@ -127,7 +127,7 @@ int VCS_SOLVE::vcs_report(int iconv)
plogf(" Inert Gas Species "); plogf(" Inert Gas Species ");
} else { } else {
plogf(" Inert Species in phase %16s ", plogf(" Inert Species in phase %16s ",
(m_VolPhaseList[i])->PhaseName.c_str()); m_VolPhaseList[i]->PhaseName.c_str());
} }
plogf("%14.7E %14.7E %12.4E\n", TPhInertMoles[i] * molScale, plogf("%14.7E %14.7E %12.4E\n", TPhInertMoles[i] * molScale,
TPhInertMoles[i] / m_tPhaseMoles_old[i], 0.0); TPhInertMoles[i] / m_tPhaseMoles_old[i], 0.0);
@ -207,7 +207,7 @@ int VCS_SOLVE::vcs_report(int iconv)
plogf(" | |\n"); plogf(" | |\n");
plogf(" | Element |"); plogf(" | Element |");
for (size_t j = 0; j < m_numElemConstraints; j++) { for (size_t j = 0; j < m_numElemConstraints; j++) {
plogf(" %10.10s", (m_elementName[j]).c_str()); plogf(" %10.10s", m_elementName[j].c_str());
} }
plogf(" | |\n"); plogf(" | |\n");
plogf(" PhaseName |KMolTarget |"); plogf(" PhaseName |KMolTarget |");
@ -268,7 +268,7 @@ int VCS_SOLVE::vcs_report(int iconv)
plogf(" Actual Target Type ElActive\n"); plogf(" Actual Target Type ElActive\n");
for (size_t i = 0; i < m_numElemConstraints; ++i) { for (size_t i = 0; i < m_numElemConstraints; ++i) {
writeline(' ', 26, false); writeline(' ', 26, false);
plogf("%-2.2s", (m_elementName[i]).c_str()); plogf("%-2.2s", m_elementName[i].c_str());
plogf("%20.12E %20.12E", m_elemAbundances[i]*molScale, m_elemAbundancesGoal[i]*molScale); plogf("%20.12E %20.12E", m_elemAbundances[i]*molScale, m_elemAbundancesGoal[i]*molScale);
plogf(" %3d %3d\n", m_elType[i], m_elementActive[i]); plogf(" %3d %3d\n", m_elType[i], m_elementActive[i]);
} }

View file

@ -406,7 +406,7 @@ int VCS_SOLVE::vcs_rxn_adj_cg()
} }
m_deltaMolNumSpecies[kspec] = 1.0e-10; m_deltaMolNumSpecies[kspec] = 1.0e-10;
m_speciesStatus[kspec] = VCS_SPECIES_MAJOR; m_speciesStatus[kspec] = VCS_SPECIES_MAJOR;
--(m_numRxnMinorZeroed); --m_numRxnMinorZeroed;
} else { } else {
if (DEBUG_MODE_ENABLED) { if (DEBUG_MODE_ENABLED) {
sprintf(ANOTE, "MultSpec: still dead DG = %11.3E", m_deltaGRxn_new[irxn]); sprintf(ANOTE, "MultSpec: still dead DG = %11.3E", m_deltaGRxn_new[irxn]);
@ -463,7 +463,7 @@ int VCS_SOLVE::vcs_rxn_adj_cg()
} }
} }
for (size_t j = 0; j < m_numPhases; j++) { for (size_t j = 0; j < m_numPhases; j++) {
if (!(m_VolPhaseList[j])->m_singleSpecies) { if (!m_VolPhaseList[j]->m_singleSpecies) {
if (m_tPhaseMoles_old[j] > 0.0) { if (m_tPhaseMoles_old[j] > 0.0) {
s -= pow(m_deltaMolNumPhase(j,irxn), 2) / m_tPhaseMoles_old[j]; s -= pow(m_deltaMolNumPhase(j,irxn), 2) / m_tPhaseMoles_old[j];
} }

View file

@ -688,7 +688,7 @@ int VCS_SOLVE::vcs_prob_specifyFully(const VCS_PROB* pub)
* Use the object's assignment operator * Use the object's assignment operator
*/ */
for (size_t iph = 0; iph < nph; iph++) { for (size_t iph = 0; iph < nph; iph++) {
*(m_VolPhaseList[iph]) = *(pub->VPhaseList[iph]); *m_VolPhaseList[iph] = *pub->VPhaseList[iph];
/* /*
* Fix up the species thermo pointer in the vcs_SpeciesThermo object * Fix up the species thermo pointer in the vcs_SpeciesThermo object
* It should point to the species thermo pointer in the private * It should point to the species thermo pointer in the private

View file

@ -125,7 +125,7 @@ int VCS_SOLVE::vcs_solve_TP(int print_lvl, int printDetails, int maxit)
plogf(" FROM ESTIMATE Type\n\n"); plogf(" FROM ESTIMATE Type\n\n");
for (size_t i = 0; i < m_numElemConstraints; ++i) { for (size_t i = 0; i < m_numElemConstraints; ++i) {
writeline(' ', 26, false); writeline(' ', 26, false);
plogf("%-2.2s", (m_elementName[i]).c_str()); plogf("%-2.2s", m_elementName[i].c_str());
plogf("%20.12E%20.12E %3d\n", m_elemAbundancesGoal[i], m_elemAbundances[i], plogf("%20.12E%20.12E %3d\n", m_elemAbundancesGoal[i], m_elemAbundances[i],
m_elType[i]); m_elType[i]);
} }
@ -357,7 +357,7 @@ int VCS_SOLVE::vcs_solve_TP(int print_lvl, int printDetails, int maxit)
double tsecond = ticktock.secondsWC(); double tsecond = ticktock.secondsWC();
m_VCount->Time_vcs_TP = tsecond; m_VCount->Time_vcs_TP = tsecond;
m_VCount->T_Time_vcs_TP += m_VCount->Time_vcs_TP; m_VCount->T_Time_vcs_TP += m_VCount->Time_vcs_TP;
(m_VCount->T_Calls_vcs_TP)++; m_VCount->T_Calls_vcs_TP++;
m_VCount->T_Its += m_VCount->Its; m_VCount->T_Its += m_VCount->Its;
m_VCount->T_Basis_Opts += m_VCount->Basis_Opts; m_VCount->T_Basis_Opts += m_VCount->Basis_Opts;
m_VCount->T_Time_basopt += m_VCount->Time_basopt; m_VCount->T_Time_basopt += m_VCount->Time_basopt;
@ -853,7 +853,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
* species is in a single species phase or in * species is in a single species phase or in
* a multispecies phase. * a multispecies phase.
*/ */
if (!(m_SSPhase[kspec])) { if (!m_SSPhase[kspec]) {
/* /*
* Section for multispecies phases: * Section for multispecies phases:
* - Cut reaction adjustment for positive kmoles of * - Cut reaction adjustment for positive kmoles of
@ -1151,7 +1151,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
l2normdg(&m_deltaGRxn_old[0]), l2normdg(&m_deltaGRxn_old[0]),
l2normdg(&m_deltaGRxn_new[0])); l2normdg(&m_deltaGRxn_new[0]));
plogf(" Total kmoles of gas = %15.7E\n", m_tPhaseMoles_old[0]); plogf(" Total kmoles of gas = %15.7E\n", m_tPhaseMoles_old[0]);
if ((m_numPhases > 1) && (!(m_VolPhaseList[1])->m_singleSpecies)) { if ((m_numPhases > 1) && (!m_VolPhaseList[1]->m_singleSpecies)) {
plogf(" Total kmoles of liquid = %15.7E\n", m_tPhaseMoles_old[1]); plogf(" Total kmoles of liquid = %15.7E\n", m_tPhaseMoles_old[1]);
} else { } else {
plogf(" Total kmoles of liquid = %15.7E\n", 0.0); plogf(" Total kmoles of liquid = %15.7E\n", 0.0);
@ -1259,7 +1259,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
/* /*
* Increment the iteration counters * Increment the iteration counters
*/ */
++(m_VCount->Its); ++m_VCount->Its;
++it1; ++it1;
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- Increment counter increased, step is accepted: %4d", plogf(" --- Increment counter increased, step is accepted: %4d",
@ -1346,14 +1346,14 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
doSwap = (m_molNumSpecies_old[l] * m_spSize[l]) > doSwap = (m_molNumSpecies_old[l] * m_spSize[l]) >
(m_molNumSpecies_old[j] * m_spSize[j] * 1.01); (m_molNumSpecies_old[j] * m_spSize[j] * 1.01);
if (!m_SSPhase[l] && doSwap) { if (!m_SSPhase[l] && doSwap) {
doSwap = (m_molNumSpecies_old[l]) > (m_molNumSpecies_old[j] * 1.01); doSwap = m_molNumSpecies_old[l] > (m_molNumSpecies_old[j] * 1.01);
} }
} else { } else {
if (m_SSPhase[l]) { if (m_SSPhase[l]) {
doSwap = (m_molNumSpecies_old[l] * m_spSize[l]) > doSwap = (m_molNumSpecies_old[l] * m_spSize[l]) >
(m_molNumSpecies_old[j] * m_spSize[j] * 1.01); (m_molNumSpecies_old[j] * m_spSize[j] * 1.01);
if (!doSwap) { if (!doSwap) {
doSwap = (m_molNumSpecies_old[l]) > (m_molNumSpecies_old[j] * 1.01); doSwap = m_molNumSpecies_old[l] > (m_molNumSpecies_old[j] * 1.01);
} }
} else { } else {
doSwap = (m_molNumSpecies_old[l] * m_spSize[l]) > doSwap = (m_molNumSpecies_old[l] * m_spSize[l]) >
@ -1702,7 +1702,7 @@ double VCS_SOLVE::vcs_minor_alt_calc(size_t kspec, size_t irxn, bool* do_delete,
/* /*
* get the diagonal of the activity coefficient Jacobian * get the diagonal of the activity coefficient Jacobian
*/ */
s = m_np_dLnActCoeffdMolNum(kspec,kspec) / (m_tPhaseMoles_old[iph]); s = m_np_dLnActCoeffdMolNum(kspec,kspec) / m_tPhaseMoles_old[iph];
/* /*
* We fit it to a power law approximation of the activity coefficient * We fit it to a power law approximation of the activity coefficient
* *
@ -1831,7 +1831,7 @@ int VCS_SOLVE::vcs_zero_species(const size_t kspec)
* Calculate a delta that will eliminate the species. * Calculate a delta that will eliminate the species.
*/ */
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
double dx = -(m_molNumSpecies_old[kspec]); double dx = -m_molNumSpecies_old[kspec];
if (dx != 0.0) { if (dx != 0.0) {
retn = delta_species(kspec, &dx); retn = delta_species(kspec, &dx);
if (DEBUG_MODE_ENABLED && !retn && m_debug_print_lvl >= 1) { if (DEBUG_MODE_ENABLED && !retn && m_debug_print_lvl >= 1) {
@ -1865,7 +1865,7 @@ int VCS_SOLVE::vcs_delete_species(const size_t kspec)
* a minor species * a minor species
*/ */
if (m_speciesStatus[kspec] != VCS_SPECIES_MAJOR) { if (m_speciesStatus[kspec] != VCS_SPECIES_MAJOR) {
--(m_numRxnMinorZeroed); --m_numRxnMinorZeroed;
} }
m_speciesStatus[kspec] = VCS_SPECIES_DELETED; m_speciesStatus[kspec] = VCS_SPECIES_DELETED;
m_deltaGRxn_new[irxn] = 0.0; m_deltaGRxn_new[irxn] = 0.0;
@ -1889,8 +1889,8 @@ int VCS_SOLVE::vcs_delete_species(const size_t kspec)
/* /*
* Adjust the current number of active species and reactions counters * Adjust the current number of active species and reactions counters
*/ */
--(m_numRxnRdc); --m_numRxnRdc;
--(m_numSpeciesRdc); --m_numSpeciesRdc;
/* /*
* Check to see whether we have just annihilated a multispecies phase. * Check to see whether we have just annihilated a multispecies phase.
@ -1938,7 +1938,7 @@ void VCS_SOLVE::vcs_reinsert_deleted(size_t kspec)
if (m_SSPhase[kspec]) { if (m_SSPhase[kspec]) {
m_speciesStatus[kspec] = VCS_SPECIES_MAJOR; m_speciesStatus[kspec] = VCS_SPECIES_MAJOR;
--(m_numRxnMinorZeroed); --m_numRxnMinorZeroed;
} }
vcs_VolPhase* Vphase = m_VolPhaseList[iph]; vcs_VolPhase* Vphase = m_VolPhaseList[iph];
@ -1969,9 +1969,9 @@ void VCS_SOLVE::vcs_reinsert_deleted(size_t kspec)
Vphase->setExistence(VCS_PHASE_EXIST_YES); Vphase->setExistence(VCS_PHASE_EXIST_YES);
} }
++(m_numRxnRdc); ++m_numRxnRdc;
++(m_numSpeciesRdc); ++m_numSpeciesRdc;
++(m_numRxnMinorZeroed); ++m_numRxnMinorZeroed;
if (kspec != (m_numSpeciesRdc - 1)) { if (kspec != (m_numSpeciesRdc - 1)) {
/* /*
@ -2002,7 +2002,7 @@ bool VCS_SOLVE::vcs_delete_multiphase(const size_t iph)
/* /*
* calculate an extent of rxn, dx, that zeroes out the species. * calculate an extent of rxn, dx, that zeroes out the species.
*/ */
double dx = - (m_molNumSpecies_old[kspec]); double dx = - m_molNumSpecies_old[kspec];
double dxTent = dx; double dxTent = dx;
int retn = delta_species(kspec, &dxTent); int retn = delta_species(kspec, &dxTent);
@ -2104,8 +2104,8 @@ bool VCS_SOLVE::vcs_delete_multiphase(const size_t iph)
m_deltaMolNumSpecies[kspec] = 0.0; m_deltaMolNumSpecies[kspec] = 0.0;
m_speciesStatus[kspec] = VCS_SPECIES_ZEROEDMS; m_speciesStatus[kspec] = VCS_SPECIES_ZEROEDMS;
++(m_numRxnRdc); ++m_numRxnRdc;
++(m_numSpeciesRdc); ++m_numSpeciesRdc;
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- Make %s", m_speciesName[kspec].c_str()); plogf(" --- Make %s", m_speciesName[kspec].c_str());
plogf(" an active but zeroed species because its phase " plogf(" an active but zeroed species because its phase "
@ -2739,7 +2739,7 @@ int VCS_SOLVE::vcs_basopt(const bool doJustComponents, double aw[], double sa[],
/* ****************************************** */ /* ****************************************** */
if (jr != k) { if (jr != k) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %-12.12s", (m_speciesName[k]).c_str()); plogf(" --- %-12.12s", m_speciesName[k].c_str());
if (m_speciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { if (m_speciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
plogf("(Volts = %9.2g)", m_molNumSpecies_old[k]); plogf("(Volts = %9.2g)", m_molNumSpecies_old[k]);
} else { } else {
@ -2841,8 +2841,8 @@ L_END_LOOP:
juse = npos; juse = npos;
jlose = npos; jlose = npos;
for (size_t j = 0; j < m_numElemConstraints; j++) { for (size_t j = 0; j < m_numElemConstraints; j++) {
if (!(m_elementActive[j])) { if (!m_elementActive[j]) {
if (!strcmp((m_elementName[j]).c_str(), "E")) { if (!strcmp(m_elementName[j].c_str(), "E")) {
juse = j; juse = j;
} }
} }
@ -3025,7 +3025,7 @@ L_CLEANUP:
; ;
double tsecond = tickTock.secondsWC(); double tsecond = tickTock.secondsWC();
m_VCount->Time_basopt += tsecond; m_VCount->Time_basopt += tsecond;
(m_VCount->Basis_Opts)++; m_VCount->Basis_Opts++;
return VCS_SUCCESS; return VCS_SUCCESS;
} }
@ -3060,20 +3060,20 @@ size_t VCS_SOLVE::vcs_basisOptMax(const double* const molNum, const size_t j,
} }
bool doSwap = false; bool doSwap = false;
if (m_SSPhase[j]) { if (m_SSPhase[j]) {
doSwap = (molNum[i] * m_spSize[i]) > (big); doSwap = (molNum[i] * m_spSize[i]) > big;
if (!m_SSPhase[i]) { if (!m_SSPhase[i]) {
if (doSwap) { if (doSwap) {
doSwap = (molNum[i]) > (molNum[largest] * 1.001); doSwap = molNum[i] > (molNum[largest] * 1.001);
} }
} }
} else { } else {
if (m_SSPhase[i]) { if (m_SSPhase[i]) {
doSwap = (molNum[i] * m_spSize[i]) > (big); doSwap = (molNum[i] * m_spSize[i]) > big;
if (!doSwap) { if (!doSwap) {
doSwap = (molNum[i]) > (molNum[largest] * 1.001); doSwap = molNum[i] > (molNum[largest] * 1.001);
} }
} else { } else {
doSwap = (molNum[i] * m_spSize[i]) > (big); doSwap = (molNum[i] * m_spSize[i]) > big;
} }
} }
if (doSwap) { if (doSwap) {
@ -3124,7 +3124,7 @@ int VCS_SOLVE::vcs_species_type(const size_t kspec) const
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %s can not be nonzero because" plogf(" --- %s can not be nonzero because"
" needed element %s is zero\n", " needed element %s is zero\n",
m_speciesName[kspec].c_str(), (m_elementName[j]).c_str()); m_speciesName[kspec].c_str(), m_elementName[j].c_str());
} }
if (m_SSPhase[kspec]) { if (m_SSPhase[kspec]) {
return VCS_SPECIES_ZEROEDSS; return VCS_SPECIES_ZEROEDSS;
@ -3265,7 +3265,7 @@ int VCS_SOLVE::vcs_species_type(const size_t kspec) const
} else { } else {
double szAdj = m_scSize[irxn] * std::sqrt((double)m_numRxnTot); double szAdj = m_scSize[irxn] * std::sqrt((double)m_numRxnTot);
for (size_t k = 0; k < m_numComponents; ++k) { for (size_t k = 0; k < m_numComponents; ++k) {
if (!(m_SSPhase[k])) { if (!m_SSPhase[k]) {
if (m_stoichCoeffRxnMatrix(k,irxn) != 0.0) { if (m_stoichCoeffRxnMatrix(k,irxn) != 0.0) {
if (m_molNumSpecies_old[kspec] * szAdj >= m_molNumSpecies_old[k] * 0.01) { if (m_molNumSpecies_old[kspec] * szAdj >= m_molNumSpecies_old[k] * 0.01) {
return VCS_SPECIES_MAJOR; return VCS_SPECIES_MAJOR;
@ -3659,7 +3659,7 @@ void VCS_SOLVE::prneav() const
plogf(" Element Now Orignal Deviation Type\n"); plogf(" Element Now Orignal Deviation Type\n");
for (size_t j = 0; j < m_numElemConstraints; ++j) { for (size_t j = 0; j < m_numElemConstraints; ++j) {
plogf(" "); plogf(" ");
plogf("%-2.2s", (m_elementName[j]).c_str()); plogf("%-2.2s", m_elementName[j].c_str());
plogf(" = %15.6E %15.6E %15.6E %3d\n", plogf(" = %15.6E %15.6E %15.6E %3d\n",
eav[j], m_elemAbundancesGoal[j], eav[j] - m_elemAbundancesGoal[j], m_elType[j]); eav[j], m_elemAbundancesGoal[j], eav[j] - m_elemAbundancesGoal[j], m_elType[j]);
if (m_elemAbundancesGoal[j] != 0.) { if (m_elemAbundancesGoal[j] != 0.) {

View file

@ -57,7 +57,7 @@ solveSP::solveSP(ImplicitSurfChem* surfChemPtr, int bulkFunc) :
throw CanteraError("solveSP", throw CanteraError("solveSP",
"InterfaceKinetics object has no surface phase"); "InterfaceKinetics object has no surface phase");
} }
ThermoPhase* tp = &(m_kin->thermo(surfPhaseIndex)); ThermoPhase* tp = &m_kin->thermo(surfPhaseIndex);
SurfPhase* sp = dynamic_cast<SurfPhase*>(tp); SurfPhase* sp = dynamic_cast<SurfPhase*>(tp);
if (!sp) { if (!sp) {
throw CanteraError("solveSP", throw CanteraError("solveSP",

View file

@ -43,7 +43,7 @@ BandMatrix::BandMatrix(size_t n, size_t kl, size_t ku, doublereal v) :
m_colPtrs.resize(n); m_colPtrs.resize(n);
size_t ldab = (2*kl + ku + 1); size_t ldab = (2*kl + ku + 1);
for (size_t j = 0; j < n; j++) { for (size_t j = 0; j < n; j++) {
m_colPtrs[j] = &(data[ldab * j]); m_colPtrs[j] = &data[ldab * j];
} }
} }
@ -63,7 +63,7 @@ BandMatrix::BandMatrix(const BandMatrix& y) :
m_colPtrs.resize(m_n); m_colPtrs.resize(m_n);
size_t ldab = (2 *m_kl + m_ku + 1); size_t ldab = (2 *m_kl + m_ku + 1);
for (size_t j = 0; j < m_n; j++) { for (size_t j = 0; j < m_n; j++) {
m_colPtrs[j] = &(data[ldab * j]); m_colPtrs[j] = &data[ldab * j];
} }
} }
@ -82,7 +82,7 @@ BandMatrix& BandMatrix::operator=(const BandMatrix& y)
m_colPtrs.resize(m_n); m_colPtrs.resize(m_n);
size_t ldab = (2 * m_kl + m_ku + 1); size_t ldab = (2 * m_kl + m_ku + 1);
for (size_t j = 0; j < m_n; j++) { for (size_t j = 0; j < m_n; j++) {
m_colPtrs[j] = &(data[ldab * j]); m_colPtrs[j] = &data[ldab * j];
} }
return *this; return *this;
} }
@ -99,7 +99,7 @@ void BandMatrix::resize(size_t n, size_t kl, size_t ku, doublereal v)
m_colPtrs.resize(m_n); m_colPtrs.resize(m_n);
size_t ldab = (2 * m_kl + m_ku + 1); size_t ldab = (2 * m_kl + m_ku + 1);
for (size_t j = 0; j < n; j++) { for (size_t j = 0; j < n; j++) {
m_colPtrs[j] = &(data[ldab * j]); m_colPtrs[j] = &data[ldab * j];
} }
m_factored = false; m_factored = false;
} }
@ -420,7 +420,7 @@ doublereal* BandMatrix::ptrColumn(size_t j)
doublereal* const* BandMatrix::colPts() doublereal* const* BandMatrix::colPts()
{ {
return &(m_colPtrs[0]); return &m_colPtrs[0];
} }
} }

View file

@ -26,7 +26,7 @@ DenseMatrix::DenseMatrix(size_t n, size_t m, doublereal v) :
m_colPts.resize(m); m_colPts.resize(m);
if (!m_data.empty()) { if (!m_data.empty()) {
for (size_t j = 0; j < m; j++) { for (size_t j = 0; j < m; j++) {
m_colPts[j] = &(m_data[m_nrows*j]); m_colPts[j] = &m_data[m_nrows*j];
} }
} }
} }
@ -40,7 +40,7 @@ DenseMatrix::DenseMatrix(const DenseMatrix& y) :
m_colPts.resize(m_ncols); m_colPts.resize(m_ncols);
if (!m_data.empty()) { if (!m_data.empty()) {
for (size_t j = 0; j < m_ncols; j++) { for (size_t j = 0; j < m_ncols; j++) {
m_colPts[j] = &(m_data[m_nrows*j]); m_colPts[j] = &m_data[m_nrows*j];
} }
} }
} }
@ -54,7 +54,7 @@ DenseMatrix& DenseMatrix::operator=(const DenseMatrix& y)
m_ipiv = y.ipiv(); m_ipiv = y.ipiv();
m_colPts.resize(m_ncols); m_colPts.resize(m_ncols);
for (size_t j = 0; j < m_ncols; j++) { for (size_t j = 0; j < m_ncols; j++) {
m_colPts[j] = &(m_data[m_nrows*j]); m_colPts[j] = &m_data[m_nrows*j];
} }
m_useReturnErrorCode = y.m_useReturnErrorCode; m_useReturnErrorCode = y.m_useReturnErrorCode;
m_printLevel = y.m_printLevel; m_printLevel = y.m_printLevel;
@ -68,19 +68,19 @@ void DenseMatrix::resize(size_t n, size_t m, doublereal v)
m_colPts.resize(m_ncols); m_colPts.resize(m_ncols);
if (!m_data.empty()) { if (!m_data.empty()) {
for (size_t j = 0; j < m_ncols; j++) { for (size_t j = 0; j < m_ncols; j++) {
m_colPts[j] = &(m_data[m_nrows*j]); m_colPts[j] = &m_data[m_nrows*j];
} }
} }
} }
doublereal* const* DenseMatrix::colPts() doublereal* const* DenseMatrix::colPts()
{ {
return &(m_colPts[0]); return &m_colPts[0];
} }
const doublereal* const* DenseMatrix::const_colPts() const const doublereal* const* DenseMatrix::const_colPts() const
{ {
return &(m_colPts[0]); return &m_colPts[0];
} }
void DenseMatrix::mult(const double* b, double* prod) const void DenseMatrix::mult(const double* b, double* prod) const

View file

@ -67,7 +67,7 @@ Func1& Func1::derivative() const
bool Func1::isIdentical(Func1& other) const bool Func1::isIdentical(Func1& other) const
{ {
if ((ID() != other.ID()) || (m_c != other.m_c)) { if (ID() != other.ID() || m_c != other.m_c) {
return false; return false;
} }
if (m_f1) { if (m_f1) {

View file

@ -76,7 +76,7 @@ int SquareMatrix::solve(doublereal* b, size_t nrhs, size_t ldb)
* Solve the factored system * Solve the factored system
*/ */
ct_dgetrs(ctlapack::NoTranspose, static_cast<int>(nRows()), ct_dgetrs(ctlapack::NoTranspose, static_cast<int>(nRows()),
nrhs, &(*(begin())), static_cast<int>(nRows()), nrhs, &*begin(), static_cast<int>(nRows()),
DATA_PTR(ipiv()), b, ldb, info); DATA_PTR(ipiv()), b, ldb, info);
if (info != 0) { if (info != 0) {
if (m_printLevel) { if (m_printLevel) {
@ -128,11 +128,11 @@ int SquareMatrix::factor()
if (useQR_) { if (useQR_) {
return factorQR(); return factorQR();
} }
a1norm_ = ct_dlange('1', m_nrows, m_nrows, &(*(begin())), m_nrows, 0); a1norm_ = ct_dlange('1', m_nrows, m_nrows, &*begin(), m_nrows, 0);
integer n = static_cast<int>(nRows()); integer n = static_cast<int>(nRows());
int info=0; int info=0;
m_factored = 1; m_factored = 1;
ct_dgetrf(n, n, &(*(begin())), static_cast<int>(nRows()), DATA_PTR(ipiv()), info); ct_dgetrf(n, n, &*begin(), static_cast<int>(nRows()), DATA_PTR(ipiv()), info);
if (info != 0) { if (info != 0) {
if (m_printLevel) { if (m_printLevel) {
writelogf("SquareMatrix::factor(): DGETRS returned INFO = %d\n", info); writelogf("SquareMatrix::factor(): DGETRS returned INFO = %d\n", info);
@ -155,11 +155,11 @@ int SquareMatrix::factorQR()
tau.resize(m_nrows, 0.0); tau.resize(m_nrows, 0.0);
work.resize(8 * m_nrows, 0.0); work.resize(8 * m_nrows, 0.0);
} }
a1norm_ = ct_dlange('1', m_nrows, m_nrows, &(*(begin())), m_nrows, DATA_PTR(work)); a1norm_ = ct_dlange('1', m_nrows, m_nrows, &*begin(), m_nrows, DATA_PTR(work));
int info = 0; int info = 0;
m_factored = 2; m_factored = 2;
size_t lwork = work.size(); size_t lwork = work.size();
ct_dgeqrf(m_nrows, m_nrows, &(*(begin())), m_nrows, DATA_PTR(tau), DATA_PTR(work), lwork, info); ct_dgeqrf(m_nrows, m_nrows, &*begin(), m_nrows, DATA_PTR(tau), DATA_PTR(work), lwork, info);
if (info != 0) { if (info != 0) {
if (m_printLevel) { if (m_printLevel) {
writelogf("SquareMatrix::factorQR(): DGEQRF returned INFO = %d\n", info); writelogf("SquareMatrix::factorQR(): DGEQRF returned INFO = %d\n", info);
@ -199,7 +199,7 @@ int SquareMatrix::solveQR(doublereal* b)
/* /*
* Solve the factored system * Solve the factored system
*/ */
ct_dormqr(ctlapack::Left, ctlapack::Transpose, m_nrows, 1, m_nrows, &(*(begin())), m_nrows, DATA_PTR(tau), b, m_nrows, ct_dormqr(ctlapack::Left, ctlapack::Transpose, m_nrows, 1, m_nrows, &*begin(), m_nrows, DATA_PTR(tau), b, m_nrows,
DATA_PTR(work), lwork, info); DATA_PTR(work), lwork, info);
if (info != 0) { if (info != 0) {
if (m_printLevel) { if (m_printLevel) {
@ -216,7 +216,7 @@ int SquareMatrix::solveQR(doublereal* b)
char dd = 'N'; char dd = 'N';
ct_dtrtrs(ctlapack::UpperTriangular, ctlapack::NoTranspose, &dd, m_nrows, 1, &(*(begin())), m_nrows, b, ct_dtrtrs(ctlapack::UpperTriangular, ctlapack::NoTranspose, &dd, m_nrows, 1, &*begin(), m_nrows, b,
m_nrows, info); m_nrows, info);
if (info != 0) { if (info != 0) {
if (m_printLevel) { if (m_printLevel) {
@ -245,7 +245,7 @@ doublereal SquareMatrix::rcond(doublereal anorm)
} }
int rinfo = 0; int rinfo = 0;
rcond = ct_dgecon('1', m_nrows, &(*(begin())), m_nrows, anorm, DATA_PTR(work), rcond = ct_dgecon('1', m_nrows, &*begin(), m_nrows, anorm, DATA_PTR(work),
DATA_PTR(iwork_), rinfo); DATA_PTR(iwork_), rinfo);
if (rinfo != 0) { if (rinfo != 0) {
if (m_printLevel) { if (m_printLevel) {
@ -278,7 +278,7 @@ doublereal SquareMatrix::rcondQR()
} }
int rinfo = 0; int rinfo = 0;
rcond = ct_dtrcon(0, ctlapack::UpperTriangular, 0, m_nrows, &(*(begin())), m_nrows, DATA_PTR(work), rcond = ct_dtrcon(0, ctlapack::UpperTriangular, 0, m_nrows, &*begin(), m_nrows, DATA_PTR(work),
DATA_PTR(iwork_), rinfo); DATA_PTR(iwork_), rinfo);
if (rinfo != 0) { if (rinfo != 0) {
if (m_printLevel) { if (m_printLevel) {

View file

@ -216,7 +216,7 @@ void Inlet1D::eval(size_t jg, doublereal* xg, doublereal* rg,
rb[2] -= x[1]; // T rb[2] -= x[1]; // T
rb[0] += x[0]; // u rb[0] += x[0]; // u
for (size_t k = 1; k < m_nsp; k++) { for (size_t k = 1; k < m_nsp; k++) {
rb[4+k] += x[0]*(m_yin[k]); rb[4+k] += x[0]*m_yin[k];
} }
} }
} }

View file

@ -1644,7 +1644,7 @@ void HMWSoln::calcIMSCutoffParams_()
(IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_)); (IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_));
double tmp = IMS_afCut_ + IMS_X_o_cutoff_*(IMS_bfCut_ + IMS_dfCut_ *IMS_X_o_cutoff_); double tmp = IMS_afCut_ + IMS_X_o_cutoff_*(IMS_bfCut_ + IMS_dfCut_ *IMS_X_o_cutoff_);
double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_); double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_);
IMS_efCut_ = - eterm * (tmp); IMS_efCut_ = - eterm * tmp;
if (fabs(IMS_efCut_ - oldV) < 1.0E-14) { if (fabs(IMS_efCut_ - oldV) < 1.0E-14) {
converged = true; converged = true;
} }
@ -1667,7 +1667,7 @@ void HMWSoln::calcIMSCutoffParams_()
(IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_)); (IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_));
double tmp = IMS_agCut_ + IMS_X_o_cutoff_*(IMS_bgCut_ + IMS_dgCut_ *IMS_X_o_cutoff_); double tmp = IMS_agCut_ + IMS_X_o_cutoff_*(IMS_bgCut_ + IMS_dgCut_ *IMS_X_o_cutoff_);
double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_); double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_);
IMS_egCut_ = - eterm * (tmp); IMS_egCut_ = - eterm * tmp;
if (fabs(IMS_egCut_ - oldV) < 1.0E-14) { if (fabs(IMS_egCut_ - oldV) < 1.0E-14) {
converged = true; converged = true;
} }
@ -1702,7 +1702,7 @@ void HMWSoln::calcMCCutoffParams_()
MC_dpCut_ = damp * MC_dpCutNew + (1-damp) * MC_dpCut_; MC_dpCut_ = damp * MC_dpCutNew + (1-damp) * MC_dpCut_;
double tmp = MC_apCut_ + MC_X_o_cutoff_*(MC_bpCut_ + MC_dpCut_ * MC_X_o_cutoff_); double tmp = MC_apCut_ + MC_X_o_cutoff_*(MC_bpCut_ + MC_dpCut_ * MC_X_o_cutoff_);
double eterm = std::exp(- MC_X_o_cutoff_ / MC_cpCut_); double eterm = std::exp(- MC_X_o_cutoff_ / MC_cpCut_);
MC_epCut_ = - eterm * (tmp); MC_epCut_ = - eterm * tmp;
double diff = MC_epCut_ - oldV; double diff = MC_epCut_ - oldV;
if (fabs(diff) < 1.0E-14) { if (fabs(diff) < 1.0E-14) {
converged = true; converged = true;

View file

@ -113,7 +113,7 @@ void IdealGasPhase::getChemPotentials(doublereal* mu) const
doublereal rt = temperature() * GasConstant; doublereal rt = temperature() * GasConstant;
for (size_t k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
double xx = std::max(SmallNumber, moleFraction(k)); double xx = std::max(SmallNumber, moleFraction(k));
mu[k] += rt * (log(xx)); mu[k] += rt * log(xx);
} }
} }

View file

@ -1274,7 +1274,7 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN()", "dynamic cast failed"); throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN()", "dynamic cast failed");
} }
size_t nsp_ge = geThermo->nSpecies(); size_t nsp_ge = geThermo->nSpecies();
geThermo->getdlnActCoeffdlnN(nsp_ge, &(dlnActCoeffdlnN_NeutralMolecule_(0,0))); geThermo->getdlnActCoeffdlnN(nsp_ge, &dlnActCoeffdlnN_NeutralMolecule_(0,0));
switch (ionSolnType_) { switch (ionSolnType_) {
case cIonSolnType_PASSTHROUGH: case cIonSolnType_PASSTHROUGH:

View file

@ -69,13 +69,13 @@ doublereal LatticeSolidPhase::minTemp(size_t k) const
if (k != npos) { if (k != npos) {
for (size_t n = 0; n < m_nlattice; n++) { for (size_t n = 0; n < m_nlattice; n++) {
if (lkstart_[n+1] < k) { if (lkstart_[n+1] < k) {
return (m_lattice[n])->minTemp(k-lkstart_[n]); return m_lattice[n]->minTemp(k-lkstart_[n]);
} }
} }
} }
doublereal mm = 1.0E300; doublereal mm = 1.0E300;
for (size_t n = 0; n < m_nlattice; n++) { for (size_t n = 0; n < m_nlattice; n++) {
double ml = (m_lattice[n])->minTemp(); double ml = m_lattice[n]->minTemp();
mm = std::min(mm, ml); mm = std::min(mm, ml);
} }
return mm; return mm;
@ -92,7 +92,7 @@ doublereal LatticeSolidPhase::maxTemp(size_t k) const
} }
doublereal mm = -1.0E300; doublereal mm = -1.0E300;
for (size_t n = 0; n < m_nlattice; n++) { for (size_t n = 0; n < m_nlattice; n++) {
double ml = (m_lattice[n])->maxTemp(); double ml = m_lattice[n]->maxTemp();
mm = std::max(mm, ml); mm = std::max(mm, ml);
} }
return mm; return mm;
@ -233,7 +233,7 @@ void LatticeSolidPhase::getMoleFractions(doublereal* const x) const
* get the same answer. * get the same answer.
*/ */
if (DEBUG_MODE_ENABLED) { if (DEBUG_MODE_ENABLED) {
m_lattice[n]->getMoleFractions(&(m_x[strt])); m_lattice[n]->getMoleFractions(&m_x[strt]);
for (size_t k = 0; k < nsp; k++) { for (size_t k = 0; k < nsp; k++) {
if (fabs((x + strt)[k] - m_x[strt+k]) > 1.0E-14) { if (fabs((x + strt)[k] - m_x[strt+k]) > 1.0E-14) {
throw CanteraError("LatticeSolidPhase::getMoleFractions()", throw CanteraError("LatticeSolidPhase::getMoleFractions()",
@ -440,7 +440,7 @@ void LatticeSolidPhase::setParametersFromXML(const XML_Node& eosdata)
double val = fpValueCheck(pval[i]); double val = fpValueCheck(pval[i]);
bool found = false; bool found = false;
for (size_t j = 0; j < m_nlattice; j++) { for (size_t j = 0; j < m_nlattice; j++) {
ThermoPhase& tp = *(m_lattice[j]); ThermoPhase& tp = *m_lattice[j];
string idj = tp.id(); string idj = tp.id();
if (idj == pnam[i]) { if (idj == pnam[i]) {
theta_[j] = val; theta_[j] = val;

View file

@ -374,7 +374,7 @@ void MargulesVPSSTP::s_update_lnActCoeff() const
void MargulesVPSSTP::s_update_dlnActCoeff_dT() const void MargulesVPSSTP::s_update_dlnActCoeff_dT() const
{ {
doublereal invT = 1.0 / temperature(); doublereal invT = 1.0 / temperature();
doublereal invRTT = 1.0 / (GasConstant)*invT*invT; doublereal invRTT = 1.0 / GasConstant*invT*invT;
dlnActCoeffdT_Scaled_.assign(m_kk, 0.0); dlnActCoeffdT_Scaled_.assign(m_kk, 0.0);
d2lnActCoeffdT2_Scaled_.assign(m_kk, 0.0); d2lnActCoeffdT2_Scaled_.assign(m_kk, 0.0);
for (size_t i = 0; i < numBinaryInteractions_; i++) { for (size_t i = 0; i < numBinaryInteractions_; i++) {

View file

@ -717,7 +717,7 @@ int MixtureFugacityTP::phaseState(bool checkState) const
double pp = psatEst(tmid); double pp = psatEst(tmid);
double mmw = meanMolecularWeight(); double mmw = meanMolecularWeight();
double molVolLiqTmid = liquidVolEst(tmid, pp); double molVolLiqTmid = liquidVolEst(tmid, pp);
double molVolGasTmid = GasConstant * tmid / (pp); double molVolGasTmid = GasConstant * tmid / pp;
double densLiqTmid = mmw / molVolLiqTmid; double densLiqTmid = mmw / molVolLiqTmid;
double densGasTmid = mmw / molVolGasTmid; double densGasTmid = mmw / molVolGasTmid;
double densMidTmid = 0.5 * (densLiqTmid + densGasTmid); double densMidTmid = 0.5 * (densLiqTmid + densGasTmid);

View file

@ -64,7 +64,7 @@ PDSS::PDSS(VPStandardStateTP* tp, size_t spindex) :
m_Vss_ptr(0) m_Vss_ptr(0)
{ {
if (tp) { if (tp) {
m_spthermo = &(tp->speciesThermo()); m_spthermo = &tp->speciesThermo();
} }
if (tp) { if (tp) {
m_vpssmgr_ptr = tp->provideVPSSMgr(); m_vpssmgr_ptr = tp->provideVPSSMgr();
@ -191,17 +191,17 @@ void PDSS::initAllPtrs(VPStandardStateTP* tp, VPSSMgr* vpssmgr_ptr,
void PDSS::initPtrs() void PDSS::initPtrs()
{ {
AssertThrow(m_vpssmgr_ptr->mPDSS_h0_RT.size() != 0, "PDSS::initPtrs()"); AssertThrow(m_vpssmgr_ptr->mPDSS_h0_RT.size() != 0, "PDSS::initPtrs()");
m_h0_RT_ptr = &(m_vpssmgr_ptr->mPDSS_h0_RT[0]); m_h0_RT_ptr = &m_vpssmgr_ptr->mPDSS_h0_RT[0];
m_cp0_R_ptr = &(m_vpssmgr_ptr->mPDSS_cp0_R[0]); m_cp0_R_ptr = &m_vpssmgr_ptr->mPDSS_cp0_R[0];
m_s0_R_ptr = &(m_vpssmgr_ptr->mPDSS_s0_R[0]); m_s0_R_ptr = &m_vpssmgr_ptr->mPDSS_s0_R[0];
m_g0_RT_ptr = &(m_vpssmgr_ptr->mPDSS_g0_RT[0]); m_g0_RT_ptr = &m_vpssmgr_ptr->mPDSS_g0_RT[0];
m_V0_ptr = &(m_vpssmgr_ptr->mPDSS_V0[0]); m_V0_ptr = &m_vpssmgr_ptr->mPDSS_V0[0];
m_hss_RT_ptr = &(m_vpssmgr_ptr->mPDSS_hss_RT[0]); m_hss_RT_ptr = &m_vpssmgr_ptr->mPDSS_hss_RT[0];
m_cpss_R_ptr = &(m_vpssmgr_ptr->mPDSS_cpss_R[0]); m_cpss_R_ptr = &m_vpssmgr_ptr->mPDSS_cpss_R[0];
m_sss_R_ptr = &(m_vpssmgr_ptr->mPDSS_sss_R[0]); m_sss_R_ptr = &m_vpssmgr_ptr->mPDSS_sss_R[0];
m_gss_RT_ptr = &(m_vpssmgr_ptr->mPDSS_gss_RT[0]); m_gss_RT_ptr = &m_vpssmgr_ptr->mPDSS_gss_RT[0];
m_Vss_ptr = &(m_vpssmgr_ptr->mPDSS_Vss[0]); m_Vss_ptr = &m_vpssmgr_ptr->mPDSS_Vss[0];
} }
doublereal PDSS::enthalpy_mole() const doublereal PDSS::enthalpy_mole() const

View file

@ -121,7 +121,7 @@ void PDSS_ConstVol::constructPDSSFile(VPStandardStateTP* tp, size_t spindex,
XML_Node& speciesList = fxml_phase->child("speciesArray"); XML_Node& speciesList = fxml_phase->child("speciesArray");
XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"], XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"],
&(fxml_phase->root())); &fxml_phase->root());
const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex)); const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex));
constructPDSSXML(tp, spindex, *s, *fxml_phase, true); constructPDSSXML(tp, spindex, *s, *fxml_phase, true);

View file

@ -690,7 +690,7 @@ void PDSS_HKFT::constructPDSSFile(VPStandardStateTP* tp, size_t spindex,
XML_Node& speciesList = fxml_phase->child("speciesArray"); XML_Node& speciesList = fxml_phase->child("speciesArray");
XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"], XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"],
&(fxml_phase->root())); &fxml_phase->root());
const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex)); const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex));
constructPDSSXML(tp, spindex, *s, *fxml_phase, true); constructPDSSXML(tp, spindex, *s, *fxml_phase, true);

View file

@ -192,7 +192,7 @@ void PDSS_IonsFromNeutral::constructPDSSFile(VPStandardStateTP* tp, size_t spind
XML_Node& speciesList = fxml_phase->child("speciesArray"); XML_Node& speciesList = fxml_phase->child("speciesArray");
XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"], XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"],
&(fxml_phase->root())); &fxml_phase->root());
const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex)); const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex));
constructPDSSXML(tp, spindex, *s, *fxml_phase, id); constructPDSSXML(tp, spindex, *s, *fxml_phase, id);

View file

@ -150,7 +150,7 @@ void PDSS_SSVol::constructPDSSFile(VPStandardStateTP* tp, size_t spindex,
XML_Node& speciesList = fxml_phase->child("speciesArray"); XML_Node& speciesList = fxml_phase->child("speciesArray");
XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"], XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"],
&(fxml_phase->root())); &fxml_phase->root());
const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex)); const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex));
constructPDSSXML(tp, spindex, *s, *fxml_phase, true); constructPDSSXML(tp, spindex, *s, *fxml_phase, true);
@ -262,7 +262,7 @@ void PDSS_SSVol::calcMolarVolume() const
doublereal dens2 = dens * dens; doublereal dens2 = dens * dens;
doublereal ddensdT = TCoeff_[1] + 2.0 * m_temp * TCoeff_[2] + 3.0 * m_temp * m_temp * TCoeff_[3]; doublereal ddensdT = TCoeff_[1] + 2.0 * m_temp * TCoeff_[2] + 3.0 * m_temp * m_temp * TCoeff_[3];
doublereal d2densdT2 = 2.0 * TCoeff_[2] + 6.0 * m_temp * TCoeff_[3]; doublereal d2densdT2 = 2.0 * TCoeff_[2] + 6.0 * m_temp * TCoeff_[3];
dVdT_ = - m_mw / (dens2) * (ddensdT); dVdT_ = - m_mw / dens2 * ddensdT;
d2VdT2_ = 2.0 * m_mw / (dens2 * dens) * ddensdT * ddensdT - m_mw / dens2 * d2densdT2; d2VdT2_ = 2.0 * m_mw / (dens2 * dens) * ddensdT * ddensdT - m_mw / dens2 * d2densdT2;
} else { } else {
throw CanteraError("PDSS_SSVol::calcMolarVolume", "unimplemented"); throw CanteraError("PDSS_SSVol::calcMolarVolume", "unimplemented");
@ -280,8 +280,8 @@ void PDSS_SSVol::setPressure(doublereal p)
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex]; m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex];
} else { } else {
doublereal del_pRT = deltaP / (GasConstant * m_temp); doublereal del_pRT = deltaP / (GasConstant * m_temp);
doublereal sV_term = - deltaP / (GasConstant) * dVdT_; doublereal sV_term = - deltaP / GasConstant * dVdT_;
m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] + sV_term + del_pRT * (m_Vss_ptr[m_spindex]); m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] + sV_term + del_pRT * m_Vss_ptr[m_spindex];
m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex] + sV_term; m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex] + sV_term;
m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex]; m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex];
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex] - m_temp * deltaP * d2VdT2_; m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex] - m_temp * deltaP * d2VdT2_;
@ -302,8 +302,8 @@ void PDSS_SSVol::setTemperature(doublereal temp)
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex]; m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex];
} else { } else {
doublereal del_pRT = deltaP / (GasConstant * m_temp); doublereal del_pRT = deltaP / (GasConstant * m_temp);
doublereal sV_term = - deltaP / (GasConstant) * dVdT_; doublereal sV_term = - deltaP / GasConstant * dVdT_;
m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] + sV_term + del_pRT * (m_Vss_ptr[m_spindex]); m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] + sV_term + del_pRT * m_Vss_ptr[m_spindex];
m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex] + sV_term; m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex] + sV_term;
m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex]; m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex];
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex] - m_temp * deltaP * d2VdT2_; m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex] - m_temp * deltaP * d2VdT2_;

View file

@ -86,19 +86,19 @@ Phase& Phase::operator=(const Phase& right)
* in each object * in each object
*/ */
if (m_xml) { if (m_xml) {
XML_Node* rroot = &(m_xml->root()); XML_Node* rroot = &m_xml->root();
delete rroot; delete rroot;
m_xml = 0; m_xml = 0;
} }
if (right.m_xml) { if (right.m_xml) {
XML_Node *rroot = &(right.m_xml->root()); XML_Node *rroot = &right.m_xml->root();
XML_Node *root_xml = new XML_Node(); XML_Node *root_xml = new XML_Node();
(rroot)->copy(root_xml); rroot->copy(root_xml);
m_xml = findXMLPhase(root_xml, right.m_xml->id()); m_xml = findXMLPhase(root_xml, right.m_xml->id());
if (!m_xml) { if (!m_xml) {
throw CanteraError("Phase::operator=()", "Confused: Couldn't find original phase " + right.m_xml->id()); throw CanteraError("Phase::operator=()", "Confused: Couldn't find original phase " + right.m_xml->id());
} }
if (&(m_xml->root()) != root_xml) { if (&m_xml->root() != root_xml) {
throw CanteraError("Phase::operator=()", "confused: root changed"); throw CanteraError("Phase::operator=()", "confused: root changed");
} }
} }
@ -110,7 +110,7 @@ Phase& Phase::operator=(const Phase& right)
Phase::~Phase() Phase::~Phase()
{ {
if (m_xml) { if (m_xml) {
XML_Node* xroot = &(m_xml->root()); XML_Node* xroot = &m_xml->root();
delete xroot; delete xroot;
} }
m_xml = 0; m_xml = 0;
@ -123,11 +123,11 @@ XML_Node& Phase::xml() const
void Phase::setXMLdata(XML_Node& xmlPhase) void Phase::setXMLdata(XML_Node& xmlPhase)
{ {
XML_Node* xroot = &(xmlPhase.root()); XML_Node* xroot = &xmlPhase.root();
XML_Node *root_xml = new XML_Node(); XML_Node *root_xml = new XML_Node();
(xroot)->copy(root_xml); xroot->copy(root_xml);
if (m_xml) { if (m_xml) {
XML_Node *rOld = &(m_xml->root()); XML_Node *rOld = &m_xml->root();
delete rOld; delete rOld;
m_xml = 0; m_xml = 0;
} }
@ -135,7 +135,7 @@ void Phase::setXMLdata(XML_Node& xmlPhase)
if (!m_xml) { if (!m_xml) {
throw CanteraError("Phase::setXMLdata()", "XML 'phase' node not found"); throw CanteraError("Phase::setXMLdata()", "XML 'phase' node not found");
} }
if (&(m_xml->root()) != root_xml) { if (&m_xml->root() != root_xml) {
throw CanteraError("Phase::setXMLdata()", "Root XML node not found"); throw CanteraError("Phase::setXMLdata()", "Root XML node not found");
} }
} }
@ -298,7 +298,7 @@ std::string Phase::speciesSPName(int k) const
void Phase::saveState(vector_fp& state) const void Phase::saveState(vector_fp& state) const
{ {
state.resize(nSpecies() + 2); state.resize(nSpecies() + 2);
saveState(state.size(),&(state[0])); saveState(state.size(), &state[0]);
} }
void Phase::saveState(size_t lenstate, doublereal* state) const void Phase::saveState(size_t lenstate, doublereal* state) const
{ {

View file

@ -1130,7 +1130,7 @@ void RedlichKwongMFTP::pressureDerivatives() const
doublereal dadt = da_dt(); doublereal dadt = da_dt();
doublereal fac = dadt - m_a_current/(2.0 * TKelvin); doublereal fac = dadt - m_a_current/(2.0 * TKelvin);
dpdT_ = (GasConstant / (vmb) - fac / (sqt * mv * vpb)); dpdT_ = (GasConstant / vmb - fac / (sqt * mv * vpb));
} }
void RedlichKwongMFTP::updateMixingExpressions() void RedlichKwongMFTP::updateMixingExpressions()

View file

@ -393,7 +393,7 @@ SpeciesThermoInterpType* newSpeciesThermoInterpType(const XML_Node& thermo)
const std::vector<XML_Node*>& tpWC = thermo.children(); const std::vector<XML_Node*>& tpWC = thermo.children();
std::vector<XML_Node*> tp; std::vector<XML_Node*> tp;
for (size_t i = 0; i < tpWC.size(); i++) { for (size_t i = 0; i < tpWC.size(); i++) {
if (!(tpWC[i])->isComment()) { if (!tpWC[i]->isComment()) {
tp.push_back(tpWC[i]); tp.push_back(tpWC[i]);
} }
} }

View file

@ -304,7 +304,7 @@ void SurfPhase::setCoverages(const doublereal* theta)
void SurfPhase::setCoveragesNoNorm(const doublereal* theta) void SurfPhase::setCoveragesNoNorm(const doublereal* theta)
{ {
for (size_t k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
m_work[k] = m_n0*theta[k]/(size(k)); m_work[k] = m_n0*theta[k]/size(k);
} }
/* /*
* Call the Phase:: class function * Call the Phase:: class function

View file

@ -304,7 +304,7 @@ void WaterSSTP::getEntropy_R_ref(doublereal* sr) const
m_sub->setState_TR(T, dd); m_sub->setState_TR(T, dd);
doublereal s = m_sub->entropy(); doublereal s = m_sub->entropy();
*sr = (s + SW_Offset)/ (GasConstant); *sr = (s + SW_Offset)/ GasConstant;
dd = m_sub->density(T, p, waterState, dens); dd = m_sub->density(T, p, waterState, dens);
} }
@ -325,7 +325,7 @@ void WaterSSTP::getCp_R_ref(doublereal* cpr) const
throw CanteraError("setPressure", "error"); throw CanteraError("setPressure", "error");
} }
doublereal cp = m_sub->cp(); doublereal cp = m_sub->cp();
*cpr = cp / (GasConstant); *cpr = cp / GasConstant;
dd = m_sub->density(T, p, waterState, dens); dd = m_sub->density(T, p, waterState, dens);
} }

View file

@ -933,7 +933,7 @@ void LiquidTransport::update_Grad_lnAC()
for (size_t k = 0; k < m_nDim; k++) { for (size_t k = 0; k < m_nDim; k++) {
grad_T = m_Grad_T[k]; grad_T = m_Grad_T[k];
size_t start = m_nsp*k; size_t start = m_nsp*k;
m_thermo->getdlnActCoeffds(grad_T, &(m_Grad_X[start]), &(m_Grad_lnAC[start])); m_thermo->getdlnActCoeffds(grad_T, &m_Grad_X[start], &m_Grad_lnAC[start]);
for (size_t i = 0; i < m_nsp; i++) for (size_t i = 0; i < m_nsp; i++)
if (m_molefracs[i] < 1.e-15) { if (m_molefracs[i] < 1.e-15) {
m_Grad_lnAC[start+i] = 0; m_Grad_lnAC[start+i] = 0;

View file

@ -226,11 +226,11 @@ bool SimpleTransport::initLiquid(LiquidTransportParams& tr)
m_coeffDiff_Ns[k] = ltd.speciesDiffusivity; m_coeffDiff_Ns[k] = ltd.speciesDiffusivity;
ltd.speciesDiffusivity = 0; ltd.speciesDiffusivity = 0;
if (!(m_coeffDiff_Ns[k])) { if (!m_coeffDiff_Ns[k]) {
if (ltd.hydroRadius) { if (ltd.hydroRadius) {
m_coeffHydroRadius_Ns[k] = (ltd.hydroRadius)->duplMyselfAsLTPspecies(); m_coeffHydroRadius_Ns[k] = (ltd.hydroRadius)->duplMyselfAsLTPspecies();
} }
if (!(m_coeffHydroRadius_Ns[k])) { if (!m_coeffHydroRadius_Ns[k]) {
throw CanteraError("SimpleTransport::initLiquid", throw CanteraError("SimpleTransport::initLiquid",
"Neither diffusivity nor hydroradius is set for species " + spName); "Neither diffusivity nor hydroradius is set for species " + spName);
} }

View file

@ -119,7 +119,7 @@ void calc(double temp, double Iionic)
printf(" diff = %20.14g\n", diff); printf(" diff = %20.14g\n", diff);
double xo = 1.0 / (molecWeight/1000. * 2 * m + 1.0); double xo = 1.0 / (molecWeight/1000. * 2 * m + 1.0);
printf(" no = %g\n", xo); printf(" no = %g\n", xo);
double tmp = diff / (RT); double tmp = diff / RT;
double actCoefWater = exp(tmp) / xo; double actCoefWater = exp(tmp) / xo;
printf("actCoefWater = %g\n", actCoefWater); printf("actCoefWater = %g\n", actCoefWater);
} }