freepooma-devel
[Top][All Lists]
Advanced

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

Patch: Get NewField to work with messaging.


From: Stephen A. Smith
Subject: Patch: Get NewField to work with messaging.
Date: Tue, 10 Apr 2001 16:00:24 -0600

I'll be checking the following changes in later today to get the
new field class working with messaging.  The changes were
reviewed by Scott H.  They were tested using Cheetah with
shared-memory transport on a dual-processor linux box,
compiled with egcs-2.95.2.
(configure with --arch LINUXEGCS --messaging --bounds)
(run with -shmem -np 2)

src/NewField/tests:
  *ExpressionTest.cpp
  *FieldTour1.cpp
  *ScalarCode.cpp
  *VectorTest.cpp
  *WhereTest.cpp
  -changes to use Remote engines and distributed
   layouts when compiled with Cheetah.  (Also, added
  ExpressionTest to the default targets and commented
  out tests corresponding to unimplemented functionality.)

Field changes:
  *NewField/Field.h
  *FieldEngine.Lagrangian.h
  *FieldEngine.NoGeometry.h
  *FieldEngine.UR.h
  *FieldEngineBase.h
  *Engine/ViewEngine.h
  *Evaluator/MultiArgEvaluator.h
  *PETE/Functors.h
  -code to enable remote view for the new field classes:
    1) added a leaf functor for taking the view of the field and
       a set of constructors in the field engines.
    2) added leaf functor for views of MultiArgs (used by
       ScalarCode with remote fields).
    3) two bug fixes in previously unused code (in ViewEngine
      and in MultiArgEvaluator)
    4) the change in PETE just makes some of the leaf functor
      code cleaner.

    Stephen

