|
Boost : |
From: Andy Little (andy_at_[hidden])
Date: 2003-10-24 05:50:26
"Deane Yang" <deane_yang_at_[hidden]> wrote in message
news:bn9dlc$m4s$1_at_sea.gmane.org...
> Andy Little wrote:
>
>
> > Yep.
> > (As an aside I hope we are discussing the same thing.
> > ie physics, physical quantities. Physics is just about big enough to
deserve
> > its own personal entities. :-)
> > Sorry.. but my view is that generalisation to boxes of apples or types
of
> > gasoline is really the road
> > to squish.)
> >
>
> I disagree. What physicists need is not that special.
Fish swim pretty well. That is what they are designed for.
Impose a law requiring all fish to ride bicycles and you merely succeed in
outlawing fish.
I suggest that the best road is to make a physical quantity type work in the
field of physics.
My demo does not solve all the problems by any stretch
One thrown up so far is temperature, not complicated (I hope :-) ) but
requiring thought.
Other dimensions may also show problems
A major problem is angles and rotational motion which will probably require
a complete rethink
see also
http://www.servocomm.freeserve.co.uk/Cpp/physical_quantity/PhysicalQuantities1.html
Its an attempt to get at the rules involved. Its far from perfect :-)
>
> > I see a "physical quantity" type as a concrete
> > type like complex or BjarneStroustrup's Date
> > class in C++3rdEd.
> >
> > A major contention I think is the basis of the type.
> > One view is that the dimension should be a type:
> >
> > length mylength;
> >
> > My view is that the unit should be the type:
> >
> > length::metres mylength;
> >
>
> I agree 100% (but I'm not so sure about the "length::").
I am currently using a pq_ prefix ie pq_length.
There is a need for a namespace/class to distinguish between units of
physical quantities , some of which have the same names
(note: my library makes a poor job of angular motion currently ):
pq_angle::seconds alpha;
pq_time::seconds t;
I am also using the same name for the unit of a dimension:
the unit class/namespaces have an of_ prefix:
http://www.servocomm.freeserve.co.uk/Cpp/physical_quantity/inc/DimensionUnitObjects.h
and a physical quantity comprised only of that unit has the same name but
in a different class/namespace:
http://www.servocomm.freeserve.co.uk/Cpp/physical_quantity/inc/PhysicalQuantities.h
Bearing in mind that this is a demo, so there is very likely a better way to
organise things.
Andy Little
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk