Boost logo

Boost Users :

Subject: Re: [Boost-users] Flow rate dimensional analysis
From: Michael Powell (mwpowellnm_at_[hidden])
Date: 2011-09-19 16:15:20


On Mon, Sep 19, 2011 at 1:14 PM, Steven Watanabe <watanabesj_at_[hidden]>wrote:

> AMDG
>
> On 09/19/2011 12:01 PM, Michael Powell wrote:
> > On Mon, Sep 19, 2011 at 12:57 PM, Steven Watanabe <watanabesj_at_[hidden]
> >wrote:
> >
> >> On 09/19/2011 11:29 AM, Michael Powell wrote:
> >>>
> >>> However, when I do this, I do get a compiler error:
> >>>
> >>> quantity<cs::units::si::flow_rate, float> __fr = __C_flow *
> __a_orifice
> >> *
> >>> boost::units::sqrt(__two * __p_diff / __d);
> >>>
> >>
> >
> > If it can be fixed from a library perspective, great. It's easy enough to
> > workaround, however, taking static_cast<float>(x.value()) of the
> > intermediate result, and so that we don't get too far removed from the
> > dimensional analysis.
> >
>
> Actually, you can directly convert the quantities.
> The conversion is just explicit. You're getting
> an error because the code tries to do an implicit
> conversion.
>

Static casting the static_cast<quantity<flow_rate, float>>(...) will work.
Thanks, bro.

> In Christ,
> Steven Watanabe
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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