JuliaApproximation / DomainSets.jl

A Julia package for describing domains as continuous sets of elements
MIT License
72 stars 12 forks source link

Support `iterate` for finite-dimensional sets #108

Open dlfivefifty opened 2 years ago

dlfivefifty commented 2 years ago

Ran into an issue where a piece of code would have worked if I could iterate over a VcatDomain (something like VcatDomain(OneTo(3), OneTo(5)))

Would be nice if we supported iterate. I started an implementation but wasn't obvious, probably just need to replicate the code for CartesianIndex

daanhb commented 2 years ago

Product iteration is simple only in hindsight :-)

daanhb commented 2 years ago

Hmm, this will be difficult to get right. There is a fairly comprehensive framework for iterating over combinations of function sets in BasisFunctions.jl, which I'm still not entirely happy with. By implementing axes and friends, I managed to reuse the standard iterators of arrays for product structures and of BlockArrays for composite structures. However, some extensions are needed when combining them: in this package that would be product domains of uniondomains.

It's certainly doable, but I'm not sure it is worth the effort here.