From 1f0ba13532f8bdf4e063bcb92997a15f1e4cf4d2 Mon Sep 17 00:00:00 2001 From: pdziekan Date: Thu, 29 Apr 2021 11:02:34 +0200 Subject: [PATCH] rename variables to point out that dry_sizes takes number of SD, not multiplicity --- bindings/python/lgrngn.hpp | 24 +++++++++---------- include/libcloudph++/lgrngn/opts_init.hpp | 2 +- .../particles_impl_init_SD_with_sizes.ipp | 2 +- src/impl/particles_impl_init_count_num.ipp | 4 ++-- src/impl/particles_impl_init_n.ipp | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bindings/python/lgrngn.hpp b/bindings/python/lgrngn.hpp index 458eeea67..a1b871ccf 100644 --- a/bindings/python/lgrngn.hpp +++ b/bindings/python/lgrngn.hpp @@ -275,14 +275,14 @@ namespace libcloudphxx const bp::dict size_conc = bp::extract(kappa_func.values()[j]); std::map> 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(size_conc.values()[i]); - assert(len(conc_multi_list) == 2); - const real_t conc = bp::extract(conc_multi_list[0]); - const int multi = bp::extract (conc_multi_list[1]); - size_conc_map[bp::extract(size_conc.keys()[i])] = std::make_pair(conc, multi); + const bp::list conc_count_list = bp::extract(size_conc.values()[i]); + assert(len(conc_count_list) == 2); + const real_t conc = bp::extract(conc_count_list[0]); + const int count = bp::extract (conc_count_list[1]); + size_conc_map[bp::extract(size_conc.keys()[i])] = std::make_pair(conc, count); } const real_t kappa = bp::extract(kappa_func.keys()[j]); arg->dry_sizes[kappa] = size_conc_map; @@ -305,14 +305,14 @@ namespace libcloudphxx const bp::dict size_conc = bp::extract(kappa_func.values()[j]); std::map> 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(size_conc.values()[i]); - assert(len(conc_multi_list) == 2); - const real_t conc = bp::extract(conc_multi_list[0]); - const int multi = bp::extract (conc_multi_list[1]); - size_conc_map[bp::extract(size_conc.keys()[i])] = std::make_pair(conc, multi); + const bp::list conc_count_list = bp::extract(size_conc.values()[i]); + assert(len(conc_count_list) == 2); + const real_t conc = bp::extract(conc_count_list[0]); + const int count = bp::extract (conc_count_list[1]); + size_conc_map[bp::extract(size_conc.keys()[i])] = std::make_pair(conc, count); } const real_t kappa = bp::extract(kappa_func.keys()[j]); arg->src_dry_sizes[kappa] = size_conc_map; diff --git a/include/libcloudph++/lgrngn/opts_init.hpp b/include/libcloudph++/lgrngn/opts_init.hpp index fa57407bc..6249414d0 100644 --- a/include/libcloudph++/lgrngn/opts_init.hpp +++ b/include/libcloudph++/lgrngn/opts_init.hpp @@ -37,7 +37,7 @@ namespace libcloudphxx typedef std::map< real_t, // kappa std::map // STP_concentration [1/m^3], SD multiplicity + std::pair // STP_concentration [1/m^3], number of SD that represent this radius kappa and concentration > > dry_sizes_t; dry_sizes_t dry_sizes; diff --git a/src/impl/particles_impl_init_SD_with_sizes.ipp b/src/impl/particles_impl_init_SD_with_sizes.ipp index cc14cf238..dfad97914 100644 --- a/src/impl/particles_impl_init_SD_with_sizes.ipp +++ b/src/impl/particles_impl_init_SD_with_sizes.ipp @@ -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 diff --git a/src/impl/particles_impl_init_count_num.ipp b/src/impl/particles_impl_init_count_num.ipp index ad3dcb414..71ec611f9 100644 --- a/src/impl/particles_impl_init_count_num.ipp +++ b/src/impl/particles_impl_init_count_num.ipp @@ -78,9 +78,9 @@ namespace libcloudphxx } template - void particles_t::impl::init_count_num_dry_sizes(const std::pair &conc_multi) + void particles_t::impl::init_count_num_dry_sizes(const std::pair &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); } diff --git a/src/impl/particles_impl_init_n.ipp b/src/impl/particles_impl_init_n.ipp index 50c4880a7..392c1d1c0 100644 --- a/src/impl/particles_impl_init_n.ipp +++ b/src/impl/particles_impl_init_n.ipp @@ -132,7 +132,7 @@ namespace libcloudphxx } template - void particles_t::impl::init_n_dry_sizes(const real_t &conc, const thrust_size_t &sd_conc) + void particles_t::impl::init_n_dry_sizes(const real_t &conc, const thrust_size_t &sd_count) { namespace arg = thrust::placeholders; thrust_device::vector &concentration(tmp_device_real_cell); @@ -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) ); } };