Skip to content
Snippets Groups Projects

Allow number types as entries of matrix and vector types

Merged Oliver Sander requested to merge allow-blockvector-of-doubles into master
All threads resolved!

So, for example, you can write

BlockVector<double>

instead of

BlockVector<FieldVector<double,1> >

and it will do what you expect it to do. With this patch, any type for which Dune::IsNumber<T>::value returns true will end the recursion.

Edited by Oliver Sander

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Looking at the code I got the impression that it might be simpler to wrap the number into a pseudo-vector using something like:

    auto&& vi = asVector(v[i]):
    // use vector interface of vi

    where asVector() forwards v[i] if it's a vector and wraps it into a vector-like class if it's a number. This would avoid most of the Hybrid::ifElse magic.

    Edited by Carsten Gräser
  • Oliver Sander added 1 commit

    added 1 commit

    • 896334d3 - Simplify Hybrid::ifElse calls

    Compare with previous version

  • Oliver Sander resolved all discussions

    resolved all discussions

  • In think that would simply be trading one magic for another. The Hybrid::ifElse stuff is quite readable, and will get even more so once we allow if constexpr.

  • In the dot() method there is also a call to the dot() methods of the vector entries (line 222). There you'll probably also want the ifElse guards.

  • Oliver Sander added 3 commits

    added 3 commits

    • fe98a297 - Avoid signed/unsigned warning by explicity cast
    • 659303a5 - Remove a spurious duplicate test
    • be32916d - Also test BlockVector<double> and BlockVector<std::complex<double> >

    Compare with previous version

  • Oliver Sander added 1 commit

    added 1 commit

    • cfe8e20a - Minor tweaks to make clang + ifElse happier

    Compare with previous version

  • Oliver Sander added 1 commit

    added 1 commit

    • 6e69b7e4 - Make the 'dot' method handle BlockVector<double>

    Compare with previous version

  • Oliver Sander added 12 commits

    added 12 commits

    • 6e69b7e4...54ee6051 - 5 commits from branch master
    • 5e154290 - Allow number types as entries of a BlockVector
    • 2aadce4e - Simplify Hybrid::ifElse calls
    • 6008166c - Avoid signed/unsigned warning by explicity cast
    • 8ffb7b25 - Remove a spurious duplicate test
    • 056e1336 - Also test BlockVector<double> and BlockVector<std::complex<double> >
    • 6e401bb9 - Minor tweaks to make clang + ifElse happier
    • 5744a151 - Make the 'dot' method handle BlockVector<double>

    Compare with previous version

  • Oliver Sander added 5 commits

    added 5 commits

    • e3f85523 - Allow number types as entries of a BlockVector
    • b153a129 - Avoid signed/unsigned warning by explicity cast
    • 489137f2 - Remove a spurious duplicate test
    • 38e6821d - Also test BlockVector<double> and BlockVector<std::complex<double> >
    • d7e3c267 - Test 'dot' methods for BlockVector<double>

    Compare with previous version

  • Oliver Sander added 1 commit

    added 1 commit

    • f5cae0c4 - Minor tweak to make clang happy

    Compare with previous version

  • Oliver Sander added 2 commits

    added 2 commits

    • 3e2cfc29 - Also test BlockVector<double> and BlockVector<std::complex<double> >
    • 898fdcc8 - Test 'dot' methods for BlockVector<double>

    Compare with previous version

  • Oliver Sander unmarked as a Work In Progress

    unmarked as a Work In Progress

  • From my side, this patch is complete now. Unless there are objections, I will merge on Monday, Dec. 3.

  • Oliver Sander added 8 commits

    added 8 commits

    • b7fd252c - Rename BlockVectorTraits to BlockTraits
    • 395f6d2f - Implement BCRSMatrix<double>
    • 71f43896 - Implement BDMatrix<double>
    • 31f9565c - Announce that all istl types can now be instantiated with numbers directly
    • ded23d98 - Implement BTDMatrix<double>
    • 88836c91 - Implement Matrix<double>
    • dce9f27a - Implement VariableBlockVector<double>
    • 1db62434 - Fix another test failure

    Compare with previous version

  • Oliver Sander added 1 commit

    added 1 commit

    Compare with previous version

  • Oliver Sander added 1 commit

    added 1 commit

    • d70b7796 - Add some explicit 'this->' qualification

    Compare with previous version

  • Oliver Sander added 1 commit

    added 1 commit

    Compare with previous version

  • Oliver Sander added 1 commit

    added 1 commit

    Compare with previous version

  • Oliver Sander added 1 commit

    added 1 commit

    Compare with previous version

  • Oliver Sander added 1 commit

    added 1 commit

    Compare with previous version

  • Oliver Sander added 1 commit

    added 1 commit

    Compare with previous version

  • Oliver Sander added 11 commits

    added 11 commits

    • 4f7ad3d5 - Allow number types as entries of a BlockVector
    • fd4f1a12 - Avoid signed/unsigned warning by explicity cast
    • dbf53070 - Remove a spurious duplicate test
    • fd3b6585 - Also test BlockVector<double> and BlockVector<std::complex<double> >
    • ad4ab82a - Test 'dot' methods for BlockVector<double>
    • c91c332e - Implement BCRSMatrix<double>
    • 7fb6680b - Implement BDMatrix<double>
    • 23993089 - Announce that all istl types can now be instantiated with numbers directly
    • bf472d9e - Implement BTDMatrix<double>
    • e6a1c8e3 - Implement Matrix<double>
    • d4e11161 - Implement VariableBlockVector<double>

    Compare with previous version

  • Oliver Sander added 1 commit

    added 1 commit

    Compare with previous version

  • Oliver Sander added 2 commits

    added 2 commits

    • 2b63e74e - Implement Matrix<double>
    • 8fc31db5 - Implement VariableBlockVector<double>

    Compare with previous version

  • Oliver Sander changed title from Allow number types as entries of a BlockVector to Allow number types as entries of matrix and vector types

    changed title from Allow number types as entries of a BlockVector to Allow number types as entries of matrix and vector types

  • Oliver Sander changed the description

    changed the description

  • Oliver Sander enabled an automatic merge when the pipeline for 8fc31db5 succeeds

    enabled an automatic merge when the pipeline for 8fc31db5 succeeds

  • merged

  • Oliver Sander mentioned in commit 01e85838

    mentioned in commit 01e85838

  • Jö Fahlke mentioned in merge request !261 (merged)

    mentioned in merge request !261 (merged)

  • Oliver Sander mentioned in commit 5007ec36

    mentioned in commit 5007ec36

  • Please register or sign in to reply
    Loading