In downstream codes, we often derive the particle container and (particle) iterator classes. This results in calls to iterate to demote them from their own type to the base type.
As a work-around, we have to overwrite in derived classes:
pc::iterator
pc::const_iterator
pti::__next__
pti::__iter__
to keep the derived classes in downstream workflows.
We might be able to generalize the return type in the pybind11 bindings for iteration or implement the __next__/__iter__ methods directly from Python as a dynamic attribute. That way, we should be able to skip the overwrites in derived classes.
Currently, we implement the iterator member functions
__next__
and__iter__
in C++. This results in strong typing. https://github.com/AMReX-Codes/pyamrex/blob/24.02/src/Base/Iterator.HIn downstream codes, we often derive the particle container and (particle) iterator classes. This results in calls to iterate to demote them from their own type to the base type.
As a work-around, we have to overwrite in derived classes:
pc::iterator
pc::const_iterator
pti::__next__
pti::__iter__
to keep the derived classes in downstream workflows.
We might be able to generalize the return type in the pybind11 bindings for iteration or implement the
__next__
/__iter__
methods directly from Python as a dynamic attribute. That way, we should be able to skip the overwrites in derived classes.