Skip to content

Commit

Permalink
Improve formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl authored and speth committed Aug 5, 2023
1 parent 64ade35 commit 25f6834
Show file tree
Hide file tree
Showing 24 changed files with 58 additions and 80 deletions.
7 changes: 4 additions & 3 deletions include/cantera/base/AnyMap.h
Expand Up @@ -74,7 +74,7 @@ class AnyMap;
* Elements are set using assignment, and the assignment operator has been
* overloaded for specific types so that only those types are allowed to be
* used in an AnyValue. The allowed types are:
* - AnyMap
* - `AnyMap`
* - `double`
* - `long int`
* - `bool`
Expand Down Expand Up @@ -341,7 +341,8 @@ vector<double>& AnyValue::asVector<double>(size_t nMin, size_t nMax);

//! Implicit conversion of long int to double if accessed as a vector<vector<double>>
template<>
const vector<vector<double>>& AnyValue::asVector<vector<double>>(size_t nMin, size_t nMax) const;
const vector<vector<double>>& AnyValue::asVector<vector<double>>(size_t nMin,
size_t nMax) const;

template<>
vector<vector<double>>& AnyValue::asVector<vector<double>>(size_t nMin, size_t nMax);
Expand Down Expand Up @@ -499,7 +500,7 @@ class AnyMap : public AnyBase

//! If `key` exists, return it as a `string`, otherwise return `default_`.
const string& getString(const string& key,
const string& default_) const;
const string& default_) const;

//! Convert the item stored by the given `key` to the units specified in
//! `units`. If the stored value is a double, convert it using the default
Expand Down
21 changes: 7 additions & 14 deletions include/cantera/base/Delegator.h
Expand Up @@ -524,13 +524,10 @@ class Delegator
map<string, function<void(bool)>*> m_funcs_v_b;
map<string, function<void(double)>*> m_funcs_v_d;
map<string, function<void(AnyMap&)>*> m_funcs_v_AMr;
map<string,
function<void(const AnyMap&, const UnitStack&)>*> m_funcs_v_cAMr_cUSr;
map<string, function<void(const AnyMap&, const UnitStack&)>*> m_funcs_v_cAMr_cUSr;
map<string, function<void(const string&, void*)>*> m_funcs_v_csr_vp;
map<string,
function<void(std::array<size_t, 1>, double*)>*> m_funcs_v_dp;
map<string,
function<void(std::array<size_t, 1>, double, double*)>*> m_funcs_v_d_dp;
map<string, function<void(std::array<size_t, 1>, double*)>*> m_funcs_v_dp;
map<string, function<void(std::array<size_t, 1>, double, double*)>*> m_funcs_v_d_dp;
map<string,
function<void(std::array<size_t, 2>, double, double*, double*)>*> m_funcs_v_d_dp_dp;
map<string,
Expand All @@ -540,15 +537,11 @@ class Delegator
map<string, function<double(void*)>> m_base_d_vp;
map<string, function<double(void*)>*> m_funcs_d_vp;

map<string,
function<string(size_t)>> m_base_s_sz;
map<string,
function<string(size_t)>*> m_funcs_s_sz;
map<string, function<string(size_t)>> m_base_s_sz;
map<string, function<string(size_t)>*> m_funcs_s_sz;

map<string,
function<size_t(const string&)>> m_base_sz_csr;
map<string,
function<size_t(const string&)>*> m_funcs_sz_csr;
map<string, function<size_t(const string&)>> m_base_sz_csr;
map<string, function<size_t(const string&)>*> m_funcs_sz_csr;
//! @}

//! Handles to wrappers for the delegated object in external language interfaces.
Expand Down
11 changes: 4 additions & 7 deletions include/cantera/base/Units.h
Expand Up @@ -27,7 +27,7 @@ class AnyMap;
/*!
* Used for converting quantities between unit systems and checking for
* dimensional consistency. Units objects are mainly used within UnitSystem
* class to convert values from a user-specified Unit system to Cantera's
* class to convert values from a user-specified Unit system to %Cantera's
* base units (SI + kmol).
* @ingroup unitsGroup
*/
Expand Down Expand Up @@ -238,10 +238,8 @@ class UnitSystem
//! Convert an array of AnyValue nodes to the units specified in `dest`. For
//! each node, if the value is a double, convert it using the default units,
//! and if it is a string, treat it as a value with the given dimensions.
vector<double> convert(const vector<AnyValue>& vals,
const string& dest) const;
vector<double> convert(const vector<AnyValue>& vals,
const Units& dest) const;
vector<double> convert(const vector<AnyValue>& vals, const string& dest) const;
vector<double> convert(const vector<AnyValue>& vals, const Units& dest) const;

