23 #include <actsvg/core.hpp>
24 #include <actsvg/meta.hpp>
31 namespace Experimental {
33 using namespace detail::GridAxisGenerators;
64 std::tuple<std::vector<ProtoSurface>,
ProtoGrid,
65 std::vector<std::vector<std::size_t>>>;
67 namespace IndexedSurfacesConverter {
86 template <
typename surface_container,
typename index_gr
id>
88 const surface_container& surfaces,
89 const index_grid& indexGrid,
92 std::vector<ProtoSurface> pSurfaces;
93 pSurfaces.reserve(surfaces.size());
104 (index_grid::grid_type::DIM == 1 and indexGrid.casts[0
u] ==
binPhi) or
105 (index_grid::grid_type::DIM == 2 and
106 (indexGrid.casts[0
u] ==
binPhi or indexGrid.casts[1
u] ==
binPhi));
114 sOptions.
style = *sfIter;
119 auto sExtent =
s->polyhedronRepresentation(gctx, 4
u).extent();
120 if constexpr (index_grid::grid_type::DIM == 2
u) {
129 if constexpr (index_grid::grid_type::DIM == 1
u) {
130 if (indexGrid.casts[0
u] ==
binPhi) {
132 std::array<ActsScalar, 2u> rRange = {estRangeR.
min(), estRangeR.max()};
141 auto axes = indexGrid.grid.axes();
144 std::vector<std::vector<std::size_t>> highlightIndices;
147 if constexpr (index_grid::grid_type::DIM == 1
u) {
148 for (
unsigned int ib0 = 1
u; ib0 <= axes[0
u]->getNBins(); ++ib0) {
149 typename index_grid::grid_type::index_t lbin;
151 highlightIndices.push_back(indexGrid.grid.atLocalBins(lbin));
158 if constexpr (index_grid::grid_type::DIM == 2
u) {
159 for (
unsigned int ib0 = 1
u; ib0 <= axes[0
u]->getNBins(); ++ib0) {
160 for (
unsigned int ib1 = 1
u; ib1 <= axes[1
u]->getNBins(); ++ib1) {
161 typename index_grid::grid_type::index_t lbin;
164 highlightIndices.push_back(indexGrid.grid.atLocalBins(lbin));
166 pGrid._bin_ids.push_back(
std::string(
"- bin : [") +
175 return std::tie(pSurfaces, pGrid, highlightIndices);
191 template <
typename surface_container,
typename instance_type>
195 [[maybe_unused]]
const instance_type& refInstance) {
197 typename instance_type::template grid_type<std::vector<std::size_t>>;
204 const auto* instance = delegate.instance();
205 auto castedDelegate =
dynamic_cast<const DelegateType*
>(instance);
206 if (castedDelegate !=
nullptr) {
208 auto indexedSurfaces = std::get<SubDelegateType>(castedDelegate->updators);
209 auto [pSurfaces, pGrid, pIndices] =
210 convertImpl(gctx, surfaces, indexedSurfaces, cOptions);
211 std::get<0u>(sgi) = pSurfaces;
212 std::get<1u>(sgi) = pGrid;
213 std::get<2u>(sgi) = pIndices;
220 template <
typename surface_container,
typename tuple_type, std::size_t...
I>
222 const surface_container& surfaces,
const Options& cOptions,
225 const tuple_type& axesTuple, std::index_sequence<I...>) {
226 (
convert(gctx, surfaces, cOptions, sgi, delegate, std::get<I>(axesTuple)),
241 template <
typename surface_container>
247 std::vector<ProtoSurface> pSurfaces;
249 std::vector<std::vector<std::size_t>> indices;
254 std::make_index_sequence<
272 auto [pSurfaces, pGrid, pIndices] = pIndexGrid;
275 actsvg::svg::object xyIndexedGrid;
276 xyIndexedGrid._id = identification;
277 xyIndexedGrid._tag =
"g";
280 std::vector<actsvg::svg::object> sObs;
281 for (
const auto&
s : pSurfaces) {
282 if (pGrid._type == actsvg::proto::grid::e_z_phi) {
294 actsvg::connectors::connect_action(gOb._sub_objects, sObs, pIndices);
297 xyIndexedGrid.add_objects(sObs);
299 auto xmax = xyIndexedGrid._x_range[1
u];
301 for (
auto [ig, gTile] :
enumerate(gOb._sub_objects)) {
303 std::vector<std::string> binText;
304 binText.push_back(
"Source:");
305 binText.push_back(pGrid._bin_ids[ig]);
306 binText.push_back(
"Target:");
307 for (
const auto& sis : pIndices[ig]) {
313 auto cText = actsvg::draw::connected_text(
314 "bla", {
static_cast<actsvg::scalar
>(1.1 *
xmax), 0}, binText,
316 xyIndexedGrid.add_object(cText);
318 xyIndexedGrid.add_object(gOb);
320 return xyIndexedGrid;
332 static inline actsvg::svg::object
zphi(
335 return xy(pIndexGrid, identification);