
Boost : 
From: Matthias Schabel (boost_at_[hidden])
Date: 20040107 17:04:40
> In particular, I do not like defining dimensions such as length as
> types
> and units such as meters as constants, because it begs the question of
> how a dimension such as length should be represented internally (you
> end up choosing an internal unit to use). This
You need to be careful to make the distinction between a unit which is
a member of the "basis" for a unit system (for example, the units which
are bases of the SI system are meters, Kelvin, Kilograms, seconds,
etc...) and a quantity which is a scalar value in a particular unit
system. The abstraction that I've been using works like this :
SI<double>::length len(2.0*_meters);
where SI<double> specifies the basis of the unit system and the
precision of the representation of quantities and _meters is a
"constant" which carries only type information (there is no contained
value since it is implicitly one) and is defined to enable the use of
the * operator to form a quantity (value in a unit system) from a
scalar and a unit. The point of this is that, in the SI system the
meter is a member of the basis and the foot is a quantity which can be
expressed in meters while in the English unit system, the foot is the
basis and the meter the derived quantity.
> And, wouldn't this units library be much simpler to develop than the
> whole physical dimensions library? I think that Abrahams, Duncan, and
> Schabel have already pretty much described how to do it. The only
> difficulty I am aware of is the compilation time involved in handling
> lists of types that represent the different fundamental units in
> a derived unit.
The dimensional analysis code already exists and works : see
test_dimensional_analysis.cpp and included headers from YANL to see the
abstract system work, including defining dimension tags, etc...


Matthias Schabel, Ph.D.
Utah Center for Advanced Imaging Research
729 Arapeen Drive
Salt Lake City, UT 84108
8015879413 (work)
8015853592 (fax)
8017065760 (cell)
8014840811 (home)
mschabel at ucair med utah edu
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk