freepooma-devel
[Top][All Lists]
Advanced

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

Re: [Freepooma-devel] [PATCH] Fix Field/Array mixed expressions


From: Roman Krylov
Subject: Re: [Freepooma-devel] [PATCH] Fix Field/Array mixed expressions
Date: Thu, 21 Apr 2005 18:26:07 +0400
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

I found that even with this patch mixed arrays and fields operations are impossible: I have 'tmp = rho/tmp;' where tmp is Array<3,double> and rho is a Field<...>and it yields:

/usr/src/POOMA/pooma/src/PETE/ForEach.h: In instantiation of ‘ForEach<BinaryNode<OpDivide, Reference<Field<Mesh_t, num_type, MultiPatch<GridTag, Brick> > >, Reference<Array<3, num_type, Brick> > >, FarLeftTag, FarLeftTag>’: /usr/src/POOMA/pooma/src/Field/FieldMakeReturn.h:130: instantiated from ‘MakeFieldReturn<BinaryNode<OpDivide, Reference<Field<Mesh_t, num_type, MultiPatch<GridTag, Brick> > >, Reference<Array<3, num_type, Brick> > > >’
$%&.cc:131: instantiated from here
/usr/src/POOMA/pooma/src/PETE/ForEach.h:111: error: ambiguous class template instantiation for ‘struct Combine2<Field<Mesh_t, num_type, MultiPatch<GridTag, Brick> >, ErrorType, OpDivide, FarLeftTag>’ /usr/src/POOMA/pooma/src/Field/FieldEngine/FieldEngine.ExprEngine.h:139: error: candidates are: struct Combine2<T, ErrorType, Op, FarLeftTag> /usr/src/POOMA/pooma/src/Field/FieldEngine/FieldEngine.ExprEngine.h:115: error: struct Combine2<Field<G1, T1, E1>, T, Op, FarLeftTag> /usr/src/POOMA/pooma/src/PETE/ForEach.h:111: error: invalid use of undefined type ‘struct Combine2<Field<Mesh_t, num_type, MultiPatch<GridTag, Brick> >, ErrorType, OpDivide, FarLeftTag>’ /usr/src/POOMA/pooma/src/PETE/Combiners.h:93: error: declaration of ‘struct Combine2<Field<Mesh_t, num_type, MultiPatch<GridTag, Brick> >, ErrorType, OpDivide, FarLeftTag>’ /usr/src/POOMA/pooma/src/PETE/ForEach.h:114: error: no type named ‘Type_t’ in ‘struct Combine2<Field<Mesh_t, num_type, MultiPatch<GridTag, Brick> >, ErrorType, OpDivide, FarLeftTag>’

Thanks.


Richard Guenther wrote:

More fallout from the fact we have different Field and Array.
Adds capability to mix Field/Array in expressions like

 Field == iota(...)

or

 Field == iota(...) + 2

should also enable

 Field = iota(...) + Field

(untested)


Will be excercised in functionality I'm going to submit later.

Tested ok, applied to HEAD.

Richard.


2005Apr14  Richard Guenther <address@hidden>

        * src/Field/Field.h: Add LeafFunctor specialization for
        Array and SubFieldViewFunctorTag.
        src/Field/FieldEngine/FieldEngine.ExprEngine.h: Add
        Combine2 specialization for ErrorType and FarLeftTag.
        Add LeafFunctor specialization for Array and FarLeftTag.

Index: Field.h
===================================================================
RCS file: /cvsroot/freepooma/freepooma/src/Field/Field.h,v
retrieving revision 1.90
diff -u -r1.90 Field.h
--- Field.h     16 Dec 2004 14:16:12 -0000      1.90
+++ Field.h     14 Apr 2005 11:56:42 -0000
@@ -1865,6 +1865,12 @@
  typedef Field<Mesh, T, EngineTag> Type_t;
};

+template<int Dim, class T, class EngineTag>
+struct LeafFunctor<Array<Dim, T, EngineTag>, SubFieldViewFunctorTag>
+{
+  typedef ErrorType Type_t;
+};
+
template<class T>
struct LeafFunctor<Scalar<T>, SubFieldViewFunctorTag>
{
Index: FieldEngine/FieldEngine.ExprEngine.h
===================================================================
RCS file: 
/cvsroot/freepooma/freepooma/src/Field/FieldEngine/FieldEngine.ExprEngine.h,v
retrieving revision 1.8
diff -u -r1.8 FieldEngine.ExprEngine.h
--- FieldEngine/FieldEngine.ExprEngine.h        10 Nov 2004 22:05:01 -0000      
1.8
+++ FieldEngine/FieldEngine.ExprEngine.h        14 Apr 2005 11:56:42 -0000
@@ -107,6 +107,30 @@
    }
};

+template<class T, class Op>
+struct Combine2<ErrorType, T, Op, FarLeftTag>
+{
+  typedef T Type_t;
+  inline static
+  const Type_t &combine(const ErrorType& e, const T& t,
+                       FarLeftTag)
+  {
+    return t;
+  }
+};
+
+template<class T, class Op>
+struct Combine2<T, ErrorType, Op, FarLeftTag>
+{
+  typedef T Type_t;
+  inline static
+  const Type_t &combine(const T& t, const ErrorType& e,
+                       FarLeftTag)
+  {
+    return t;
+  }
+};
+
template<class A,class B,class C,class Op>
struct Combine3<A, B, C, Op, FarLeftTag>
{
@@ -140,6 +164,18 @@
    }
};

+template<int Dim, class T, class EngineTag>
+struct LeafFunctor<Array<Dim, T, EngineTag>, FarLeftTag>
+{
+  typedef ErrorType Type_t;
+  inline static
+  const Type_t &apply(const Array<Dim, T, EngineTag> &a,
+    const FarLeftTag &)
+    {
+      return Type_t();
+    }
+};
+
template<class T>
struct LeafFunctor<Scalar<T>, FarLeftTag>
{




_______________________________________________
Freepooma-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/freepooma-devel







reply via email to

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