Skip to content
Snippets Groups Projects
  1. Jun 27, 2024
  2. Jun 25, 2024
  3. Jun 24, 2024
    • Simon Praetorius's avatar
      Merge branch 'feature/move-config-h-to-headers' into 'master' · 20eb0c9e
      Simon Praetorius authored
      Move include of config.h from source to some header files
      
      See merge request !1313
      20eb0c9e
    • Carsten Gräser's avatar
    • Carsten Gräser's avatar
    • Carsten Gräser's avatar
    • Carsten Gräser's avatar
      Implement TransformedRangeIterator using IteratorFacade · 9ac6cb1f
      Carsten Gräser authored
      This comes with a slight change: The old helper
      `Dune::Impl::PointerProxy` was dropped in favor of the new
      `Dune::ProxyArrowResult`. The latter no longer supports storing
      raw references. This change is deliberately: In the no-proxy
      case, we can simply use raw pointers instead of the helper
      to avoid indirection and keep simple cases simple.
      
      Furthermore it this make `TransformedRangeIterator` simpler
      and allows to make it more flexible:
      
      * All iterator operations despite dereferencing
        are now autogenerated, by exporting `baseIterator()`.
      * Allow to either store a function or a pointer to function.
        The transformation is evaluated conditionally, if a call
        `f(z)` is valid, this is used, else `(*f)(z)` is used.
      * Use `Dune::AutonomousValue` instead of `std::decay_t`
        to deduce `value_type`. This improves support for types
        using this mechanism.
      * Store `reference` instead of `value_type` in `ProxyArrowResult`.
        This is important if both types are different and the `reference`
        proxy e.g. forwards to some other storage.
      * Add checks for free `TransformedRangeIterator` storing functions
        with value and pointer semantics.
      9ac6cb1f
    • Carsten Gräser's avatar
      4c1066d8
    • Carsten Gräser's avatar
      [test] Add check of new IteratorFacade · 3c903f3d
      Carsten Gräser authored
      3c903f3d
    • Carsten Gräser's avatar
      Introduce new class IteratorFacade · 604c7636
      Carsten Gräser authored
      The new CRTP-mixin class `IteratorFacade` is parameterized
      by implementation, iterator category, `value_type`, `reference`,
      `pointer`, and `difference_type`. Discussion of the changes:
      
      * Making the iterator category a template parameter, allows to
        work with the facades class in a more uniform way. E.g.
        comparisons only need to be defined once for all categories.
      * Being able to customize `pointer` allows to use the facade
        classes for proxy-iterators. This was not possible before,
        because it is not sufficient to simply exchange the `reference`
        type to support proxies.
      * The design is in line with the `std::iterator_interface`
        proposal, in the sense that the template parameters have
        the same order to avoid surprises. Notice however, that
        this is not a drop-in replacement because
        `srd::iterator_interface` avoids classic CRTP by deducing `this`.
      * Additionally to the old facade classes, `IteratorFacade`
        also allows to implement the raw analouges of the
        methods used in the old classes, i.e.
        * `operator*` instead of `dereference()`,
        * `operator++` instead of `increment()`,
        * `operator--` instead of `decrement()`,
        * `operator+=` instead of `advance()`,
        * `operator==` instead of `equals()`,
        * `operator- instead of `distanceTo()`.
      * If the implementation class provides a `baseIterator()`
        method returning an underlying internal iterator, the
        operators of the returned iterator will be used if not
        dedicated implementation is provided.
      
      A major consequence of this change is, that it allows to
      use the new `IteratorFacade` for proxy-iterators,
      like e.g. `TransformedRangeIterator`.
      In this case you have to specify a suitable proxy-type for
      the pointer. In this case the new helper `Dune::ProxyArrowResult` can
      be used. This was adopted from the `TransformedRangeIterator`, but
      the name was adjusted to the `std::iterator_interface` proposal.
      604c7636
  4. Jun 20, 2024
  5. Jun 17, 2024
    • Carsten Gräser's avatar
      Merge branch 'feature/simplify-and-test-tupleentriesmodel' into 'master' · 53305824
      Carsten Gräser authored
      [concept] Simplify tupleEntriesModel()
      
      See merge request !1397
      53305824
    • Carsten Gräser's avatar
      [concept] Simplify tupleEntriesModel() · 9d29896d
      Carsten Gräser authored
      This helper allows to check if all entries from a tuple model
      a concept. The patch simplifes the check and reduces
      the dependencies: We no longer depend on `tupleutility.hh`
      which is pretty heavy weight since in includes `hybridutilities.hh`
      and `rangeutilities.hh`. Thus emulated concepts could not be used
      in these headers so far, which is fixed by the patch.
      
      To prevent a regression this also adds a test for the previously
      untestet function.
      9d29896d
  6. Jun 15, 2024
  7. Jun 14, 2024
    • Carsten Gräser's avatar
      Change meaning of function template in TransformedRangeIterator · c3fdf1da
      Carsten Gräser authored
      So far the template parameter `F` was interpreted as function
      and a `const F*` was stored. With this patch `F` is directly
      interpreted as pointer_type and the `*` is added in the
      `TransformedRangeView`.
      
      This allows to use other pointer-like types than `const F*`.
      E.g. `TransformedRangeView` now uses `F*` for a non-const
      iterator, such that the transformation calls a non-const
      `operator()` for non-const interators. Thus one can use
      `TransformedRangeIterator` to create self-contained
      mutable ranges on the fly, which was not possible before
      (either mutable with reference capture or self-contained
      but non-mutable).
      
      A test for the new feature is added. This also contains a handy
      utility for combined mutable/nonmutable capture which is not
      directly possible with plain lambdas. Maybe we later want to
      make this public.
      
      This patch potentially also allows to create self-contained
      `TransformedRangeIterator`s by passing e.g. an optional
      (pointer-like but stores a value) as `F`. However, this
      should be carefully tested and - if working correctly - be
      accessible publicly in namespace `Dune::`.
      c3fdf1da
  8. Jun 13, 2024
    • Carsten Gräser's avatar
      Merge branch 'bugfix/fix-transformed-range-iterator' into 'master' · b71d7bf3
      Carsten Gräser authored
      [bugfix] Fix two bugs in TransformedRangeView and TransformedRangeIterator
      
      See merge request !1389
      b71d7bf3
    • Carsten Gräser's avatar
    • Carsten Gräser's avatar
      [bugfix] Fix operator-> for non-proxy TransformedRangeIterator · de38fa63
      Carsten Gräser authored
      In order to support `operator->`, the `TransformedRangeIterator`
      uses a `PointerProxy<T>` that stores the result of the transformation.
      There are to possible options for the type to be stored:
      
      * `reference = decltype(transform(...))` and
      * `value_type` = std::decay_t<reference>`.
      
      So far a `value_type` was stored in the `ProxyType`. This has the
      consequence that `operator->` will store a copy of the result,
      even if it is an l-value. Hence `(*it).foo(...)` calls `foo()`
      on the referenced value while `it->foo(...)` calls it on the copy.
      This is not only inefficient, but may also lead to incorrect
      behaviour if `foo(...)` is non-const, e.g. `operator=`.
      
      This patch replaces `value_type` by `reference` in the `ProxyType`.
      Thus if the transformation returns a value it will still be
      copied, while an l-value reference is stored as reference.
      
      To make this work we also have use `add_pointer_t<T>` instead
      of `T*` to get a proper pointer if `T` is a reference.
      de38fa63
  9. Jun 12, 2024
  10. Jun 01, 2024
  11. May 31, 2024
  12. May 30, 2024
  13. May 29, 2024
  14. May 26, 2024
Loading