Skip to content

Commit

Permalink
Merge pull request #424 from pdziekan/naming_cleanup
Browse files Browse the repository at this point in the history
rename variables to point out that dry_sizes takes number of SD, not …
  • Loading branch information
pdziekan authored Jan 26, 2023
2 parents 59c6407 + f050d79 commit 62f5d18
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions bindings/python/lgrngn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,14 @@ namespace libcloudphxx
const bp::dict size_conc = bp::extract<bp::dict>(kappa_func.values()[j]);
std::map<real_t, std::pair<real_t, int>> size_conc_map;

// turn the size : {conc, multi} dict into a size : {conc, multi} map
// turn the size : {conc, count} dict into a size : {conc, count} map
for (int i = 0; i < len(size_conc.keys()); ++i)
{
const bp::list conc_multi_list = bp::extract<bp::list>(size_conc.values()[i]);
assert(len(conc_multi_list) == 2);
const real_t conc = bp::extract<real_t>(conc_multi_list[0]);
const int multi = bp::extract<int> (conc_multi_list[1]);
size_conc_map[bp::extract<real_t>(size_conc.keys()[i])] = std::make_pair(conc, multi);
const bp::list conc_count_list = bp::extract<bp::list>(size_conc.values()[i]);
assert(len(conc_count_list) == 2);
const real_t conc = bp::extract<real_t>(conc_count_list[0]);
const int count = bp::extract<int> (conc_count_list[1]);
size_conc_map[bp::extract<real_t>(size_conc.keys()[i])] = std::make_pair(conc, count);
}
const real_t kappa = bp::extract<real_t>(kappa_func.keys()[j]);
arg->dry_sizes[kappa] = size_conc_map;
Expand All @@ -305,14 +305,14 @@ namespace libcloudphxx
const bp::dict size_conc = bp::extract<bp::dict>(kappa_func.values()[j]);
std::map<real_t, std::pair<real_t, int>> size_conc_map;

// turn the size : {conc, multi} dict into a size : {conc, multi} map
// turn the size : {conc, count} dict into a size : {conc, count} map
for (int i = 0; i < len(size_conc.keys()); ++i)
{
const bp::list conc_multi_list = bp::extract<bp::list>(size_conc.values()[i]);
assert(len(conc_multi_list) == 2);
const real_t conc = bp::extract<real_t>(conc_multi_list[0]);
const int multi = bp::extract<int> (conc_multi_list[1]);
size_conc_map[bp::extract<real_t>(size_conc.keys()[i])] = std::make_pair(conc, multi);
const bp::list conc_count_list = bp::extract<bp::list>(size_conc.values()[i]);
assert(len(conc_count_list) == 2);
const real_t conc = bp::extract<real_t>(conc_count_list[0]);
const int count = bp::extract<int> (conc_count_list[1]);
size_conc_map[bp::extract<real_t>(size_conc.keys()[i])] = std::make_pair(conc, count);
}
const real_t kappa = bp::extract<real_t>(kappa_func.keys()[j]);
arg->src_dry_sizes[kappa] = size_conc_map;
Expand Down
2 changes: 1 addition & 1 deletion include/libcloudph++/lgrngn/opts_init.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace libcloudphxx
typedef std::map<
real_t, // kappa
std::map<real_t, // radius [m]
std::pair<real_t, int> // STP_concentration [1/m^3], SD multiplicity
std::pair<real_t, int> // STP_concentration [1/m^3], number of SD that represent this radius kappa and concentration
>
> dry_sizes_t;
dry_sizes_t dry_sizes;
Expand Down
2 changes: 1 addition & 1 deletion src/impl/particles_impl_init_SD_with_sizes.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace libcloudphxx
const kappa_t &kappa(dsi->first);
const size_number_t &size_number_map(dsi->second);

// loop over the "size : {concentration, multiplicity}" pairs for this kappa
// loop over the "size : {concentration, count}" pairs for this kappa
for (typename size_number_t::const_iterator sni = size_number_map.begin(); sni != size_number_map.end(); ++sni)
{
// init number of SDs of this kappa in cells
Expand Down
4 changes: 2 additions & 2 deletions src/impl/particles_impl_init_count_num.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ namespace libcloudphxx
}

template <typename real_t, backend_t device>
void particles_t<real_t, device>::impl::init_count_num_dry_sizes(const std::pair<real_t, int> &conc_multi)
void particles_t<real_t, device>::impl::init_count_num_dry_sizes(const std::pair<real_t, int> &conc_count)
{
thrust::fill(count_num.begin(), count_num.end(), conc_multi.second);
thrust::fill(count_num.begin(), count_num.end(), conc_count.second);
//init_count_num_hlpr(conc_multi.first, conc_multi.second);
}

Expand Down
4 changes: 2 additions & 2 deletions src/impl/particles_impl_init_n.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ namespace libcloudphxx
}

template <typename real_t, backend_t device>
void particles_t<real_t, device>::impl::init_n_dry_sizes(const real_t &conc, const thrust_size_t &sd_conc)
void particles_t<real_t, device>::impl::init_n_dry_sizes(const real_t &conc, const thrust_size_t &sd_count)
{
namespace arg = thrust::placeholders;
thrust_device::vector<real_t> &concentration(tmp_device_real_cell);
Expand All @@ -142,7 +142,7 @@ namespace libcloudphxx
thrust::make_permutation_iterator(concentration.begin(), ijk.begin() + n_part_old),
thrust::make_permutation_iterator(concentration.begin(), ijk.end()),
n.begin() + n_part_old,
arg::_1 / sd_conc + real_t(.5)
arg::_1 / sd_count + real_t(.5)
);
}
};
Expand Down

0 comments on commit 62f5d18

Please sign in to comment.