Boost logo

Boost :

From: David Richardson (dgr24_at_[hidden])
Date: 2003-10-15 08:55:04


There is a new dimensioned.tar.bz2 on yahoo. It now works with
gcc 3.3.1 and icc 7.0 (both on Linux), adds a sqrt function, and
fixes a bug involving fractional powers not being reduced correctly.

Hopefully the changes to get it to compile under icc 7.0 will let
it compile on more compilers. Could people with access to other
compilers please check?

Summary of Current Features:

* Units defined in terms of Mass, Length, Time
* Handles fractional powers for units
* Provides typedefs for commonly used units
* Provides mechanism for users to make new units
* Has functions for exponentiation (sci::pow) and square roots
(sci::sqrt)
* Arithmetic operators +, +=, -, -=, *, *=, /, =
* Comparison operators ==, !=, <, <=, >, >=
* Numeric type may be specified by user
* May be extended to use new numeric types by creation of a traits
class
* Absolutely zero runtime cost for validating dimensional correctness
* All invalid expressions are detected at compile time and prevent
compilation

Rough Edges:

* Does not do type promotion when underlying numeric types are
different. Does anyone know of existing code to do this other
then what is in Generative Programming/GMCL?

* Number of dimensions hard coded to three. I'm working learning
the MPL so I can fix this.

* Dimension semantics are hard coded to Mass, Length, Time. How
many people will want to use this for situation where they need
different semantics?

* sci::pow calling syntax is a bit awkward. Does anyone have any
suggestions for improving this?

Possible Features:

* Formated I/O
* Automatic Conversion
* Multiple Units Systems (e.g. English, Metric)
* Uncertainty Propagation. This is easily added by using an
interval as the numeric type (and boost already has an interval
class).

Are there any other features people are interested in? One design
goal that I have is making it so that people can always use the
dimensional analysis part of the library at zero runtime cost.
There are many domains (e.g. molecular simulation) where any
runtime penalty makes the library useless. If things like
conversion and I/O formatting get implemented, I think it will
need to be on top of the dimensional correctness class. That way
people can not use the I/O and conversion functionality if they do
not need it.

Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk