Boost logo

Boost Users :

Subject: Re: [Boost-users] Creating Boost unit system for astrodynamic equations
From: Matthias Schabel (boost_at_[hidden])
Date: 2011-11-23 16:45:25


> Length (earth radii)
> Time (minutes)
> Angle (radians)
>
> So derived types would be:
>
> Velocity (radians/minute)

Be careful to define this as angular velocity...

>
> Now that I have described what types are required I have a few questions:
>
> 1. Where is the length type for already defined for earth radii?

In your header file? The library does not include earth radii as a unit of length, but it is easy to roll your own.

> 2. What advantage is there to creating my own unit system?

For most applications, it is not necessary to create a whole unit system; you should just define your desired base units and, possibly, conversion factors to SI or some other system.

> It seems that my unit system would have:
>
> - earth radii

Look at <boost/units/base_units/us/yard.hpp>

> - kg (useless in the equations)

If mass doesn't appear in any of your equations, it is not necessary to define or include it.

> - minute

This already exists in the library : <boost/units/base_units/metric/minute.hpp>

> - radians

This already exists in the library <boost/units/base_units/angle/radian.hpp>

With a compiler that supports auto/decltype/typeof reasonably well, unit systems are now essentially an implementation detail for most uses of the library.

Matthias


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net