freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pooma-dev] Re: [PATCH] Add relation like constructor to ScalarCode


From: Richard Guenther
Subject: Re: [pooma-dev] Re: [PATCH] Add relation like constructor to ScalarCode
Date: Wed, 7 Apr 2004 10:11:19 +0200 (CEST)

On Tue, 6 Apr 2004, Jeffrey D. Oldham wrote:

> Richard Guenther wrote:
>
> >Hi!
> >
> >This adds a relation functor required constructor to ScalarCode to be able
> >to use ScalarCode objects as relation functors.  It also updates
> >TestBasicRelations check to excercise this and also adds actual checking
> >to the test.
> >
> >Tested partly (relation and scalarcode tests) on ia32-linux, ok?
> >
> >Richard.
> >
> >
> >2004Apr02  Richard Guenther <address@hidden>
> >
> >     * src/Evaluator/ScalarCode.h: add copy constructor with
> >     extra LHS argument for relation functor compatibility.
> >     src/Field/tests/TestBasicRelations.cpp: check using
> >     ScalarCode object as relation functor.
> >
> >===== Evaluator/ScalarCode.h 1.5 vs edited =====
> >--- 1.5/r2/src/Evaluator/ScalarCode.h        Thu Oct 23 14:41:02 2003
> >+++ edited/Evaluator/ScalarCode.h    Fri Apr  2 13:29:26 2004
> >@@ -403,6 +403,14 @@
> >   {
> >   }
> >
> >+  /// Constructor to allow ScalarCode being used as RelationFunctor
> >+
> >+  template <class LHS>
> >+  ScalarCode(const ScalarCode<Function>& sc, const LHS&)
> >+    : function_m(sc.function_m)
> >+  {
> >+  }
> >+
> >   template<class F>
> >   static inline bool checkValidity(const F& f, WrappedInt<false>)
> >   {
> >===== Field/tests/TestBasicRelations.cpp 1.1 vs edited =====
> >--- 1.1/r2/src/Field/tests/TestBasicRelations.cpp    Mon May 13 17:47:37 2002
> >+++ edited/Field/tests/TestBasicRelations.cpp        Fri Apr  2 13:37:14 2004


> If I understand correctly, this modifies the code to support computation
> at a particular Loc (location).  I had assumed that relations worked on
> fields, not individual locations within fields.  Thus, a field might be
> lazily evaluated.  If a value at a particular location is needed, the
> field can be queried at that location.   Why do we need the proposed
> code changes?

You misunderstood the intent of the patch.  It's just I can use my
existing ScalarCode<> functors with a relation, i.e. say

Pooma::newRelation(ScalarCode<computePotentialEnergy<2> >(), U, m, h);

in order for this to work, ScalarCode needs the above constructor (I
snipped all other parts of the patch), else it would not compile.

The changes to the testcase just use a ScalarCode for one of the relations
and further actually check for correct operation.

Richard.

--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]