Hi,
I asked about this in StackOverflowhttp://stackoverflow.com/questions/27519186/boost-heterogeneous-unit-bar-per... but didn't get any answers so I thought I'd try here as well.
I need to create a unit which represents pressure per time, specifically Bar per Minute. I tried creating it in the same way as I created similar units before:
typedef boost::units::derived_dimension::type pressure_roc_dimension;
typedef boost::units::unit::type> bar_per_minute_unit;
BOOST_UNITS_STATIC_CONSTANT(BarPerMinute, bar_per_minute_unit::unit_type);
typedef boost::units::quantity BarPerMinuteRoC;
And then I try to use it:
BarPerMinuteRoC bpm = 5.0 * BarPerMinute;
But this line doesn't compile with quite a long error trail which I'm having a bit of trouble understanding fully.
1>c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(197): error C2039: 'item' : is not a member of 'boost::units::dimensionless_type'
1> c:\workspace\externals\boost_1_57_0\include\boost\units\dimensionless_type.hpp(37) : see declaration of 'boost::units::dimensionless_type'
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(259) : see reference to class template instantiation 'boost::units::detail::determine_extra_equations_skip_zeros_impl::apply' being compiled
1> with
1> [
1> RowsBegin=boost::units::list,boost::units::list,boost::units::detail::make_zero_vector<0>::type>>,boost::units::detail::determine_extra_equations_skip_zeros_impl::apply,boost::units::list,boost::units::list,boost::units::detail::expand_dimensions<0>::applyboost::units::dimensionless_type,boost::units::dimensionless_type::type>>>,boost::units::dimensionless_type>,1,0,3,boost::units::list,boost::units::list,boost::units::list,boost::units::detail::make_zero_vector<0>::type>>>,boost::units::list,boost::units::list,boost::units::list,boost::units::detail::expand_dimensions<0>::applyboost::units::dimensionless_type,boost::units::dimensionless_type::type>>>,boost::units::dimensionless_type>>>::next_equations>
1> , Result=boost::units::list,boost::units::list,boost::units::list,boost::units::detail::make_zero_vector<0>::type>>>,boost::units::list,boost::units::list,boost::units::list,boost::units::detail::expand_dimensions<0>::applyboost::units::dimensionless_type,boost::units::dimensionless_type::type>>>,boost::units::dimensionless_type>>
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(264) : see reference to class template instantiation 'boost::units::detail::determine_extra_equations<2,false>::apply,boost::units::list,boost::units::detail::make_zero_vector<0>::type>>,boost::units::detail::determine_extra_equations_skip_zeros_impl::apply,boost::units::list,boost::units::list,boost::units::detail::expand_dimensions<0>::applyboost::units::dimensionless_type,boost::units::dimensionless_type::type>>>,boost::units::dimensionless_type>,1,0,3,Result>::next_equations>,3,Result>' being compiled
1> with
1> [
1> Result=boost::units::list,boost::units::list,boost::units::list,boost::units::detail::make_zero_vector<0>::type>>>,boost::units::list,boost::units::list,boost::units::list,boost::units::detail::expand_dimensions<0>::applyboost::units::dimensionless_type,boost::units::dimensionless_type::type>>>,boost::units::dimensionless_type>>
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(538) : see reference to class template instantiation 'boost::units::detail::determine_extra_equations<3,false>::apply' being compiled
1> with
1> [
1> Matrix=boost::units::list,boost::units::list,boost::units::list,boost::units::detail::make_zero_vector<0>::type>>>,boost::units::list,boost::units::list,boost::units::list,boost::units::detail::expand_dimensions<0>::applyboost::units::dimensionless_type,boost::units::dimensionless_type::type>>>,boost::units::dimensionless_type>>
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(828) : see reference to class template instantiation 'boost::units::detail::make_square_and_invert,boost::units::list,boost::units::list,boost::units::detail::make_zero_vector<0>::type>>>,boost::units::list,boost::units::list,boost::units::list,boost::units::detail::expand_dimensions<0>::applyboost::units::dimensionless_type,boost::units::dimensionless_type::type>>>,boost::units::dimensionless_type>>>' being compiled
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(1032) : see reference to class template instantiation 'boost::units::detail::normalize_units<T>' being compiled
1> with
1> [
1> T=boost::units::list>>,boost::units::listboost::units::metric::bar_base_unit,boost::units::dimensionless_type>
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(1051) : see reference to class template instantiation 'boost::units::detail::calculate_base_unit_exponents_impl<false>::apply' being compiled
1> with
1> [
1> T=boost::units::list>>,boost::units::listboost::units::metric::bar_base_unit,boost::units::dimensionless_type>
1> , Dimensions=BSII::Units::pressure_roc_dimension
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\heterogeneous_system.hpp(243) : see reference to class template instantiation 'boost::units::detail::calculate_base_unit_exponents>>,boost::units::list>,Dimensions>' being compiled
1> with
1> [
1> T=boost::units::metric::bar_base_unit
1> , Dimensions=BSII::Units::pressure_roc_dimension
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\unit.hpp(92) : see reference to class template instantiation 'boost::units::detail::make_heterogeneous_system' being compiled
1> with
1> [
1> Dim=BSII::Units::pressure_roc_dimension
1> , System=boost::units::homogeneous_system>>,boost::units::listboost::units::metric::bar_base_unit,boost::units::dimensionless_type>>
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\unit.hpp(99) : see reference to class template instantiation 'boost::units::reduce_unit<S1>' being compiled
1> with
1> [
1> S1=BSII::Units::bar_per_minute_unit
1> ]
1> c:\workspace\foundations\sw_foundations\bsii_common\test\src\units\units_pressure_test.cpp(97) : see reference to class template instantiation 'boost::units::is_implicitly_convertibleBSII::Units::bar_per_minute_unit,Unit' being compiled
1> with
1> [
1> Unit=BSII::Units::bar_per_minute_unit
1> ]
According to the Boost documentation a homogeneous system can only be composed of linearly independent base units. In my case, I'm trying to mix bars (which in turn "contain" seconds as the time element) with minutes. This sounds problematic to me. But on the other hand, since I don't include mass and length base units in my system it seems to me that the base is independent after all.
In any case, I searched online for an example of creating such a heterogeneous unit but didn't find anything comprehensible. Also, I read in the Boost documentation that a heterogeneous unit doesn't preserve information about how it was created. Does this mean I won't be able to, for instance, multiply BarPerMinuteRoC by Minute and get Bar back?
Thanks a lot!
Dina
This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain materials protected by copyright or information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or agreement. If you are not the intended recipient, you are hereby notified that any review use, dissemination, distribution, or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply email and destroy all copies of the original. Thank you.