Index: ExpressionTest.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/tests/ExpressionTest.cpp,v
retrieving revision 1.1
diff -r1.1 ExpressionTest.cpp
59a60,69
> #if POOMA_CHEETAH
>   typedef DistributedTag LayoutTag_t;
>   typedef Remote<Brick> BrickTag_t;
>   typedef Remote<CompressibleBrick> CompBrickTag_t;
> #else
>   typedef ReplicatedTag LayoutTag_t;
>   typedef Brick BrickTag_t;
>   typedef CompressibleBrick CompBrickTag_t;
> #endif
> 
107c117
<   UserFunction<Norm> norm;
---
>   //  UserFunction<Norm> norm;
109c119
<   return (sum(norm(a)) < epsilon);
---
>   return (sum(abs(a)) < epsilon);
369,409d378
< template<class A1,class A2,class A3,class A4, class AInit>
< void test7(Pooma::Tester& tester, int test,
<          const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4,
<          const AInit &initial, const Interval<1> &I)
< {
<   //---------------------------------------------------------------------
<   // test #7
<   // Simple indirection test.
< 
<   int from = I.first();
<   int to = I.last();
<   int i;
< 
<   Array<1, int, Brick> b(I);
< 
<   for (i = from; i < to; ++i)
<   {
<     b(i) = i + 1;
<   }
<   b(to) = from;
< 
<   a1 = initial;
<   a2 = initial;
<   a3 = initial;
<   a4 = initial;
< 
<   Pooma::blockAndEvaluate();
< 
<   for (i = from; i <= to; ++i)
<   {
<     a2(b(i)) = a1(i);
<   }
< 
<   a4(b) = a3;
< 
<   Pooma::blockAndEvaluate();
< 
<   tester.check(checkTest(tester, test, a2, a4));
< }
< 
< 
421c390
<                             ReplicatedTag());
---
>                             LayoutTag_t());
423,424c392,393
<   std::cout << layout << std::endl;
<   std::cout << layout.domain() << std::endl;
---
>   tester.out() << layout << std::endl;
>   tester.out() << layout.domain() << std::endl;
431c400
<     Field<UniformRectilinear<1>, double, MultiPatch<UniformTag, Brick> >
---
>     Field<UniformRectilinear<1>, double, MultiPatch<UniformTag, BrickTag_t> >
440,441c409,410
<   std::cout << "physical domain:" << a1.physicalDomain() << std::endl;
<   std::cout << "interior domain:" << cellInterior << std::endl;
---
>   tester.out() << "physical domain:" << a1.physicalDomain() << std::endl;
>   tester.out() << "interior domain:" << cellInterior << std::endl;
451,453c420,425
<   test2(tester, 2, a1, a2, a3, a4, initial, cellInterior);
<   test3(tester, 3, a1, a2, a3, a4, initial, cellInterior);
<   test4(tester, 4, a1, a2, a3, a4, initial, cellInterior);
---
>   // No UserFunction for Field yet.
>   //  test2(tester, 2, a1, a2, a3, a4, initial, cellInterior);
> 
>   // Need to replace the stencil code above with Field Stencil code.
>   //  test3(tester, 3, a1, a2, a3, a4, initial, cellInterior);
>   //  test4(tester, 4, a1, a2, a3, a4, initial, cellInterior);
457c429
<                                                     CompressibleBrick> >
---
>                                                     CompBrickTag_t> >
474,476c446,449
<   test2(tester, 2, ca1, ca2, ca3, ca4, cinit, cellInterior);
<   test3(tester, 3, ca1, ca2, ca3, ca4, cinit, cellInterior);
<   test4(tester, 4, ca1, ca2, ca3, ca4, cinit, cellInterior);
---
>   //  test2(tester, 2, ca1, ca2, ca3, ca4, cinit, cellInterior);
>   //  test3(tester, 3, ca1, ca2, ca3, ca4, cinit, cellInterior);
>   //  test4(tester, 4, ca1, ca2, ca3, ca4, cinit, cellInterior);
> 
477a451
>   int ret = tester.results("ScalarCode");
479c453
<   return 0; 
---
>   return ret;
Index: FieldTour1.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/tests/FieldTour1.cpp,v
retrieving revision 1.3
diff -r1.3 FieldTour1.cpp
34a35,42
> #if POOMA_CHEETAH
>   typedef DistributedTag LayoutTag_t;
>   typedef Remote<Brick> BrickTag_t;
> #else
>   typedef ReplicatedTag LayoutTag_t;
>   typedef Brick BrickTag_t;
> #endif
> 
50c58
<   UniformGridLayout<2> layout(physicalVertexDomain, partition, 
ReplicatedTag());
---
>   UniformGridLayout<2> layout(physicalVertexDomain, partition, LayoutTag_t());
60c68,69
<     Field<UniformRectilinear<2>, double, MultiPatch<UniformTag, Brick> > 
Field_t;
---
>     Field<UniformRectilinear<2>, double,
>     MultiPatch<UniformTag, BrickTag_t> > Field_t;
135c144,145
<     Field<Lagrangian<2>, double, MultiPatch<UniformTag, Brick> > 
---
>     Field<Lagrangian<2>, double,
>     MultiPatch<UniformTag, BrickTag_t> > 
146c156
<   
---
>    
155,157c165,178
<   std::cout << f[0].patchLocal(0) << std::endl;
<   std::cout << f[0].patchLocal(1) << std::endl;
<   
---
>   int nLocal = f[0].numPatchesLocal();
>   std::cout << "context " << Pooma::context() << " has "
>           << nLocal << " patches" << std::endl;
>   if (nLocal > 0)
>     {
>       std::cout << "context " << Pooma::context()
>               << " local patch 0: " << f[0].patchLocal(0) << std::endl;
>     }
>   if (nLocal > 1)
>     {
>       std::cout << "context " << Pooma::context()
>               << " local patch 1: " << f[0].patchLocal(1) << std::endl;
>     }
> 
168c189,190
<     Field<UniformRectilinear<2>, Vector<2>, MultiPatch<UniformTag, Brick> > 
---
>     Field<UniformRectilinear<2>, Vector<2>,
>     MultiPatch<UniformTag, BrickTag_t> > 
176c198
<    
---
> 
Index: ScalarCode.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/tests/ScalarCode.cpp,v
retrieving revision 1.5
diff -r1.5 ScalarCode.cpp
44a45,52
> #if POOMA_CHEETAH
>   typedef DistributedTag LayoutTag_t;
>   typedef Remote<Brick> BrickTag_t;
> #else
>   typedef ReplicatedTag LayoutTag_t;
>   typedef Brick BrickTag_t;
> #endif
> 
275,281d282
< // switch the definitions here to test the distributed case.
< 
< typedef ReplicatedTag LayoutTag_t;
< typedef Brick BrickTag_t;
< //typedef DistributedTag LayoutTag_t;
< //typedef Remote<Brick> BrickTag_t;
< 
447a449
>   // 2) Lagrangian fields
Index: VectorTest.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/tests/VectorTest.cpp,v
retrieving revision 1.1
diff -r1.1 VectorTest.cpp
59a60,67
> #if POOMA_CHEETAH
>   typedef DistributedTag LayoutTag_t;
>   typedef Remote<Brick> BrickTag_t;
> #else
>   typedef ReplicatedTag LayoutTag_t;
>   typedef Brick BrickTag_t;
> #endif
> 
72,75c80,83
<   //  Loc<2> blocks(2, 2);
<   //  UniformGridPartition<2> partition(blocks, GuardLayers<2>(1));   
<   //  UniformGridLayout<2> layout(physicalVertexDomain, partition,
<   //                        ReplicatedTag());
---
>   Loc<2> blocks(2, 2);
>   UniformGridPartition<2> partition(blocks, GuardLayers<2>(1));   
>   UniformGridLayout<2> layout(physicalVertexDomain, partition,
>                             LayoutTag_t());
77a86
>   tester.out() << "layout domain: " << layout.domain() << std::endl;
84,85c93,94
<   typedef Brick EngineTag_t;
<   //  typedef MultiPatch<UniformTag, Brick> EngineTag_t;
---
>   typedef MultiPatch<UniformTag, BrickTag_t> EngineTag_t;
>   //  typedef BrickTag_t EngineTag_t;
93,95c102,107
<   Field_t a(allFace, layoutDom, origin, spacings);
<   VField_t b(allFace, layoutDom, origin, spacings);
<   VField_t c(allFace, layoutDom, origin, spacings);
---
>   Field_t a(allFace, layout, origin, spacings);
>   VField_t b(allFace, layout, origin, spacings);
>   VField_t c(allFace, layout, origin, spacings);
>   //  Field_t a(allFace, layoutDom, origin, spacings);
>   //  VField_t b(allFace, layoutDom, origin, spacings);
>   //  VField_t c(allFace, layoutDom, origin, spacings);
Index: WhereTest.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/tests/WhereTest.cpp,v
retrieving revision 1.2
diff -r1.2 WhereTest.cpp
59a60,67
> #if POOMA_CHEETAH
>   typedef DistributedTag LayoutTag_t;
>   typedef Remote<Brick> BrickTag_t;
> #else
>   typedef ReplicatedTag LayoutTag_t;
>   typedef Brick BrickTag_t;
> #endif
> 
74c82
<                             ReplicatedTag());
---
>                             LayoutTag_t());
85c93
<     Field<Geometry_t, double, MultiPatch<UniformTag, Brick> >
---
>     Field<Geometry_t, double, MultiPatch<UniformTag, BrickTag_t> >
89c97
<     Field<Geometry_t, Vector<2>, MultiPatch<UniformTag, Brick> >
---
>     Field<Geometry_t, Vector<2>, MultiPatch<UniformTag, BrickTag_t> >
Index: makefile
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/tests/makefile,v
retrieving revision 1.8
diff -r1.8 makefile
54a55
>       $(ODIR)/ExpressionTest $(TSTOPTS) 1>ExpressionTest.out 2>&1
59c60
<       $(ODIR)/ScalarCode
---
>       $(ODIR)/ScalarCode $(ODIR)/ExpressionTest
105a107,108
> .PHONY: WhereTest
> 
110a114,115
> .PHONY: VectorTest
> 
114a120,121
> 
> .PHONY: CrossBox
Index: Field.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/Field.h,v
retrieving revision 1.10
diff -r1.10 Field.h
1122a1123,1127
>   inline int
>   numPatchesLocal() const
>   {
>     return engineFunctor(engine(), EngineNumPatches());
>   }
1465a1471,1491
> template<class GeometryTag, class T, class EngineTag, class Tag>
> struct LeafFunctor<Field<GeometryTag, T, EngineTag>, EngineView<Tag> >
> {
>   typedef Field<GeometryTag, T, EngineTag> Subject_t;
>   typedef typename Subject_t::Engine_t Engine_t;
>   typedef typename LeafFunctor<Engine_t, EngineView<Tag> >::Type_t 
> NewEngine_t;
>   typedef typename NewEngine_t::Tag_t NewEngineTag_t;
> 
>   // Don't bother computing NewGeometry tag yet.
>   // For now all EngineView operations are equivalent to Interval views.
> 
>   typedef Field<GeometryTag, T, NewEngineTag_t> Type_t;
> 
>   inline static
>   Type_t apply(const Subject_t &field,
>              const EngineView<Tag> &tag)
>   {
>     return Type_t(field, tag);
>   }
> };
> 
1751c1777,1778
< assign(const Field<GeometryTag, T, EngineTag> &lhs, const T1 &rhs, const Op 
&op)
---
> assign(const Field<GeometryTag, T, EngineTag> &lhs, const T1 &rhs,
>        const Op &op)
Index: FieldEngine/FieldEngine.Lagrangian.h
===================================================================
RCS file: 
/home/pooma/Repository/r2/src/NewField/FieldEngine/FieldEngine.Lagrangian.h,v
retrieving revision 1.3
diff -r1.3 FieldEngine.Lagrangian.h
183a184,193
>   // Note there is no change to the vertex positions, because EngineView
>   // currently is only used to support RemoteView operations which don't
>   // change the domain.
>   template<class T2, class ET2, class Tag>  
>   FieldEngine(const FieldEngine<GeometryTag_t, T2, ET2> &model, 
>     const EngineView<Tag> &engineView)
>   : Base_t(model, engineView),
>     positions_m(forEach(model.vertexPositions(), engineView, TreeCombine()))
>   { }
> 
Index: FieldEngine/FieldEngine.NoGeometry.h
===================================================================
RCS file: 
/home/pooma/Repository/r2/src/NewField/FieldEngine/FieldEngine.NoGeometry.h,v
retrieving revision 1.3
diff -r1.3 FieldEngine.NoGeometry.h
188a189
>   // EngineView version used for remote computations.
189a191,197
>   template<class G2, class T2, class ET2, class Tag>  
>   FieldEngine(const FieldEngine<G2, T2, ET2> &model, 
>             const EngineView<Tag> &engineView)
>     : engine_m(leafFunctor(model.engine(), engineView)),
>     updaters_m(model.updaters())
>   { }
>     
Index: FieldEngine/FieldEngine.UR.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/FieldEngine/FieldEngine.UR.h,v
retrieving revision 1.4
diff -r1.4 FieldEngine.UR.h
212a213,222
>   template<class T2, class ET2, class Tag>  
>   FieldEngine(const FieldEngine<GeometryTag_t, T2, ET2> &model, 
>             const EngineView<Tag> &engineView)
>   : Base_t(model, engineView),
>     origin_m(model.origin()),
>     spacings_m(model.spacings())
>   {
>     // Will need to fix up origin_m if EnginView replaces INode<> view.
>   }
> 
Index: FieldEngine/FieldEngineBase.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/FieldEngine/FieldEngineBase.h,v
retrieving revision 1.9
diff -r1.9 FieldEngineBase.h
280a281,306
>   template<int Dim2, class T2, class EngineTag2, class Tag>
>   void initialize(This_t &s, 
>                 const FieldEngineBase<Dim2, T2, EngineTag2> &model,
>                 const EngineView<Tag> &ev)
>   {
>     typedef typename FieldEngineBase<Dim2, T2, EngineTag2>::Engine_t EngIn_t;
>     int n = model.numSubFields();
>     if (n == 0)
>     {
>       s.physicalCellDomain_m = model.physicalCellDomain();
>       s.guards_m = model.guardLayers();
>       s.initialize(model.offsets(),
>                  LeafFunctor<EngIn_t,
>                  EngineView<Tag> >::apply(model.engine(), ev),
>                  model.updaters());
>     }
>     else
>     {
>       s.physicalCellDomain_m = model.physicalCellDomain();
>       s.guards_m = model.guardLayers();
>       s.addSubFields(n);
>       for (int i = 0; i < n; i++)
>       initialize(s.subFields_m[i], model.subField(i), ev);
>     }
>   }
> 

