19 #include <type_traits>
85 virtual size_t size()
const = 0;
95 virtual std::vector<const IAxis*>
getAxes()
const = 0;
106 virtual bool isValidBin(
size_t bin)
const = 0;
118 template <
class... Axes>
120 static constexpr
size_t DIM =
sizeof...(Axes);
141 std::tuple<Axes...> axes,
142 std::vector<BinningValue> bValues = {})
161 for (
const auto& srf : surfaces) {
163 lookup(pos).push_back(srf);
178 size_t binCompleted = 0;
179 size_t nBins =
size();
182 const Surface* minSrf =
nullptr;
184 for (
size_t b = 0;
b < nBins; ++
b) {
188 std::vector<const Surface*>& binContent =
lookup(
b);
190 if (!binContent.empty()) {
195 minPath = std::numeric_limits<double>::max();
196 for (
const auto& srf : surfaces) {
197 curPath = (binCtr - srf->binningPosition(gctx,
binR)).
norm();
199 if (curPath < minPath) {
205 binContent.push_back(minSrf);
273 std::vector<const IAxis*>
getAxes()
const override {
275 return std::vector<const IAxis*>(
arr.begin(),
arr.end());
290 for (
size_t i = 0;
i < indices.size(); ++
i) {
291 size_t idx = indices.at(
i);
292 if (idx <= 0 || idx >= nBins.at(
i) + 1) {
312 for (
const auto idx : neighborIdxs) {
313 const std::vector<const Surface*>& binContent =
m_grid.
at(
idx);
314 std::copy(binContent.begin(), binContent.end(),
315 std::back_inserter(neighbors));
330 template <
size_t D = DIM, std::enable_if_t<D != 1,
int> = 0>
338 template <
size_t D = DIM, std::enable_if_t<D == 1,
int> = 0>
357 : m_element({element}) {}
405 size_t size()
const override {
return 1; }
417 std::vector<const IAxis*>
getAxes()
const override {
return {}; }
421 size_t dimensions()
const override {
return 0; }
454 SurfaceArray(std::unique_ptr<ISurfaceGridLookup> gridLookup,
455 std::vector<std::shared_ptr<const Surface>>
surfaces,