Status

Mark Mitchell mark at codesourcery.com
Mon Jul 9 15:57:36 UTC 2001



--On Saturday, July 07, 2001 11:23:04 AM -0600 Scott Haney 
<scotth at proximation.com> wrote:

> I finally have a design for a POOMA relations package that I like and
> have implemented it and started to perform some testing.

Excellent.

>    Pooma::newRelationFunctor(ComputeKineticEnergy(), K, m, v);
>    Pooma::newRelationFunctionPtr(computePotentialEnergy, U, m, h);
>    Pooma::newRelationMemberPtr(obj, &ComputeVelocity::doit, v, p, m);

FYI, the STL in most places just uses one function, like this:

  template <typename T>
  void newRelation(T t) { ... t() ... }

which works with functors and function pointers automatically, and
with the pointer-to-member case via an adaptor; I think there
is something like `member_function' that returns a new functor so that
you can say:

 newRelation (member_function(obj, &ComputeVelocity::doit), v, p, m)

It's not clear to me that we should try to imitate the STL in any way
in POOMA -- but its conventions are now used by lots of people, so it
might be good to gradually move the interfaces in that direction.  It's
also worth noting that compilers are working hard on optimizing those
constructs, so if POOMA looks like the STL, that might have positive
side-effects as well.

Doing things that way also makes for a nice concept-based view of
what the arguments are; they are things that are Callable.

And, of course, if you go this way you only have to write one function
instead of three...

-- 
Mark Mitchell                mark at codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com



More information about the pooma-dev mailing list