Boost logo

Boost Users :

From: Patricia Hawley (hawley1_at_[hidden])
Date: 2008-05-15 14:32:25


Steven Watanabe <watanabesj <at> gmail.com> writes:

>
> AMDG
>
>
> Can you post the definitions of FPS::foot, FPS::system &c.
>
> In Christ,
> Steven Watanabe
>

Here is the definition for feet (using centimeters as an example):

#ifndef BOOST_UNITS_FPS_LENGTH_HPP
#define BOOST_UNITS_FPS_LENGTH_HPP

#include <boost/units/systems/fps/base.hpp>

namespace boost {

namespace units {

namespace FPS {

typedef unit<length_dimension,FPS::system> length;
    
BOOST_UNITS_STATIC_CONSTANT(foot,length);
BOOST_UNITS_STATIC_CONSTANT(feet,length);

} // namespace FPS

} // namespace units

} // namespace boost

#endif // BOOST_UNITS_FPS_LENGTH_HPP

Note: in the following I have a slug_base_unit, but I can't get this to work
even if I strip out slugs and seconds, and only try working with feet.

#ifndef BOOST_UNITS_FPS_BASE_HPP
#define BOOST_UNITS_FPS_BASE_HPP

#include <string>

#include <boost/units/io.hpp>
#include <boost/units/static_constant.hpp>
#include <boost/units/unit.hpp>
#include <boost/units/make_system.hpp>

#include <boost/units/systems/base_units/foot.hpp>
#include <boost/units/systems/base_units/slug.hpp>
#include <boost/units/systems/base_units/second.hpp>

namespace boost {

namespace units {

namespace FPS {

// Note: called fps for foot-pound-second, but mass unit is slugs
typedef make_system<foot_base_unit, slug_base_unit, second_base_unit>::type
   system;

/// dimensionless FPS unit
typedef unit<dimensionless_type,system> dimensionless;

} // namespace FPS
                                                    
} // namespace units

} // namespace boost

#endif // BOOST_UNITS_FPS_BASE_HPP

FPS is a fairly common system where I work, and although it is short for
foot-pounds-seconds since pounds is a force, the mass unit is slugs.

Pat


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