[units] slowness dimension
Hello, I've learned about a "new" (or potentially new-to-boost-units, at any rate) dimension this week. TBD whether we'll be using boost or even units, but in the event we would, I'd like to add a slowness dimension. Basically it is the inverse of velocity: where velocity is time per length, slowness is length per time. Taking a gander at the velocity.hpp physical dimension, doesn't seem like a terribly hard thing to do, and with the new Git-module decomp, even less so today? Thank ye... Best regards, Michael Powell
On 15/02/2014 03:49, Quoth Michael Powell:
I've learned about a "new" (or potentially new-to-boost-units, at any rate) dimension this week. TBD whether we'll be using boost or even units, but in the event we would, I'd like to add a slowness dimension. Basically it is the inverse of velocity: where velocity is time per length, slowness is length per time. Taking a gander at the velocity.hpp physical dimension, doesn't seem like a terribly hard thing to do, and with the new Git-module decomp, even less so today?
It's fairly straightforward to define your own custom dimensions using Boost.Units, especially when they're based on the existing dimensions and base units. You can do this in your application code, without touching Boost.Units itself. Have a look at boost/units/physical_dimensions/velocity.hpp and just define your new dimension similarly -- you can then define units (see boost/units/systems/si/velocity.hpp) and quantities using that and then everything else should automatically recognise it and just work.
On Sun, Feb 16, 2014 at 7:30 PM, Gavin Lambert
On 15/02/2014 03:49, Quoth Michael Powell:
I've learned about a "new" (or potentially new-to-boost-units, at any rate) dimension this week. TBD whether we'll be using boost or even units, but in the event we would, I'd like to add a slowness dimension. Basically it is the inverse of velocity: where velocity is time per length, slowness is length per time. Taking a gander at the velocity.hpp physical dimension, doesn't seem like a terribly hard thing to do, and with the new Git-module decomp, even less so today?
It's fairly straightforward to define your own custom dimensions using Boost.Units, especially when they're based on the existing dimensions and base units.
You can do this in your application code, without touching Boost.Units itself.
I get that. However that's why I mention it here in the event there's some process for folding in other, potentially value-added physical dimensions into the library.
Have a look at boost/units/physical_dimensions/velocity.hpp and just define your new dimension similarly -- you can then define units (see boost/units/systems/si/velocity.hpp) and quantities using that and then everything else should automatically recognise it and just work.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 18/02/2014 11:50, Quoth Michael Powell:
It's fairly straightforward to define your own custom dimensions using Boost.Units, especially when they're based on the existing dimensions and base units.
You can do this in your application code, without touching Boost.Units itself.
I get that. However that's why I mention it here in the event there's some process for folding in other, potentially value-added physical dimensions into the library.
If it's something you think should be included in the standard Boost distribution, then you can submit a Trac ticket suggesting it. It's more likely to go through if you also include a patch that adds it (following the same style as the existing code). But that's up to the maintainer of the library.
participants (2)
-
Gavin Lambert
-
Michael Powell