Boost logo

Glas :

RE: [glas] MTL3 design ? [was MTL project site is up]

From: Virgilio, Vincent - SSD (Vincent.Virgilio_at_[hidden])
Date: 2005-02-03 14:16:12


> -----Original Message-----
> From: glas-bounces_at_[hidden]
> [mailto:glas-bounces_at_[hidden]] On Behalf Of David Abrahams
> Sent: Thursday, February 03, 2005 8:55 AM
> To: Generic Linear Algorithm Software
> Subject: Re: [glas] MTL3 design ? [was MTL project site is up]
>
> "Patrick Kowalzick" <patrick.kowalzick_at_[hidden]> writes:
>
> > From: "David Abrahams" <dave_at_[hidden]>
> >> Guntram Berti <berti_at_[hidden]> writes:
> >
> > [snip]
> >
> >>> I think it will not be uncommon to wish to forbid even assignment
> >>> between vectors of equal size, for example if one represents
> >>> cell-based and the other one vertex-based quantities
> (speaking FEM).
> >>> So one could introduce mechanisms to forbid assigment at compile
> >>> time (i.e. making those vectors different types).
> >>
> >> Or const?
> >
> > IMO for a "user" there is an easy way needed to create a bunch of
> > vectors with different _semantic_ meanings. One example is
> Guntrams FEM example.
> > Another one might be the representations of geometrical
> entities, e.g
> > the semantic difference between points and vectors. This
> truly depends
> > on the mathematical context.
> >
> > Having different types makes it much easier declaring functions for
> > some action. As an example take two vectors[3], where one
> represents a
> > point and the other a line in a 2D homogeneous space. The affine
> > transformations for both types must not be equal, so the
> functions should be overloaded:
> > point affine_transformation( const matrix & a, const point & x );
> > line affine_transformation( const matrix & a, const line & x );
> >
> > Both points and lines _are_ vectors, but behave completly
> different. E.g.
> > addition of both is forbidden.
>
> Now you're talking about
> http://article.gmane.org/gmane.comp.lib.boost.devel/117232
> (click the message subject to see the whole thread).
>
> --
> Dave Abrahams
> Boost Consulting
> www.boost-consulting.com
> _______________________________________________
> glas mailing list
> glas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/glas
>

Similarly, you might want to encode the coordinate system of a vector
into its type, to prevent unintentional combinations across coordinate
systems. I have a small implementation of this that has proven very
helpful.

Vince Virgilio

************************************
This e-mail and any files transmitted with it are proprietary and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Industries, Inc. The recipient should check this e-mail and any attachments for the presence of viruses. ITT Industries accepts no liability for any damage caused by any virus transmitted by this e-mail.
************************************