[pooma-dev] Re: [PATCH] Add relation like constructor to ScalarCode
Jeffrey D. Oldham
oldham at codesourcery.com
Wed Apr 7 13:58:13 UTC 2004
Richard Guenther wrote:
>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 <richard.guenther at uni-tuebingen.de>
>>>
>>> * 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.
>
>
OK. Thank you for the explanation. Please commit the change.
--
Jeffrey D. Oldham
oldham at codesourcery.com
More information about the pooma-dev
mailing list