//! Convert `value` from the units of `src` to the units of `dest`, allowing
//! for the different dimensions that can be used for activation energies
Expand All @@ -261,8 +259,7 @@ class UnitSystem
//! input is a double, convert it using the default units. If the input is a
//! string, treat this as a dimensioned value, such as '2.7e4 J/kmol', and
//! convert from the specified units.
double convertActivationEnergy(const AnyValue& val,
const string& dest) const;
double convertActivationEnergy(const AnyValue& val, const string& dest) const;

//! Get the changes to the defaults from `other` to this UnitSystem
AnyMap getDelta(const UnitSystem& other) const;
Expand Down
10 changes: 4 additions & 6 deletions include/cantera/base/stringUtils.h
Expand Up @@ -26,7 +26,7 @@ namespace Cantera
* @param sep Separator
*/
string vec2str(const vector<double>& v, const string& fmt="%g",
const string& sep=", ");
const string& sep=", ");

//! Strip non-printing characters wherever they are
/*!
Expand Down Expand Up @@ -59,7 +59,7 @@ string stripnonprint(const string& s);
* @return map of names to values
*/
Composition parseCompString(const string& ss,
const vector<string>& names=vector<string>());
const vector<string>& names=vector<string>());

//! Translate a string into one double value
/*!
Expand Down Expand Up @@ -104,8 +104,7 @@ double fpValueCheck(const string& val);
* @param oval String to be broken up
* @param v Output vector of tokens.
*/
void tokenizeString(const string& oval,
vector<string>& v);
void tokenizeString(const string& oval, vector<string>& v);

//! This function separates a string up into tokens according to the location of
//! path separators.
Expand All @@ -117,8 +116,7 @@ void tokenizeString(const string& oval,
*
* @since New in %Cantera 3.0.
*/
void tokenizePath(const string& oval,
vector<string>& v);
void tokenizePath(const string& oval, vector<string>& v);

//! Copy the contents of a string into a char array of a given length
/*!
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/equil/MultiPhaseEquil.h
Expand Up @@ -66,7 +66,7 @@ class MultiPhaseEquil
}

double equilibrate(int XY, double err = 1.0e-9,
int maxsteps = 1000, int loglevel=-99);
int maxsteps = 1000, int loglevel=-99);
double error();

string reactionString(size_t j) {
Expand Down
7 changes: 5 additions & 2 deletions include/cantera/kinetics/InterfaceRate.h
Expand Up @@ -117,7 +117,8 @@ class InterfaceRateBase
//! Add a coverage dependency for species *sp*, with exponential dependence
//! *a*, power-law exponent *m*, and activation energy dependence *e*,
//! where *e* is in Kelvin, that is, energy divided by the molar gas constant.
virtual void addCoverageDependence(const string& sp, double a, double m, const vector<double>& e);
virtual void addCoverageDependence(const string& sp, double a, double m,
const vector<double>& e);

//! Boolean indicating whether rate uses exchange current density formulation
bool exchangeCurrentDensityFormulation() {
Expand Down Expand Up @@ -441,7 +442,9 @@ class InterfaceRate : public RateType, public InterfaceRateBase
return RateType::activationEnergy() + m_ecov * GasConstant;
}

void addCoverageDependence(const string& sp, double a, double m, const vector<double>& e) override {
void addCoverageDependence(const string& sp, double a, double m,
const vector<double>& e) override
{
InterfaceRateBase::addCoverageDependence(sp, a, m, e);
RateType::setCompositionDependence(true);
}
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/kinetics/ReactionPath.h
Expand Up @@ -226,8 +226,7 @@ class ReactionPathDiagram
m_local = k;
}

void linkNodes(size_t k1, size_t k2, size_t rxn, double value,
string legend = "");
void linkNodes(size_t k1, size_t k2, size_t rxn, double value, string legend = "");

void include(const string& aaname) {
m_include.push_back(aaname);
Expand Down
9 changes: 6 additions & 3 deletions include/cantera/kinetics/StoichManager.h
Expand Up @@ -334,7 +334,8 @@ class C_AnyN
public:
C_AnyN() = default;

C_AnyN(size_t rxn, const vector<size_t>& ic, const vector<double>& order_, const vector<double>& stoich_) :
C_AnyN(size_t rxn, const vector<size_t>& ic,
const vector<double>& order_, const vector<double>& stoich_) :
m_n(ic.size()),
m_rxn(rxn) {
m_ic.resize(m_n);
Expand Down Expand Up @@ -676,10 +677,12 @@ class StoichManagerN
void add(size_t rxn, const vector<size_t>& k, const vector<double>& order,
const vector<double>& stoich) {
if (order.size() != k.size()) {
throw CanteraError("StoichManagerN::add()", "size of order and species arrays differ");
throw CanteraError(\
"StoichManagerN::add()", "size of order and species arrays differ");
}
if (stoich.size() != k.size()) {
throw CanteraError("StoichManagerN::add()", "size of stoich and species arrays differ");
throw CanteraError(
"StoichManagerN::add()", "size of stoich and species arrays differ");
}
bool frac = false;
for (size_t n = 0; n < stoich.size(); n++) {
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/kinetics/ThirdBodyCalc.h
Expand Up @@ -21,7 +21,7 @@ class ThirdBodyCalc
public:
//! Install reaction that uses third-body effects in ThirdBodyCalc manager
void install(size_t rxnNumber, const map<size_t, double>& efficiencies,
double default_efficiency, bool mass_action) {
double default_efficiency, bool mass_action) {
m_reaction_index.push_back(rxnNumber);
m_default.push_back(default_efficiency);

Expand Down
4 changes: 2 additions & 2 deletions include/cantera/kinetics/solveSP.h
Expand Up @@ -226,8 +226,8 @@ class solveSP
* @returns the 1. / delta T to be used on the next step
*/
double calc_t(double netProdRateSolnSP[], double XMolSolnSP[],
int* label, int* label_old,
double* label_factor, int ioflag);
int* label, int* label_old,
double* label_factor, int ioflag);

