Skip to content
Snippets Groups Projects

Add a `Field::compare` method

Merged Thibault Lestang requested to merge compare_fields into master
All threads resolved!

This adds a compare method for a instance of Field to compare itself to another one. I originally wanted to overload operator==, but implemented a normal method in order to be able to pass a tolerance. The method should return true only if the the two fields have the same number of blocks and these blocks have the same structure, and each field value are equal up to the absolute tolerance passed to the function.

This does the job for now, but we might want to look into using the boost manipulator boost::test_tools::per_element in the test assertions. That would require the field to be implemented as a container with a forward iterator: beyond my C++ skills at the minute.

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
  • Chris Cantwell
  • @tlestang Can you have a quick look at these comments? Would be worth getting this merged as I think it could be useful for more robust testing of the operators.

  • Author Maintainer

    @ccantwel I forgot about this one.. I'll have a look now.

  • Thibault Lestang added 2 commits

    added 2 commits

    • 1f58ca50 - Fail if abs difference is _larger_ than tol
    • cc93cafa - fix: initialisation of expected field object

    Compare with previous version

  • Thibault Lestang added 15 commits

    added 15 commits

    • cc93cafa...142c6bd4 - 11 commits from branch master
    • 6e60a566 - Add a Field::compare with tolerance
    • 782055e4 - Introduce field fixture for expected result
    • 91e75a33 - Compare output field against expected solution
    • 7e6b9f80 - Fail if abs difference is _larger_ than tol

    Compare with previous version

  • Author Maintainer

    rebased on master

  • One last thing I spotted.

  • added 1 commit

    • 50542899 - fix: Pass template argument stateOut to Field constructor

    Compare with previous version

  • Chris Cantwell resolved all threads

    resolved all threads

  • Chris Cantwell mentioned in commit e83c7bc5

    mentioned in commit e83c7bc5

  • merged

  • Please register or sign in to reply
    Loading