Skip to content

Commit

Permalink
[Kinetics] Remove return argument from ReactionData::restore
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl authored and speth committed Jan 14, 2022
1 parent b20a25b commit ec85c24
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
14 changes: 4 additions & 10 deletions include/cantera/kinetics/ReactionData.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ struct ReactionData
void perturbTemperature(double deltaT);

//! Restore data container after a perturbation
/*
* @returns A boolean indicating whether value was restored after a perturbation.
*/
virtual bool restore();
virtual void restore();

//! Update number of species and reactions
virtual void resize(size_t n_species, size_t n_reactions) {}
Expand Down Expand Up @@ -179,8 +176,7 @@ struct FalloffData : public ReactionData
*/
void perturbThirdBodies(double deltaM);

//! Restore data container after a perturbation
virtual bool restore() override;
virtual void restore() override;

virtual void resize(size_t n_species, size_t n_reactions) override {
conc_3b.resize(n_reactions, NAN);
Expand Down Expand Up @@ -230,8 +226,7 @@ struct PlogData : public ReactionData
*/
void perturbPressure(double deltaP);

//! Restore data container after a perturbation
virtual bool restore() override;
virtual void restore() override;

virtual void invalidateCache() override {
ReactionData::invalidateCache();
Expand Down Expand Up @@ -272,8 +267,7 @@ struct ChebyshevData : public ReactionData
*/
void perturbPressure(double deltaP);

//! Restore data container after a perturbation
virtual bool restore() override;
virtual void restore() override;

virtual void invalidateCache() override {
ReactionData::invalidateCache();
Expand Down
26 changes: 11 additions & 15 deletions src/kinetics/ReactionData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ void ReactionData::perturbTemperature(double deltaT)
ReactionData::update(temperature * (1. + deltaT));
}

bool ReactionData::restore()
void ReactionData::restore()
{
// only restore if there is a valid buffered value
if (m_temperature_buf < 0.) {
return false;
return;
}
ReactionData::update(m_temperature_buf);
m_temperature_buf = -1.;
return true;
}

bool ArrheniusData::update(const ThermoPhase& bulk, const Kinetics& kin)
Expand Down Expand Up @@ -177,16 +176,15 @@ void FalloffData::perturbThirdBodies(double deltaM)
m_perturbed = true;
}

bool FalloffData::restore()
void FalloffData::restore()
{
bool ret = ReactionData::restore();
ReactionData::restore();
// only restore if there is a valid buffered value
if (!m_perturbed) {
return ret;
return;
}
conc_3b = m_conc_3b_buf;
m_perturbed = false;
return true;
}

void PlogData::update(double T)
Expand Down Expand Up @@ -216,16 +214,15 @@ void PlogData::perturbPressure(double deltaP)
update(temperature, pressure * (1. + deltaP));
}

bool PlogData::restore()
void PlogData::restore()
{
bool ret = ReactionData::restore();
ReactionData::restore();
// only restore if there is a valid buffered value
if (m_pressure_buf < 0.) {
return ret;
return;
}
update(temperature, m_pressure_buf);
m_pressure_buf = -1.;
return true;
}

void ChebyshevData::update(double T)
Expand Down Expand Up @@ -255,16 +252,15 @@ void ChebyshevData::perturbPressure(double deltaP)
update(temperature, pressure * (1. + deltaP));
}

bool ChebyshevData::restore()
void ChebyshevData::restore()
{
bool ret = ReactionData::restore();
ReactionData::restore();
// only restore if there is a valid buffered value
if (m_pressure_buf < 0.) {
return ret;
return;
}
update(temperature, m_pressure_buf);
m_pressure_buf = -1.;
return true;
}

}

0 comments on commit ec85c24

Please sign in to comment.