|
Boost Users : |
Subject: Re: [Boost-users] [units] conversion factor for non-base
From: Matthias Schabel (boost_at_[hidden])
Date: 2010-04-30 12:13:04
> "The flow coefficient is Q/sqrt(dP), a volumetric flow/sqrt(pressure)."
>
> The units, specifically, are:
>
> Kv = (m3/h)/sqrt(bar)
> Cv = (usgal/min)/sqrt(psi)
>
> Repasted from the omitted text:
>
> "The only way I can think of to do it is to make a system with the
> components within the derived dimension and make conversion factors for
> those. The problem is that I am not sure such systems can be coherent
> and it would be a significant effort above and beyond the direct
> conversion factors I already know."
To finish the thought, you can get a function to take any quantity of volumetric flow/sqrt(pressure) as follows (using the previous code) :
namespace boost {
namespace units {
typedef
make_dimension_list< list< dim< length_base_dimension,static_rational<7,2> >,
list< dim< mass_base_dimension,static_rational<-1,2> >, dimensionless_type > > >::type funky_type;
} // namespace units
} // namespace boost
using namespace boost::units;
template<class Y,class System>
void f2(const quantity<unit<funky_type,System>,Y>& arg)
{
std::cout << quantity<Kv,Y>(arg) << std::endl;
}
int main(void)
{
f2(1.0*Kv());
f2(1.0*Cv());
}
Matthias
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