38 double sampling_delta_z,
double sampling_offset_x,
39 double sampling_offset_y,
double sampling_offset_z,
40 int n_x_bins,
int n_y_bins,
int n_z_bins,
double min_x,
41 double max_x,
double min_y,
double max_y,
double min_z,
45 sampling_delta{{sampling_delta_x, sampling_delta_y, sampling_delta_z}},
47 {sampling_offset_x, sampling_offset_y, sampling_offset_z}},
48 allow_empty_bins(allow_empty_bins) {
49 if (sampling_delta[0] <= 0.)
50 throw std::domain_error(
"sampling_delta_x has to be > 0");
51 if (sampling_delta[1] <= 0.)
52 throw std::domain_error(
"sampling_delta_y has to be > 0");
53 if (sampling_delta[2] <= 0.)
54 throw std::domain_error(
"sampling_delta_z has to be > 0");
55 if (sampling_offset[0] < 0.)
56 throw std::domain_error(
"sampling_offset_x has to be >= 0");
57 if (sampling_offset[1] < 0.)
58 throw std::domain_error(
"sampling_offset_y has to be >= 0");
59 if (sampling_offset[2] < 0.)
60 throw std::domain_error(
"sampling_offset_z has to be >= 0");
61 calculate_sampling_positions();
68 auto const lim = limits();
69 sampling_positions.clear();
72 const auto n_samples_x =
static_cast<std::size_t
>(
73 std::rint((lim[0].second - lim[0].first) / sampling_delta[0]));
74 const auto n_samples_y =
static_cast<std::size_t
>(
75 std::rint((lim[1].second - lim[1].first) / sampling_delta[1]));
76 const auto n_samples_z =
static_cast<std::size_t
>(
77 std::rint((lim[2].second - lim[2].first) / sampling_delta[2]));
78 for (std::size_t x = 0; x < n_samples_x; ++x) {
79 for (std::size_t y = 0; y < n_samples_y; ++y) {
80 for (std::size_t z = 0; z < n_samples_z; ++z) {
82 {lim[0].first + sampling_offset[0] +
83 static_cast<double>(x) * sampling_delta[0],
84 lim[1].first + sampling_offset[1] +
85 static_cast<double>(y) * sampling_delta[1],
86 lim[2].first + sampling_offset[2] +
87 static_cast<double>(z) * sampling_delta[2]}});