Skip to content

Commit

Permalink
Fix variables that hide class members
Browse files Browse the repository at this point in the history
As noted by MSVC; to improve clarity
  • Loading branch information
ianhbell committed Jan 5, 2025
1 parent e15bc25 commit 047f510
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion include/teqp/models/CPA.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ inline auto CPAfactory(const nlohmann::json &j){
}
}
else{
kmat.resize(N); for (auto i = 0U; i < N; ++i){ kmat[i].resize(N); for (auto j = 0U; j < N; ++j){kmat[i][j] = 0.0;} }
kmat.resize(N); for (auto i = 0U; i < N; ++i){ kmat[i].resize(N); for (auto k = 0U; k < N; ++k){kmat[i][k] = 0.0;} }
}

std::size_t i = 0;
Expand Down
10 changes: 5 additions & 5 deletions include/teqp/models/activity/COSMOSAC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ class COSMO3 {
Eigen::Index min_ileft = 51, max_iright = 0;
for (auto i = 0U; i < profiles.size(); ++i) {
const Eigen::ArrayXd psigma = profiles[i].nhb.psigma(A_COSMO_A2[i]);
Eigen::Index ileft = 0, iright = psigma.size();
for (auto ii = 0; ii < psigma.size(); ++ii) { if (std::abs(psigma(ii)) > 1e-16) { ileft = ii; break; } }
for (auto ii = psigma.size() - 1; ii > ileft; --ii) { if (std::abs(psigma(ii)) > 1e-16) { iright = ii; break; } }
if (ileft < min_ileft) { min_ileft = ileft; }
if (iright > max_iright) { max_iright = iright; }
Eigen::Index ileft_ = 0, iright_ = psigma.size();
for (auto ii = 0; ii < psigma.size(); ++ii) { if (std::abs(psigma(ii)) > 1e-16) { ileft_ = ii; break; } }
for (auto ii = psigma.size() - 1; ii > ileft_; --ii) { if (std::abs(psigma(ii)) > 1e-16) { iright_ = ii; break; } }
if (ileft_ < min_ileft) { min_ileft = ileft_; }
if (iright_ > max_iright) { max_iright = iright_; }
}
return std::make_tuple(min_ileft, max_iright);
}
Expand Down
14 changes: 7 additions & 7 deletions include/teqp/models/association/association.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Association{
std::vector<std::vector<std::string>> molecule_sites;
};
private:
IndexMapper make_mapper(const std::vector<std::vector<std::string>>& molecule_sites, const AssociationOptions& options) const {
IndexMapper make_mapper(const std::vector<std::vector<std::string>>& molecule_sites, const AssociationOptions& options_in) const {
IndexMapper ind;
ind.counts.resize(1000);
ind.comp_index.resize(1000);
Expand All @@ -90,7 +90,7 @@ class Association{
++site_counts[site];
}
auto unique_sites_on_molecule = std::set(molecule.begin(), molecule.end());
if (!options.site_order.empty()){
if (!options_in.site_order.empty()){
// TODO: enforce sites to appear in the order matching the specification
// TODO: this would be required to for instance check the D matrix of Langenbach and Enders
}
Expand Down Expand Up @@ -118,9 +118,9 @@ class Association{
/***
Construct the counting matrix \f$ D_{IJ} \f$ as given by Langenbach and Enders
*/
auto make_D(const IndexMapper& ind, const AssociationOptions& options ) const{
auto make_D(const IndexMapper& ind, const AssociationOptions& options_in ) const{

auto get_DIJ = [&ind, &options](std::size_t I, std::size_t J) -> int {
auto get_DIJ = [&ind, &options_in](std::size_t I, std::size_t J) -> int {
/** Return the value of an entry in the D_{IJ} matrix
For a given unique site, look at all other sites on all other molecules
Expand All @@ -129,17 +129,17 @@ class Association{
auto [ph2, typej] = ind.to_CompSite.at(J);

// If self-association is disabled for this site, then return zero for the D matrix
if (!options.self_association_mask.empty() && ph1 == ph2 && !options.self_association_mask[ph1]){
if (!options_in.self_association_mask.empty() && ph1 == ph2 && !options_in.self_association_mask[ph1]){
return 0;
}
auto contains = [](auto& container, const auto& val){ return std::find(container.begin(), container.end(), val) != container.end(); };
/// If interaction parameters are not provided, assume conservatively that all sites can interact with all other sites
if (options.interaction_partners.empty() || (contains(options.interaction_partners.at(typei), typej))){
if (options_in.interaction_partners.empty() || (contains(options_in.interaction_partners.at(typei), typej))){
return ind.counts[J];
}
return 0;
};
if (!options.self_association_mask.empty() && options.self_association_mask.size() != static_cast<std::size_t>(ind.N_sites.size())){
if (!options_in.self_association_mask.empty() && options_in.self_association_mask.size() != static_cast<std::size_t>(ind.N_sites.size())){
throw teqp::InvalidArgument("self_association_mask is of the wrong size");
}
int Ngroups = static_cast<int>(ind.to_siteid.size());
Expand Down

0 comments on commit 047f510

Please sign in to comment.