Index: Engine/ViewEngine.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Engine/ViewEngine.h,v
retrieving revision 1.20
diff -r1.20 ViewEngine.h
655c655,657
<   typedef LeafFunctor<E, ExpressionApply<Tag> > LeafFunctor_t;
---
>   typedef Engine<D, T, ViewEngine<D2, E> > Subject_t;
>   typedef typename Subject_t::ViewedEngine_t Engine_t;
>   typedef LeafFunctor<Engine_t, ExpressionApply<Tag> > LeafFunctor_t;
659,660c661
<   Type_t apply(const Engine<D, T, ViewEngine<D2, E> > &engine,
<              const ExpressionApply<Tag> &tag)
---
>   Type_t apply(const Subject_t &engine, const ExpressionApply<Tag> &tag)
Index: Evaluator/MultiArgEvaluator.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Evaluator/MultiArgEvaluator.h,v
retrieving revision 1.7
diff -r1.7 MultiArgEvaluator.h
377c377
<                function, domain, info, kernel);
---
>                function, evalDom, info, kernel);
466a467,757
> };
> 
> 
> 
> //----------------------------------------------------------------------------
> // LeafFunctor Specializations for ExpressionApply and EngineView
> //
> 
> 
> template<class A1, class Tag>
> struct LeafFunctor<MultiArg1<A1>, ExpressionApply<Tag> >
> {
>   typedef int Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg1<A1> &multiarg,
>              const ExpressionApply<Tag> &tag)
>   {
>     leafFunctor(multiarg.a1_m, tag);
>     return 0;
>   }
> };
> 
> template<class A1, class Tag>
> struct LeafFunctor<MultiArg1<A1>, EngineView<Tag> >
> {
>   typedef typename LeafFunctor<A1, EngineView<Tag> >::Type_t Type1_t;
>   typedef MultiArg1<Type1_t> Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg1<A1> &multiarg,
>              const EngineView<Tag> &tag)
>   {
>     return Type_t(
>                 leafFunctor(multiarg.a1_m, tag)
>                 );
>   }
> };
> 
> template<class A1, class A2, class Tag>
> struct LeafFunctor<MultiArg2<A1, A2>, ExpressionApply<Tag> >
> {
>   typedef int Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg2<A1, A2> &multiarg,
>              const ExpressionApply<Tag> &tag)
>   {
>     leafFunctor(multiarg.a1_m, tag);
>     leafFunctor(multiarg.a2_m, tag);
>     return 0;
>   }
> };
> 
> template<class A1, class A2, class Tag>
> struct LeafFunctor<MultiArg2<A1, A2>, EngineView<Tag> >
> {
>   typedef typename LeafFunctor<A1, EngineView<Tag> >::Type_t Type1_t;
>   typedef typename LeafFunctor<A2, EngineView<Tag> >::Type_t Type2_t;
>   typedef MultiArg2<Type1_t, Type2_t> Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg2<A1, A2> &multiarg,
>              const EngineView<Tag> &tag)
>   {
>     return Type_t(
>                 leafFunctor(multiarg.a1_m, tag),
>                 leafFunctor(multiarg.a2_m, tag)
>                 );
>   }
> };
> 
> template<class A1, class A2, class A3, class Tag>
> struct LeafFunctor<MultiArg3<A1, A2, A3>,
>   ExpressionApply<Tag> >
> {
>   typedef int Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg3<A1, A2, A3> &multiarg,
>              const ExpressionApply<Tag> &tag)
>   {
>     leafFunctor(multiarg.a1_m, tag);
>     leafFunctor(multiarg.a2_m, tag);
>     leafFunctor(multiarg.a3_m, tag);
>     return 0;
>   }
> };
> 
> template<class A1, class A2, class A3, class Tag>
> struct LeafFunctor<MultiArg3<A1, A2, A3>, EngineView<Tag> >
> {
>   typedef typename LeafFunctor<A1, EngineView<Tag> >::Type_t Type1_t;
>   typedef typename LeafFunctor<A2, EngineView<Tag> >::Type_t Type2_t;
>   typedef typename LeafFunctor<A3, EngineView<Tag> >::Type_t Type3_t;
>   typedef MultiArg3<Type1_t, Type2_t, Type3_t> Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg3<A1, A2, A3> &multiarg,
>              const EngineView<Tag> &tag)
>   {
>     return Type_t(
>                 leafFunctor(multiarg.a1_m, tag),
>                 leafFunctor(multiarg.a2_m, tag),
>                 leafFunctor(multiarg.a3_m, tag)
>                 );
>   }
> };
> 
> template<class A1, class A2, class A3, class A4, class Tag>
> struct LeafFunctor<MultiArg4<A1, A2, A3, A4>,
>   ExpressionApply<Tag> >
> {
>   typedef int Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg4<A1, A2, A3, A4> &multiarg,
>              const ExpressionApply<Tag> &tag)
>   {
>     leafFunctor(multiarg.a1_m, tag);
>     leafFunctor(multiarg.a2_m, tag);
>     leafFunctor(multiarg.a3_m, tag);
>     leafFunctor(multiarg.a4_m, tag);
>     return 0;
>   }
> };
> 
> template<class A1, class A2, class A3, class A4, class Tag>
> struct LeafFunctor<MultiArg4<A1, A2, A3, A4>, EngineView<Tag> >
> {
>   typedef typename LeafFunctor<A1, EngineView<Tag> >::Type_t Type1_t;
>   typedef typename LeafFunctor<A2, EngineView<Tag> >::Type_t Type2_t;
>   typedef typename LeafFunctor<A3, EngineView<Tag> >::Type_t Type3_t;
>   typedef typename LeafFunctor<A4, EngineView<Tag> >::Type_t Type4_t;
>   typedef MultiArg4<Type1_t, Type2_t, Type3_t, Type4_t> Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg4<A1, A2, A3, A4> &multiarg,
>              const EngineView<Tag> &tag)
>   {
>     return Type_t(
>                 leafFunctor(multiarg.a1_m, tag),
>                 leafFunctor(multiarg.a2_m, tag),
>                 leafFunctor(multiarg.a3_m, tag),
>                 leafFunctor(multiarg.a4_m, tag)
>                 );
>   }
> };
> 
> template<class A1, class A2, class A3, class A4, class A5, class Tag>
> struct LeafFunctor<MultiArg5<A1, A2, A3, A4, A5>,
>   ExpressionApply<Tag> >
> {
>   typedef int Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg5<A1, A2, A3, A4, A5> &multiarg,
>              const ExpressionApply<Tag> &tag)
>   {
>     leafFunctor(multiarg.a1_m, tag);
>     leafFunctor(multiarg.a2_m, tag);
>     leafFunctor(multiarg.a3_m, tag);
>     leafFunctor(multiarg.a4_m, tag);
>     leafFunctor(multiarg.a5_m, tag);
>     return 0;
>   }
> };
> 
> template<class A1, class A2, class A3, class A4, class A5, class Tag>
> struct LeafFunctor<MultiArg5<A1, A2, A3, A4, A5>, EngineView<Tag> >
> {
>   typedef typename LeafFunctor<A1, EngineView<Tag> >::Type_t Type1_t;
>   typedef typename LeafFunctor<A2, EngineView<Tag> >::Type_t Type2_t;
>   typedef typename LeafFunctor<A3, EngineView<Tag> >::Type_t Type3_t;
>   typedef typename LeafFunctor<A4, EngineView<Tag> >::Type_t Type4_t;
>   typedef typename LeafFunctor<A5, EngineView<Tag> >::Type_t Type5_t;
>   typedef MultiArg5<Type1_t, Type2_t, Type3_t, Type4_t, Type5_t> Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg5<A1, A2, A3, A4, A5> &multiarg,
>              const EngineView<Tag> &tag)
>   {
>     return Type_t(
>                 leafFunctor(multiarg.a1_m, tag),
>                 leafFunctor(multiarg.a2_m, tag),
>                 leafFunctor(multiarg.a3_m, tag),
>                 leafFunctor(multiarg.a4_m, tag),
>                 leafFunctor(multiarg.a5_m, tag)
>                 );
>   }
> };
> 
> template<class A1, class A2, class A3, class A4, class A5,
>   class A6, class Tag>
> struct LeafFunctor<MultiArg6<A1, A2, A3, A4, A5, A6>,
>   ExpressionApply<Tag> >
> {
>   typedef int Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg6<A1, A2, A3, A4, A5, A6> &multiarg,
>              const ExpressionApply<Tag> &tag)
>   {
>     leafFunctor(multiarg.a1_m, tag);
>     leafFunctor(multiarg.a2_m, tag);
>     leafFunctor(multiarg.a3_m, tag);
>     leafFunctor(multiarg.a4_m, tag);
>     leafFunctor(multiarg.a5_m, tag);
>     leafFunctor(multiarg.a6_m, tag);
>     return 0;
>   }
> };
> 
> template<class A1, class A2, class A3, class A4, class A5,
>   class A6, class Tag>
> struct LeafFunctor<MultiArg6<A1, A2, A3, A4, A5, A6>, EngineView<Tag> >
> {
>   typedef typename LeafFunctor<A1, EngineView<Tag> >::Type_t Type1_t;
>   typedef typename LeafFunctor<A2, EngineView<Tag> >::Type_t Type2_t;
>   typedef typename LeafFunctor<A3, EngineView<Tag> >::Type_t Type3_t;
>   typedef typename LeafFunctor<A4, EngineView<Tag> >::Type_t Type4_t;
>   typedef typename LeafFunctor<A5, EngineView<Tag> >::Type_t Type5_t;
>   typedef typename LeafFunctor<A6, EngineView<Tag> >::Type_t Type6_t;
>   typedef MultiArg6<Type1_t, Type2_t, Type3_t, Type4_t, Type5_t,
>     Type6_t> Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg6<A1, A2, A3, A4, A5, A6> &multiarg,
>              const EngineView<Tag> &tag)
>   {
>     return Type_t(
>                 leafFunctor(multiarg.a1_m, tag),
>                 leafFunctor(multiarg.a2_m, tag),
>                 leafFunctor(multiarg.a3_m, tag),
>                 leafFunctor(multiarg.a4_m, tag),
>                 leafFunctor(multiarg.a5_m, tag),
>                 leafFunctor(multiarg.a6_m, tag)
>                 );
>   }
> };
> 
> template<class A1, class A2, class A3, class A4, class A5,
>   class A6, class A7, class Tag>
> struct LeafFunctor<MultiArg7<A1, A2, A3, A4, A5, A6, A7>,
>   ExpressionApply<Tag> >
> {
>   typedef int Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg7<A1, A2, A3, A4, A5, A6, A7> &multiarg,
>              const ExpressionApply<Tag> &tag)
>   {
>     leafFunctor(multiarg.a1_m, tag);
>     leafFunctor(multiarg.a2_m, tag);
>     leafFunctor(multiarg.a3_m, tag);
>     leafFunctor(multiarg.a4_m, tag);
>     leafFunctor(multiarg.a5_m, tag);
>     leafFunctor(multiarg.a6_m, tag);
>     leafFunctor(multiarg.a7_m, tag);
>     return 0;
>   }
> };
> 
> template<class A1, class A2, class A3, class A4, class A5,
>   class A6, class A7, class Tag>
> struct LeafFunctor<MultiArg7<A1, A2, A3, A4, A5, A6, A7>, EngineView<Tag> >
> {
>   typedef typename LeafFunctor<A1, EngineView<Tag> >::Type_t Type1_t;
>   typedef typename LeafFunctor<A2, EngineView<Tag> >::Type_t Type2_t;
>   typedef typename LeafFunctor<A3, EngineView<Tag> >::Type_t Type3_t;
>   typedef typename LeafFunctor<A4, EngineView<Tag> >::Type_t Type4_t;
>   typedef typename LeafFunctor<A5, EngineView<Tag> >::Type_t Type5_t;
>   typedef typename LeafFunctor<A6, EngineView<Tag> >::Type_t Type6_t;
>   typedef typename LeafFunctor<A7, EngineView<Tag> >::Type_t Type7_t;
>   typedef MultiArg7<Type1_t, Type2_t, Type3_t, Type4_t, Type5_t,
>     Type6_t, Type7_t> Type_t;
> 
>   inline static
>   Type_t apply(const MultiArg7<A1, A2, A3, A4, A5, A6, A7> &multiarg,
>              const EngineView<Tag> &tag)
>   {
>     return Type_t(
>                 leafFunctor(multiarg.a1_m, tag),
>                 leafFunctor(multiarg.a2_m, tag),
>                 leafFunctor(multiarg.a3_m, tag),
>                 leafFunctor(multiarg.a4_m, tag),
>                 leafFunctor(multiarg.a5_m, tag),
>                 leafFunctor(multiarg.a6_m, tag),
>                 leafFunctor(multiarg.a7_m, tag)
>                 );
>   }
Index: PETE/Functors.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/PETE/Functors.h,v
retrieving revision 1.7
diff -r1.7 Functors.h
76a77,83
> template<class LeafType, class LeafTag>
> inline
> typename LeafFunctor<LeafType, LeafTag>::Type_t
> leafFunctor(const LeafType &leaf, const LeafTag &tag)
> {
>   return LeafFunctor<LeafType, LeafTag>::apply(leaf, tag);
> }

reply via email to

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