Fix MemoryWriter is no longer available from fmtlib
In fmtlib 5.0.0, MemoryWriter was removed. The recommendation is to replace it with memory_buffer
This commit is contained in:
parent
c8305375ef
commit
6b3c912ec3
5 changed files with 103 additions and 103 deletions
|
|
@ -520,12 +520,12 @@ string CVodesIntegrator::getErrorInfo(int N)
|
|||
|
||||
N = std::min(N, static_cast<int>(m_neq));
|
||||
sort(weightedErrors.begin(), weightedErrors.end());
|
||||
fmt::MemoryWriter s;
|
||||
fmt::memory_buffer s;
|
||||
for (int i=0; i<N; i++) {
|
||||
s.write("{}: {}\n",
|
||||
format_to(s, "{}: {}\n",
|
||||
get<2>(weightedErrors[i]), get<1>(weightedErrors[i]));
|
||||
}
|
||||
return s.str();
|
||||
return to_string(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -374,19 +374,19 @@ bool MolalityVPSSTP::addSpecies(shared_ptr<Species> spec)
|
|||
|
||||
std::string MolalityVPSSTP::report(bool show_thermo, doublereal threshold) const
|
||||
{
|
||||
fmt::MemoryWriter b;
|
||||
fmt::memory_buffer b;
|
||||
try {
|
||||
if (name() != "") {
|
||||
b.write("\n {}:\n", name());
|
||||
format_to(b, "\n {}:\n", name());
|
||||
}
|
||||
b.write("\n");
|
||||
b.write(" temperature {:12.6g} K\n", temperature());
|
||||
b.write(" pressure {:12.6g} Pa\n", pressure());
|
||||
b.write(" density {:12.6g} kg/m^3\n", density());
|
||||
b.write(" mean mol. weight {:12.6g} amu\n", meanMolecularWeight());
|
||||
format_to(b, "\n");
|
||||
format_to(b, " temperature {:12.6g} K\n", temperature());
|
||||
format_to(b, " pressure {:12.6g} Pa\n", pressure());
|
||||
format_to(b, " density {:12.6g} kg/m^3\n", density());
|
||||
format_to(b, " mean mol. weight {:12.6g} amu\n", meanMolecularWeight());
|
||||
|
||||
doublereal phi = electricPotential();
|
||||
b.write(" potential {:12.6g} V\n", phi);
|
||||
format_to(b, " potential {:12.6g} V\n", phi);
|
||||
|
||||
vector_fp x(m_kk);
|
||||
vector_fp molal(m_kk);
|
||||
|
|
@ -404,48 +404,48 @@ std::string MolalityVPSSTP::report(bool show_thermo, doublereal threshold) const
|
|||
size_t iHp = speciesIndex("H+");
|
||||
if (iHp != npos) {
|
||||
double pH = -log(actMolal[iHp]) / log(10.0);
|
||||
b.write(" pH {:12.4g}\n", pH);
|
||||
format_to(b, " pH {:12.4g}\n", pH);
|
||||
}
|
||||
|
||||
if (show_thermo) {
|
||||
b.write("\n");
|
||||
b.write(" 1 kg 1 kmol\n");
|
||||
b.write(" ----------- ------------\n");
|
||||
b.write(" enthalpy {:12.6g} {:12.4g} J\n",
|
||||
format_to(b, "\n");
|
||||
format_to(b, " 1 kg 1 kmol\n");
|
||||
format_to(b, " ----------- ------------\n");
|
||||
format_to(b, " enthalpy {:12.6g} {:12.4g} J\n",
|
||||
enthalpy_mass(), enthalpy_mole());
|
||||
b.write(" internal energy {:12.6g} {:12.4g} J\n",
|
||||
format_to(b, " internal energy {:12.6g} {:12.4g} J\n",
|
||||
intEnergy_mass(), intEnergy_mole());
|
||||
b.write(" entropy {:12.6g} {:12.4g} J/K\n",
|
||||
format_to(b, " entropy {:12.6g} {:12.4g} J/K\n",
|
||||
entropy_mass(), entropy_mole());
|
||||
b.write(" Gibbs function {:12.6g} {:12.4g} J\n",
|
||||
format_to(b, " Gibbs function {:12.6g} {:12.4g} J\n",
|
||||
gibbs_mass(), gibbs_mole());
|
||||
b.write(" heat capacity c_p {:12.6g} {:12.4g} J/K\n",
|
||||
format_to(b, " heat capacity c_p {:12.6g} {:12.4g} J/K\n",
|
||||
cp_mass(), cp_mole());
|
||||
try {
|
||||
b.write(" heat capacity c_v {:12.6g} {:12.4g} J/K\n",
|
||||
format_to(b, " heat capacity c_v {:12.6g} {:12.4g} J/K\n",
|
||||
cv_mass(), cv_mole());
|
||||
} catch (NotImplementedError&) {
|
||||
b.write(" heat capacity c_v <not implemented>\n");
|
||||
format_to(b, " heat capacity c_v <not implemented>\n");
|
||||
}
|
||||
}
|
||||
|
||||
b.write("\n");
|
||||
format_to(b, "\n");
|
||||
int nMinor = 0;
|
||||
doublereal xMinor = 0.0;
|
||||
if (show_thermo) {
|
||||
b.write(" X "
|
||||
format_to(b, " X "
|
||||
" Molalities Chem.Pot. ChemPotSS ActCoeffMolal\n");
|
||||
b.write(" "
|
||||
format_to(b, " "
|
||||
" (J/kmol) (J/kmol)\n");
|
||||
b.write(" ------------- "
|
||||
format_to(b, " ------------- "
|
||||
" ------------ ------------ ------------ ------------\n");
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
if (x[k] > threshold) {
|
||||
if (x[k] > SmallNumber) {
|
||||
b.write("{:>18s} {:12.6g} {:12.6g} {:12.6g} {:12.6g} {:12.6g}\n",
|
||||
format_to(b, "{:>18s} {:12.6g} {:12.6g} {:12.6g} {:12.6g} {:12.6g}\n",
|
||||
speciesName(k), x[k], molal[k], mu[k], muss[k], acMolal[k]);
|
||||
} else {
|
||||
b.write("{:>18s} {:12.6g} {:12.6g} N/A {:12.6g} {:12.6g}\n",
|
||||
format_to(b, "{:>18s} {:12.6g} {:12.6g} N/A {:12.6g} {:12.6g}\n",
|
||||
speciesName(k), x[k], molal[k], muss[k], acMolal[k]);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -454,13 +454,13 @@ std::string MolalityVPSSTP::report(bool show_thermo, doublereal threshold) const
|
|||
}
|
||||
}
|
||||
} else {
|
||||
b.write(" X"
|
||||
format_to(b, " X"
|
||||
"Molalities\n");
|
||||
b.write(" -------------"
|
||||
format_to(b, " -------------"
|
||||
" ------------\n");
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
if (x[k] > threshold) {
|
||||
b.write("{:>18s} {:12.6g} {:12.6g}\n",
|
||||
format_to(b, "{:>18s} {:12.6g} {:12.6g}\n",
|
||||
speciesName(k), x[k], molal[k]);
|
||||
} else {
|
||||
nMinor++;
|
||||
|
|
@ -469,12 +469,12 @@ std::string MolalityVPSSTP::report(bool show_thermo, doublereal threshold) const
|
|||
}
|
||||
}
|
||||
if (nMinor) {
|
||||
b.write(" [{:+5d} minor] {:12.6g}\n", nMinor, xMinor);
|
||||
format_to(b, " [{:+5d} minor] {:12.6g}\n", nMinor, xMinor);
|
||||
}
|
||||
} catch (CanteraError& err) {
|
||||
return b.str() + err.what();
|
||||
return to_string(b) + err.what();
|
||||
}
|
||||
return b.str();
|
||||
return to_string(b);
|
||||
}
|
||||
|
||||
void MolalityVPSSTP::getCsvReportData(std::vector<std::string>& names,
|
||||
|
|
|
|||
|
|
@ -315,19 +315,19 @@ void MolarityIonicVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
|||
|
||||
std::string MolarityIonicVPSSTP::report(bool show_thermo, doublereal threshold) const
|
||||
{
|
||||
fmt::MemoryWriter b;
|
||||
fmt::memory_buffer b;
|
||||
try {
|
||||
if (name() != "") {
|
||||
b.write("\n {}:\n", name());
|
||||
format_to(b, "\n {}:\n", name());
|
||||
}
|
||||
b.write("\n");
|
||||
b.write(" temperature {:12.6g} K\n", temperature());
|
||||
b.write(" pressure {:12.6g} Pa\n", pressure());
|
||||
b.write(" density {:12.6g} kg/m^3\n", density());
|
||||
b.write(" mean mol. weight {:12.6g} amu\n", meanMolecularWeight());
|
||||
format_to(b, "\n");
|
||||
format_to(b, " temperature {:12.6g} K\n", temperature());
|
||||
format_to(b, " pressure {:12.6g} Pa\n", pressure());
|
||||
format_to(b, " density {:12.6g} kg/m^3\n", density());
|
||||
format_to(b, " mean mol. weight {:12.6g} amu\n", meanMolecularWeight());
|
||||
|
||||
doublereal phi = electricPotential();
|
||||
b.write(" potential {:12.6g} V\n", phi);
|
||||
format_to(b, " potential {:12.6g} V\n", phi);
|
||||
|
||||
vector_fp x(m_kk);
|
||||
vector_fp molal(m_kk);
|
||||
|
|
@ -342,30 +342,30 @@ std::string MolarityIonicVPSSTP::report(bool show_thermo, doublereal threshold)
|
|||
getActivities(&actMolal[0]);
|
||||
|
||||
if (show_thermo) {
|
||||
b.write("\n");
|
||||
b.write(" 1 kg 1 kmol\n");
|
||||
b.write(" ----------- ------------\n");
|
||||
b.write(" enthalpy {:12.6g} {:12.4g} J\n",
|
||||
format_to(b, "\n");
|
||||
format_to(b, " 1 kg 1 kmol\n");
|
||||
format_to(b, " ----------- ------------\n");
|
||||
format_to(b, " enthalpy {:12.6g} {:12.4g} J\n",
|
||||
enthalpy_mass(), enthalpy_mole());
|
||||
b.write(" internal energy {:12.6g} {:12.4g} J\n",
|
||||
format_to(b, " internal energy {:12.6g} {:12.4g} J\n",
|
||||
intEnergy_mass(), intEnergy_mole());
|
||||
b.write(" entropy {:12.6g} {:12.4g} J/K\n",
|
||||
format_to(b, " entropy {:12.6g} {:12.4g} J/K\n",
|
||||
entropy_mass(), entropy_mole());
|
||||
b.write(" Gibbs function {:12.6g} {:12.4g} J\n",
|
||||
format_to(b, " Gibbs function {:12.6g} {:12.4g} J\n",
|
||||
gibbs_mass(), gibbs_mole());
|
||||
b.write(" heat capacity c_p {:12.6g} {:12.4g} J/K\n",
|
||||
format_to(b, " heat capacity c_p {:12.6g} {:12.4g} J/K\n",
|
||||
cp_mass(), cp_mole());
|
||||
try {
|
||||
b.write(" heat capacity c_v {:12.6g} {:12.4g} J/K\n",
|
||||
format_to(b, " heat capacity c_v {:12.6g} {:12.4g} J/K\n",
|
||||
cv_mass(), cv_mole());
|
||||
} catch (NotImplementedError&) {
|
||||
b.write(" heat capacity c_v <not implemented>\n");
|
||||
format_to(b, " heat capacity c_v <not implemented>\n");
|
||||
}
|
||||
}
|
||||
} catch (CanteraError& e) {
|
||||
return b.str() + e.what();
|
||||
return to_string(b) + e.what();
|
||||
}
|
||||
return b.str();
|
||||
return to_string(b);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -378,43 +378,43 @@ void PureFluidPhase::setState_Psat(doublereal p, doublereal x)
|
|||
|
||||
std::string PureFluidPhase::report(bool show_thermo, doublereal threshold) const
|
||||
{
|
||||
fmt::MemoryWriter b;
|
||||
fmt::memory_buffer b;
|
||||
if (name() != "") {
|
||||
b.write("\n {}:\n", name());
|
||||
format_to(b, "\n {}:\n", name());
|
||||
}
|
||||
b.write("\n");
|
||||
b.write(" temperature {:12.6g} K\n", temperature());
|
||||
b.write(" pressure {:12.6g} Pa\n", pressure());
|
||||
b.write(" density {:12.6g} kg/m^3\n", density());
|
||||
b.write(" mean mol. weight {:12.6g} amu\n", meanMolecularWeight());
|
||||
b.write(" vapor fraction {:12.6g}\n", vaporFraction());
|
||||
format_to(b, "\n");
|
||||
format_to(b, " temperature {:12.6g} K\n", temperature());
|
||||
format_to(b, " pressure {:12.6g} Pa\n", pressure());
|
||||
format_to(b, " density {:12.6g} kg/m^3\n", density());
|
||||
format_to(b, " mean mol. weight {:12.6g} amu\n", meanMolecularWeight());
|
||||
format_to(b, " vapor fraction {:12.6g}\n", vaporFraction());
|
||||
|
||||
doublereal phi = electricPotential();
|
||||
if (phi != 0.0) {
|
||||
b.write(" potential {:12.6g} V\n", phi);
|
||||
format_to(b, " potential {:12.6g} V\n", phi);
|
||||
}
|
||||
if (show_thermo) {
|
||||
b.write("\n");
|
||||
b.write(" 1 kg 1 kmol\n");
|
||||
b.write(" ----------- ------------\n");
|
||||
b.write(" enthalpy {:12.6g} {:12.4g} J\n",
|
||||
format_to(b, "\n");
|
||||
format_to(b, " 1 kg 1 kmol\n");
|
||||
format_to(b, " ----------- ------------\n");
|
||||
format_to(b, " enthalpy {:12.6g} {:12.4g} J\n",
|
||||
enthalpy_mass(), enthalpy_mole());
|
||||
b.write(" internal energy {:12.6g} {:12.4g} J\n",
|
||||
format_to(b, " internal energy {:12.6g} {:12.4g} J\n",
|
||||
intEnergy_mass(), intEnergy_mole());
|
||||
b.write(" entropy {:12.6g} {:12.4g} J/K\n",
|
||||
format_to(b, " entropy {:12.6g} {:12.4g} J/K\n",
|
||||
entropy_mass(), entropy_mole());
|
||||
b.write(" Gibbs function {:12.6g} {:12.4g} J\n",
|
||||
format_to(b, " Gibbs function {:12.6g} {:12.4g} J\n",
|
||||
gibbs_mass(), gibbs_mole());
|
||||
b.write(" heat capacity c_p {:12.6g} {:12.4g} J/K\n",
|
||||
format_to(b, " heat capacity c_p {:12.6g} {:12.4g} J/K\n",
|
||||
cp_mass(), cp_mole());
|
||||
try {
|
||||
b.write(" heat capacity c_v {:12.6g} {:12.4g} J/K\n",
|
||||
format_to(b, " heat capacity c_v {:12.6g} {:12.4g} J/K\n",
|
||||
cv_mass(), cv_mole());
|
||||
} catch (NotImplementedError&) {
|
||||
b.write(" heat capacity c_v <not implemented>\n");
|
||||
format_to(b, " heat capacity c_v <not implemented>\n");
|
||||
}
|
||||
}
|
||||
return b.str();
|
||||
return to_string(b);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -819,40 +819,40 @@ void ThermoPhase::getdlnActCoeffdlnN_numderiv(const size_t ld, doublereal* const
|
|||
|
||||
std::string ThermoPhase::report(bool show_thermo, doublereal threshold) const
|
||||
{
|
||||
fmt::MemoryWriter b;
|
||||
fmt::memory_buffer b;
|
||||
try {
|
||||
if (name() != "") {
|
||||
b.write("\n {}:\n", name());
|
||||
format_to(b, "\n {}:\n", name());
|
||||
}
|
||||
b.write("\n");
|
||||
b.write(" temperature {:12.6g} K\n", temperature());
|
||||
b.write(" pressure {:12.6g} Pa\n", pressure());
|
||||
b.write(" density {:12.6g} kg/m^3\n", density());
|
||||
b.write(" mean mol. weight {:12.6g} amu\n", meanMolecularWeight());
|
||||
format_to(b, "\n");
|
||||
format_to(b, " temperature {:12.6g} K\n", temperature());
|
||||
format_to(b, " pressure {:12.6g} Pa\n", pressure());
|
||||
format_to(b, " density {:12.6g} kg/m^3\n", density());
|
||||
format_to(b, " mean mol. weight {:12.6g} amu\n", meanMolecularWeight());
|
||||
|
||||
doublereal phi = electricPotential();
|
||||
if (phi != 0.0) {
|
||||
b.write(" potential {:12.6g} V\n", phi);
|
||||
format_to(b, " potential {:12.6g} V\n", phi);
|
||||
}
|
||||
if (show_thermo) {
|
||||
b.write("\n");
|
||||
b.write(" 1 kg 1 kmol\n");
|
||||
b.write(" ----------- ------------\n");
|
||||
b.write(" enthalpy {:12.5g} {:12.4g} J\n",
|
||||
format_to(b, "\n");
|
||||
format_to(b, " 1 kg 1 kmol\n");
|
||||
format_to(b, " ----------- ------------\n");
|
||||
format_to(b, " enthalpy {:12.5g} {:12.4g} J\n",
|
||||
enthalpy_mass(), enthalpy_mole());
|
||||
b.write(" internal energy {:12.5g} {:12.4g} J\n",
|
||||
format_to(b, " internal energy {:12.5g} {:12.4g} J\n",
|
||||
intEnergy_mass(), intEnergy_mole());
|
||||
b.write(" entropy {:12.5g} {:12.4g} J/K\n",
|
||||
format_to(b, " entropy {:12.5g} {:12.4g} J/K\n",
|
||||
entropy_mass(), entropy_mole());
|
||||
b.write(" Gibbs function {:12.5g} {:12.4g} J\n",
|
||||
format_to(b, " Gibbs function {:12.5g} {:12.4g} J\n",
|
||||
gibbs_mass(), gibbs_mole());
|
||||
b.write(" heat capacity c_p {:12.5g} {:12.4g} J/K\n",
|
||||
format_to(b, " heat capacity c_p {:12.5g} {:12.4g} J/K\n",
|
||||
cp_mass(), cp_mole());
|
||||
try {
|
||||
b.write(" heat capacity c_v {:12.5g} {:12.4g} J/K\n",
|
||||
format_to(b, " heat capacity c_v {:12.5g} {:12.4g} J/K\n",
|
||||
cv_mass(), cv_mole());
|
||||
} catch (NotImplementedError&) {
|
||||
b.write(" heat capacity c_v <not implemented> \n");
|
||||
format_to(b, " heat capacity c_v <not implemented> \n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -865,19 +865,19 @@ std::string ThermoPhase::report(bool show_thermo, doublereal threshold) const
|
|||
int nMinor = 0;
|
||||
doublereal xMinor = 0.0;
|
||||
doublereal yMinor = 0.0;
|
||||
b.write("\n");
|
||||
format_to(b, "\n");
|
||||
if (show_thermo) {
|
||||
b.write(" X "
|
||||
format_to(b, " X "
|
||||
" Y Chem. Pot. / RT\n");
|
||||
b.write(" ------------- "
|
||||
format_to(b, " ------------- "
|
||||
"------------ ------------\n");
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
if (abs(x[k]) >= threshold) {
|
||||
if (abs(x[k]) > SmallNumber) {
|
||||
b.write("{:>18s} {:12.6g} {:12.6g} {:12.6g}\n",
|
||||
format_to(b, "{:>18s} {:12.6g} {:12.6g} {:12.6g}\n",
|
||||
speciesName(k), x[k], y[k], mu[k]/RT());
|
||||
} else {
|
||||
b.write("{:>18s} {:12.6g} {:12.6g}\n",
|
||||
format_to(b, "{:>18s} {:12.6g} {:12.6g}\n",
|
||||
speciesName(k), x[k], y[k]);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -887,11 +887,11 @@ std::string ThermoPhase::report(bool show_thermo, doublereal threshold) const
|
|||
}
|
||||
}
|
||||
} else {
|
||||
b.write(" X Y\n");
|
||||
b.write(" ------------- ------------\n");
|
||||
format_to(b, " X Y\n");
|
||||
format_to(b, " ------------- ------------\n");
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
if (abs(x[k]) >= threshold) {
|
||||
b.write("{:>18s} {:12.6g} {:12.6g}\n",
|
||||
format_to(b, "{:>18s} {:12.6g} {:12.6g}\n",
|
||||
speciesName(k), x[k], y[k]);
|
||||
} else {
|
||||
nMinor++;
|
||||
|
|
@ -901,13 +901,13 @@ std::string ThermoPhase::report(bool show_thermo, doublereal threshold) const
|
|||
}
|
||||
}
|
||||
if (nMinor) {
|
||||
b.write(" [{:+5d} minor] {:12.6g} {:12.6g}\n",
|
||||
format_to(b, " [{:+5d} minor] {:12.6g} {:12.6g}\n",
|
||||
nMinor, xMinor, yMinor);
|
||||
}
|
||||
} catch (CanteraError& err) {
|
||||
return b.str() + err.what();
|
||||
return to_string(b) + err.what();
|
||||
}
|
||||
return b.str();
|
||||
return to_string(b);
|
||||
}
|
||||
|
||||
void ThermoPhase::reportCSV(std::ofstream& csvFile) const
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue