Skip to content

Implement EntityIterator conditionally

Summary

Some grid implementation do not provide entity iterators for all codimensions, e.g. UGGrid. Therefore, we have the corresponding capabilities to check for this. In the type-erasure interface class, we have no idea whether the wrapped grid provides these iterators, thus we have implement all of them. In the implementation class, we have access to the type and thus the capabilities of the wrapped grid and can make conditional implementation. The fallback is a default constructed iterator plus an exception that this iterator is not available. We thus have to switch from compile-time guarantees that the iterator exists or not, to runtime-checks whether it is available.

Discussion

Maybe we should also implement run-time capabilities in the grid interface?

Edited by Simon Praetorius

Merge request reports

Loading