Boost logo

Boost :

From: e_d_k_at_[hidden]
Date: 2001-04-24 09:28:42


--- In boost_at_y..., "Paul A. Bristow" <pbristow_at_h...> wrote:
> I think this is definitely a very important facility,
> but should it also be tied up with input and output of units,
> including SI units?
>
> So we can read files like:
>
> teabag 1 (dimensionsless item!?!)
> sugar 1 teaspoon
> milk 1 tablespoon
> water at 100 degrees Celsius 250 ml
> ...
>
>
> I have some code which tries to do this - but it gets jolly complicated!
>
> Paul

I define all the basic SI units, and define the standard prefixes and sufixes. so If you want to use gigameters and cubic ccintimeters in your calculations you define a constant :

const Distance gigameter = giga(meter);
const Volume ccs = Pow<3>(centi(meter));

I have also defined most American and British units, and many additional units (SiderealTime, Apothecary Weigh, . . .). Teaspoons are part of the U.S. Customary System. If I have overlooked a unit you want it is easy to define it in terms of an existing unit if you know the convertion factor as follows:

const Distance smoots = sumoots_per_meter * meter;

(sorry I do not know the lent of the standard smoot).

I have difined basic dimentions of distance, time, mass, tempriture, charge, and money. I have reserde six aditional dimentions slots for future developmen, and and five to be user defined. If you want units of tea bags you can use on of these five.

I do not consider reading files to be part of the core functionality of a dimentional analysis package. It sould be easy to white code to read a file though. Infoact it will be nessisary to handle monitaty convertion, since they can not be fixed at run time.

    -EdK


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