Renumber all axes while preserving the order of the axes
| 162 | |
| 163 | // Renumber all axes while preserving the order of the axes |
| 164 | static void renumber_axes(std::map<std::size_t, std::vector<dimension::sub*>>& axes_map) |
| 165 | { |
| 166 | for(auto&& p : axes_map) |
| 167 | { |
| 168 | const auto& axis = p.first; |
| 169 | auto& subs = p.second; |
| 170 | if(subs.size() == 1) |
| 171 | { |
| 172 | set_origin_axis(*subs[0], {axis}); |
| 173 | } |
| 174 | else |
| 175 | { |
| 176 | std::sort(subs.begin(), subs.end(), by(std::less<>{}, [](const dimension::sub* s) { |
| 177 | return s->origin_axis(); |
| 178 | })); |
| 179 | for(std::size_t i : range(subs.size())) |
| 180 | set_origin_axis(*subs[i], {axis, i}); |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | static void renumber_axes(std::vector<dimension>& dimensions) |
| 185 | { |
| 186 | auto axes_map = group_axes(dimensions); |
no test coverage detected