[PATCH] Another Stencil test
Richard Guenther
rguenth at tat.physik.uni-tuebingen.de
Tue Jul 20 09:40:55 UTC 2004
This adds a Stencil test for expression arguments and removes a FIXME.
Ok?
Richard.
2004Jul20 Richard Guenther <richard.guenther at uni-tuebingen.de>
* src/Engine/Stencil.h: remove FIXME.
src/Array/tests/array_test33.cpp: new.
src/Array/tests/makefile: add array_test33.
--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
-------------- next part --------------
--- pooma-bk/r2/src/Engine/Stencil.h Fri Jan 16 23:03:53 2004
+++ pooma-bib/r2/src/Engine/Stencil.h Thu Jul 15 11:31:50 2004
@@ -815,8 +815,6 @@
GuardLayers<Dim> &usedGuards)
{
intersect(engine);
- // FIXME: accumulate used guards from intersect above and
- // stencil extent? I.e. allow Stencil<>(a(i-1)+a(i+1))?
usedGuards = stencilExtent_m;
return true;
}
--- /dev/null Tue May 18 17:20:27 2004
+++ pooma-bib/r2/src/Array/tests/array_test33.cpp Thu Jul 15 11:31:41 2004
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+// ACL:license
+// ----------------------------------------------------------------------
+// This software and ancillary information (herein called "SOFTWARE")
+// called POOMA (Parallel Object-Oriented Methods and Applications) is
+// made available under the terms described here. The SOFTWARE has been
+// approved for release with associated LA-CC Number LA-CC-98-65.
+//
+// Unless otherwise indicated, this SOFTWARE has been authored by an
+// employee or employees of the University of California, operator of the
+// Los Alamos National Laboratory under Contract No. W-7405-ENG-36 with
+// the U.S. Department of Energy. The U.S. Government has rights to use,
+// reproduce, and distribute this SOFTWARE. The public may copy, distribute,
+// prepare derivative works and publicly display this SOFTWARE without
+// charge, provided that this Notice and any statement of authorship are
+// reproduced on all copies. Neither the Government nor the University
+// makes any warranty, express or implied, or assumes any liability or
+// responsibility for the use of this SOFTWARE.
+//
+// If SOFTWARE is modified to produce derivative works, such modified
+// SOFTWARE should be clearly marked, so as not to confuse it with the
+// version available from LANL.
+//
+// For more information about POOMA, send e-mail to pooma at acl.lanl.gov,
+// or visit the POOMA web page at http://www.acl.lanl.gov/pooma/.
+// ----------------------------------------------------------------------
+// ACL:license
+
+//-----------------------------------------------------------------------------
+// array_test33.cpp verify correctnes of stencil objects with expressions
+//-----------------------------------------------------------------------------
+
+// Include files
+
+#include "Pooma/Arrays.h"
+#include "Utilities/Tester.h"
+#include <iostream>
+
+class EvaluateExpr
+{
+public:
+ template <class A>
+ typename A::Element_t operator()(const A& x, int i) const
+ {
+ return x.read(i);
+ }
+
+ int lowerExtent(int) const { return 0; }
+ int upperExtent(int) const { return 0; }
+};
+
+int main(int argc, char *argv[])
+{
+ // Initialize POOMA and output stream, using Tester class
+ Pooma::initialize(argc, argv);
+ Pooma::Tester tester(argc, argv);
+
+ Interval<1> domain(8);
+ UniformGridLayout<1> layout(domain, Loc<1>(2), GuardLayers<1>(1), DistributedTag());
+ Array<1,int,MultiPatch<UniformTag, Remote<Brick> > > a(layout), b(layout), c(layout);
+
+ a = 0;
+ b = 1;
+ c = 2;
+ a(domain) = Stencil<EvaluateExpr>()(b(domain-1)+c(domain+1), domain);
+ tester.check("a = b(I-1) + c(I+1)", all(a(domain) == 3));
+ tester.out() << a(domain) << std::endl;
+
+ a = 0;
+ b = 2;
+ c = 3;
+ a(domain) = b(domain) + Stencil<EvaluateExpr>()(b(domain)+c(domain+1), domain);
+ tester.check("a = b + b(I-1) + c", all(a(domain) == 7));
+ tester.out() << a(domain) << std::endl;
+
+ int retval = tester.results("array_test33");
+ Pooma::finalize();
+ return retval;
+}
+
+// ACL:rcsinfo
+// ----------------------------------------------------------------------
+// $RCSfile: array_test23.cpp,v $ $Author: sa_smith $
+// $Revision: 1.5 $ $Date: 2000/07/04 05:06:54 $
+// ----------------------------------------------------------------------
+// ACL:rcsinfo
More information about the pooma-dev
mailing list