Boost logo

Boost Users :

Subject: [Boost-users] boost::units - converting from one derived_dimension to another across systems (imperial to metric)
From: Matt Vinson (matt.vinson_at_[hidden])
Date: 2018-11-16 12:27:50

Thanks for input...Ok, I have errors creating a 'lineal force unit'.
In our branch of engineering, we have kips****/ft, kips/in, lbs/foot, lbs/in, kN/meter, Kn/cm, KN/mm, N/meter, N/cm, N/mm, Metric Ton/meter, Metric Ton/cm, Metric Ton/mm, KiloGram/meter $, KiloGram/cm, KiloGram/mm, etc....All these units* are loosing force divided by length.
After all the appreciated input in this thread, I thought I'd try this but it does not compile*** probably because force is "L M T^-2" and length is "L" which is not correct:        //Lineal Force
        typedef boost::units::derived_dimension<
            boost::units::force_dimension, 1,
            boost::units::length_dimension, -1
        >::type lineal_force_dimension;

How can I use Boost.Units to convert one force/length to another force/length: say, lb/in to, say, kg/m?
*not Boost.Units**, the units in the engineering math equation**A set of base units raised to rational exponents, e.g. m^1, kg^1, m^1/s^2.
*** ...\boost_1_68_0\boost\mpl\aux_\preprocessed\plain\less.hpp(20): error C2039: 'value': is not a member of 'boost::units::detail::dimension_list_tag'
****1000 lbs force = kips***** Here is a table in Wiki about converting between lbs and kilogram.  Kilogram in Boost.Units is a mass not a force so I need to create a kilogram force and I did that when I converted "Forces" $ in another task...
        struct metric_ton_base_unit : boost::units::base_unit<metric_ton_base_unit, boost::units::force_dimension, 7> { };
        typedef metric_ton_base_unit::unit_type metric_ton_unit;
        BOOST_UNITS_STATIC_CONSTANT(metric_ton, metric_ton_unit);
        typedef boost::units::quantity<metric_ton_unit> metric_ton_quantity;
        typedef boost::units::make_scaled_unit<metric_ton_unit, boost::units::scale<10, boost::units::static_rational<-3>>>::type kg_force_unit;
        BOOST_UNITS_STATIC_CONSTANT(kg_force, kg_force_unit);
        typedef boost::units::quantity<kg_force_unit> kg_quantity;.cpp       BOOST_UNITS_DEFINE_CONVERSION_FACTOR(dimensional_analysis::force::metric_ton_base_unit, dimensional_analysis::force::newton_base_unit, double, 9806.65); // exact conversion
BOOST_UNITS_DEFAULT_CONVERSION(dimensional_analysis::force::metric_ton_base_unit, dimensional_analysis::force::newton_base_unit);%
$ lb/in to kg/m: Google: convert lb/in to kg/m


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at