Boost logo

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