Reputation: 410
In my business field, I have values that are expressed as W.mˆ-2.Kˆ-1.
In a 'base dimensions' point of view, these values are expressed as kg.sˆ-3.Kˆ-1 (W = kg.mˆ2.sˆ-3)
How do I implement this dimension and this unit with Boost Unit?
The only examples I found, including the official documentation, were about deriving dimensions from base dimensions, but I'd like to derive from the 'power' dimension, which is itself a derived dimension.
Also, I don't know if I have to derive from the power dimension, or if I must derive my dimension from the base ones and set my dimension's unit such as it is expressed in W.mˆ-2.Kˆ-1. I forsee that the latter would be more difficult to manipulate (getting the number of watts, given an area and a temperature would not be trivial given that my 'base-derived' dimension is about kilograms and seconds...).
Thanks.
Upvotes: 2
Views: 615
Reputation: 1231
You can use the unit operators to manipulate higher level dimensions and then typedef them into something useful. These units operators are available in the <boost/units/operators.hpp>
header file.
Examples are available in the documentation and they are used to create high level dimensions for physical constants here [<boost/units/systems/si/codata/typedefs.hpp>][1]
typedef divide_typeof_helper<frequency,electric_potential>::type frequency_over_electric_potential;
typedef divide_typeof_helper<electric_charge,mass>::type electric_charge_over_mass;
typedef divide_typeof_helper<mass,amount>::type mass_over_amount;
and for your specific case:
typedef divide_typeof_helper< power , area >::type power_over_area;
typedef divide_typeof_helper< power_over_area, temperature >::type heat_transfer_coeff;
Upvotes: 0