|
Boost Users : |
Subject: Re: [Boost-users] boost::units - converting from one derived_dimension to another across systems (imperial to metric)
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2018-11-21 04:15:10
AMDG
On 11/20/2018 08:55 PM, Matt Vinson via Boost-users wrote:
> Michael Powell:
> A) I hope to get Boost.Units to convert all these for me. I am replacing my own unit conversion classes with Boost.Units so there are no masking certain details, magic numbers, etc! Fingers Crossed.
> B) Boost.Units looks promising. Good to hear it has strong support. I'll keep at it. Thanks!//
> Steven Watanabe: Got it! You've been very patient and awesome. Thank you, yet again.I updated to this because I do need mass for density conversions:typedef boost::units::make_system<
> boost::units::us::inch_base_unit,
> boost::units::us::pound_base_unit,
> boost::units::us::pound_force_base_unit
> Â >::type
> ip_system;
> Any issues you see with boost::units::us::pound_base_unit for mass && boost::units::us::pound_force_base_unit for force?
It will work fine. The only requirement
for the units that make up a system is that
their dimensions must be linearly independent.
which is satisfied for L, M, L M T^-2.
The only issue is that you might get some
strange looking units coming out, like
the unit of time: lbf^{-1/2} in^{1/2} lb^{1/2}
>Â If I don't hear from you, I'll presume it's okay.
> My density unit testing* still passed after adding boost::units::us::pound_force_base_unit so I don't think there are issues.
>
> *each of these are converted to the other.
> enum class DENSITY : char
> {
> Â Â Â K_FT3 = 0,
> Â Â Â K_IN3 = 1,
> Â Â Â LB_FT3 = 2,
> Â Â Â LB_IN3 = 3,
> Â Â Â MT_M3 = 4,
> Â Â Â MT_CM3 = 5,
> Â Â Â MT_MM3 = 6,
> Â Â Â KG_M3 = 7,
> Â Â Â KG_CM3 = 8,
> Â Â Â KG_MM3 = 9,
> Â Â Â LAST = 10
> };
>
In Christ,
Steven Watanabe
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net