11 #include <type_traits>
84 virtual size_t size()
const = 0;
94 virtual std::vector<const IAxis*>
getAxes()
const = 0;
105 virtual bool isValidBin(
size_t bin)
const = 0;
113 template <
class... Axes>
115 static constexpr
size_t DIM =
sizeof...(Axes);
135 std::tuple<Axes...> axes)
154 for (
const auto& srf : surfaces) {
156 lookup(pos).push_back(srf);
171 size_t binCompleted = 0;
172 size_t nBins =
size();
173 double minPath, curPath;
176 for (
size_t b = 0;
b < nBins; ++
b) {
180 std::vector<const Surface*>& binContent =
lookup(
b);
182 if (!binContent.empty()) {
188 for (
const auto& srf : surfaces) {
189 curPath = (binCtr - srf->binningPosition(gctx,
binR)).
norm();
191 if (curPath < minPath) {
197 binContent.push_back(minSrf);
259 std::vector<const IAxis*>
getAxes()
const override {
261 return std::vector<const IAxis*>(arr.begin(), arr.end());
276 for (
size_t i = 0; i < indices.size(); ++i) {
277 size_t idx = indices.at(i);
278 if (idx <= 0 || idx >= nBins.at(i) + 1) {
298 for (
const auto&
idx : neighborIdxs) {
299 const std::vector<const Surface*>& binContent =
m_grid.
at(
idx);
300 std::copy(binContent.begin(), binContent.end(),
301 std::back_inserter(neighbors));
316 template <
size_t D = DIM, std::enable_if_t<D != 1,
int> = 0>
324 template <
size_t D = DIM, std::enable_if_t<D == 1,
int> = 0>
342 : m_element({element}) {}
380 size_t size()
const override {
return 1; }
391 std::vector<const IAxis*>
getAxes()
const override {
return {}; }
395 size_t dimensions()
const override {
return 0; }
412 bool isValidBin(
size_t )
const override {
return true; }
425 SurfaceArray(std::unique_ptr<ISurfaceGridLookup> gridLookup,
426 std::vector<std::shared_ptr<const Surface>>
surfaces,
427 std::shared_ptr<const Transform3D>
transform =
nullptr);