Skip to content

Commit

Permalink
Clean up line wrapping and indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Aug 5, 2023
1 parent c50b8b4 commit 53396d4
Show file tree
Hide file tree
Showing 100 changed files with 244 additions and 423 deletions.
7 changes: 3 additions & 4 deletions include/cantera/base/AnyMap.h
Expand Up @@ -533,7 +533,7 @@ class AnyMap : public AnyBase
* thrown if this condition is not met.
*/
vector<double> convertVector(const string& key, const string& units,
size_t nMin=npos, size_t nMax=npos) const;
size_t nMin=npos, size_t nMax=npos) const;

//! Defined to allow use with range-based for loops. Iteration automatically
//! skips over keys that start and end with double underscores.
Expand Down Expand Up @@ -771,9 +771,8 @@ class InputFileError : public CanteraError
return "InputFileError";
}
protected:
static string formatError(const string& message,
int line, int column,
const shared_ptr<AnyMap>& metadata);
static string formatError(const string& message, int line, int column,
const shared_ptr<AnyMap>& metadata);
static string formatError2(const string& message,
int line1, int column1, const shared_ptr<AnyMap>& metadata1,
int line2, int column2, const shared_ptr<AnyMap>& metadata2);
Expand Down
6 changes: 2 additions & 4 deletions include/cantera/base/ExtensionManager.h
Expand Up @@ -74,8 +74,7 @@ class ExtensionManager
//! @param rateName The name of the reaction rate type, which corresponds to the
//! name used to register the wrapper generator using registerReactionDataLinker
//! @param data The ReactionData object to be wrapped
static void wrapReactionData(const string& rateName,
ReactionDataDelegator& data);
static void wrapReactionData(const string& rateName, ReactionDataDelegator& data);

//! Create an object in an external language that wraps the specified Solution
//! object.
Expand Down Expand Up @@ -108,8 +107,7 @@ class ExtensionManager

protected:
//! Functions for wrapping and linking ReactionData objects
static map<string,
function<void(ReactionDataDelegator&)>> s_ReactionData_linkers;
static map<string, function<void(ReactionDataDelegator&)>> s_ReactionData_linkers;

//! Functions for wrapping and linking Solution objects
static map<string,
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/base/Units.h
Expand Up @@ -207,8 +207,7 @@ class UnitSystem
void setDefaultActivationEnergy(const string& e_units);

//! Convert `value` from the units of `src` to the units of `dest`.
double convert(double value, const string& src,
const string& dest) const;
double convert(double value, const string& src, const string& dest) const;
double convert(double value, const Units& src, const Units& dest) const;

