From 2161a2713a6a8c0506cb7903c2b595d421a0c343 Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Sat, 24 Feb 2024 11:35:15 -0500 Subject: [PATCH] More integers --- include/teqp/models/GERG/GERG.hpp | 4 ++-- include/teqp/models/pcsaft.hpp | 10 +++++----- include/teqp/models/saftvrmie.hpp | 6 +++--- interface/C/teqpc.cpp | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/teqp/models/GERG/GERG.hpp b/include/teqp/models/GERG/GERG.hpp index 8f736852..dd24c875 100644 --- a/include/teqp/models/GERG/GERG.hpp +++ b/include/teqp/models/GERG/GERG.hpp @@ -187,7 +187,7 @@ class GERG200XCorrespondingStatesTerm{ using resulttype = std::common_type_t; // Type promotion, without the const-ness resulttype alphar = 0.0; auto N = molefracs.size(); - if (N != size()){ + if (static_cast(N) != size()){ throw std::invalid_argument("wrong size"); } for (auto i = 0U; i < N; ++i) { @@ -282,7 +282,7 @@ class GERG200XDepartureTerm { using resulttype = std::common_type_t; // Type promotion, without the const-ness resulttype alphar = 0.0; auto N = molefracs.size(); - if (N != static_cast(Fmat.cols())){ + if (static_cast(N) != static_cast(Fmat.cols())){ throw std::invalid_argument("wrong size"); } diff --git a/include/teqp/models/pcsaft.hpp b/include/teqp/models/pcsaft.hpp index f0ab28e5..63464707 100644 --- a/include/teqp/models/pcsaft.hpp +++ b/include/teqp/models/pcsaft.hpp @@ -214,9 +214,9 @@ class PCSAFTHardChainContribution{ c.m2_epsilon_sigma3_bar = static_cast(0.0); c.m2_epsilon2_sigma3_bar = static_cast(0.0); c.d.resize(N); - for (std::size_t i = 0; i < N; ++i) { + for (auto i = 0L; i < N; ++i) { c.d[i] = sigma_Angstrom[i]*(1.0 - 0.12 * exp(-3.0*epsilon_over_k[i]/T)); // [A] - for (std::size_t j = 0; j < N; ++j) { + for (auto j = 0; j < N; ++j) { // Eq. A.5 auto sigma_ij = 0.5 * sigma_Angstrom[i] + 0.5 * sigma_Angstrom[j]; auto eij_over_k = sqrt(epsilon_over_k[i] * epsilon_over_k[j]) * (1.0 - kmat(i,j)); @@ -293,7 +293,7 @@ class PCSAFTMixture { std::optional dipolar; // Can be present or not std::optional quadrupolar; // Can be present or not - void check_kmat(std::size_t N) { + void check_kmat(Eigen::Index N) { if (kmat.cols() != kmat.rows()) { throw teqp::InvalidArgument("kmat rows and columns are not identical"); } @@ -431,7 +431,7 @@ inline auto PCSAFTfactory(const nlohmann::json& spec) { if (spec.contains("names")){ std::vector names = spec["names"]; - if (kmat && kmat.value().rows() != names.size()){ + if (kmat && static_cast(kmat.value().rows()) != names.size()){ throw teqp::InvalidArgument("Provided length of names of " + std::to_string(names.size()) + " does not match the dimension of the kmat of " + std::to_string(kmat.value().rows())); } return PCSAFTMixture(names, kmat.value_or(Eigen::ArrayXXd{})); @@ -455,7 +455,7 @@ inline auto PCSAFTfactory(const nlohmann::json& spec) { } coeffs.push_back(c); } - if (kmat && kmat.value().rows() != coeffs.size()){ + if (kmat && static_cast(kmat.value().rows()) != coeffs.size()){ throw teqp::InvalidArgument("Provided length of coeffs of " + std::to_string(coeffs.size()) + " does not match the dimension of the kmat of " + std::to_string(kmat.value().rows())); } return PCSAFTMixture(coeffs, kmat.value_or(Eigen::ArrayXXd{})); diff --git a/include/teqp/models/saftvrmie.hpp b/include/teqp/models/saftvrmie.hpp index 963b82b8..37df9052 100644 --- a/include/teqp/models/saftvrmie.hpp +++ b/include/teqp/models/saftvrmie.hpp @@ -745,7 +745,7 @@ class SAFTVRMieMixture { const SAFTVRMieChainContributionTerms terms; const std::optional polar; // Can be present or not - static void check_kmat(const Eigen::ArrayXXd& kmat, std::size_t N) { + static void check_kmat(const Eigen::ArrayXXd& kmat, Eigen::Index N) { if (kmat.size() == 0){ return; } @@ -940,7 +940,7 @@ inline auto SAFTVRMiefactory(const nlohmann::json & spec){ if (spec.contains("names")){ std::vector names = spec["names"]; - if (kmat && kmat.value().rows() != names.size()){ + if (kmat && static_cast(kmat.value().rows()) != names.size()){ throw teqp::InvalidArgument("Provided length of names of " + std::to_string(names.size()) + " does not match the dimension of the kmat of " + std::to_string(kmat.value().rows())); } return SAFTVRMieMixture(names, kmat); @@ -974,7 +974,7 @@ inline auto SAFTVRMiefactory(const nlohmann::json & spec){ } coeffs.push_back(c); } - if (kmat && kmat.value().rows() != coeffs.size()){ + if (kmat && static_cast(kmat.value().rows()) != coeffs.size()){ throw teqp::InvalidArgument("Provided length of coeffs of " + std::to_string(coeffs.size()) + " does not match the dimension of the kmat of " + std::to_string(kmat.value().rows())); } diff --git a/interface/C/teqpc.cpp b/interface/C/teqpc.cpp index df6d95b9..c8b905b0 100644 --- a/interface/C/teqpc.cpp +++ b/interface/C/teqpc.cpp @@ -39,12 +39,12 @@ std::unordered_map(buffer_length)){ strcpy(message_buffer, msg.c_str()); } else{ std::string toolong_message = "Error message too long for buffer"; - if (toolong_message.size() < buffer_length){ + if (toolong_message.size() < static_cast(buffer_length)){ strcpy(message_buffer, toolong_message.c_str()); } else if (buffer_length > 1){