From 619cd20f149079d0f2f0fb322fd129a82727e746 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 29 Jul 2015 18:10:18 -0400 Subject: [PATCH] Fix badly-formatted else/else if/catch clauses --- samples/cxx/bvp/blasius.cpp | 11 +++---- src/base/ctml.cpp | 9 +++--- src/equil/MultiPhase.cpp | 23 +++++---------- src/equil/vcs_MultiPhaseEquil.cpp | 14 ++++----- src/equil/vcs_phaseStability.cpp | 5 ++-- src/equil/vcs_solve_TP.cpp | 15 ++++------ src/kinetics/Kinetics.cpp | 5 ++-- src/kinetics/ReactionPath.cpp | 21 +++++--------- src/kinetics/solveSP.cpp | 11 ++++--- src/matlab/flowdevicemethods.cpp | 8 ++--- src/matlab/funcmethods.cpp | 4 +-- src/matlab/kineticsmethods.cpp | 11 ++----- src/matlab/mixturemethods.cpp | 15 +++------- src/matlab/onedimmethods.cpp | 14 +++------ src/matlab/phasemethods.cpp | 29 +++++-------------- src/matlab/reactormethods.cpp | 8 ++--- src/matlab/reactornetmethods.cpp | 7 ++--- src/matlab/surfmethods.cpp | 6 ++-- src/matlab/thermomethods.cpp | 16 ++++------ src/matlab/transportmethods.cpp | 10 ++----- src/matlab/wallmethods.cpp | 8 ++--- src/numerics/RootFind.cpp | 4 +-- src/oneD/MultiNewton.cpp | 16 ++++------ src/oneD/OneDim.cpp | 8 ++--- src/oneD/StFlow.cpp | 8 ++--- src/oneD/boundaries1D.cpp | 6 ++-- src/thermo/HMWSoln.cpp | 14 ++++----- src/thermo/IdealMolalSoln.cpp | 6 ++-- src/thermo/ThermoPhase.cpp | 3 +- src/transport/GasTransport.cpp | 17 +++++------ .../ChemEquil_ionizedGas/ionizedGasEquil.cpp | 4 +-- 31 files changed, 114 insertions(+), 222 deletions(-) diff --git a/samples/cxx/bvp/blasius.cpp b/samples/cxx/bvp/blasius.cpp index 91fd80035..c843d227d 100644 --- a/samples/cxx/bvp/blasius.cpp +++ b/samples/cxx/bvp/blasius.cpp @@ -73,21 +73,18 @@ public: if (n == 0) { if (isLeft(j)) { // here we specify zeta(0) = 0 return zeta(x,j); - } else + } else { // this implements d(zeta)/dz = u - { return (zeta(x,j) - zeta(x,j-1))/(z(j)-z(j-1)) - u(x,j); } - } - // if n = 1, then return the residual for the second ODE - else { + } else { + // if n = 1, then return the residual for the second ODE if (isLeft(j)) { // here we specify u(0) = 0 return u(x,j); } else if (isRight(j)) { // and here we specify u(L) = 1 return u(x,j) - 1.0; - } else + } else { // this implements the 2nd ODE - { return cdif2(x,1,j) + 0.5*zeta(x,j)*centralFirstDeriv(x,1,j); } } diff --git a/src/base/ctml.cpp b/src/base/ctml.cpp index 84a29c259..244aad36d 100644 --- a/src/base/ctml.cpp +++ b/src/base/ctml.cpp @@ -217,16 +217,15 @@ doublereal getFloatCurrent(const XML_Node& node, const std::string& type) writelog("\nWarning: conversion toSI() was done on node value " + node.name() + "but wasn't explicitly requested. Type was \"" + type + "\"\n"); #endif - } - // Note, below currently produces a lot of output due to transport blocks. - // This needs to be addressed. #ifdef DEBUG_MODE_MORE - else if (type == "" && units != "") { + } else if (type == "" && units != "") { + // Note, below currently produces a lot of output due to transport blocks. + // This needs to be addressed. writelog("\nWarning: XML node " + node.name() + "has a units attribute, \"" + units + "\"," "but no conversion was done because the getFloat() command didn't have a type\n"); - } #endif + } return fctr*x; } diff --git a/src/equil/MultiPhase.cpp b/src/equil/MultiPhase.cpp index d6417186c..53bb5109a 100644 --- a/src/equil/MultiPhase.cpp +++ b/src/equil/MultiPhase.cpp @@ -585,9 +585,7 @@ double MultiPhase::equilibrate_MultiPhaseEquil(int XY, doublereal err, throw err; } return err; - } - - else if (XY == HP) { + } else if (XY == HP) { h0 = enthalpy(); Tlow = 0.5*m_Tmin; // lower bound on T Thigh = 2.0*m_Tmax; // upper bound on T @@ -610,10 +608,9 @@ double MultiPhase::equilibrate_MultiPhaseEquil(int XY, doublereal err, Tlow = m_temp; Hlow = hnow; } - } - // the current enthalpy is greater than the target; therefore the - // current temperature is too high. - else { + } else { + // the current enthalpy is greater than the target; therefore the + // current temperature is too high. if (m_temp < Thigh) { Thigh = m_temp; Hhigh = hnow; @@ -649,9 +646,7 @@ double MultiPhase::equilibrate_MultiPhaseEquil(int XY, doublereal err, strt = false; } - } - - catch (CanteraError& err) { + } catch (CanteraError& err) { err.save(); if (!strt) { strt = true; @@ -699,9 +694,7 @@ double MultiPhase::equilibrate_MultiPhaseEquil(int XY, doublereal err, if (dta < 100.0) { strt = false; } - } - - catch (CanteraError& err) { + } catch (CanteraError& err) { err.save(); if (!strt) { strt = true; @@ -736,9 +729,7 @@ double MultiPhase::equilibrate_MultiPhaseEquil(int XY, doublereal err, dVdP = (volume() - vnow)/(0.01*pnow); setPressure(pnow + 0.5*(v0 - vnow)/dVdP); } - } - - else { + } else { throw CanteraError("MultiPhase::equilibrate_MultiPhaseEquil", "unknown option"); } diff --git a/src/equil/vcs_MultiPhaseEquil.cpp b/src/equil/vcs_MultiPhaseEquil.cpp index f03727243..138a0108b 100644 --- a/src/equil/vcs_MultiPhaseEquil.cpp +++ b/src/equil/vcs_MultiPhaseEquil.cpp @@ -210,10 +210,9 @@ int vcs_MultiPhaseEquil::equilibrate_HP(doublereal Htarget, Tlow = Tnow; Hlow = Hnow; } - } - // the current enthalpy is greater than the target; therefore the - // current temperature is too high. Set the high bounds. - else { + } else { + // the current enthalpy is greater than the target; therefore the + // current temperature is too high. Set the high bounds. if (Tnow < Thigh) { Thigh = Tnow; Hhigh = Hnow; @@ -340,10 +339,9 @@ int vcs_MultiPhaseEquil::equilibrate_SP(doublereal Starget, } } } - } - // the current enthalpy is greater than the target; therefore the - // current temperature is too high. Set the high bounds. - else { + } else { + // the current enthalpy is greater than the target; therefore the + // current temperature is too high. Set the high bounds. if (Tnow < Thigh) { Thigh = Tnow; Shigh = Snow; diff --git a/src/equil/vcs_phaseStability.cpp b/src/equil/vcs_phaseStability.cpp index f9ef32241..71c0bb8d1 100644 --- a/src/equil/vcs_phaseStability.cpp +++ b/src/equil/vcs_phaseStability.cpp @@ -80,9 +80,8 @@ bool VCS_SOLVE::vcs_popPhasePossible(const size_t iphasePop) const if (foundJrxn) { return true; } - } - // Second we are here if the component is a reactant in the reaction, and the reaction goes backwards. - else if (m_stoichCoeffRxnMatrix(kspec,jrxn) < 0.0) { + } else if (m_stoichCoeffRxnMatrix(kspec,jrxn) < 0.0) { + // Second we are here if the component is a reactant in the reaction, and the reaction goes backwards. foundJrxn = true; size_t jspec = jrxn + m_numComponents; if (m_molNumSpecies_old[jspec] <= VCS_DELETE_ELEMENTABS_CUTOFF*0.5) { diff --git a/src/equil/vcs_solve_TP.cpp b/src/equil/vcs_solve_TP.cpp index 0afa33e61..de19e0026 100644 --- a/src/equil/vcs_solve_TP.cpp +++ b/src/equil/vcs_solve_TP.cpp @@ -1482,8 +1482,7 @@ void VCS_SOLVE::solve_tp_equilib_check(bool& allMinorZeroedSpecies, plogf(" MAJOR SPECIES CONVERGENCE achieved"); plogendl(); } - } - else if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { + } else if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { plogf(" MAJOR SPECIES CONVERGENCE achieved " "(because there are no major species)"); plogendl(); @@ -2755,8 +2754,7 @@ int VCS_SOLVE::vcs_basopt(const bool doJustComponents, double aw[], double sa[], } vcs_switch_pos(false, jr, k); std::swap(aw[jr], aw[k]); - } - else if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { + } else if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { plogf(" --- %-12.12s", m_speciesName[k].c_str()); if (m_speciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { plogf("(Volts = %9.2g) remains ", m_molNumSpecies_old[k]); @@ -4201,11 +4199,10 @@ void VCS_SOLVE::vcs_deltag_Phase(const size_t iphase, const bool doDeleted, deltaGRxn[irxn] += m_stoichCoeffRxnMatrix(kcomp,irxn) * feSpecies[kcomp]; } } - } - /* - * Multispecies Phase - */ - else { + } else { + /* + * Multispecies Phase + */ bool zeroedPhase = true; for (size_t irxn = 0; irxn < irxnl; ++irxn) { diff --git a/src/kinetics/Kinetics.cpp b/src/kinetics/Kinetics.cpp index 99be32d85..c89357ac8 100644 --- a/src/kinetics/Kinetics.cpp +++ b/src/kinetics/Kinetics.cpp @@ -508,9 +508,8 @@ void Kinetics::addPhase(thermo_t& thermo) if (m_thermo.size() > 0) { m_start.push_back(m_start.back() + m_thermo.back()->nSpecies()); - } - // otherwise start at 0 - else { + } else { + // otherwise start at 0 m_start.push_back(0); } diff --git a/src/kinetics/ReactionPath.cpp b/src/kinetics/ReactionPath.cpp index 3b4294b5b..2c75988b9 100644 --- a/src/kinetics/ReactionPath.cpp +++ b/src/kinetics/ReactionPath.cpp @@ -330,9 +330,7 @@ void ReactionPathDiagram::exportToDot(ostream& s) } } } - } - - else { + } else { for (size_t i = 0; i < nPaths(); i++) { p = path(i); flmax = std::max(p->flow(), flmax); @@ -862,16 +860,13 @@ int ReactionPathBuilder::build(Kinetics& s, const string& element, f = g[kkr][kkp].nAtoms(m); } } - } - - // no ambiguity about where the m-atoms come - // from or go to. Either all reactant m atoms - // end up in one product, or only one reactant - // contains all the m-atoms. In either case, - // the number of atoms transferred is given by - // the same expression. - - else { + } else { + // no ambiguity about where the m-atoms come + // from or go to. Either all reactant m atoms + // end up in one product, or only one reactant + // contains all the m-atoms. In either case, + // the number of atoms transferred is given by + // the same expression. f = m_atoms(kkp,m) * m_atoms(kkr,m) / m_elatoms(m, i); } diff --git a/src/kinetics/solveSP.cpp b/src/kinetics/solveSP.cpp index 99a36a31e..57704f06b 100644 --- a/src/kinetics/solveSP.cpp +++ b/src/kinetics/solveSP.cpp @@ -276,12 +276,11 @@ int solveSP::solveSurfProb(int ifunc, doublereal time_scale, doublereal TKelvin, info = m_Jac.factor(); if (info==0) { m_Jac.solve(&m_resid[0]); - } - /* - * Force convergence if residual is small to avoid - * "nan" results from the linear solve. - */ - else { + } else { + /* + * Force convergence if residual is small to avoid + * "nan" results from the linear solve. + */ if (m_ioflag) { printf("solveSurfSS: Zero pivot, assuming converged: %g (%d)\n", resid_norm, info); diff --git a/src/matlab/flowdevicemethods.cpp b/src/matlab/flowdevicemethods.cpp index 46ecf7094..d07b782bf 100644 --- a/src/matlab/flowdevicemethods.cpp +++ b/src/matlab/flowdevicemethods.cpp @@ -64,12 +64,8 @@ void flowdevicemethods(int nlhs, mxArray* plhs[], reportError(); } return; - } - - - // options that return a value of type 'double' - - else if (job < 40) { + } else if (job < 40) { + // options that return a value of type 'double' switch (job) { case 21: r = flowdev_massFlowRate(i, v); diff --git a/src/matlab/funcmethods.cpp b/src/matlab/funcmethods.cpp index 3581b34e1..028c3010e 100644 --- a/src/matlab/funcmethods.cpp +++ b/src/matlab/funcmethods.cpp @@ -33,9 +33,7 @@ void funcmethods(int nlhs, mxArray* plhs[], reportError(); } return; - } - - else { + } else { int nn = 0; double t; double v = 0.0; diff --git a/src/matlab/kineticsmethods.cpp b/src/matlab/kineticsmethods.cpp index 3a69c660a..e347a84f6 100644 --- a/src/matlab/kineticsmethods.cpp +++ b/src/matlab/kineticsmethods.cpp @@ -29,10 +29,8 @@ void kineticsmethods(int nlhs, mxArray* plhs[], double* h = mxGetPr(plhs[0]); *h = vv; return; - } - - // methods - else if (job > 0) { + } else if (job > 0) { + // methods int isp = 1; if (job < 5 || job > 6) { checkNArgs(4,nrhs); @@ -147,10 +145,7 @@ void kineticsmethods(int nlhs, mxArray* plhs[], reportError(); } } - } - - else { - + } else { // set attributes int iok = -1; job = -job; diff --git a/src/matlab/mixturemethods.cpp b/src/matlab/mixturemethods.cpp index cdfb2f9ad..54b19959e 100644 --- a/src/matlab/mixturemethods.cpp +++ b/src/matlab/mixturemethods.cpp @@ -77,12 +77,8 @@ void mixturemethods(int nlhs, mxArray* plhs[], reportError(); } return; - } - - - // options that return a value of type 'double' - - else if (job < 40) { + } else if (job < 40) { + // options that return a value of type 'double' switch (job) { case 19: r = (double) mix_nPhases(i); @@ -143,11 +139,8 @@ void mixturemethods(int nlhs, mxArray* plhs[], reportError(); } return; - } - - // species properties - else if (job < 60) { - + } else if (job < 60) { + // species properties int iok = 0; mwSize nsp = (mwSize) mix_nSpecies(i); std::vector x(nsp); diff --git a/src/matlab/onedimmethods.cpp b/src/matlab/onedimmethods.cpp index a0f411d9d..d9b4e8c8c 100644 --- a/src/matlab/onedimmethods.cpp +++ b/src/matlab/onedimmethods.cpp @@ -105,10 +105,8 @@ void onedimmethods(int nlhs, mxArray* plhs[], reportError(); } return; - } - - // methods - else if (job < 40) { + } else if (job < 40) { + // methods int k; switch (job) { @@ -185,9 +183,7 @@ void onedimmethods(int nlhs, mxArray* plhs[], reportError(); } return; - } - - else if (job < 50) { + } else if (job < 50) { int iok = -1; int buflen, icomp; char* output_buf; @@ -208,10 +204,8 @@ void onedimmethods(int nlhs, mxArray* plhs[], mexErrMsgTxt("error or unknown method."); return; } - } - + } else { // set parameters - else { int iok = -1; double lower, upper, rtol, atol, *grid, *pos, *values, mdot, t, p, val, *temp, ratio, slope, curve, tstep, *dts, diff --git a/src/matlab/phasemethods.cpp b/src/matlab/phasemethods.cpp index a246a71cc..508700790 100644 --- a/src/matlab/phasemethods.cpp +++ b/src/matlab/phasemethods.cpp @@ -45,10 +45,8 @@ void phasemethods(int nlhs, mxArray* plhs[], default: mexErrMsgTxt("Unknown job number"); } - } - - // set array attributes - else if (mjob < 30) { + } else if (mjob < 30) { + // set array attributes if ((m == nsp && n == 1) || (m == 1 && n == nsp)) { int norm = 1; switch (mjob) { @@ -72,10 +70,8 @@ void phasemethods(int nlhs, mxArray* plhs[], } else { mexErrMsgTxt("wrong array size"); } - } - - // set attributes from a string - else { + } else { + // set attributes from a string int status; mwSize buflen; char* input_buf; @@ -107,11 +103,8 @@ void phasemethods(int nlhs, mxArray* plhs[], mexErrMsgTxt("expected a string."); } } - } - - else if (job < 20) { + } else if (job < 20) { double threshold; - switch (job) { case 0: vv = (double) newThermoFromXML(ph); @@ -166,9 +159,7 @@ void phasemethods(int nlhs, mxArray* plhs[], double* h = mxGetPr(plhs[0]); *h = vv; return; - } - - else if (job < 30) { + } else if (job < 30) { iok = 0; size_t nsp = phase_nSpecies(ph); std::vector x(nsp); @@ -199,9 +190,7 @@ void phasemethods(int nlhs, mxArray* plhs[], mexErrMsgTxt("unknown attribute"); return; } - } - - else if (job < 40) { + } else if (job < 40) { iok = 0; size_t nel = phase_nElements(ph); std::vector x(nel); @@ -226,9 +215,7 @@ void phasemethods(int nlhs, mxArray* plhs[], mexErrMsgTxt("unknown attribute"); return; } - } - - else if (job < 50) { + } else if (job < 50) { iok = -1; int ksp, mel; int buflen; diff --git a/src/matlab/reactormethods.cpp b/src/matlab/reactormethods.cpp index abde89953..21b099a55 100644 --- a/src/matlab/reactormethods.cpp +++ b/src/matlab/reactormethods.cpp @@ -67,12 +67,8 @@ void reactormethods(int nlhs, mxArray* plhs[], reportError(); } return; - } - - - // options that return a value of type 'double' - - else if (job < 40) { + } else if (job < 40) { + // options that return a value of type 'double' switch (job) { case 23: r = reactor_mass(i); diff --git a/src/matlab/reactornetmethods.cpp b/src/matlab/reactornetmethods.cpp index da82dbab4..acdc88810 100644 --- a/src/matlab/reactornetmethods.cpp +++ b/src/matlab/reactornetmethods.cpp @@ -71,11 +71,8 @@ void reactornetmethods(int nlhs, mxArray* plhs[], reportError(); } return; - } - - // options that return a value of type 'double' - - else if (job < 40) { + } else if (job < 40) { + // options that return a value of type 'double' switch (job) { case 21: r = reactornet_step(i, v); diff --git a/src/matlab/surfmethods.cpp b/src/matlab/surfmethods.cpp index 5448b761c..c2dd05975 100644 --- a/src/matlab/surfmethods.cpp +++ b/src/matlab/surfmethods.cpp @@ -60,10 +60,8 @@ void surfmethods(int nlhs, mxArray* plhs[], double* h = mxGetPr(plhs[0]); *h = double(iok); return; - } - - // return array parameters - else if (job < 200) { + } else if (job < 200) { + // return array parameters nsp = phase_nSpecies(surf); std::vector x(nsp); iok = -1; diff --git a/src/matlab/thermomethods.cpp b/src/matlab/thermomethods.cpp index e82604d32..5a8e42459 100644 --- a/src/matlab/thermomethods.cpp +++ b/src/matlab/thermomethods.cpp @@ -36,10 +36,8 @@ static void thermoset(int nlhs, mxArray* plhs[], default: mexErrMsgTxt("unknown attribute."); } - } - - // property pairs - else if (job < 40) { + } else if (job < 40) { + // property pairs if ((m == 2 && n == 1) || (m == 1 && n == 2)) { switch (job) { case 20: @@ -69,10 +67,8 @@ static void thermoset(int nlhs, mxArray* plhs[], } else { mexErrMsgTxt("wrong size"); } - } - - // equilibrate - else if (job == 50) { + } else if (job == 50) { + // equilibrate char* xy = getString(prhs[3]); int solver = getInt(prhs[4]); double rtol = getDouble(prhs[5]); @@ -230,9 +226,7 @@ static void thermoget(int nlhs, mxArray* plhs[], mexErrMsgTxt("unknown attribute"); return; } - } - - else { + } else { mexErrMsgTxt("unknown attribute"); } } diff --git a/src/matlab/transportmethods.cpp b/src/matlab/transportmethods.cpp index 0ecf30146..0c6d5747f 100644 --- a/src/matlab/transportmethods.cpp +++ b/src/matlab/transportmethods.cpp @@ -72,9 +72,7 @@ void transportmethods(int nlhs, mxArray* plhs[], default: mexErrMsgTxt("unknown Transport method"); } - } - - else if (job < 30) { + } else if (job < 30) { nsp = getInt(prhs[3]); plhs[0] = mxCreateNumericMatrix(nsp,nsp,mxDOUBLE_CLASS,mxREAL); h = mxGetPr(plhs[0]); @@ -88,10 +86,8 @@ void transportmethods(int nlhs, mxArray* plhs[], default: mexErrMsgTxt("unknown Transport method"); } - } - - // set parameters - else if (job < 40) { + } else if (job < 40) { + // set parameters double* params; int typ, k; switch (job) { diff --git a/src/matlab/wallmethods.cpp b/src/matlab/wallmethods.cpp index 1d1b2994b..6211f41fb 100644 --- a/src/matlab/wallmethods.cpp +++ b/src/matlab/wallmethods.cpp @@ -83,12 +83,8 @@ void wallmethods(int nlhs, mxArray* plhs[], reportError(); } return; - } - - - // options that return a value of type 'double' - - else if (job < 40) { + } else if (job < 40) { + // options that return a value of type 'double' switch (job) { case 21: r = wall_vdot(i, v); diff --git a/src/numerics/RootFind.cpp b/src/numerics/RootFind.cpp index 25bd76818..4659d204e 100644 --- a/src/numerics/RootFind.cpp +++ b/src/numerics/RootFind.cpp @@ -855,9 +855,7 @@ int RootFind::solve(doublereal xmin, doublereal xmax, int itmax, doublereal& fun converged = 1; rfT.reasoning += "NormalConvergence"; retn = ROOTFIND_SUCCESS; - } - - else if (fabs(slope) > 1.0E-100) { + } else if (fabs(slope) > 1.0E-100) { double xdels = fabs(fnew / slope); if (xdels < deltaXConverged_ * 0.3) { converged = 1; diff --git a/src/oneD/MultiNewton.cpp b/src/oneD/MultiNewton.cpp index 5eb823371..a2f387ff5 100644 --- a/src/oneD/MultiNewton.cpp +++ b/src/oneD/MultiNewton.cpp @@ -379,18 +379,14 @@ int MultiNewton::solve(doublereal* x0, doublereal* x1, // step, and try again. if (m == 0) { copy(x1, x1 + m_n, m_x.begin()); - } - - // convergence - else if (m == 1) { + } else if (m == 1) { + // convergence jac.setAge(0); // for efficient sensitivity analysis break; - } - - // If dampStep fails, first try a new Jacobian if an old - // one was being used. If it was a new Jacobian, then - // return -1 to signify failure. - else if (m < 0) { + } else if (m < 0) { + // If dampStep fails, first try a new Jacobian if an old + // one was being used. If it was a new Jacobian, then + // return -1 to signify failure. if (jac.age() > 1) { forceNewJac = true; if (nJacReeval > 3) { diff --git a/src/oneD/OneDim.cpp b/src/oneD/OneDim.cpp index e44817dd8..3bfdef712 100644 --- a/src/oneD/OneDim.cpp +++ b/src/oneD/OneDim.cpp @@ -349,11 +349,9 @@ doublereal OneDim::timeStep(int nsteps, doublereal dt, doublereal* x, dt *= 1.5; } dt = std::min(dt, m_tmax); - } - - // No solution could be found with this time step. - // Decrease the stepsize and try again. - else { + } else { + // No solution could be found with this time step. + // Decrease the stepsize and try again. writelog("...failure.\n", loglevel); dt *= m_tfactor; if (dt < m_tmin) diff --git a/src/oneD/StFlow.cpp b/src/oneD/StFlow.cpp index 740d3853e..06c4c2827 100644 --- a/src/oneD/StFlow.cpp +++ b/src/oneD/StFlow.cpp @@ -378,9 +378,7 @@ void StFlow::eval(size_t jg, doublereal* xg, -(m_flux(k,0) + rho_u(x,0)* Y(x,k,0)); } rsd[index(c_offset_Y, 0)] = 1.0 - sum; - } - - else if (j == m_points - 1) { + } else if (j == m_points - 1) { evalRightBoundary(x, rsd, diag, rdt); } else { // interior points @@ -983,9 +981,7 @@ void FreeFlame::evalContinuity(size_t j, doublereal* x, doublereal* rsd, rsd[index(c_offset_U,j)] = - (rho_u(x,j) - rho_u(x,j-1))/m_dz[j-1] - (density(j-1)*V(x,j-1) + density(j)*V(x,j)); - } - - else if (grid(j) == m_zfixed) { + } else if (grid(j) == m_zfixed) { if (m_do_energy[j]) { rsd[index(c_offset_U,j)] = (T(x,j) - m_tfixed); } else { diff --git a/src/oneD/boundaries1D.cpp b/src/oneD/boundaries1D.cpp index c9800ba63..f5a059b24 100644 --- a/src/oneD/boundaries1D.cpp +++ b/src/oneD/boundaries1D.cpp @@ -205,10 +205,8 @@ void Inlet1D::eval(size_t jg, doublereal* xg, doublereal* rg, r[0] = m_mdot - x[0]; rb[3] = xb[3]; } - } - - // right inlet. - else { + } else { + // right inlet. size_t boffset = m_flow->nComponents(); xb = x - boffset; rb = r - boffset; diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index 1d295ffb5..64ea08ced 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -4925,11 +4925,10 @@ void HMWSoln::calc_thetas(int z1, int z2, if (z1*z2 < 0) { *etheta = 0.0; *etheta_prime = 0.0; - } - /* - * Actually calculate the interaction. - */ - else { + } else { + /* + * Actually calculate the interaction. + */ double f1 = (double)i / (2.0 * j); double f2 = (double)j / (2.0 * i); *etheta = elambda[i*j] - f1*elambda[j*j] - f2*elambda[i*i]; @@ -5007,9 +5006,8 @@ void HMWSoln::s_updateIMS_lnMolalityActCoeff() const } IMS_lnActCoeffMolal_[m_indexSolvent] = lngammao; } - } - // Exponentials - trial 2 - else if (IMS_typeCutoff_ == 2) { + } else if (IMS_typeCutoff_ == 2) { + // Exponentials - trial 2 if (xmolSolvent > IMS_X_o_cutoff_) { for (size_t k = 1; k < m_kk; k++) { IMS_lnActCoeffMolal_[k]= 0.0; diff --git a/src/thermo/IdealMolalSoln.cpp b/src/thermo/IdealMolalSoln.cpp index 443c01c7b..a250d68f3 100644 --- a/src/thermo/IdealMolalSoln.cpp +++ b/src/thermo/IdealMolalSoln.cpp @@ -696,10 +696,8 @@ void IdealMolalSoln::s_updateIMS_lnMolalityActCoeff() const } IMS_lnActCoeffMolal_[m_indexSolvent] = lngammao; } - } - - // Exponentials - trial 2 - else if (IMS_typeCutoff_ == 2) { + } else if (IMS_typeCutoff_ == 2) { + // Exponentials - trial 2 if (xmolSolvent > IMS_X_o_cutoff_) { for (size_t k = 1; k < m_kk; k++) { IMS_lnActCoeffMolal_[k]= 0.0; diff --git a/src/thermo/ThermoPhase.cpp b/src/thermo/ThermoPhase.cpp index 647f345cc..6adfc8d96 100644 --- a/src/thermo/ThermoPhase.cpp +++ b/src/thermo/ThermoPhase.cpp @@ -1019,8 +1019,7 @@ std::string ThermoPhase::report(bool show_thermo, doublereal threshold) const nMinor, xMinor, yMinor); s += p; } - } - catch (CanteraError& err) { + } catch (CanteraError& err) { err.save(); } return s; diff --git a/src/transport/GasTransport.cpp b/src/transport/GasTransport.cpp index e7136a63e..ead4e2f1f 100644 --- a/src/transport/GasTransport.cpp +++ b/src/transport/GasTransport.cpp @@ -555,10 +555,8 @@ void GasTransport::fitCollisionIntegrals(MMCollisionInt& integrals) m_cstar_poly.push_back(cc); m_poly[i][j] = static_cast(m_astar_poly.size()) - 1; fitlist.push_back(dstar); - } - - // delta* found in fitlist, so just point to this polynomial - else { + } else { + // delta* found in fitlist, so just point to this polynomial m_poly[i][j] = static_cast((dptr - fitlist.begin())); } m_poly[j][i] = m_poly[i][j]; @@ -719,25 +717,26 @@ void GasTransport::fitProperties(MMCollisionInt& integrals) writelogf("Maximum viscosity relative error: %12.6g\n", mxrelerr); writelog("\nPolynomial fits for conductivity:\n"); - if (m_mode == CK_Mode) + if (m_mode == CK_Mode) { writelog("log(conductivity) fit to cubic polynomial in log(T)"); - else { + } else { writelogf("conductivity/sqrt(T) fit to " "polynomial of degree %d in log(T)", degree); } - if (m_log_level >= 2) + if (m_log_level >= 2) { for (size_t k = 0; k < m_nsp; k++) { writelog(m_thermo->speciesName(k) + ": [" + vec2str(m_condcoeffs[k]) + "]\n"); } + } writelogf("Maximum conductivity absolute error: %12.6g\n", mxerr_cond); writelogf("Maximum conductivity relative error: %12.6g\n", mxrelerr_cond); // fit the binary diffusion coefficients for each species pair writelogf("\nbinary diffusion coefficients:\n"); - if (m_mode == CK_Mode) + if (m_mode == CK_Mode) { writelog("log(D) fit to cubic polynomial in log(T)"); - else { + } else { writelogf("D/T**(3/2) fit to polynomial of degree %d in log(T)",degree); } } diff --git a/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp b/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp index 933ec2cef..24d69a9ca 100644 --- a/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp +++ b/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp @@ -81,9 +81,7 @@ int main(int argc, char** argv) } delete gas; fclose(FF); - } - - catch (CanteraError& err) { + } catch (CanteraError& err) { std::cout << err.what() << std::endl; return -1; }