//! Convert `value` to the specified `dest` units from the appropriate units
Expand Down
6 changes: 2 additions & 4 deletions include/cantera/base/ctexceptions.h
Expand Up @@ -80,8 +80,7 @@ class CanteraError : public std::exception
* @param args Arguments which will be used to interpolate the format string
*/
template <typename... Args>
CanteraError(const string& procedure, const string& msg,
const Args&... args)
CanteraError(const string& procedure, const string& msg, const Args&... args)
: procedure_(procedure)
{
if (sizeof...(args) == 0) {
Expand Down Expand Up @@ -202,8 +201,7 @@ class NotImplementedError : public CanteraError

//! Alternative constructor taking same arguments as CanteraError
template <typename... Args>
NotImplementedError(const string& func, const string& msg,
const Args&... args) :
NotImplementedError(const string& func, const string& msg, const Args&... args) :
CanteraError(func, msg, args...) {}

virtual string getClass() const {
Expand Down
9 changes: 3 additions & 6 deletions include/cantera/base/global.h
Expand Up @@ -224,8 +224,7 @@ void _warn_deprecated(const string& method, const string& extra="");
* @param args arguments for the format string
*/
template <typename... Args>
void warn_deprecated(const string& method, const string& msg,
const Args&... args) {
void warn_deprecated(const string& method, const string& msg, const Args&... args) {
if (sizeof...(args) == 0) {
_warn_deprecated(method, msg);
} else {
Expand All @@ -236,8 +235,7 @@ void warn_deprecated(const string& method, const string& msg,
//! @cond

//! helper function passing generic warning to global handler
void _warn(const string& warning,
const string& method, const string& extra);
void _warn(const string& warning, const string& method, const string& extra);

//! @endcond

Expand Down Expand Up @@ -266,8 +264,7 @@ void warn(const string& warning, const string& method,
* @param args arguments for the format string
*/
template <typename... Args>
void warn_user(const string& method, const string& msg,
const Args&... args) {
void warn_user(const string& method, const string& msg, const Args&... args) {
if (sizeof...(args) == 0) {
_warn("Cantera", method, msg);
} else {
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/base/stringUtils.h
Expand Up @@ -25,8 +25,7 @@ namespace Cantera
* @param fmt Format to be used (printf style) for each element
* @param sep Separator
*/
string vec2str(const vector<double>& v, const string& fmt="%g",
const string& sep=", ");
string vec2str(const vector<double>& v, const string& fmt="%g", const string& sep=", ");

//! Strip non-printing characters wherever they are
/*!
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/base/utilities.h
Expand Up @@ -79,8 +79,7 @@ inline double dot5(const V& x, const V& y)
* @return The return is hard-coded to return a double.
*/
template<class InputIter, class InputIter2>
inline double dot(InputIter x_begin, InputIter x_end,
InputIter2 y_begin)
inline double dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
{
return std::inner_product(x_begin, x_end, y_begin, 0.0);
}
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/kinetics/Kinetics.h
Expand Up @@ -1512,8 +1512,7 @@ class Kinetics
* @return 0.0 if the stoichiometries are not multiples of one another
* Otherwise, it returns the ratio of the stoichiometric coefficients.
*/
double checkDuplicateStoich(map<int, double>& r1,
map<int, double>& r2) const;
double checkDuplicateStoich(map<int, double>& r1, map<int, double>& r2) const;

//! @name Stoichiometry management
//!
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/kinetics/Reaction.h
Expand Up @@ -327,8 +327,7 @@ unique_ptr<Reaction> newReaction(const AnyMap& rxn_node,
//! Create Reaction objects for each item (an AnyMap) in `items`. The species
//! involved in these reactions must exist in the phases associated with the
//! Kinetics object `kinetics`.
vector<shared_ptr<Reaction>> getReactions(const AnyValue& items,
Kinetics& kinetics);
vector<shared_ptr<Reaction>> getReactions(const AnyValue& items, Kinetics& kinetics);

//! Parse reaction equation
void parseReactionEquation(Reaction& R, const string& equation,
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/kinetics/ReactionPath.h
Expand Up @@ -95,8 +95,7 @@ class Path
* Add a reaction to the path. Increment the flow from this reaction, the
* total flow, and the flow associated with this label.
*/
void addReaction(size_t rxnNumber, double value,
const string& label = "");
void addReaction(size_t rxnNumber, double value, const string& label = "");

//! Upstream node.
const SpeciesNode* begin() const {
Expand Down
14 changes: 5 additions & 9 deletions include/cantera/kinetics/StoichManager.h
Expand Up @@ -363,31 +363,27 @@ class C_AnyN
}
}

void incrementSpecies(const double* input,
double* output) const {
void incrementSpecies(const double* input, double* output) const {
double x = input[m_rxn];
for (size_t n = 0; n < m_n; n++) {
output[m_ic[n]] += m_stoich[n]*x;
}
}

void decrementSpecies(const double* input,
double* output) const {
void decrementSpecies(const double* input, double* output) const {
double x = input[m_rxn];
for (size_t n = 0; n < m_n; n++) {
output[m_ic[n]] -= m_stoich[n]*x;
}
}

void incrementReaction(const double* input,
double* output) const {
void incrementReaction(const double* input, double* output) const {
for (size_t n = 0; n < m_n; n++) {
output[m_rxn] += m_stoich[n]*input[m_ic[n]];
}
}

void decrementReaction(const double* input,
double* output) const {
void decrementReaction(const double* input, double* output) const {
for (size_t n = 0; n < m_n; n++) {
output[m_rxn] -= m_stoich[n]*input[m_ic[n]];
}
Expand Down Expand Up @@ -677,7 +673,7 @@ 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(\
throw CanteraError(
"StoichManagerN::add()", "size of order and species arrays differ");
}
if (stoich.size() != k.size()) {
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/numerics/funcs.h
Expand Up @@ -35,8 +35,7 @@ namespace Cantera
* @returns the value of of the interpolated function at x.
* @ingroup mathUtils
*/
double linearInterp(double x, const vector<double>& xpts,
const vector<double>& fpts);
double linearInterp(double x, const vector<double>& xpts, const vector<double>& fpts);

//! Numerical integration of a function using the trapezoidal rule.
/*!
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/oneD/Domain1D.h
Expand Up @@ -322,8 +322,7 @@ class Domain1D
* @param[in] rdt Reciprocal of the timestep (`rdt=0` implies steady-
* state.)
*/
virtual void eval(size_t j, double* x, double* r,
integer* mask, double rdt=0.0) {
virtual void eval(size_t j, double* x, double* r, integer* mask, double rdt=0.0) {
throw NotImplementedError("Domain1D::eval");
}

Expand Down
8 changes: 3 additions & 5 deletions include/cantera/oneD/MultiNewton.h
Expand Up @@ -34,8 +34,7 @@ class MultiNewton

//! Compute the undamped Newton step. The residual function is evaluated
//! at `x`, but the Jacobian is not recomputed.
void step(double* x, double* step,
OneDim& r, MultiJac& jac, int loglevel);
void step(double* x, double* step, OneDim& r, MultiJac& jac, int loglevel);

/**
* Return the factor by which the undamped Newton step 'step0'
Expand All @@ -52,9 +51,8 @@ class MultiNewton
* successful, the new solution after taking the damped step is returned in
* x1, and the undamped step at x1 is returned in step1.
*/
int dampStep(const double* x0, const double* step0,
double* x1, double* step1, double& s1,
OneDim& r, MultiJac& jac, int loglevel, bool writetitle);
int dampStep(const double* x0, const double* step0, double* x1, double* step1,
double& s1, 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;
Expand Down
8 changes: 3 additions & 5 deletions include/cantera/oneD/Sim1D.h
Expand Up @@ -138,8 +138,7 @@ class Sim1D : public OneDim
* @param loglevel Level of diagnostic output
* @deprecated To be removed after %Cantera 3.0; loglevel is deprecated.
*/
void save(const string& fname, const string& id,
const string& desc, int loglevel);
void save(const string& fname, const string& id, const string& desc, int loglevel);

/**
* Save current simulation data to a container file or CSV format.
Expand Down Expand Up @@ -168,9 +167,8 @@ class Sim1D : public OneDim
* if not specified (default=""), the native basis of the underlying
* ThermoPhase manager is used - @see nativeState (CSV only)
*/
void save(const string& fname, const string& name,
const string& desc, bool overwrite=false, int compression=0,
const string& basis="");
void save(const string& fname, const string& name, const string& desc,
bool overwrite=false, int compression=0, const string& basis="");

/**
* Save the residual of the current solution to a container file.
Expand Down
12 changes: 4 additions & 8 deletions include/cantera/thermo/ConstCpPoly.h
Expand Up @@ -80,20 +80,16 @@ class ConstCpPoly: public SpeciesThermoInterpType
* - m_t[0] = tt;
*
*/
void updateProperties(const double* tt,
double* cp_R, double* h_RT,
void updateProperties(const double* tt, double* cp_R, double* h_RT,
double* s_R) const;

void updatePropertiesTemp(const double temp,
double* cp_R, double* h_RT,
void updatePropertiesTemp(const double temp, double* cp_R, double* h_RT,
double* s_R) const;

size_t nCoeffs() const { return 4; }

void reportParameters(size_t& n, int& type,
double& tlow, double& thigh,
double& pref,
double* const coeffs) const;
void reportParameters(size_t& n, int& type, double& tlow, double& thigh,
double& pref, double* const coeffs) const;

virtual void getParameters(AnyMap& thermo) const;

Expand Down
6 changes: 2 additions & 4 deletions include/cantera/thermo/DebyeHuckel.h
Expand Up @@ -422,8 +422,7 @@ class DebyeHuckel : public MolalityVPSSTP
* If blank, an empty phase will be created.
* @param id id attribute containing the name of the phase.
*/
explicit DebyeHuckel(const string& inputFile="",
const string& id="");
explicit DebyeHuckel(const string& inputFile="", const string& id="");

//! @name Utilities
//! @{
Expand Down Expand Up @@ -623,8 +622,7 @@ class DebyeHuckel : public MolalityVPSSTP
virtual bool addSpecies(shared_ptr<Species> spec);
virtual void initThermo();
virtual void getParameters(AnyMap& phaseNode) const;
virtual void getSpeciesParameters(const string& name,
AnyMap& speciesNode) const;
virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const;

//! Return the Debye Huckel constant as a function of temperature
//! and pressure (Units = sqrt(kg/gmol))
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/thermo/IdealGasPhase.h
Expand Up @@ -258,8 +258,7 @@ class IdealGasPhase: public ThermoPhase
* @param id ID of the phase in the input file. Defaults to the
* empty string.
*/
explicit IdealGasPhase(const string& inputFile="",
const string& id="");
explicit IdealGasPhase(const string& inputFile="", const string& id="");

virtual string type() const {
return "ideal-gas";
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/thermo/IdealMolalSoln.h
Expand Up @@ -76,8 +76,7 @@ class IdealMolalSoln : public MolalityVPSSTP
* about the phase. If blank, an empty phase will be created.
* @param id id of the phase within the input file
*/
explicit IdealMolalSoln(const string& inputFile="",
const string& id="");
explicit IdealMolalSoln(const string& inputFile="", const string& id="");

virtual string type() const {
return "ideal-molal-solution";
Expand Down
6 changes: 2 additions & 4 deletions include/cantera/thermo/IdealSolidSolnPhase.h
Expand Up @@ -53,8 +53,7 @@ class IdealSolidSolnPhase : public ThermoPhase
* @param id The name of this phase. This is used to look up
* the phase in the input file.
*/
explicit IdealSolidSolnPhase(const string& infile="",
const string& id="");
explicit IdealSolidSolnPhase(const string& infile="", const string& id="");

virtual string type() const {
return "ideal-condensed";
Expand Down Expand Up @@ -526,8 +525,7 @@ class IdealSolidSolnPhase : public ThermoPhase
virtual bool addSpecies(shared_ptr<Species> spec);
virtual void initThermo();
virtual void getParameters(AnyMap& phaseNode) const;
virtual void getSpeciesParameters(const string& name,
AnyMap& speciesNode) const;
virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const;
virtual void setToEquilState(const double* mu_RT);

//! Set the form for the standard and generalized concentrations
Expand Down
6 changes: 3 additions & 3 deletions include/cantera/thermo/IonsFromNeutralVPSSTP.h
Expand Up @@ -79,8 +79,7 @@ class IonsFromNeutralVPSSTP : public GibbsExcessVPSSTP
* @param id name (ID) of the phase in the input file. If empty, the
* first phase definition in the input file will be used.
*/
explicit IonsFromNeutralVPSSTP(const string& inputFile="",
const string& id="");
explicit IonsFromNeutralVPSSTP(const string& inputFile="", const string& id="");

//! @}
//! @name Utilities
Expand Down Expand Up @@ -179,7 +178,8 @@ class IonsFromNeutralVPSSTP : public GibbsExcessVPSSTP
* This is the mapping between ion species and neutral molecule for
* quick invert.
*/
void getDissociationCoeffs(vector<double>& fm_neutralMolec_ions, vector<double>& charges, vector<size_t>& neutMolIndex) const;
void getDissociationCoeffs(vector<double>& fm_neutralMolec_ions,
vector<double>& charges, vector<size_t>& neutMolIndex) const;

//! Return the current value of the neutral mole fraction vector
/*!
Expand Down
3 changes: 1 addition & 2 deletions include/cantera/thermo/LatticePhase.h
Expand Up @@ -553,8 +553,7 @@ class LatticePhase : public ThermoPhase

virtual void initThermo();
virtual void getParameters(AnyMap& phaseNode) const;
virtual void getSpeciesParameters(const string& name,
AnyMap& speciesNode) const;
virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const;

//! @}

Expand Down
3 changes: 1 addition & 2 deletions include/cantera/thermo/LatticeSolidPhase.h
Expand Up @@ -435,8 +435,7 @@ class LatticeSolidPhase : public ThermoPhase
const AnyMap& rootNode=AnyMap());
virtual void initThermo();
virtual void getParameters(AnyMap& phaseNode) const;
virtual void getSpeciesParameters(const string& name,
AnyMap& speciesNode) const;
virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const;

//! Set the Lattice mole fractions using a string
/*!
Expand Down

0 comments on commit 53396d4

Please sign in to comment.