Actions

icon Post
text/html Subscribe
text/html Unsubscribe

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

[RFH] ExpressionEngine _not_ zero-based?


  • To: pooma-dev@xxxxxxxxxxxxxxxxxxxxxx
  • Subject: [RFH] ExpressionEngine _not_ zero-based?
  • From: Richard Guenther <rguenth@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
  • Date: Mon, 23 Aug 2004 23:15:06 +0200

Despite it says so

template<int Dim, class T, class Expr>
class Engine<Dim, T, ExpressionTag<Expr> >
{
public:
...
  /// Expression-engines are zero-based.

  enum { zeroBased = true };

it is _not_ zero-based - at least not in all cases.  Example:

  Array<1, int> a(8, GuardLayers<1>(1)), b(8, GuardLayers<1>(1));
  std::cout << (a+b).domain() << std::endl;

prints [-1:8:1] while it should have printed [0:9:1]!

or not?  The same wrapped into a dummy stencil with zero extent

  std::cout << Stencil<Dummy>()(a+b).domain() << std::endl;

yields the expected.  StencilEngines seem to be really zero-based
(well, yes - they do it the strange way - not taking a view of the expression, but keeping an offset).

While I suspect StencilEngine and ExpressionEngine need to be very similar in principle I don't know how to best fix this deficiency.

Any ideas?

Richard.