//! Calculate the solution and residual weights
/*!
Expand Down
8 changes: 3 additions & 5 deletions include/cantera/oneD/MultiNewton.h
Expand Up @@ -43,7 +43,7 @@ class MultiNewton
* all domains between their specified lower and upper bounds.
*/
double boundStep(const double* x0, const double* step0,
const OneDim& r, int loglevel);
const OneDim& r, int loglevel);

/**
* On entry, step0 must contain an undamped Newton step for the solution x0.
Expand All @@ -57,16 +57,14 @@ class MultiNewton
OneDim& r, MultiJac& jac, int loglevel, bool writetitle);

//! Compute the weighted 2-norm of `step`.
double norm2(const double* x, const double* step,
OneDim& r) const;
double norm2(const double* x, const double* step, OneDim& r) const;

/**
* Find the solution to F(X) = 0 by damped Newton iteration. On entry, x0
* contains an initial estimate of the solution. On successful return, x1
* contains the converged solution.
*/
int solve(double* x0, double* x1, OneDim& r, MultiJac& jac,
int loglevel);
int solve(double* x0, double* x1, OneDim& r, MultiJac& jac, int loglevel);

//! Set options.
void setOptions(int maxJacAge = 5) {
Expand Down
6 changes: 2 additions & 4 deletions include/cantera/oneD/OneDim.h
Expand Up @@ -193,8 +193,7 @@ class OneDim
* the default value is used.
* @param count Set to zero to omit this call from the statistics
*/
void eval(size_t j, double* x, double* r, double rdt=-1.0,
int count = 1);
void eval(size_t j, double* x, double* r, double rdt=-1.0, int count = 1);

//! Return a pointer to the domain global point *i* belongs to.
/*!
Expand All @@ -220,8 +219,7 @@ class OneDim
* @param loglevel controls amount of printed diagnostics
* @returns size of last timestep taken
*/
double timeStep(int nsteps, double dt, double* x,
double* r, int loglevel);
double timeStep(int nsteps, double dt, double* x, double* r, int loglevel);

void resetBadValues(double* x);

Expand Down
3 changes: 1 addition & 2 deletions include/cantera/oneD/StFlow.h
Expand Up @@ -305,8 +305,7 @@ class StFlow : public Domain1D
* j-1, j, and j+1. This option is used to efficiently evaluate the
* Jacobian numerically.
*/
virtual void eval(size_t j, double* x, double* r,
integer* mask, double rdt);
virtual void eval(size_t j, double* x, double* r, integer* mask, double rdt);

//! Evaluate all residual components at the right boundary.
virtual void evalRightBoundary(double* x, double* res, int* diag,
Expand Down
11 changes: 4 additions & 7 deletions include/cantera/thermo/HMWSoln.h
Expand Up @@ -1187,7 +1187,7 @@ class HMWSoln : public MolalityVPSSTP
}

void setCroppingCoefficients(double ln_gamma_k_min, double ln_gamma_k_max,
double ln_gamma_o_min, double ln_gamma_o_max);
double ln_gamma_o_min, double ln_gamma_o_max);

virtual void initThermo();
virtual void getParameters(AnyMap& phaseNode) const;
Expand Down Expand Up @@ -1253,8 +1253,7 @@ class HMWSoln : public MolalityVPSSTP
* @param pressure Pressure of the derivative calculation
* or -1 to indicate the current pressure
*/
double ADebye_L(double temperature = -1.0,
double pressure = -1.0) const;
double ADebye_L(double temperature = -1.0, double pressure = -1.0) const;

