[Units] defining a derived dimension

I want to define a dimension stroke_rate, or flow_rate, for that matter. Not too out of the ordinary for our application. So I am starting with something like this for my dimensions. #include <boost/units/derived_dimension.hpp> #include <boost/units/physical_dimensions/length.hpp> #include <boost/units/physical_dimensions/time.hpp> typedef boost::units::derived_dimension<boost::units::dimensionless_type,1,boost::units::time_base_dimension,-1>::type stroke_rate_dimension; typedef boost::units::derived_dimension<boost::units::length_dimension,3,boost::units::time_dimension,-1>::type flow_rate_dimension; typedef boost::units::unit<ourns::units::stroke_rate_dimension,boost::units::si::system> stroke_rate; typedef boost::units::unit<ourns::units::flow_rate_dimension,boost::units::si::system> flow_rate; However, I am receiving compiler errors when I try and include the units, Error 1 error C2039: 'value' : is not a member of 'boost::units::detail::dimension_list_tag' C:\Source\Simulations\tools\boost-msvc90-pro\boost\mpl\aux_\preprocessed\plain\less.hpp 20 CS.Calculations.Managed Error 2 error C2065: 'value' : undeclared identifier C:\Source\Simulations\tools\boost-msvc90-pro\boost\mpl\aux_\preprocessed\plain\less.hpp 21 CS.Calculations.Managed Error 3 error C2039: 'value' : is not a member of 'boost::units::detail::dimension_list_tag' C:\Source\Simulations\tools\boost-msvc90-pro\boost\mpl\aux_\preprocessed\plain\less.hpp 21 CS.Calculations.Managed Error 4 error C2065: 'value' : undeclared identifier C:\Source\Simulations\tools\boost-msvc90-pro\boost\mpl\aux_\preprocessed\plain\less.hpp 22 CS.Calculations.Managed And so on along these lines. What am I doing wrong with the units and/or dimensions? This is quite similar to energy_density_dimension, for example. typedef derived_dimension<length_base_dimension,-1,mass_base_dimension,1,time_base_dimension,-2>::type energy_density_dimension; However, I am failing to see any appreciable difference. Any thoughts? Thanks, Michael

AMDG On 09/08/2011 12:43 PM, Michael Powell wrote:
I want to define a dimension stroke_rate, or flow_rate, for that matter. Not too out of the ordinary for our application. So I am starting with something like this for my dimensions.
#include <boost/units/derived_dimension.hpp> #include <boost/units/physical_dimensions/length.hpp> #include <boost/units/physical_dimensions/time.hpp>
typedef boost::units::derived_dimension<boost::units::dimensionless_type,1,boost::units::time_base_dimension,-1>::type stroke_rate_dimension;
<snip>
Any thoughts?
Does it work better if you use boost::units::derived_dimension<boost::units::time_base_dimension,-1>::type ? i.e. Leave out the unnecessary dimensionless_type. In Christ, Steven Watanabe

On Thu, Sep 8, 2011 at 2:03 PM, Steven Watanabe <watanabesj@gmail.com>wrote:
AMDG
On 09/08/2011 12:43 PM, Michael Powell wrote:
I want to define a dimension stroke_rate, or flow_rate, for that matter. Not too out of the ordinary for our application. So I am starting with something like this for my dimensions.
#include <boost/units/derived_dimension.hpp> #include <boost/units/physical_dimensions/length.hpp> #include <boost/units/physical_dimensions/time.hpp>
typedef
boost::units::derived_dimension<boost::units::dimensionless_type,1,boost::units::time_base_dimension,-1>::type
stroke_rate_dimension;
<snip>
Any thoughts?
Does it work better if you use
boost::units::derived_dimension<boost::units::time_base_dimension,-1>::type
Actually, that's the approach I ended up taking, then leave the dimensionless aspect for a calculation to resolve. That one does anyway. Next up, I need to capture a flow_rate, which I think is something like, typedef derived_dimension<length_dimension,3,time_base_dimension,-1>::type flow_rate_dimension; Or possibly, would be better, typedef derived_dimension<volume_dimension,1,time_base_dimension,-1>::type flow_rate_dimension; But this is causing the same type of build errors. ?
i.e. Leave out the unnecessary dimensionless_type.
In Christ, Steven Watanabe
Thanks, brother. :) _______________________________________________
Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

AMDG On 09/08/2011 01:39 PM, Michael Powell wrote:
Next up, I need to capture a flow_rate, which I think is something like,
typedef derived_dimension<length_dimension,3,time_base_dimension,-1>::type flow_rate_dimension;
Or possibly, would be better,
typedef derived_dimension<volume_dimension,1,time_base_dimension,-1>::type flow_rate_dimension;
But this is causing the same type of build errors.
?
You're mixing dimensions and base dimensions incorrectly. Use either: derived_dimension<length_base_dimension,3,time_base_dimension,-1>::type or mpl::divides<volume_dimension, time_dimension>::type In Christ, Steven Watanabe

Ah ok. On Thu, Sep 8, 2011 at 3:01 PM, Steven Watanabe <watanabesj@gmail.com>wrote:
AMDG
On 09/08/2011 01:39 PM, Michael Powell wrote:
Next up, I need to capture a flow_rate, which I think is something like,
typedef
derived_dimension<length_dimension,3,time_base_dimension,-1>::type
flow_rate_dimension;
Or possibly, would be better,
typedef derived_dimension<volume_dimension,1,time_base_dimension,-1>::type flow_rate_dimension;
But this is causing the same type of build errors.
?
You're mixing dimensions and base dimensions incorrectly. Use either:
derived_dimension<length_base_dimension,3,time_base_dimension,-1>::type
or
mpl::divides<volume_dimension, time_dimension>::type
I knew it had to be something stupid like that. Thanks for pointing that out.
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Michael Powell
-
Steven Watanabe