[PATCH] Re: Two New Array Failures
Richard Guenther
rguenth at tat.physik.uni-tuebingen.de
Wed Mar 12 21:54:38 UTC 2003
Hi!
The attached patch canonicalizes Engine::domain() const to return a
const reference to its domain. It can do so by adding a domain_m
member to the expression engine (pls review this part carefully, as
in some of the constructors we might do things more optimally if I
had understood what they actually do...).
(We might do something similar to the Engine::layout() const methods,
though this would affect many more engines to be added a layout_m member)
Testing is still in progress, but the concept sounds reasonable?
Thanks, Richard.
--
Richard Guenther <richard.guenther at uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
===== DynamicEngine.h 1.1 vs edited =====
--- 1.1/r2/src/Engine/DynamicEngine.h Mon May 13 17:47:32 2002
+++ edited/DynamicEngine.h Wed Mar 12 22:49:39 2003
@@ -509,7 +509,7 @@
// Return the domain:
- const Domain_t &domain() const { return domain_m; }
+ inline const Domain_t &domain() const { return domain_m; }
// Return a DomainLayout built from our domain
===== ExpressionEngine.h 1.1 vs edited =====
--- 1.1/r2/src/Engine/ExpressionEngine.h Mon May 13 17:47:32 2002
+++ edited/ExpressionEngine.h Wed Mar 12 22:49:05 2003
@@ -499,12 +499,14 @@
//---------------------------------------------------------------------------
// Expression constructor. Just stick the expression in local storage.
- inline Engine(const Expr &expr) : expr_m(expr) { }
+ inline Engine(const Expr &expr) : expr_m(expr),
+ domain_m(forEach(expr_m, DomainFunctorTag(), DomainFunctorTag())) { }
//---------------------------------------------------------------------------
// Copy constructor.
- inline Engine(const Engine_t &engine) : expr_m(engine.expression()) { }
+ inline Engine(const Engine_t &engine) : expr_m(engine.expression()),
+ domain_m(engine.domain()) { }
//---------------------------------------------------------------------------
// Subsetting Constructor. We build this expression engine, in place, from
@@ -517,13 +519,15 @@
template<int Dim2, class T2, class Expr2, class Initializer>
inline Engine(const Engine<Dim2, T2, ExpressionTag<Expr2> > &e,
const Initializer &i)
- : expr_m(e.expression(), i)
+ : expr_m(e.expression(), i),
+ domain_m(forEach(expr_m, DomainFunctorTag(), DomainFunctorTag()))
{ }
template<int Dim2, class T2, class Expr2, class I1, class I2>
inline Engine(const Engine<Dim2, T2, ExpressionTag<Expr2> > &e,
const I1 &i1, const I2 &i2)
- : expr_m(e.expression(), i1, i2)
+ : expr_m(e.expression(), i1, i2),
+ domain_m(forEach(expr_m, DomainFunctorTag(), DomainFunctorTag()))
{ }
//---------------------------------------------------------------------------
@@ -531,7 +535,9 @@
template<class Expr2>
explicit inline Engine(const Engine<Dim,T,ExpressionTag<Expr2> > &e)
- : expr_m(e.expression()) { }
+ : expr_m(e.expression()),
+ domain_m(forEach(expr_m, DomainFunctorTag(), DomainFunctorTag()))
+ { }
//---------------------------------------------------------------------------
// Accessor functions that return the expression.
@@ -600,12 +606,13 @@
// combine the results based on the DomainFunctorTag. The DomainFunctorTag
// combiners are above.
- Domain_t domain() const
+ inline const Domain_t& domain() const
{
- return forEach(expr_m, DomainFunctorTag(), DomainFunctorTag());
+ return domain_m;
}
- //--------------------------------------------------------------------------- // Return a layout.
+ //---------------------------------------------------------------------------
+ // Return a layout.
inline Layout_t layout() const { return Layout_t(domain()); }
@@ -638,6 +645,10 @@
// The expression is stored here.
Expr expr_m;
+
+ // The domain of the expression.
+
+ Domain_t domain_m;
};
===== IndexFunctionEngine.h 1.1 vs edited =====
--- 1.1/r2/src/Engine/IndexFunctionEngine.h Mon May 13 17:47:32 2002
+++ edited/IndexFunctionEngine.h Wed Mar 12 22:48:44 2003
@@ -228,7 +228,7 @@
//---------------------------------------------------------------------------
// Return/set the domain. Also, return the base domain.
- const Domain_t &domain() const { return domain_m; }
+ inline const Domain_t &domain() const { return domain_m; }
void setDomain(const Domain_t &dom) { domain_m = dom; }
//---------------------------------------------------------------------------
===== IndirectionEngine.h 1.1 vs edited =====
--- 1.1/r2/src/Engine/IndirectionEngine.h Mon May 13 17:47:32 2002
+++ edited/IndirectionEngine.h Wed Mar 12 21:38:21 2003
@@ -246,7 +246,7 @@
//---------------------------------------------------------------------------
- inline Domain_t domain() const
+ inline const Domain_t& domain() const
{
return array2_m.domain();
}
===== Stencil.h 1.5 vs edited =====
--- 1.5/r2/src/Engine/Stencil.h Fri Jan 24 10:35:52 2003
+++ edited/Stencil.h Wed Mar 12 21:40:46 2003
@@ -400,7 +401,7 @@
// Return the output domain.
//============================================================
- inline Domain_t domain() const { return domain_m; }
+ inline const Domain_t& domain() const { return domain_m; }
//============================================================
// Return the first output index value for the specified direction
===== UserFunction.h 1.1 vs edited =====
--- 1.1/r2/src/Engine/UserFunction.h Mon May 13 17:47:32 2002
+++ edited/UserFunction.h Wed Mar 12 22:48:05 2003
@@ -241,7 +241,7 @@
// Return the domain.
//---------------------------------------------------------------------------
- Domain_t domain() const { return expression_m.domain(); }
+ inline const Domain_t& domain() const { return expression_m.domain(); }
//---------------------------------------------------------------------------
// Return first index in the specified direction.
===== ViewEngine.h 1.5 vs edited =====
--- 1.5/r2/src/Engine/ViewEngine.h Fri Jan 24 10:35:52 2003
+++ edited/ViewEngine.h Wed Mar 12 22:47:55 2003
@@ -263,7 +263,7 @@
//---------------------------------------------------------------------------
// Return the domain.
- const Domain_t &domain() const { return indexer_m.domain(); }
+ inline const Domain_t &domain() const { return indexer_m.domain(); }
//---------------------------------------------------------------------------
// Return the first value for the specified direction (always zero since this
More information about the pooma-dev
mailing list