/**
* Return Pitzer's definition of A_J. This is basically the temperature
Expand All @@ -1271,8 +1270,7 @@ class HMWSoln : public MolalityVPSSTP
* @param pressure Pressure of the derivative calculation
* or -1 to indicate the current pressure
*/
double ADebye_J(double temperature = -1.0,
double pressure = -1.0) const;
double ADebye_J(double temperature = -1.0, double pressure = -1.0) const;

/**
* Return Pitzer's definition of A_V. This is the derivative wrt pressure of
Expand All @@ -1289,8 +1287,7 @@ class HMWSoln : public MolalityVPSSTP
* @param pressure Pressure of the derivative calculation
* or -1 to indicate the current pressure
*/
double ADebye_V(double temperature = -1.0,
double pressure = -1.0) const;
double ADebye_V(double temperature = -1.0, double pressure = -1.0) const;

//! Value of the 2nd derivative of the Debye Huckel constant with respect to
//! temperature as a function of temperature and pressure.
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/thermo/LatticePhase.h
Expand Up @@ -189,8 +189,7 @@ class LatticePhase : public ThermoPhase
* an empty phase will be created.
* @param id string id of the phase name
*/
explicit LatticePhase(const string& inputFile="",
const string& id="");
explicit LatticePhase(const string& inputFile="", const string& id="");

virtual string type() const {
return "lattice";
Expand Down
5 changes: 2 additions & 3 deletions include/cantera/thermo/MixtureFugacityTP.h
Expand Up @@ -418,7 +418,7 @@ class MixtureFugacityTP : public ThermoPhase
* return a -2.
*/
virtual double densityCalc(double TKelvin, double pressure, int phaseRequested,
double rhoguess);
double rhoguess);

protected:
//! Utility routine in the calculation of the saturation pressure
Expand Down Expand Up @@ -469,8 +469,7 @@ class MixtureFugacityTP : public ThermoPhase
* @param molarVolLiquid (return) Molar volume of the liquid
* @returns the saturation pressure at the given temperature
*/
double calculatePsat(double TKelvin, double& molarVolGas,
double& molarVolLiquid);
double calculatePsat(double TKelvin, double& molarVolGas, double& molarVolLiquid);

public:
//! Calculate the saturation pressure at the current mixture content for the
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/thermo/MolalityVPSSTP.h
Expand Up @@ -537,8 +537,7 @@ class MolalityVPSSTP : public VPStandardStateTP
getdlnActCoeffdlnN_numderiv(ld, dlnActCoeffdlnN);
}

virtual string report(bool show_thermo=true,
double threshold=1e-14) const;
virtual string report(bool show_thermo=true, double threshold=1e-14) const;

protected:
virtual void getCsvReportData(vector<string>& names,
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/thermo/PDSS_HKFT.h
Expand Up @@ -230,8 +230,7 @@ class PDSS_HKFT : public PDSS_Molar
* - 2 2nd derivative wrt temperature
* - 3 derivative wrt pressure
*/
double gstar(const double temp, const double pres,
const int ifunc = 0) const;
double gstar(const double temp, const double pres, const int ifunc = 0) const;

//! Function to look up Element Free Energies
/*!
Expand Down
6 changes: 2 additions & 4 deletions include/cantera/thermo/PengRobinson.h
Expand Up @@ -164,17 +164,15 @@ class PengRobinson : public MixtureFugacityTP
* @param b @f$ a @f$ parameter in the Peng-Robinson model [m^3/kmol]
* @param w acentric factor
*/
void setSpeciesCoeffs(const string& species, double a, double b,
double w);
void setSpeciesCoeffs(const string& species, double a, double b, double w);

//! Set values for the interaction parameter between two species
/*!
* @param species_i Name of one species
* @param species_j Name of the other species
* @param a @f$ a @f$ parameter in the Peng-Robinson model [Pa-m^6/kmol^2]
*/
void setBinaryCoeffs(const string& species_i,
const string& species_j, double a);
void setBinaryCoeffs(const string& species_i, const string& species_j, double a);
//! @}

protected:
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/thermo/PureFluidPhase.h
Expand Up @@ -186,8 +186,7 @@ class PureFluidPhase : public ThermoPhase
virtual void initThermo();
virtual void getParameters(AnyMap& phaseNode) const;

virtual string report(bool show_thermo=true,
double threshold=1e-14) const;
virtual string report(bool show_thermo=true, double threshold=1e-14) const;

virtual bool compatibleWithMultiPhase() const {
return false;
Expand Down

0 comments on commit 25f6834

Please sign in to comment.