47 std::pair<double, double>
const &r_limits,
48 std::pair<double, double>
const &phi_limits,
49 std::pair<double, double>
const &z_limits, std::size_t n_r_bins,
50 std::size_t n_phi_bins, std::size_t n_z_bins,
double sampling_density) {
51 auto constexpr endpoint =
false;
53 (r_limits.second - r_limits.first) /
static_cast<double>(n_r_bins);
54 auto const delta_phi =
55 (phi_limits.second - phi_limits.first) /
static_cast<double>(n_phi_bins);
60 auto const smallest_bin_volume =
61 Utils::sqr(r_limits.first + delta_r) * delta_phi / 2.;
62 auto const min_n_samples =
63 std::max(n_z_bins,
static_cast<std::size_t
>(std::round(
64 smallest_bin_volume * sampling_density)));
66 (z_limits.second - z_limits.first) /
static_cast<double>(min_n_samples);
68 std::vector<double> r_range;
70 r_limits.second, n_r_bins, endpoint),
71 std::back_inserter(r_range));
73 auto const phi_range =
74 make_lin_space(phi_limits.first + .5 * delta_phi, phi_limits.second,
75 n_phi_bins, endpoint);
77 z_limits.second, min_n_samples, endpoint);
80 std::vector<Vector3d> sampling_positions;
81 for (
auto const z : z_range) {
82 for (
auto const phi : phi_range) {
83 sampling_positions.push_back(
Vector3d{{r_range.
front(), phi, z}});
88 auto phis = [n_phi_bins, phi_limits](
long r_bin) {
90 phi_limits.first, phi_limits.second,
91 n_phi_bins * (
static_cast<std::size_t
>(r_bin) + 1u), endpoint);
96 for (
auto const z : z_range) {
98 for (
auto r_it = ++r_range.begin(); r_it != r_range.end(); ++r_it) {
100 for (
auto const phi : phis(std::distance(r_range.begin(), r_it))) {
101 sampling_positions.push_back(
Vector3d{{*r_it, phi, z}});
106 return sampling_positions;
std::vector< Vector3d > get_cylindrical_sampling_positions(std::pair< double, double > const &r_limits, std::pair< double, double > const &phi_limits, std::pair< double, double > const &z_limits, std::size_t n_r_bins, std::size_t n_phi_bins, std::size_t n_z_bins, double sampling_density)
Generate sampling positions for a cylindrical histogram.