Skip to content

Commit

Permalink
Squelch more pedantic warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhbell committed Feb 24, 2024
1 parent 99b9125 commit 3d4940d
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions include/teqp/algorithms/ancillary_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ auto build_ancillaries(const AbstractModel& model, double Tcritguess, double rho

if (verify){
// Verify
for (auto i = 0; i < Thetas_.size(); ++i){
for (auto i = 0U; i < Thetas_.size(); ++i){
double T = (1-Thetas_[i])*Tcrittrue;

double rhoLanc = anc.rhoL(T);
double rhoVanc = anc.rhoV(T);
double panc = anc.pL(T);
// double panc = anc.pL(T);
if (std::abs(rhoLanc/rhoLs_[i]-1) > 1e-2){
std::cout << T << " " << rhoLs_[i] << " " << rhoLanc << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion include/teqp/ideal_eosterms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ namespace teqp {
// std::cout << term.dump() << std::endl;
std::valarray<double> t = term.at("t"), c = term.at("c");
double T_0 = term.at("T0");
for (auto i = 0; i < t.size(); ++i){
for (auto i = 0U; i < t.size(); ++i){
if (t[i] == 0){
newterms.push_back({{"type", "Cp0Constant"}, {"c", c[i]}, {"T_0", T_0}, {"R", R}});
}
Expand Down
4 changes: 2 additions & 2 deletions include/teqp/json_tools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ namespace teqp{
// Then copy elements over
for (auto i = 0U; i < m.size(); ++i){
auto row = m[i];
if (row.size() != mat.rows()){
if (row.size() != static_cast<std::size_t>(mat.rows())){
throw std::invalid_argument("provided matrix is not square");
}
for (auto k = 0; k < row.size(); ++k){
for (auto k = 0U; k < row.size(); ++k){
mat(i, k) = row[k];
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/teqp/math/finite_derivs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ auto centered_diff(const Function &f, const Scalar x, const Scalar h) {
throw std::invalid_argument("Finite differentiation coefficient arrays not the same size");
}
Scalar num = 0.0;
for (auto i = 0; i < k.size(); ++i) {
for (auto i = 0U; i < k.size(); ++i) {
num = num + c[i]*f(x + h*k[i]);
}
auto val = num / pow(h, Nderiv);
Expand Down
4 changes: 2 additions & 2 deletions include/teqp/models/CPA.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ class CPACubic {
auto get_ab(const TType T, const VecType& molefrac) const {
using return_type = std::common_type_t<decltype(T), decltype(molefrac[0])>;
return_type asummer = 0.0, bsummer = 0.0;
for (auto i = 0; i < molefrac.size(); ++i) {
for (auto i = 0U; i < molefrac.size(); ++i) {
bsummer += molefrac[i] * bi[i];
auto ai = get_ai(T, i);
for (auto j = 0; j < molefrac.size(); ++j) {
for (auto j = 0U; j < molefrac.size(); ++j) {
auto aj = get_ai(T, j);
auto a_ij = (1.0 - k_ij[i][j]) * sqrt(ai * aj);
asummer += molefrac[i] * molefrac[j] * a_ij;
Expand Down
4 changes: 2 additions & 2 deletions include/teqp/models/GERG/GERG.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class GERG200XCorrespondingStatesTerm{
if (N != size()){
throw std::invalid_argument("wrong size");
}
for (auto i = 0; i < N; ++i) {
for (auto i = 0U; i < N; ++i) {
alphar += molefracs[i] * EOSs[i].alphar(tau, delta);
}
return forceeval(alphar);
Expand Down Expand Up @@ -286,7 +286,7 @@ class GERG200XDepartureTerm {
throw std::invalid_argument("wrong size");
}

for (auto i = 0; i < N; ++i){
for (auto i = 0U; i < N; ++i){
for (auto j = i+1; j < N; ++j){
auto Fij = Fmat(i,j);
if (Fij != 0){
Expand Down
22 changes: 11 additions & 11 deletions include/teqp/models/cubics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ class GenericCubic {
template<typename TType, typename CompType>
auto get_a(TType T, const CompType& molefracs) const {
std::common_type_t<TType, decltype(molefracs[0])> a_ = 0.0;
for (auto i = 0; i < molefracs.size(); ++i) {
for (auto i = 0U; i < molefracs.size(); ++i) {
auto alphai = forceeval(std::visit([&](auto& t) { return t(T); }, alphas[i]));
auto ai_ = forceeval(this->ai[i] * alphai);
for (auto j = 0; j < molefracs.size(); ++j) {
for (auto j = 0U; j < molefracs.size(); ++j) {
auto alphaj = forceeval(std::visit([&](auto& t) { return t(T); }, alphas[j]));
auto aj_ = this->ai[j] * alphaj;
auto aij = forceeval((1 - kmat(i,j)) * sqrt(ai_ * aj_));
Expand All @@ -234,7 +234,7 @@ class GenericCubic {
template<typename TType, typename CompType>
auto get_b(TType /*T*/, const CompType& molefracs) const {
std::common_type_t<TType, decltype(molefracs[0])> b_ = 0.0;
for (auto i = 0; i < molefracs.size(); ++i) {
for (auto i = 0U; i < molefracs.size(); ++i) {
b_ = b_ + molefracs[i] * bi[i];
}
return forceeval(b_);
Expand Down Expand Up @@ -501,13 +501,13 @@ class WilsonResidualHelmholtzOverRT {
using TYPE = std::common_type_t<TType, decltype(molefracs[0])>;
// The denominator in Phi
TYPE Vtot = 0.0;
for (auto i = 0; i < molefracs.size(); ++i){
for (auto i = 0U; i < molefracs.size(); ++i){
auto v_i = b[i];
Vtot += molefracs[i]*v_i;
}

TYPE summer = 0.0;
for (auto i = 0; i < molefracs.size(); ++i){
for (auto i = 0U; i < molefracs.size(); ++i){
auto v_i = b[i];
// The ratio phi_i/z_i is expressed like this to better handle
// the case of z_i = 0, which would otherwise be a divide by zero
Expand All @@ -528,10 +528,10 @@ class WilsonResidualHelmholtzOverRT {

using TYPE = std::common_type_t<TType, decltype(molefracs[0])>;
TYPE summer = 0.0;
for (auto i = 0; i < molefracs.size(); ++i){
for (auto i = 0U; i < molefracs.size(); ++i){
auto v_i = b[i];
TYPE summerj = 0.0;
for (auto j = 0; j < molefracs.size(); ++j){
for (auto j = 0U; j < molefracs.size(); ++j){
auto v_j = b[j];
auto Aij = get_Aij(i,j,T);
auto Omega_ji = v_j/v_i*exp(-Aij/T);
Expand Down Expand Up @@ -675,7 +675,7 @@ class AdvancedPRaEres {
auto get_am_over_bm(TType T, const CompType& molefracs) const {
auto aEresRT = std::visit([&](auto& aresRTfunc) { return aresRTfunc(T, molefracs); }, ares); // aEres/RT, so a non-dimensional quantity
std::common_type_t<TType, decltype(molefracs[0])> summer = aEresRT*Ru*T/CEoS;
for (auto i = 0; i < molefracs.size(); ++i) {
for (auto i = 0U; i < molefracs.size(); ++i) {
summer += molefracs[i]*get_ai(T,i)/get_bi(T,i);
}
return forceeval(summer);
Expand All @@ -687,9 +687,9 @@ class AdvancedPRaEres {

switch (brule){
case AdvancedPRaEMixingRules::kQuadratic:
for (auto i = 0; i < molefracs.size(); ++i) {
for (auto i = 0U; i < molefracs.size(); ++i) {
auto bi_ = get_bi(T, i);
for (auto j = 0; j < molefracs.size(); ++j) {
for (auto j = 0U; j < molefracs.size(); ++j) {
auto bj_ = get_bi(T, j);

auto bij = (1 - lmat(i,j)) * pow((pow(bi_, 1.0/s) + pow(bj_, 1.0/s))/2.0, s);
Expand All @@ -698,7 +698,7 @@ class AdvancedPRaEres {
}
break;
case AdvancedPRaEMixingRules::kLinear:
for (auto i = 0; i < molefracs.size(); ++i) {
for (auto i = 0U; i < molefracs.size(); ++i) {
b_ += molefracs[i] * get_bi(T, i);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion include/teqp/models/model_potentials/LJChain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace teqp {
}

template<class VecType>
auto R(const VecType& molefrac) const {
auto R(const VecType& /*molefrac*/) const {
return 1.0;
}
};
Expand Down
4 changes: 2 additions & 2 deletions include/teqp/models/multifluid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CorrespondingStatesContribution {
using resulttype = std::common_type_t<decltype(tau), decltype(molefracs[0]), decltype(delta)>; // Type promotion, without the const-ness
resulttype alphar = 0.0;
auto N = molefracs.size();
for (auto i = 0; i < N; ++i) {
for (auto i = 0U; i < N; ++i) {
alphar = alphar + molefracs[i] * EOSs[i].alphar(tau, delta);
}
return forceeval(alphar);
Expand Down Expand Up @@ -164,7 +164,7 @@ class MultiFluid {
const RhoType &rho,
const MoleFracType& molefrac) const
{
if (molefrac.size() != corr.size()){
if (static_cast<std::size_t>(molefrac.size()) != corr.size()){
throw teqp::InvalidArgument("Wrong size of mole fractions; "+std::to_string(corr.size()) + " are loaded but "+std::to_string(molefrac.size()) + " were provided");
}
auto Tred = forceeval(redfunc.get_Tr(molefrac));
Expand Down
2 changes: 1 addition & 1 deletion include/teqp/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace teqp {
/// A constexpr function for ensuring that an argument to a function is NOT an expr,
/// which can have surprising behavior
template<typename T>
void error_if_expr(T&& expr)
void error_if_expr(T&& /*expr*/)
{
using namespace autodiff::detail;
if constexpr (isExpr<T>) {
Expand Down
1 change: 1 addition & 0 deletions interface/C/teqpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ TEST_CASE("Use of C interface","[teqpc]") {
};
std::string js = j.dump(2);
int e1 = build_model(js.c_str(), &uuidMF, errmsg, errmsg_length);
REQUIRE(e1 == 0);
}
{
nlohmann::json jmodel = nlohmann::json::object();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/GERG2008.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
// Kunz, O., Klimeck, R., Wagner, W., and Jaeschke, M.
// The GERG-2004 Wide-Range Equation of State for Natural Gases and Other Mixtures
// GERG Technical Monograph 15
// Fortschr.-Ber. VDI, Reihe 6, Nr. 557, VDI Verlag, Düsseldorf, 2007.
// Fortschr.-Ber. VDI, Reihe 6, Nr. 557, VDI Verlag, Dusseldorf, 2007.
// http://www.gerg.eu/public/uploads/files/publications/technical_monographs/tm15_04.pdf

// Subroutines contained here for property calculations:
Expand Down
8 changes: 4 additions & 4 deletions src/tests/catch_test_GERG.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TEST_CASE("Load all GERG2004 models", "[GERG2004]"){
}
CHECK_THROWS(GERG2004::get_pure_info("NOT A FLUID"));

for (auto i = 0; i < names.size(); ++i){
for (auto i = 0U; i < names.size(); ++i){
for (auto j = i+1; j < names.size(); ++j){
CHECK_NOTHROW(GERG2004::get_betasgammas(names[i], names[j]));
CHECK_NOTHROW(GERG2004::get_betasgammas(names[j], names[i]));
Expand Down Expand Up @@ -61,7 +61,7 @@ TEST_CASE("Load all GERG2008 models", "[GERG2008]"){
}
CHECK_THROWS(GERG2008::get_pure_info("NOT A FLUID"));

for (auto i = 0; i < names.size(); ++i){
for (auto i = 0U; i < names.size(); ++i){
for (auto j = i+1; j < names.size(); ++j){
CHECK_NOTHROW(GERG2008::get_betasgammas(names[i], names[j]));
CHECK_NOTHROW(GERG2008::get_betasgammas(names[j], names[i]));
Expand Down Expand Up @@ -498,7 +498,7 @@ TEST_CASE("Validate all GERG2008 binaries", "[GERG20082]"){

double R = 8.314472;

for (auto i = 0; i < components.size(); ++i){
for (auto i = 0U; i < components.size(); ++i){
for(auto j = i+1; j < components.size(); ++j){

double T_K = 300;
Expand Down Expand Up @@ -546,7 +546,7 @@ TEST_CASE("Validate all GERG2008 models", "[GERG2008]"){
auto model = GERG2008::GERG2008ResidualModel(components);

SetupGERG();
for (auto i = 0; i < validation_data.size(); ++i){
for (auto i = 0U; i < validation_data.size(); ++i){
double p_given_MPa = validation_data[i].P_MPa;

double rho = validation_data[i].D_molL*1e3;
Expand Down
1 change: 0 additions & 1 deletion src/tests/catch_test_Grayiteration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ TEST_CASE("Test critical points against Kiyohara results", "[polarizability]"){
double Tstar = Tc/epsilon_over_kB;
double rhostar = rhoc*N_A*pow(sigma_m,3);
std::cout << mustar << "," << alphastar << "," << Tstar << "," << rhostar << std::endl;
int tt =0;
}
}
}
3 changes: 2 additions & 1 deletion src/tests/catch_test_SAFTpolar.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ TEST_CASE("Evaluation of J^{(n)}", "[LuckasJn]")
{
LuckasJIntegral J12{12};
auto Jval = J12.get_J(3.0, 1.0);
CHECK(Jval != 0);
}

TEST_CASE("Evaluation of K(xxx, yyy)", "[LuckasKnn]")
Expand Down Expand Up @@ -218,7 +219,7 @@ TEST_CASE("Check Stockmayer critical points with polarity terms", "[SAFTVRMiepol
if (print) std::cout << "0, " << Tstar_guess << ", " << rhostar_guess << std::endl;

double mustar2factor = 1.0/(4*static_cast<double>(EIGEN_PI)*8.8541878128e-12*1.380649e-23);
double Qstar2factor = 1.0/(4*static_cast<double>(EIGEN_PI)*8.8541878128e-12*1.380649e-23);
// double Qstar2factor = 1.0/(4*static_cast<double>(EIGEN_PI)*8.8541878128e-12*1.380649e-23);
j["model"]["polar_model"] = polar_model;

for (double mustar2 = 0.1; mustar2 < 5; mustar2 += 0.1){
Expand Down
2 changes: 1 addition & 1 deletion src/tests/catch_test_alphaig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using Catch::Approx;

using namespace teqp;

nlohmann::json demo_pure_term(double a_1, double a_2){
nlohmann::json demo_pure_term(double /*a_1*/, double /*a_2*/){
nlohmann::json j0 = nlohmann::json::array();
j0.push_back({ {"type", "Lead"}, { "a_1", 1 }, { "a_2", 2 } });
return {{"R", 8.31446261815324}, {"terms", j0}};
Expand Down
2 changes: 1 addition & 1 deletion src/tests/catch_test_cubics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ TEST_CASE("Check manual integration of subcritical VLE isobar for binary mixture
double pfinal = get_p(X0, T);

double diffs = 0;
for (auto i = 0; i < X0.size(); ++i) {
for (auto i = 0U; i < X0.size(); ++i) {
diffs += std::abs(pinit-pfinal);
}
CHECK(diffs < 0.1);
Expand Down
1 change: 0 additions & 1 deletion src/tests/catch_test_mutant.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ TEST_CASE("Test infinite dilution critical locus derivatives for multifluid muta
auto infdil = ct::get_drhovec_dT_crit(mutant, T0, rhovec0);
auto der = ct::get_derivs(mutant, T0, rhovec0);
auto epinfdil = ct::eigen_problem(mutant, T0, rhovec0);
using tdx = TDXDerivatives<decltype(mutant), double, Eigen::ArrayXd>;
auto z = (rhovec0 / rhovec0.sum()).eval();
auto alphar = mutant.alphar(T0, rhoc0, z);
return std::make_tuple(T0, rhoc0, alphar, infdil, der);
Expand Down

0 comments on commit 3d4940d

Please sign in to comment.