Ticket #8794 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Units provide conversion limits

Reported by: Alex Buts Owned by: Alex Buts
Priority: major Milestone: Release 3.1
Component: Framework Keywords:
Cc: Blocked By:
Blocking: Tester: Roman Tolchenov

Description

this ticket is the part of the ticket #7529

Its purpose is to add to units the methods, which return the ranges where the unit can be converted to TOF and back and the conversion is monotonic.

Change History

comment:1 Changed 7 years ago by Alex Buts

  • Status changed from new to inprogress
  • Owner set to Alex Buts

comment:2 Changed 7 years ago by Alex Buts

refs #7529 Generally fixes the issue with different Units

but more testing is necessary refs #8794 Resolved conflicts while reverting ticket to master

Conflicts:

Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDHelper2.h Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDHelper2.cpp

Changeset: 6b3bf28f3b60d10bc00487c27e4c2a2c9ab0df72

comment:3 Changed 7 years ago by Alex Buts

refs #8794 mainly introducing monotonic ranges method in Units class

refs #7529 further enhancements (not finished)

Changeset: a540ee9e73b84794bad1c5eb133c70b86c1f5fa4

comment:4 Changed 7 years ago by Alex Buts

refs #8794 fixing Unix differences.

Changeset: 4535b6c2583284c14e697e2cde10ae3b3f4a7b37

comment:5 Changed 7 years ago by Alex Buts

refs #8794 Adding header missing on Unix

Changeset: e1b19d67078c8aa8d30f99f872c04e7e4b03bd07

comment:6 Changed 7 years ago by Alex Buts

refs #8794 Adding another header not automatically included on RHEL

Changeset: 6eb0fe2884a8da00d2af3be9e31fb86837138259

comment:7 Changed 7 years ago by Alex Buts

refs #8794 Trying to fix Round-off error on OSX

Changeset: de936099ddd38fbaa2b81cc8a500f1521439e069

comment:8 Changed 7 years ago by Alex Buts

refs #8794 fixing linkage error caused by Unix-related changes

Changeset: 401bdb4f672862ccaeaac0a22942149498a6fd1c

comment:9 Changed 7 years ago by Martyn Gigg

There are some compiler warnings related to this that need fixing. Details here

comment:10 Changed 7 years ago by Martyn Gigg

I also think the return type of conversionRange() should be a std::pair rather than a vector, i.e.

std::pair<double,double> Wavelength::conversionRange() const
{
    return std::make_pair<double>(-DBL_MAX,DBL_MAX);
}

as it seems more appropriate since you only ever want to values.

comment:11 Changed 7 years ago by Alex Buts

refs #8794 should fix GCC warning

Changeset: 84f7d7f6b71c867c69c22e4ba246e58e5ca39e9d

comment:12 Changed 7 years ago by Alex Buts

refs #8794 should fix another GCC warning

removing methods which are seems not used anywhere and despised by GCC

Changeset: 982ef223ffd547a3cf51f117e5a32830ed6c5918

comment:13 Changed 7 years ago by Alex Buts

refs #8794 Replaced vector by std::pair structure

I am unsure about it, as the functional equivalent of this function for ConvertToMD methods would return more then 2 values. And some functional modifications of this method may also return more then 2 values. But after some thinking decide to make the change for the time being and then see if expansion is necessary.

Changeset: a4c0ff508aef7fd41c93a6c71b1d030d5b0cf991

comment:14 Changed 7 years ago by Martyn Gigg

But this stuff is in Kernel::Unit at that point all you should be thinking about is what makes sense at that level and range suggests two values. If the MD stuff needs to return more values then it sounds to me like range is not a good name and it should not be overriding this method

comment:15 Changed 7 years ago by Alex Buts

  • Status changed from inprogress to verify
  • Resolution set to fixed

The main part of the code has been cherry-picked form another ticket so the whole changes can be viewed in Git only.

Test it by code review.

Methods added to Kernel report range of TOF values where the conversion to unit is unique and monotonic and range of units values where conversion to TOF is unique and monotonic.

Unit tests check that this generally holds in the limits of DBL_EPSILON.

How good this approximation is can be identified by further usage only.

comment:16 Changed 7 years ago by Roman Tolchenov

  • Status changed from verify to verifying
  • Tester set to Roman Tolchenov

comment:17 Changed 7 years ago by Roman Tolchenov

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/8794_unitConversionLimits'

Full changeset: 251c2ff50ad480b49930e9c11c84ce7fefc333da

comment:18 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9638

Note: See TracTickets for help on using tickets.