|
Boost : |
From: Gerhard Wesp (gwesp_at_[hidden])
Date: 2006-06-07 04:51:11
Sorry, I don't have the time to read the PQS documentation in-depth
right now.
Still, I'd like to make one suggestion.
I think that handling of dimensional quantities and conversion factors
are orthogonal concepts and should be separated.
I suggest that for maximum transparency the library should *exclusively*
handle quantities expressed in SI units.
I'm aware that this "mildly forces" developers to adopt SI units. I
consider this a Good Thing.
Conversion factors between non-SI units and SI units should be constant
dimensional quantities, e.g. (assuming constructors from double):
const length foot = .3048 ; // Meter
const power european_horse_power = 735.4987 ; // Watt
const mass pound = 0.4535924; // Kilogram
// ...
This way, one could e.g. construct dimensional quantities like this:
const power deux_chevaux = 2 * european_horse_power;
Non-SI quantities would have to stay "out of the system" in normal
floating point variables:
length altitude;
double altitude_ft = altitude / foot;
Ignoring dimensionality, this is the notation Mathematica chooses.
I have done some engineering simulations, written a flight simulation
framework and used one that uses US units (D6; see www.bihrle.com). The
D6 source code is riddled with magic constants. I've collected some
conversion constants in units.h of cpp-lib, see
http://gwesp.tx0.org/software/.
Regards
-Gerhard
-- Gerhard Wesp ZRH office voice: +41 (0)44 668 1878 ZRH office fax: +41 (0)44 200 1818 For the rest I claim that raw pointers must be abolished.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk