diff --git a/include/cantera/equil/vcs_internal.h b/include/cantera/equil/vcs_internal.h index 0d82bd570..9e768631d 100644 --- a/include/cantera/equil/vcs_internal.h +++ b/include/cantera/equil/vcs_internal.h @@ -14,9 +14,6 @@ #include "cantera/base/global.h" namespace Cantera { -//! Points to the data in a std::vector<> object -#define VCS_DATA_PTR(vvv) (&(vvv[0])) - //! define this Cantera function to replace printf /*! * We can replace this with printf easily diff --git a/src/equil/vcs_MultiPhaseEquil.cpp b/src/equil/vcs_MultiPhaseEquil.cpp index 8751f76bf..3f4e32131 100644 --- a/src/equil/vcs_MultiPhaseEquil.cpp +++ b/src/equil/vcs_MultiPhaseEquil.cpp @@ -610,9 +610,9 @@ void vcs_MultiPhaseEquil::reportCSV(const std::string& reportFile) } double Temp = m_mix->temperature(); double pres = m_mix->pressure(); - double* mf = VCS_DATA_PTR(m_vprob.mf); + vector_fp& mf = m_vprob.mf; #ifdef DEBUG_MODE - double* fe = VCS_DATA_PTR(m_vprob.m_gibbsSpecies); + double* fe = &m_vprob.m_gibbsSpecies[0]); #endif std::vector VolPM; std::vector activity; @@ -627,7 +627,7 @@ void vcs_MultiPhaseEquil::reportCSV(const std::string& reportFile) ThermoPhase& tref = m_mix->phase(iphase); size_t nSpecies = tref.nSpecies(); VolPM.resize(nSpecies, 0.0); - tref.getPartialMolarVolumes(VCS_DATA_PTR(VolPM)); + tref.getPartialMolarVolumes(&VolPM[0]); vcs_VolPhase* volP = m_vprob.VPhaseList[iphase]; double TMolesPhase = volP->totalMoles(); @@ -664,12 +664,12 @@ void vcs_MultiPhaseEquil::reportCSV(const std::string& reportFile) molalities.resize(nSpecies, 0.0); int actConvention = tref.activityConvention(); - tref.getActivities(VCS_DATA_PTR(activity)); - tref.getActivityCoefficients(VCS_DATA_PTR(ac)); - tref.getStandardChemPotentials(VCS_DATA_PTR(mu0)); + tref.getActivities(&activity[0]); + tref.getActivityCoefficients(&ac[0]); + tref.getStandardChemPotentials(&mu0[0]); - tref.getPartialMolarVolumes(VCS_DATA_PTR(VolPM)); - tref.getChemPotentials(VCS_DATA_PTR(mu)); + tref.getPartialMolarVolumes(&VolPM[0]); + tref.getChemPotentials(&mu[0]); double VolPhaseVolumes = 0.0; for (size_t k = 0; k < nSpecies; k++) { VolPhaseVolumes += VolPM[k] * mf[istart + k]; @@ -680,8 +680,8 @@ void vcs_MultiPhaseEquil::reportCSV(const std::string& reportFile) if (actConvention == 1) { MolalityVPSSTP* mTP = static_cast(&tref); - mTP->getMolalities(VCS_DATA_PTR(molalities)); - tref.getChemPotentials(VCS_DATA_PTR(mu)); + mTP->getMolalities(&molalities[0]); + tref.getChemPotentials(&mu[0]); if (iphase == 0) { fprintf(FP," Name, Phase, PhaseMoles, Mole_Fract, " @@ -1027,7 +1027,7 @@ int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob) } else { std::vector phaseTermCoeff(nSpPhase, 0.0); int nCoeff; - tPhase->getParameters(nCoeff, VCS_DATA_PTR(phaseTermCoeff)); + tPhase->getParameters(nCoeff, &phaseTermCoeff[0]); ts_ptr->SSStar_Vol_Model = VCS_SSVOL_CONSTANT; ts_ptr->SSStar_Vol0 = phaseTermCoeff[k]; } @@ -1055,7 +1055,7 @@ int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob) } } - VolPhase->setMolesFromVCS(VCS_STATECALC_OLD, VCS_DATA_PTR(vprob->w)); + VolPhase->setMolesFromVCS(VCS_STATECALC_OLD, &vprob->w[0]); /* * Now, calculate a sample naught Gibbs free energy calculation * at the specified temperature. @@ -1181,7 +1181,7 @@ int vcs_Cantera_update_vprob(MultiPhase* mphase, VCS_PROB* vprob) size_t kglob = volPhase->spGlobalIndexVCS(kphi); vprob->w[kglob] = tPhase->electricPotential(); } - volPhase->setMolesFromVCS(VCS_STATECALC_OLD, VCS_DATA_PTR(vprob->w)); + volPhase->setMolesFromVCS(VCS_STATECALC_OLD, &vprob->w[0]); if ((nSpPhase == 1) && (volPhase->phiVarIndex() == 0)) { volPhase->setExistence(VCS_PHASE_EXIST_ALWAYS); } else if (volPhase->totalMoles() > 0.0) { diff --git a/src/equil/vcs_TP.cpp b/src/equil/vcs_TP.cpp index 1af7c1e9d..9ec9ac981 100644 --- a/src/equil/vcs_TP.cpp +++ b/src/equil/vcs_TP.cpp @@ -71,7 +71,7 @@ int VCS_SOLVE::vcs_evalSS_TP(int ipr, int ip1, double Temp, double pres) for (size_t iph = 0; iph < m_numPhases; iph++) { vcs_VolPhase* vph = m_VolPhaseList[iph]; vph->setState_TP(m_temperature, m_pressurePA); - vph->sendToVCS_GStar(VCS_DATA_PTR(m_SSfeSpecies)); + vph->sendToVCS_GStar(&m_SSfeSpecies[0]); } if (m_VCS_UnitsFormat == VCS_UNITS_UNITLESS) { diff --git a/src/equil/vcs_VolPhase.cpp b/src/equil/vcs_VolPhase.cpp index 6b316a5e8..624e90cf6 100644 --- a/src/equil/vcs_VolPhase.cpp +++ b/src/equil/vcs_VolPhase.cpp @@ -299,7 +299,7 @@ void vcs_VolPhase::_updateActCoeff() const m_UpToDate_AC = true; return; } - TP_ptr->getActivityCoefficients(VCS_DATA_PTR(ActCoeff)); + TP_ptr->getActivityCoefficients(&ActCoeff[0]); m_UpToDate_AC = true; } @@ -313,7 +313,7 @@ double vcs_VolPhase::AC_calc_one(size_t kspec) const void vcs_VolPhase::_updateG0() const { - TP_ptr->getGibbs_ref(VCS_DATA_PTR(SS0ChemicalPotential)); + TP_ptr->getGibbs_ref(&SS0ChemicalPotential[0]); m_UpToDate_G0 = true; } @@ -327,7 +327,7 @@ double vcs_VolPhase::G0_calc_one(size_t kspec) const void vcs_VolPhase::_updateGStar() const { - TP_ptr->getStandardChemPotentials(VCS_DATA_PTR(StarChemicalPotential)); + TP_ptr->getStandardChemPotentials(&StarChemicalPotential[0]); m_UpToDate_GStar = true; } @@ -438,18 +438,18 @@ void vcs_VolPhase::setMolesFromVCS(const int stateCalc, AssertThrowMsg(m_owningSolverObject, "vcs_VolPhase::setMolesFromVCS", "shouldn't be here"); if (stateCalc == VCS_STATECALC_OLD) { - molesSpeciesVCS = VCS_DATA_PTR(m_owningSolverObject->m_molNumSpecies_old); + molesSpeciesVCS = &m_owningSolverObject->m_molNumSpecies_old[0]; } else if (stateCalc == VCS_STATECALC_NEW) { - molesSpeciesVCS = VCS_DATA_PTR(m_owningSolverObject->m_molNumSpecies_new); + molesSpeciesVCS = &m_owningSolverObject->m_molNumSpecies_new[0]; } else if (DEBUG_MODE_ENABLED) { throw CanteraError("vcs_VolPhase::setMolesFromVCS", "shouldn't be here"); } } else if (DEBUG_MODE_ENABLED && m_owningSolverObject) { if (stateCalc == VCS_STATECALC_OLD) { - if (molesSpeciesVCS != VCS_DATA_PTR(m_owningSolverObject->m_molNumSpecies_old)) { + if (molesSpeciesVCS != &m_owningSolverObject->m_molNumSpecies_old[0]) { throw CanteraError("vcs_VolPhase::setMolesFromVCS", "shouldn't be here"); } } else if (stateCalc == VCS_STATECALC_NEW) { - if (molesSpeciesVCS != VCS_DATA_PTR(m_owningSolverObject->m_molNumSpecies_new)) { + if (molesSpeciesVCS != &m_owningSolverObject->m_molNumSpecies_new[0]) { throw CanteraError("vcs_VolPhase::setMolesFromVCS", "shouldn't be here"); } } @@ -624,7 +624,7 @@ void vcs_VolPhase::setState_T(const double temp) void vcs_VolPhase::_updateVolStar() const { - TP_ptr->getStandardVolumes(VCS_DATA_PTR(StarMolarVol)); + TP_ptr->getStandardVolumes(&StarMolarVol[0]); m_UpToDate_VolStar = true; } @@ -638,7 +638,7 @@ double vcs_VolPhase::VolStar_calc_one(size_t kspec) const double vcs_VolPhase::_updateVolPM() const { - TP_ptr->getPartialMolarVolumes(VCS_DATA_PTR(PartialMolarVol)); + TP_ptr->getPartialMolarVolumes(&PartialMolarVol[0]); m_totalVol = 0.0; for (size_t k = 0; k < m_numSpecies; k++) { m_totalVol += PartialMolarVol[k] * Xmol_[k]; @@ -730,7 +730,7 @@ void vcs_VolPhase::_updateLnActCoeffJac() * -> Just wanted to make sure that cantera is in sync * with VolPhase after this call. */ - setMoleFractions(VCS_DATA_PTR(Xmol_Base)); + setMoleFractions(&Xmol_Base[0]); _updateMoleFractionDependencies(); _updateActCoeff(); } @@ -772,7 +772,7 @@ void vcs_VolPhase::setPtrThermoPhase(ThermoPhase* tp_ptr) } resize(VP_ID_, nsp, nelem, PhaseName.c_str()); } - TP_ptr->getMoleFractions(VCS_DATA_PTR(Xmol_)); + TP_ptr->getMoleFractions(&Xmol_[0]); creationMoleNumbers_ = Xmol_; _updateMoleFractionDependencies(); diff --git a/src/equil/vcs_inest.cpp b/src/equil/vcs_inest.cpp index ae34b09c6..fa5d35223 100644 --- a/src/equil/vcs_inest.cpp +++ b/src/equil/vcs_inest.cpp @@ -146,8 +146,8 @@ void VCS_SOLVE::vcs_inest(double* const aw, double* const sa, double* const sm, /* ********************************************************** */ /* **** ESTIMATE REACTION ADJUSTMENTS *********************** */ /* ********************************************************** */ - double* xtphMax = VCS_DATA_PTR(m_TmpPhase); - double* xtphMin = VCS_DATA_PTR(m_TmpPhase2); + vector_fp& xtphMax = m_TmpPhase; + vector_fp& xtphMin = m_TmpPhase2; m_deltaPhaseMoles.assign(m_deltaPhaseMoles.size(), 0.0); for (size_t iph = 0; iph < m_numPhases; iph++) { xtphMax[iph] = log(m_tPhaseMoles_new[iph] * 1.0E32); @@ -364,8 +364,7 @@ int VCS_SOLVE::vcs_inest_TP() plogendl(); } double test = -1.0E20; - vcs_inest(VCS_DATA_PTR(aw), VCS_DATA_PTR(sa), VCS_DATA_PTR(sm), - VCS_DATA_PTR(ss), test); + vcs_inest(&aw[0], &sa[0], &sm[0], &ss[0], test); /* * Calculate the elemental abundances */ @@ -388,7 +387,7 @@ int VCS_SOLVE::vcs_inest_TP() plogf("%sCall vcs_elcorr to attempt fix", pprefix); plogendl(); } - vcs_elcorr(VCS_DATA_PTR(sm), VCS_DATA_PTR(aw)); + vcs_elcorr(&sm[0], &aw[0]); rangeCheck = vcs_elabcheck(1); if (!vcs_elabcheck(0)) { plogf("%sInitial guess still fails element abundance equations\n", @@ -428,8 +427,8 @@ int VCS_SOLVE::vcs_inest_TP() if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { plogf("%sTotal Dimensionless Gibbs Free Energy = %15.7E", pprefix, - vcs_Total_Gibbs(VCS_DATA_PTR(m_molNumSpecies_old), VCS_DATA_PTR(m_feSpecies_new), - VCS_DATA_PTR(m_tPhaseMoles_old))); + vcs_Total_Gibbs(&m_molNumSpecies_old[0], &m_feSpecies_new[0], + &m_tPhaseMoles_old[0])); plogendl(); } diff --git a/src/equil/vcs_phaseStability.cpp b/src/equil/vcs_phaseStability.cpp index d150e6e60..01bdfb56b 100644 --- a/src/equil/vcs_phaseStability.cpp +++ b/src/equil/vcs_phaseStability.cpp @@ -535,7 +535,7 @@ double VCS_SOLVE::vcs_phaseStabilityTest(const size_t iph) doublereal dirProdOld = 0.0; // get the activity coefficients - Vphase->sendToVCS_ActCoeff(VCS_STATECALC_OLD, VCS_DATA_PTR(m_actCoeffSpecies_new)); + Vphase->sendToVCS_ActCoeff(VCS_STATECALC_OLD, &m_actCoeffSpecies_new[0]); // Get the stored estimate for the composition of the phase if // it gets created @@ -619,12 +619,12 @@ double VCS_SOLVE::vcs_phaseStabilityTest(const size_t iph) * Feed the newly formed estimate of the mole fractions back into the * ThermoPhase object */ - Vphase->setMoleFractionsState(0.0, VCS_DATA_PTR(X_est), VCS_STATECALC_PHASESTABILITY); + Vphase->setMoleFractionsState(0.0, &X_est[0], VCS_STATECALC_PHASESTABILITY); /* * get the activity coefficients */ - Vphase->sendToVCS_ActCoeff(VCS_STATECALC_OLD, VCS_DATA_PTR(m_actCoeffSpecies_new)); + Vphase->sendToVCS_ActCoeff(VCS_STATECALC_OLD, &m_actCoeffSpecies_new[0]); /* * First calculate altered chemical potentials for component species @@ -784,12 +784,12 @@ double VCS_SOLVE::vcs_phaseStabilityTest(const size_t iph) /* * Save the final optimized stated back into the VolPhase object for later use */ - Vphase->setMoleFractionsState(0.0, VCS_DATA_PTR(X_est), VCS_STATECALC_PHASESTABILITY); + Vphase->setMoleFractionsState(0.0, &X_est[0], VCS_STATECALC_PHASESTABILITY); /* * Save fracDelta for later use to initialize the problem better * @TODO creationGlobalRxnNumbers needs to be calculated here and stored. */ - Vphase->setCreationMoleNumbers(VCS_DATA_PTR(fracDelta_new), creationGlobalRxnNumbers); + Vphase->setCreationMoleNumbers(&fracDelta_new[0], creationGlobalRxnNumbers); } diff --git a/src/equil/vcs_prep.cpp b/src/equil/vcs_prep.cpp index 209097898..5138f359e 100644 --- a/src/equil/vcs_prep.cpp +++ b/src/equil/vcs_prep.cpp @@ -149,7 +149,7 @@ int VCS_SOLVE::vcs_prep_oneTime(int printLvl) * reaction matrix. */ std::vector awSpace(m_numSpeciesTot + (m_numElemConstraints + 2)*(m_numElemConstraints), 0.0); - double* aw = VCS_DATA_PTR(awSpace); + double* aw = &awSpace[0]; if (aw == NULL) { plogf("vcs_prep_oneTime: failed to get memory: global bailout\n"); return VCS_NOMEMORY; @@ -180,7 +180,7 @@ int VCS_SOLVE::vcs_prep_oneTime(int printLvl) * The elements might need to be rearranged. */ awSpace.resize(m_numElemConstraints + (m_numElemConstraints + 2)*(m_numElemConstraints), 0.0); - aw = VCS_DATA_PTR(awSpace); + aw = &awSpace[0]; sa = aw + m_numElemConstraints; sm = sa + m_numElemConstraints; ss = sm + (m_numElemConstraints)*(m_numElemConstraints); diff --git a/src/equil/vcs_prob.cpp b/src/equil/vcs_prob.cpp index 660b9e0f2..ca063810e 100644 --- a/src/equil/vcs_prob.cpp +++ b/src/equil/vcs_prob.cpp @@ -150,12 +150,10 @@ void VCS_PROB::resizeElements(size_t nel, int force) void VCS_PROB::set_gai() { gai.assign(gai.size(), 0.0); - double* ElemAbund = VCS_DATA_PTR(gai); - for (size_t j = 0; j < ne; j++) { for (size_t kspec = 0; kspec < nspecies; kspec++) { if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { - ElemAbund[j] += FormulaMatrix(kspec,j) * w[kspec]; + gai[j] += FormulaMatrix(kspec,j) * w[kspec]; } } } @@ -371,7 +369,7 @@ void VCS_PROB::reportCSV(const std::string& reportFile) vcs_VolPhase* volP = VPhaseList[iphase]; size_t nSpeciesPhase = volP->nSpecies(); volPM.resize(nSpeciesPhase, 0.0); - volP->sendToVCS_VolPM(VCS_DATA_PTR(volPM)); + volP->sendToVCS_VolPM(&volPM[0]); double TMolesPhase = volP->totalMoles(); double VolPhaseVolumes = 0.0; @@ -399,7 +397,7 @@ void VCS_PROB::reportCSV(const std::string& reportFile) const ThermoPhase* tp = volP->ptrThermoPhase(); string phaseName = volP->PhaseName; size_t nSpeciesPhase = volP->nSpecies(); - volP->sendToVCS_VolPM(VCS_DATA_PTR(volPM)); + volP->sendToVCS_VolPM(&volPM[0]); double TMolesPhase = volP->totalMoles(); activity.resize(nSpeciesPhase, 0.0); ac.resize(nSpeciesPhase, 0.0); @@ -410,12 +408,12 @@ void VCS_PROB::reportCSV(const std::string& reportFile) molalities.resize(nSpeciesPhase, 0.0); int actConvention = tp->activityConvention(); - tp->getActivities(VCS_DATA_PTR(activity)); - tp->getActivityCoefficients(VCS_DATA_PTR(ac)); - tp->getStandardChemPotentials(VCS_DATA_PTR(mu0)); + tp->getActivities(&activity[0]); + tp->getActivityCoefficients(&ac[0]); + tp->getStandardChemPotentials(&mu0[0]); - tp->getPartialMolarVolumes(VCS_DATA_PTR(volPM)); - tp->getChemPotentials(VCS_DATA_PTR(mu)); + tp->getPartialMolarVolumes(&volPM[0]); + tp->getChemPotentials(&mu[0]); double VolPhaseVolumes = 0.0; for (size_t k = 0; k < nSpeciesPhase; k++) { VolPhaseVolumes += volPM[k] * mf[istart + k]; @@ -425,9 +423,9 @@ void VCS_PROB::reportCSV(const std::string& reportFile) if (actConvention == 1) { const MolalityVPSSTP* mTP = static_cast(tp); - tp->getChemPotentials(VCS_DATA_PTR(mu)); - mTP->getMolalities(VCS_DATA_PTR(molalities)); - tp->getChemPotentials(VCS_DATA_PTR(mu)); + tp->getChemPotentials(&mu[0]); + mTP->getMolalities(&molalities[0]); + tp->getChemPotentials(&mu[0]); if (iphase == 0) { fprintf(FP," Name, Phase, PhaseMoles, Mole_Fract, " @@ -480,7 +478,7 @@ void VCS_PROB::reportCSV(const std::string& reportFile) /* * Check consistency: These should be equal */ - tp->getChemPotentials(VCS_DATA_PTR(m_gibbsSpecies)+istart); + tp->getChemPotentials(&m_gibbsSpecies[0]+istart); for (size_t k = 0; k < nSpeciesPhase; k++) { if (!vcs_doubleEqual(m_gibbsSpecies[istart+k], mu[k])) { fclose(FP); diff --git a/src/equil/vcs_report.cpp b/src/equil/vcs_report.cpp index e1fa35e1b..2240e157e 100644 --- a/src/equil/vcs_report.cpp +++ b/src/equil/vcs_report.cpp @@ -35,7 +35,7 @@ int VCS_SOLVE::vcs_report(int iconv) * the magnitude of the mole fraction vector. */ for (size_t l = m_numComponents; l < m_numSpeciesRdc; ++l) { - size_t k = vcs_optMax(VCS_DATA_PTR(xy), 0, l, m_numSpeciesRdc); + size_t k = vcs_optMax(&xy[0], 0, l, m_numSpeciesRdc); if (k != l) { std::swap(xy[k], xy[l]); std::swap(sortindex[k], sortindex[l]); @@ -77,7 +77,7 @@ int VCS_SOLVE::vcs_report(int iconv) */ vcs_tmoles(); m_totalVol = vcs_VolTotal(m_temperature, m_pressurePA, - VCS_DATA_PTR(m_molNumSpecies_old), VCS_DATA_PTR(m_PMVolumeSpecies)); + &m_molNumSpecies_old[0], &m_PMVolumeSpecies[0]); plogf("\t\tTemperature = %15.2g Kelvin\n", m_temperature); plogf("\t\tPressure = %15.5g Pa \n", m_pressurePA); @@ -227,13 +227,13 @@ int VCS_SOLVE::vcs_report(int iconv) throw CanteraError("VCS_SOLVE::vcs_report", "we have a problem"); } } - vcs_elabPhase(iphase, VCS_DATA_PTR(gaPhase)); + vcs_elabPhase(iphase, &gaPhase[0]); for (size_t j = 0; j < m_numElemConstraints; j++) { plogf(" %10.3g", gaPhase[j]); gaTPhase[j] += gaPhase[j]; } - gibbsPhase = vcs_GibbsPhase(iphase, VCS_DATA_PTR(m_molNumSpecies_old), - VCS_DATA_PTR(m_feSpecies_old)); + gibbsPhase = vcs_GibbsPhase(iphase, &m_molNumSpecies_old[0], + &m_feSpecies_old[0]); gibbsTotal += gibbsPhase; plogf(" | %18.11E |\n", gibbsPhase); } @@ -257,8 +257,8 @@ int VCS_SOLVE::vcs_report(int iconv) * energy of zero */ - double g = vcs_Total_Gibbs(VCS_DATA_PTR(m_molNumSpecies_old), VCS_DATA_PTR(m_feSpecies_old), - VCS_DATA_PTR(m_tPhaseMoles_old)); + double g = vcs_Total_Gibbs(&m_molNumSpecies_old[0], &m_feSpecies_old[0], + &m_tPhaseMoles_old[0]); plogf("\n\tTotal Dimensionless Gibbs Free Energy = G/RT = %15.7E\n", g); if (inertYes) { plogf("\t\t(Inert species have standard free energy of zero)\n"); diff --git a/src/equil/vcs_rxnadj.cpp b/src/equil/vcs_rxnadj.cpp index 55779ee19..c9f89fe97 100644 --- a/src/equil/vcs_rxnadj.cpp +++ b/src/equil/vcs_rxnadj.cpp @@ -46,7 +46,7 @@ size_t VCS_SOLVE::vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial) * top of the loop, when necessary */ if (m_useActCoeffJac) { - vcs_CalcLnActCoeffJac(VCS_DATA_PTR(m_molNumSpecies_old)); + vcs_CalcLnActCoeffJac(&m_molNumSpecies_old[0]); } /************************************************************************ ******** LOOP OVER THE FORMATION REACTIONS ***************************** @@ -672,14 +672,14 @@ double VCS_SOLVE::vcs_line_search(const size_t irxn, const double dx_orig, char* const int MAXITS = 10; double dx = dx_orig; double* sc_irxn = m_stoichCoeffRxnMatrix.ptrColumn(irxn); - double* molNumBase = VCS_DATA_PTR(m_molNumSpecies_old); - double* acBase = VCS_DATA_PTR(m_actCoeffSpecies_old); - double* ac = VCS_DATA_PTR(m_actCoeffSpecies_new); + vector_fp& molNumBase = m_molNumSpecies_old; + vector_fp& acBase = m_actCoeffSpecies_old; + vector_fp& ac = m_actCoeffSpecies_new; /* * Calculate the deltaG value at the dx = 0.0 point */ vcs_setFlagsVolPhases(false, VCS_STATECALC_OLD); - double deltaGOrig = deltaG_Recalc_Rxn(VCS_STATECALC_OLD, irxn, molNumBase, acBase, VCS_DATA_PTR(m_feSpecies_old)); + double deltaGOrig = deltaG_Recalc_Rxn(VCS_STATECALC_OLD, irxn, &molNumBase[0], &acBase[0], &m_feSpecies_old[0]); double forig = fabs(deltaGOrig) + 1.0E-15; if (deltaGOrig > 0.0) { if (dx_orig > 0.0) { @@ -713,8 +713,8 @@ double VCS_SOLVE::vcs_line_search(const size_t irxn, const double dx_orig, char* } vcs_setFlagsVolPhases(false, VCS_STATECALC_NEW); - double deltaG1 = deltaG_Recalc_Rxn(VCS_STATECALC_NEW, irxn, VCS_DATA_PTR(m_molNumSpecies_new), - ac, VCS_DATA_PTR(m_feSpecies_new)); + double deltaG1 = deltaG_Recalc_Rxn(VCS_STATECALC_NEW, irxn, &m_molNumSpecies_new[0], + &ac[0], &m_feSpecies_new[0]); /* * If deltaG hasn't switched signs when going the full distance @@ -752,8 +752,8 @@ double VCS_SOLVE::vcs_line_search(const size_t irxn, const double dx_orig, char* m_molNumSpecies_new[k] = molNumBase[k] + sc_irxn[k] * dx; } vcs_setFlagsVolPhases(false, VCS_STATECALC_NEW); - double deltaG = deltaG_Recalc_Rxn(VCS_STATECALC_NEW, irxn, VCS_DATA_PTR(m_molNumSpecies_new), - ac, VCS_DATA_PTR(m_feSpecies_new)); + double deltaG = deltaG_Recalc_Rxn(VCS_STATECALC_NEW, irxn, &m_molNumSpecies_new[0], + &ac[0], &m_feSpecies_new[0]); /* * If deltaG hasn't switched signs when going the full distance * then we are heading in the appropriate direction, and diff --git a/src/equil/vcs_setMolesLinProg.cpp b/src/equil/vcs_setMolesLinProg.cpp index 8940f1069..b4d6c9285 100644 --- a/src/equil/vcs_setMolesLinProg.cpp +++ b/src/equil/vcs_setMolesLinProg.cpp @@ -76,7 +76,7 @@ int VCS_SOLVE::vcs_setMolesLinProg() plogf(" --- seMolesLinProg Mole numbers failing element abundances\n"); plogf(" --- seMolesLinProg Call vcs_elcorr to attempt fix\n"); } - retn = vcs_elcorr(VCS_DATA_PTR(sm), VCS_DATA_PTR(wx)); + retn = vcs_elcorr(&sm[0], &wx[0]); if (retn >= 2) { abundancesOK = false; } else { @@ -90,8 +90,7 @@ int VCS_SOLVE::vcs_setMolesLinProg() * coefficient matrix, based on the current composition, m_molNumSpecies_old[] * We also calculate sc[][], the reaction matrix. */ - retn = vcs_basopt(false, VCS_DATA_PTR(aw), VCS_DATA_PTR(sa), - VCS_DATA_PTR(sm), VCS_DATA_PTR(ss), + retn = vcs_basopt(false, &aw[0], &sa[0], &sm[0], &ss[0], test, &usedZeroedSpecies); if (retn != VCS_SUCCESS) { return retn; diff --git a/src/equil/vcs_solve.cpp b/src/equil/vcs_solve.cpp index a3bb713c8..3853ca17f 100644 --- a/src/equil/vcs_solve.cpp +++ b/src/equil/vcs_solve.cpp @@ -883,7 +883,7 @@ int VCS_SOLVE::vcs_prob_update(VCS_PROB* pub) vcs_tmoles(); m_totalVol = vcs_VolTotal(m_temperature, m_pressurePA, - VCS_DATA_PTR(m_molNumSpecies_old), VCS_DATA_PTR(m_PMVolumeSpecies)); + &m_molNumSpecies_old[0], &m_PMVolumeSpecies[0]); for (size_t i = 0; i < m_numSpeciesTot; ++i) { /* @@ -922,7 +922,7 @@ int VCS_SOLVE::vcs_prob_update(VCS_PROB* pub) pubPhase->setElectricPotential(vPhase->electricPotential()); double sumMoles = pubPhase->totalMolesInert(); pubPhase->setMoleFractionsState(vPhase->totalMoles(), - VCS_DATA_PTR(vPhase->moleFractions()), + &vPhase->moleFractions()[0], VCS_STATECALC_TMP); const std::vector & mfVector = pubPhase->moleFractions(); for (size_t k = 0; k < pubPhase->nSpecies(); k++) { diff --git a/src/equil/vcs_solve_TP.cpp b/src/equil/vcs_solve_TP.cpp index c35ba3de1..fbf9d28ba 100644 --- a/src/equil/vcs_solve_TP.cpp +++ b/src/equil/vcs_solve_TP.cpp @@ -371,8 +371,7 @@ int VCS_SOLVE::solve_tp_component_calc(bool& allMinorZeroedSpecies) { double test = -1.0e-10; bool usedZeroedSpecies; - int retn = vcs_basopt(false, VCS_DATA_PTR(m_aw), VCS_DATA_PTR(m_sa), - VCS_DATA_PTR(m_sm), VCS_DATA_PTR(m_ss), + int retn = vcs_basopt(false, &m_aw[0], &m_sa[0], &m_sm[0], &m_ss[0], test, &usedZeroedSpecies); if (retn != VCS_SUCCESS) { return retn; @@ -395,7 +394,7 @@ int VCS_SOLVE::solve_tp_component_calc(bool& allMinorZeroedSpecies) plogf(" --- Element Abundance check failed"); plogendl(); } - vcs_elcorr(VCS_DATA_PTR(m_sm), VCS_DATA_PTR(m_wx)); + vcs_elcorr(&m_sm[0], &m_wx[0]); vcs_setFlagsVolPhases(false, VCS_STATECALC_OLD); vcs_dfe(VCS_STATECALC_OLD, 0, 0, m_numSpeciesRdc); // Update the phase objects with the contents of the soln vector @@ -974,8 +973,8 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1, } if (DEBUG_MODE_ENABLED) { - checkDelta1(VCS_DATA_PTR(m_deltaMolNumSpecies), - VCS_DATA_PTR(m_deltaPhaseMoles), kspec+1); + checkDelta1(&m_deltaMolNumSpecies[0], + &m_deltaPhaseMoles[0], kspec+1); } /* * Branch point for returning - @@ -1062,8 +1061,8 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1, par = 1.0; } if (DEBUG_MODE_ENABLED) { - checkDelta1(VCS_DATA_PTR(m_deltaMolNumSpecies), - VCS_DATA_PTR(m_deltaPhaseMoles), m_numSpeciesTot); + checkDelta1(&m_deltaMolNumSpecies[0], + &m_deltaPhaseMoles[0], m_numSpeciesTot); } /* @@ -1114,11 +1113,11 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1, /* *************************************************************** */ if (printDetails) { plogf(" --- Total Old Dimensionless Gibbs Free Energy = %20.13E\n", - vcs_Total_Gibbs(VCS_DATA_PTR(m_molNumSpecies_old), VCS_DATA_PTR(m_feSpecies_old), - VCS_DATA_PTR(m_tPhaseMoles_old))); + vcs_Total_Gibbs(&m_molNumSpecies_old[0], &m_feSpecies_old[0], + &m_tPhaseMoles_old[0])); plogf(" --- Total tentative Dimensionless Gibbs Free Energy = %20.13E", - vcs_Total_Gibbs(VCS_DATA_PTR(m_molNumSpecies_new), VCS_DATA_PTR(m_feSpecies_new), - VCS_DATA_PTR(m_tPhaseMoles_new))); + vcs_Total_Gibbs(&m_molNumSpecies_new[0], &m_feSpecies_new[0], + &m_tPhaseMoles_new[0])); plogendl(); } @@ -1149,8 +1148,8 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1, } writeline(' ', 26, false); plogf("Norms of Delta G():%14.6E%14.6E\n", - l2normdg(VCS_DATA_PTR(m_deltaGRxn_old)), - l2normdg(VCS_DATA_PTR(m_deltaGRxn_new))); + l2normdg(&m_deltaGRxn_old[0]), + l2normdg(&m_deltaGRxn_new[0])); plogf(" Total kmoles of gas = %15.7E\n", m_tPhaseMoles_old[0]); if ((m_numPhases > 1) && (!(m_VolPhaseList[1])->m_singleSpecies)) { plogf(" Total kmoles of liquid = %15.7E\n", m_tPhaseMoles_old[1]); @@ -1158,8 +1157,8 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1, plogf(" Total kmoles of liquid = %15.7E\n", 0.0); } plogf(" Total New Dimensionless Gibbs Free Energy = %20.13E\n", - vcs_Total_Gibbs(VCS_DATA_PTR(m_molNumSpecies_new), VCS_DATA_PTR(m_feSpecies_new), - VCS_DATA_PTR(m_tPhaseMoles_new))); + vcs_Total_Gibbs(&m_molNumSpecies_new[0], &m_feSpecies_new[0], + &m_tPhaseMoles_new[0])); plogf(" -----------------------------------------------------"); plogendl(); } @@ -1209,8 +1208,8 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1, plogf(" ---"); writeline(' ', 56, false); plogf("Norms of Delta G():%14.6E%14.6E", - l2normdg(VCS_DATA_PTR(m_deltaGRxn_old)), - l2normdg(VCS_DATA_PTR(m_deltaGRxn_new))); + l2normdg(&m_deltaGRxn_old[0]), + l2normdg(&m_deltaGRxn_new[0])); plogendl(); plogf(" --- Phase_Name KMoles(after update)\n"); @@ -1223,11 +1222,11 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1, plogf(" "); writeline('-', 103); plogf(" --- Total Old Dimensionless Gibbs Free Energy = %20.13E\n", - vcs_Total_Gibbs(VCS_DATA_PTR(m_molNumSpecies_old), VCS_DATA_PTR(m_feSpecies_old), - VCS_DATA_PTR(m_tPhaseMoles_old))); + vcs_Total_Gibbs(&m_molNumSpecies_old[0], &m_feSpecies_old[0], + &m_tPhaseMoles_old[0])); plogf(" --- Total New Dimensionless Gibbs Free Energy = %20.13E", - vcs_Total_Gibbs(VCS_DATA_PTR(m_molNumSpecies_new), VCS_DATA_PTR(m_feSpecies_new), - VCS_DATA_PTR(m_tPhaseMoles_new))); + vcs_Total_Gibbs(&m_molNumSpecies_new[0], &m_feSpecies_new[0], + &m_tPhaseMoles_new[0])); plogendl(); if (DEBUG_MODE_ENABLED && m_VCount->Its > 550) { plogf(" --- Troublesome solve"); @@ -1298,9 +1297,8 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1, if (justDeletedMultiPhase) { bool usedZeroedSpecies; double test = -1.0e-10; - int retn = vcs_basopt(false, VCS_DATA_PTR(m_aw), VCS_DATA_PTR(m_sa), - VCS_DATA_PTR(m_sm), VCS_DATA_PTR(m_ss), test, - &usedZeroedSpecies); + int retn = vcs_basopt(false, &m_aw[0], &m_sa[0], &m_sm[0], &m_ss[0], + test, &usedZeroedSpecies); if (retn != VCS_SUCCESS) { throw CanteraError("VCS_SOLVE::solve_tp_inner", "BASOPT returned with an error condition"); @@ -1324,7 +1322,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1, plogf(" - failed -> redoing element abundances."); plogendl(); } - vcs_elcorr(VCS_DATA_PTR(m_sm), VCS_DATA_PTR(m_wx)); + vcs_elcorr(&m_sm[0], &m_wx[0]); vcs_setFlagsVolPhases(false, VCS_STATECALC_OLD); vcs_dfe(VCS_STATECALC_OLD, 0, 0, m_numSpeciesRdc); vcs_deltag(0, true, VCS_STATECALC_OLD); @@ -1603,7 +1601,7 @@ void VCS_SOLVE::solve_tp_elem_abund_check(size_t& iti, int& stage, bool& lec, rangeErrorFound = 0; if (! vcs_elabcheck(1)) { bool ncBefore = vcs_elabcheck(0); - vcs_elcorr(VCS_DATA_PTR(m_sm), VCS_DATA_PTR(m_wx)); + vcs_elcorr(&m_sm[0], &m_wx[0]); bool ncAfter = vcs_elabcheck(0); bool neAfter = vcs_elabcheck(1); /* @@ -1885,9 +1883,8 @@ int VCS_SOLVE::vcs_delete_species(const size_t kspec) /* * Adjust the total moles in a phase downwards. */ - Vphase->setMolesFromVCSCheck(VCS_STATECALC_OLD, - VCS_DATA_PTR(m_molNumSpecies_old), - VCS_DATA_PTR(m_tPhaseMoles_old)); + Vphase->setMolesFromVCSCheck(VCS_STATECALC_OLD, &m_molNumSpecies_old[0], + &m_tPhaseMoles_old[0]); /* * Adjust the current number of active species and reactions counters @@ -1946,8 +1943,8 @@ void VCS_SOLVE::vcs_reinsert_deleted(size_t kspec) vcs_VolPhase* Vphase = m_VolPhaseList[iph]; Vphase->setMolesFromVCSCheck(VCS_STATECALC_OLD, - VCS_DATA_PTR(m_molNumSpecies_old), - VCS_DATA_PTR(m_tPhaseMoles_old)); + &m_molNumSpecies_old[0], + &m_tPhaseMoles_old[0]); /* * We may have popped a multispecies phase back * into existence. If we did, we have to check @@ -2139,7 +2136,7 @@ bool VCS_SOLVE::vcs_delete_multiphase(const size_t iph) int VCS_SOLVE::vcs_recheck_deleted() { - double* xtcutoff = VCS_DATA_PTR(m_TmpPhase); + vector_fp& xtcutoff = m_TmpPhase; if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { plogf(" --- Start rechecking deleted species in multispec phases\n"); } @@ -2276,7 +2273,7 @@ size_t VCS_SOLVE::vcs_add_all_deleted() m_molNumSpecies_new[kspec] = VCS_DELETE_MINORSPECIES_CUTOFF * 1.0E-10; } if (!Vphase->m_singleSpecies) { - Vphase->sendToVCS_ActCoeff(VCS_STATECALC_NEW, VCS_DATA_PTR(m_actCoeffSpecies_new)); + Vphase->sendToVCS_ActCoeff(VCS_STATECALC_NEW, &m_actCoeffSpecies_new[0]); } m_feSpecies_new[kspec] = (m_SSfeSpecies[kspec] + log(m_actCoeffSpecies_new[kspec]) - m_lnMnaughtSpecies[kspec] + m_chargeSpecies[kspec] * m_Faraday_dim * m_phasePhi[iph]); @@ -2356,7 +2353,7 @@ size_t VCS_SOLVE::vcs_add_all_deleted() bool VCS_SOLVE::vcs_globStepDamp() { - double* dptr = VCS_DATA_PTR(m_deltaGRxn_new); + double* dptr = &m_deltaGRxn_new[0]; /* *************************************************** */ /* **** CALCULATE SLOPE AT END OF THE STEP ********** */ @@ -2374,7 +2371,7 @@ bool VCS_SOLVE::vcs_globStepDamp() /* **** CALCULATE ORIGINAL SLOPE ********************* */ /* ************************************************** */ double s1 = 0.0; - dptr = VCS_DATA_PTR(m_deltaGRxn_old); + dptr = &m_deltaGRxn_old[0]; for (size_t irxn = 0; irxn < m_numRxnRdc; ++irxn) { size_t kspec = irxn + m_numComponents; if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { @@ -2432,7 +2429,7 @@ bool VCS_SOLVE::vcs_globStepDamp() m_deltaGRxn_tmp = m_deltaGRxn_new; } - dptr = VCS_DATA_PTR(m_molNumSpecies_new); + dptr = &m_molNumSpecies_new[0]; for (size_t kspec = 0; kspec < m_numSpeciesRdc; ++kspec) { m_molNumSpecies_new[kspec] = m_molNumSpecies_old[kspec] + al * m_deltaMolNumSpecies[kspec]; @@ -2461,7 +2458,7 @@ bool VCS_SOLVE::vcs_globStepDamp() */ vcs_deltag(0, false, VCS_STATECALC_NEW); - dptr = VCS_DATA_PTR(m_deltaGRxn_new); + dptr = &m_deltaGRxn_new[0]; s2 = 0.0; for (size_t irxn = 0; irxn < m_numRxnRdc; ++irxn) { size_t kspec = irxn + m_numComponents; @@ -3339,15 +3336,15 @@ void VCS_SOLVE::vcs_dfe(const int stateCalc, double* feSpecies=0; double* molNum=0; if (stateCalc == VCS_STATECALC_OLD) { - feSpecies = VCS_DATA_PTR(m_feSpecies_old); - tPhMoles_ptr = VCS_DATA_PTR(m_tPhaseMoles_old); - actCoeff_ptr = VCS_DATA_PTR(m_actCoeffSpecies_old); - molNum = VCS_DATA_PTR(m_molNumSpecies_old); + feSpecies = &m_feSpecies_old[0]; + tPhMoles_ptr = &m_tPhaseMoles_old[0]; + actCoeff_ptr = &m_actCoeffSpecies_old[0]; + molNum = &m_molNumSpecies_old[0]; } else if (stateCalc == VCS_STATECALC_NEW) { - feSpecies = VCS_DATA_PTR(m_feSpecies_new); - tPhMoles_ptr = VCS_DATA_PTR(m_tPhaseMoles_new); - actCoeff_ptr = VCS_DATA_PTR(m_actCoeffSpecies_new); - molNum = VCS_DATA_PTR(m_molNumSpecies_new); + feSpecies = &m_feSpecies_new[0]; + tPhMoles_ptr = &m_tPhaseMoles_new[0]; + actCoeff_ptr = &m_actCoeffSpecies_new[0]; + molNum = &m_molNumSpecies_new[0]; } else if (DEBUG_MODE_ENABLED) { throw CanteraError("VCS_SOLVE::vcs_dfe", "Subroutine vcs_dfe called with bad stateCalc value: "+ @@ -3376,12 +3373,12 @@ void VCS_SOLVE::vcs_dfe(const int stateCalc, plogendl(); } - double* tlogMoles = VCS_DATA_PTR(m_TmpPhase); + double* tlogMoles = &m_TmpPhase[0]; /* * Might as well recalculate the phase mole vector * and compare to the stored one. They should be correct. */ - double* tPhInertMoles = VCS_DATA_PTR(TPhInertMoles); + double* tPhInertMoles = &TPhInertMoles[0]; for (size_t iph = 0; iph < m_numPhases; iph++) { tlogMoles[iph] = tPhInertMoles[iph]; @@ -3423,7 +3420,7 @@ void VCS_SOLVE::vcs_dfe(const int stateCalc, vcs_VolPhase* Vphase = m_VolPhaseList[iphase]; Vphase->updateFromVCS_MoleNumbers(stateCalc); if (!Vphase->m_singleSpecies) { - Vphase->sendToVCS_ActCoeff(stateCalc, VCS_DATA_PTR(actCoeff_ptr)); + Vphase->sendToVCS_ActCoeff(stateCalc, &actCoeff_ptr[0]); } m_phasePhi[iphase] = Vphase->electricPotential(); } @@ -3574,15 +3571,15 @@ void VCS_SOLVE::vcs_printSpeciesChemPot(const int stateCalc) const double mfValue = 1.0; bool zeroedPhase = false; - const double* molNum = VCS_DATA_PTR(m_molNumSpecies_old); - const double* actCoeff_ptr = VCS_DATA_PTR(m_actCoeffSpecies_old); + const double* molNum = &m_molNumSpecies_old[0]; + const double* actCoeff_ptr = &m_actCoeffSpecies_old[0]; if (stateCalc == VCS_STATECALC_NEW) { - actCoeff_ptr = VCS_DATA_PTR(m_actCoeffSpecies_new); - molNum = VCS_DATA_PTR(m_molNumSpecies_new); + actCoeff_ptr = &m_actCoeffSpecies_new[0]; + molNum = &m_molNumSpecies_new[0]; } - double* tMoles = VCS_DATA_PTR(m_TmpPhase); - const double* tPhInertMoles = VCS_DATA_PTR(TPhInertMoles); + double* tMoles = &m_TmpPhase[0]; + const double* tPhInertMoles = &TPhInertMoles[0]; for (size_t iph = 0; iph < m_numPhases; iph++) { tMoles[iph] = tPhInertMoles[iph]; } @@ -3756,12 +3753,12 @@ void VCS_SOLVE::vcs_updateVP(const int vcsState) vcs_VolPhase* Vphase = m_VolPhaseList[i]; if (vcsState == VCS_STATECALC_OLD) { Vphase->setMolesFromVCSCheck(VCS_STATECALC_OLD, - VCS_DATA_PTR(m_molNumSpecies_old), - VCS_DATA_PTR(m_tPhaseMoles_old)); + &m_molNumSpecies_old[0], + &m_tPhaseMoles_old[0]); } else if (vcsState == VCS_STATECALC_NEW) { Vphase->setMolesFromVCSCheck(VCS_STATECALC_NEW, - VCS_DATA_PTR(m_molNumSpecies_new), - VCS_DATA_PTR(m_tPhaseMoles_new)); + &m_molNumSpecies_new[0], + &m_tPhaseMoles_new[0]); } else if (DEBUG_MODE_ENABLED) { throw CanteraError("VCS_SOLVE::vcs_updateVP", "wrong stateCalc value: " + int2str(vcsState)); @@ -3856,15 +3853,15 @@ void VCS_SOLVE::vcs_deltag(const int l, const bool doDeleted, double* molNumSpecies; double* actCoeffSpecies; if (vcsState == VCS_STATECALC_NEW) { - deltaGRxn = VCS_DATA_PTR(m_deltaGRxn_new); - feSpecies = VCS_DATA_PTR(m_feSpecies_new); - molNumSpecies = VCS_DATA_PTR(m_molNumSpecies_new); - actCoeffSpecies = VCS_DATA_PTR(m_actCoeffSpecies_new); + deltaGRxn = &m_deltaGRxn_new[0]; + feSpecies = &m_feSpecies_new[0]; + molNumSpecies = &m_molNumSpecies_new[0]; + actCoeffSpecies = &m_actCoeffSpecies_new[0]; } else if (vcsState == VCS_STATECALC_OLD) { - deltaGRxn = VCS_DATA_PTR(m_deltaGRxn_old); - feSpecies = VCS_DATA_PTR(m_feSpecies_old); - molNumSpecies = VCS_DATA_PTR(m_molNumSpecies_old); - actCoeffSpecies = VCS_DATA_PTR(m_actCoeffSpecies_old); + deltaGRxn = &m_deltaGRxn_old[0]; + feSpecies = &m_feSpecies_old[0]; + molNumSpecies = &m_molNumSpecies_old[0]; + actCoeffSpecies = &m_actCoeffSpecies_old[0]; } else { throw CanteraError("VCS_SOLVE::vcs_deltag", "bad vcsState"); } @@ -4035,17 +4032,17 @@ void VCS_SOLVE::vcs_deltag(const int l, const bool doDeleted, void VCS_SOLVE::vcs_printDeltaG(const int stateCalc) { - double* deltaGRxn = VCS_DATA_PTR(m_deltaGRxn_old); - double* feSpecies = VCS_DATA_PTR(m_feSpecies_old); - double* molNumSpecies = VCS_DATA_PTR(m_molNumSpecies_old); - const double* tPhMoles_ptr = VCS_DATA_PTR(m_tPhaseMoles_old); - const double* actCoeff_ptr = VCS_DATA_PTR(m_actCoeffSpecies_old); + double* deltaGRxn = &m_deltaGRxn_old[0]; + double* feSpecies = &m_feSpecies_old[0]; + double* molNumSpecies = &m_molNumSpecies_old[0]; + const double* tPhMoles_ptr = &m_tPhaseMoles_old[0]; + const double* actCoeff_ptr = &m_actCoeffSpecies_old[0]; if (stateCalc == VCS_STATECALC_NEW) { - deltaGRxn = VCS_DATA_PTR(m_deltaGRxn_new); - feSpecies = VCS_DATA_PTR(m_feSpecies_new); - molNumSpecies = VCS_DATA_PTR(m_molNumSpecies_new); - actCoeff_ptr = VCS_DATA_PTR(m_actCoeffSpecies_new); - tPhMoles_ptr = VCS_DATA_PTR(m_tPhaseMoles_new); + deltaGRxn = &m_deltaGRxn_new[0]; + feSpecies = &m_feSpecies_new[0]; + molNumSpecies = &m_molNumSpecies_new[0]; + actCoeff_ptr = &m_actCoeffSpecies_new[0]; + tPhMoles_ptr = &m_tPhaseMoles_new[0]; } double RT = m_temperature * GasConstant; bool zeroedPhase = false; @@ -4171,13 +4168,13 @@ void VCS_SOLVE::vcs_deltag_Phase(const size_t iphase, const bool doDeleted, double* deltaGRxn=0; double* actCoeffSpecies=0; if (stateCalc == VCS_STATECALC_NEW) { - feSpecies = VCS_DATA_PTR(m_feSpecies_new); - deltaGRxn = VCS_DATA_PTR(m_deltaGRxn_new); - actCoeffSpecies = VCS_DATA_PTR(m_actCoeffSpecies_new); + feSpecies = &m_feSpecies_new[0]; + deltaGRxn = &m_deltaGRxn_new[0]; + actCoeffSpecies = &m_actCoeffSpecies_new[0]; } else if (stateCalc == VCS_STATECALC_OLD) { - feSpecies = VCS_DATA_PTR(m_feSpecies_old); - deltaGRxn = VCS_DATA_PTR(m_deltaGRxn_old); - actCoeffSpecies = VCS_DATA_PTR(m_actCoeffSpecies_old); + feSpecies = &m_feSpecies_old[0]; + deltaGRxn = &m_deltaGRxn_old[0]; + actCoeffSpecies = &m_actCoeffSpecies_old[0]; } else if (DEBUG_MODE_ENABLED) { throw CanteraError("VCS_SOLVE::vcs_deltag_Phase", "bad stateCalc"); } diff --git a/src/equil/vcs_solve_phaseStability.cpp b/src/equil/vcs_solve_phaseStability.cpp index d15be80ca..5dedad05b 100644 --- a/src/equil/vcs_solve_phaseStability.cpp +++ b/src/equil/vcs_solve_phaseStability.cpp @@ -152,7 +152,7 @@ int VCS_SOLVE::vcs_solve_phaseStability(const int iph, const int ifunc, std::vector wx(m_numElemConstraints, 0.0); - vcs_basopt(false, VCS_DATA_PTR(aw), VCS_DATA_PTR(sa), VCS_DATA_PTR(sm), VCS_DATA_PTR(ss), + vcs_basopt(false, &aw[0], &sa[0], &sm[0], &ss[0], test, &usedZeroedSpecies); vcs_evaluate_speciesType();