/* Definitions of ET stencil operators. This file was generated by generate/genstencils.py. Do not edit. Note: You can't pass templates with >1 parameter as macro parameters because cpp doesn't recognize that the comma is balanced between the angle brackets and interprets them as multiple arguments, i.e., the following alternative declaration of grad2D will not work: BZ_ET_STENCIL(grad2D, TinyVector, TinyVector, shape(-1,1), shape(1,1)) instead, you have to use the above bzCC ("ConCatenate") macro to protect the things containing commas. The following would work: BZ_ET_STENCIL(grad2D, bzCC(TinyVector), bzCC(TinyVector), shape(-1,-1), shape(1,1)) */ BZ_NAMESPACE(blitz) /* Defines a stencil ET difference operator "central12" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -1 and 1 are integer expressions describing the extent of the operator in the operating dimension. */ template class central12_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central12_et< typename T_expr::template tvresult::Type> Type; }; typedef central12_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central12_et(const central12_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central12_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central12_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central12_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central12_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central12_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central12_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central12_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central12_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central12_et T_slice; }; template central12_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central12_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central12(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12(const Array& d1, int dim) { return central12(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12(Array& d1, int dim) { return central12(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central22" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -1 and 1 are integer expressions describing the extent of the operator in the operating dimension. */ template class central22_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central22_et< typename T_expr::template tvresult::Type> Type; }; typedef central22_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central22_et(const central22_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central22_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central22_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central22_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central22_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central22_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central22_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central22_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central22_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central22_et T_slice; }; template central22_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central22_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central22(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22(const Array& d1, int dim) { return central22(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22(Array& d1, int dim) { return central22(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central32" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central32_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central32_et< typename T_expr::template tvresult::Type> Type; }; typedef central32_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central32_et(const central32_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central32_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central32_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central32_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central32_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central32_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central32_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central32_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central32_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central32_et T_slice; }; template central32_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central32_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central32(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32(const Array& d1, int dim) { return central32(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32(Array& d1, int dim) { return central32(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central42" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central42_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central42_et< typename T_expr::template tvresult::Type> Type; }; typedef central42_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central42_et(const central42_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central42_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central42_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central42_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central42_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central42_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central42_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central42_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central42_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central42_et T_slice; }; template central42_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central42_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central42(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42(const Array& d1, int dim) { return central42(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42(Array& d1, int dim) { return central42(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central14" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central14_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central14_et< typename T_expr::template tvresult::Type> Type; }; typedef central14_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central14_et(const central14_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central14_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central14_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central14_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central14_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central14_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central14_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central14_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central14_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central14_et T_slice; }; template central14_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central14_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central14(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14(const Array& d1, int dim) { return central14(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14(Array& d1, int dim) { return central14(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central24" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central24_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central24_et< typename T_expr::template tvresult::Type> Type; }; typedef central24_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central24_et(const central24_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central24_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central24_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central24_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central24_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central24_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central24_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central24_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central24_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central24_et T_slice; }; template central24_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central24_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central24(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24(const Array& d1, int dim) { return central24(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24(Array& d1, int dim) { return central24(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central34" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central34_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central34_et< typename T_expr::template tvresult::Type> Type; }; typedef central34_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central34_et(const central34_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central34_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central34_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central34_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central34_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central34_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central34_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central34_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central34_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central34_et T_slice; }; template central34_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central34_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central34(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34(const Array& d1, int dim) { return central34(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34(Array& d1, int dim) { return central34(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central44" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central44_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central44_et< typename T_expr::template tvresult::Type> Type; }; typedef central44_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central44_et(const central44_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central44_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central44_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central44_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central44_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central44_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central44_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central44_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central44_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central44_et T_slice; }; template central44_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central44_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central44(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44(const Array& d1, int dim) { return central44(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44(Array& d1, int dim) { return central44(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central12n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -1 and 1 are integer expressions describing the extent of the operator in the operating dimension. */ template class central12n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central12n_et< typename T_expr::template tvresult::Type> Type; }; typedef central12n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central12n_et(const central12n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central12n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central12n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central12n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central12n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central12n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central12n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central12n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central12n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central12n_et T_slice; }; template central12n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central12n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central12n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12n(const Array& d1, int dim) { return central12n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12n(Array& d1, int dim) { return central12n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central22n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -1 and 1 are integer expressions describing the extent of the operator in the operating dimension. */ template class central22n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central22n_et< typename T_expr::template tvresult::Type> Type; }; typedef central22n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central22n_et(const central22n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central22n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central22n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central22n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central22n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central22n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central22n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central22n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central22n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central22n_et T_slice; }; template central22n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central22n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central22n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22n(const Array& d1, int dim) { return central22n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22n(Array& d1, int dim) { return central22n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central32n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central32n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central32n_et< typename T_expr::template tvresult::Type> Type; }; typedef central32n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central32n_et(const central32n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central32n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central32n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central32n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central32n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central32n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central32n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central32n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central32n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central32n_et T_slice; }; template central32n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central32n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central32n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32n(const Array& d1, int dim) { return central32n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32n(Array& d1, int dim) { return central32n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central42n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central42n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central42n_et< typename T_expr::template tvresult::Type> Type; }; typedef central42n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central42n_et(const central42n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central42n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central42n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central42n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central42n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central42n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central42n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central42n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central42n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central42n_et T_slice; }; template central42n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central42n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central42n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42n(const Array& d1, int dim) { return central42n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42n(Array& d1, int dim) { return central42n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central14n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central14n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central14n_et< typename T_expr::template tvresult::Type> Type; }; typedef central14n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central14n_et(const central14n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central14n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central14n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central14n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central14n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central14n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central14n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central14n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central14n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central14n_et T_slice; }; template central14n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central14n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central14n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14n(const Array& d1, int dim) { return central14n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14n(Array& d1, int dim) { return central14n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central24n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central24n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central24n_et< typename T_expr::template tvresult::Type> Type; }; typedef central24n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central24n_et(const central24n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central24n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central24n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central24n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central24n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central24n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central24n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central24n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central24n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central24n_et T_slice; }; template central24n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central24n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central24n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24n(const Array& d1, int dim) { return central24n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24n(Array& d1, int dim) { return central24n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central34n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central34n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central34n_et< typename T_expr::template tvresult::Type> Type; }; typedef central34n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central34n_et(const central34n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central34n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central34n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central34n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central34n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central34n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central34n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central34n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central34n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central34n_et T_slice; }; template central34n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central34n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central34n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34n(const Array& d1, int dim) { return central34n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34n(Array& d1, int dim) { return central34n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "central44n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class central44n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef central44n_et< typename T_expr::template tvresult::Type> Type; }; typedef central44n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central44n_et(const central44n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } central44n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } central44n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return central44n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central44n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return central44n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = central44n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = central44n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = central44n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central44n_et T_slice; }; template central44n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central44n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central44n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44n(const Array& d1, int dim) { return central44n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44n(Array& d1, int dim) { return central44n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward11" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -1 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward11_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward11_et< typename T_expr::template tvresult::Type> Type; }; typedef backward11_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward11_et(const backward11_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward11_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward11_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward11_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward11_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward11_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward11_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward11_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward11_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward11_et T_slice; }; template backward11_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward11_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward11(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11(const Array& d1, int dim) { return backward11(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11(Array& d1, int dim) { return backward11(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward21" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward21_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward21_et< typename T_expr::template tvresult::Type> Type; }; typedef backward21_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward21_et(const backward21_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward21_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward21_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward21_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward21_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward21_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward21_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward21_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward21_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward21_et T_slice; }; template backward21_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward21_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward21(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21(const Array& d1, int dim) { return backward21(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21(Array& d1, int dim) { return backward21(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward31" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -3 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward31_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward31_et< typename T_expr::template tvresult::Type> Type; }; typedef backward31_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward31_et(const backward31_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward31_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward31_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward31_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward31_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward31_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward31_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward31_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward31_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward31_et T_slice; }; template backward31_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward31_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward31(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-3; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31(const Array& d1, int dim) { return backward31(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31(Array& d1, int dim) { return backward31(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward41" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -4 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward41_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward41_et< typename T_expr::template tvresult::Type> Type; }; typedef backward41_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward41_et(const backward41_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward41_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward41_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward41_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward41_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward41_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward41_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward41_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward41_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward41_et T_slice; }; template backward41_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward41_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward41(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-4; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41(const Array& d1, int dim) { return backward41(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41(Array& d1, int dim) { return backward41(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward12" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward12_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward12_et< typename T_expr::template tvresult::Type> Type; }; typedef backward12_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward12_et(const backward12_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward12_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward12_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward12_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward12_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward12_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward12_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward12_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward12_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward12_et T_slice; }; template backward12_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward12_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward12(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12(const Array& d1, int dim) { return backward12(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12(Array& d1, int dim) { return backward12(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward22" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -3 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward22_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward22_et< typename T_expr::template tvresult::Type> Type; }; typedef backward22_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward22_et(const backward22_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward22_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward22_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward22_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward22_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward22_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward22_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward22_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward22_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward22_et T_slice; }; template backward22_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward22_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward22(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-3; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22(const Array& d1, int dim) { return backward22(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22(Array& d1, int dim) { return backward22(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward32" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -4 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward32_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward32_et< typename T_expr::template tvresult::Type> Type; }; typedef backward32_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward32_et(const backward32_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward32_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward32_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward32_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward32_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward32_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward32_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward32_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward32_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward32_et T_slice; }; template backward32_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward32_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward32(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-4; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32(const Array& d1, int dim) { return backward32(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32(Array& d1, int dim) { return backward32(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward42" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -5 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward42_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward42_et< typename T_expr::template tvresult::Type> Type; }; typedef backward42_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward42_et(const backward42_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward42_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward42_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward42_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward42_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward42_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward42_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward42_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward42_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward42_et T_slice; }; template backward42_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward42_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward42(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-5; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42(const Array& d1, int dim) { return backward42(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42(Array& d1, int dim) { return backward42(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward11n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -1 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward11n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward11n_et< typename T_expr::template tvresult::Type> Type; }; typedef backward11n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward11n_et(const backward11n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward11n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward11n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward11n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward11n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward11n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward11n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward11n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward11n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward11n_et T_slice; }; template backward11n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward11n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward11n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11n(const Array& d1, int dim) { return backward11n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11n(Array& d1, int dim) { return backward11n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward21n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward21n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward21n_et< typename T_expr::template tvresult::Type> Type; }; typedef backward21n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward21n_et(const backward21n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward21n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward21n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward21n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward21n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward21n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward21n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward21n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward21n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward21n_et T_slice; }; template backward21n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward21n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward21n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21n(const Array& d1, int dim) { return backward21n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21n(Array& d1, int dim) { return backward21n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward31n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -3 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward31n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward31n_et< typename T_expr::template tvresult::Type> Type; }; typedef backward31n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward31n_et(const backward31n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward31n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward31n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward31n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward31n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward31n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward31n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward31n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward31n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward31n_et T_slice; }; template backward31n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward31n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward31n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-3; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31n(const Array& d1, int dim) { return backward31n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31n(Array& d1, int dim) { return backward31n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward41n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -4 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward41n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward41n_et< typename T_expr::template tvresult::Type> Type; }; typedef backward41n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward41n_et(const backward41n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward41n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward41n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward41n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward41n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward41n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward41n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward41n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward41n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward41n_et T_slice; }; template backward41n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward41n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward41n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-4; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41n(const Array& d1, int dim) { return backward41n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41n(Array& d1, int dim) { return backward41n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward12n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -2 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward12n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward12n_et< typename T_expr::template tvresult::Type> Type; }; typedef backward12n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward12n_et(const backward12n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward12n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward12n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward12n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward12n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward12n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward12n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward12n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward12n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward12n_et T_slice; }; template backward12n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward12n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward12n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12n(const Array& d1, int dim) { return backward12n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12n(Array& d1, int dim) { return backward12n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward22n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -3 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward22n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward22n_et< typename T_expr::template tvresult::Type> Type; }; typedef backward22n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward22n_et(const backward22n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward22n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward22n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward22n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward22n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward22n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward22n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward22n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward22n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward22n_et T_slice; }; template backward22n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward22n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward22n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-3; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22n(const Array& d1, int dim) { return backward22n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22n(Array& d1, int dim) { return backward22n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward32n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -4 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward32n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward32n_et< typename T_expr::template tvresult::Type> Type; }; typedef backward32n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward32n_et(const backward32n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward32n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward32n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward32n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward32n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward32n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward32n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward32n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward32n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward32n_et T_slice; }; template backward32n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward32n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward32n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-4; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32n(const Array& d1, int dim) { return backward32n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32n(Array& d1, int dim) { return backward32n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "backward42n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). -5 and 0 are integer expressions describing the extent of the operator in the operating dimension. */ template class backward42n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef backward42n_et< typename T_expr::template tvresult::Type> Type; }; typedef backward42n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward42n_et(const backward42n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } backward42n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } backward42n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return backward42n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward42n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return backward42n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = backward42n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = backward42n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = backward42n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward42n_et T_slice; }; template backward42n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward42n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward42n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-5; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42n(const Array& d1, int dim) { return backward42n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42n(Array& d1, int dim) { return backward42n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward11" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 1 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward11_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward11_et< typename T_expr::template tvresult::Type> Type; }; typedef forward11_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward11_et(const forward11_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward11_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward11_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward11_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward11_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward11_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward11_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward11_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward11_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward11_et T_slice; }; template forward11_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward11_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward11(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11(const Array& d1, int dim) { return forward11(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11(Array& d1, int dim) { return forward11(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward21" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward21_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward21_et< typename T_expr::template tvresult::Type> Type; }; typedef forward21_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward21_et(const forward21_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward21_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward21_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward21_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward21_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward21_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward21_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward21_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward21_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward21_et T_slice; }; template forward21_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward21_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward21(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21(const Array& d1, int dim) { return forward21(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21(Array& d1, int dim) { return forward21(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward31" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 3 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward31_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward31_et< typename T_expr::template tvresult::Type> Type; }; typedef forward31_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward31_et(const forward31_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward31_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward31_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward31_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward31_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward31_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward31_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward31_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward31_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward31_et T_slice; }; template forward31_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward31_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward31(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=3; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31(const Array& d1, int dim) { return forward31(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31(Array& d1, int dim) { return forward31(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward41" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 4 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward41_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward41_et< typename T_expr::template tvresult::Type> Type; }; typedef forward41_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward41_et(const forward41_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward41_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward41_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward41_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward41_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward41_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward41_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward41_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward41_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward41_et T_slice; }; template forward41_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward41_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward41(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=4; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41(const Array& d1, int dim) { return forward41(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41(Array& d1, int dim) { return forward41(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward12" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward12_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward12_et< typename T_expr::template tvresult::Type> Type; }; typedef forward12_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward12_et(const forward12_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward12_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward12_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward12_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward12_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward12_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward12_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward12_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward12_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward12_et T_slice; }; template forward12_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward12_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward12(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12(const Array& d1, int dim) { return forward12(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12(Array& d1, int dim) { return forward12(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward22" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 3 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward22_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward22_et< typename T_expr::template tvresult::Type> Type; }; typedef forward22_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward22_et(const forward22_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward22_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward22_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward22_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward22_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward22_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward22_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward22_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward22_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward22_et T_slice; }; template forward22_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward22_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward22(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=3; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22(const Array& d1, int dim) { return forward22(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22(Array& d1, int dim) { return forward22(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward32" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 4 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward32_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward32_et< typename T_expr::template tvresult::Type> Type; }; typedef forward32_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward32_et(const forward32_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward32_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward32_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward32_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward32_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward32_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward32_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward32_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward32_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward32_et T_slice; }; template forward32_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward32_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward32(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=4; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32(const Array& d1, int dim) { return forward32(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32(Array& d1, int dim) { return forward32(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward42" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 5 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward42_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward42_et< typename T_expr::template tvresult::Type> Type; }; typedef forward42_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward42_et(const forward42_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward42_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward42_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward42_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward42_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward42_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward42_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward42_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward42_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward42_et T_slice; }; template forward42_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward42_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward42(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=5; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42(const Array& d1, int dim) { return forward42(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42(Array& d1, int dim) { return forward42(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward11n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 1 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward11n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward11n_et< typename T_expr::template tvresult::Type> Type; }; typedef forward11n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward11n_et(const forward11n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward11n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward11n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward11n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward11n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward11n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward11n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward11n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward11n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward11n_et T_slice; }; template forward11n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward11n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward11n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11n(const Array& d1, int dim) { return forward11n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11n(Array& d1, int dim) { return forward11n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward21n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward21n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward21n_et< typename T_expr::template tvresult::Type> Type; }; typedef forward21n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward21n_et(const forward21n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward21n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward21n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward21n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward21n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward21n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward21n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward21n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward21n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward21n_et T_slice; }; template forward21n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward21n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward21n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21n(const Array& d1, int dim) { return forward21n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21n(Array& d1, int dim) { return forward21n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward31n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 3 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward31n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward31n_et< typename T_expr::template tvresult::Type> Type; }; typedef forward31n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward31n_et(const forward31n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward31n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward31n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward31n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward31n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward31n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward31n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward31n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward31n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward31n_et T_slice; }; template forward31n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward31n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward31n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=3; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31n(const Array& d1, int dim) { return forward31n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31n(Array& d1, int dim) { return forward31n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward41n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 4 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward41n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward41n_et< typename T_expr::template tvresult::Type> Type; }; typedef forward41n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward41n_et(const forward41n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward41n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward41n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward41n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward41n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward41n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward41n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward41n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward41n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward41n_et T_slice; }; template forward41n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward41n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward41n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=4; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41n(const Array& d1, int dim) { return forward41n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41n(Array& d1, int dim) { return forward41n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward12n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 2 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward12n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward12n_et< typename T_expr::template tvresult::Type> Type; }; typedef forward12n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward12n_et(const forward12n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward12n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward12n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward12n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward12n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward12n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward12n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward12n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward12n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward12n_et T_slice; }; template forward12n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward12n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward12n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12n(const Array& d1, int dim) { return forward12n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12n(Array& d1, int dim) { return forward12n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward22n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 3 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward22n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward22n_et< typename T_expr::template tvresult::Type> Type; }; typedef forward22n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward22n_et(const forward22n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward22n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward22n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward22n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward22n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward22n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward22n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward22n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward22n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward22n_et T_slice; }; template forward22n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward22n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward22n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=3; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22n(const Array& d1, int dim) { return forward22n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22n(Array& d1, int dim) { return forward22n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward32n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 4 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward32n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward32n_et< typename T_expr::template tvresult::Type> Type; }; typedef forward32n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward32n_et(const forward32n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward32n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward32n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward32n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward32n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward32n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward32n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward32n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward32n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward32n_et T_slice; }; template forward32n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward32n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward32n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=4; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32n(const Array& d1, int dim) { return forward32n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32n(Array& d1, int dim) { return forward32n(d1.wrap(), dim); } /* Defines a stencil ET difference operator "forward42n" that operates on an array and returns an array of identical type. (The only significance of the "difference" aspect is that the operator is assumed to take a second argument which is the dimension to do the difference in). 0 and 5 are integer expressions describing the extent of the operator in the operating dimension. */ template class forward42n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef forward42n_et< typename T_expr::template tvresult::Type> Type; }; typedef forward42n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward42n_et(const forward42n_et& a) : _bz_StencilExpr(a), dim_(a.dim_) { } forward42n_et(BZ_ETPARM(T_expr) a, int dim) : _bz_StencilExpr(a), dim_(dim) { } forward42n_et(_bz_typename T_expr::T_ctorArg1 a, int dim) : _bz_StencilExpr(a), dim_(dim) { } T_result operator*() const { return forward42n_stencilop(iter_, dim_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward42n_stencilop(iter_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim_); } T_result operator[](int i) const { return forward42n_stencilop(iter_[i], dim_); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = forward42n_stencilop (iter_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim_); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = forward42n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = forward42n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward42n_et T_slice; }; template forward42n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward42n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),dim_); } private: int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward42n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=5; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42n(const Array& d1, int dim) { return forward42n(d1.wrap(), dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42n(Array& d1, int dim) { return forward42n(d1.wrap(), dim); } /** Defines a stencil ET difference operator "central12" that operates on a multicomponent array and returns an array. */ template class central12_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central12_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central12_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central12_et_multi(const central12_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central12_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central12_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central12_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central12_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central12_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central12_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central12_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central12_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central12_et_multi T_slice; }; template central12_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central12_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central12(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12(const Array& d1, int comp, int dim) { return central12(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12(Array& d1, int comp, int dim) { return central12(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12(const Array& d1) { return central12(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12(Array& d1) { return central12(d1.wrap()); } /** Defines a stencil ET difference operator "central22" that operates on a multicomponent array and returns an array. */ template class central22_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central22_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central22_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central22_et_multi(const central22_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central22_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central22_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central22_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central22_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central22_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central22_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central22_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central22_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central22_et_multi T_slice; }; template central22_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central22_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central22(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22(const Array& d1, int comp, int dim) { return central22(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22(Array& d1, int comp, int dim) { return central22(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22(const Array& d1) { return central22(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22(Array& d1) { return central22(d1.wrap()); } /** Defines a stencil ET difference operator "central32" that operates on a multicomponent array and returns an array. */ template class central32_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central32_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central32_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central32_et_multi(const central32_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central32_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central32_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central32_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central32_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central32_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central32_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central32_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central32_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central32_et_multi T_slice; }; template central32_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central32_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central32(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32(const Array& d1, int comp, int dim) { return central32(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32(Array& d1, int comp, int dim) { return central32(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32(const Array& d1) { return central32(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32(Array& d1) { return central32(d1.wrap()); } /** Defines a stencil ET difference operator "central42" that operates on a multicomponent array and returns an array. */ template class central42_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central42_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central42_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central42_et_multi(const central42_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central42_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central42_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central42_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central42_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central42_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central42_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central42_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central42_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central42_et_multi T_slice; }; template central42_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central42_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central42(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42(const Array& d1, int comp, int dim) { return central42(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42(Array& d1, int comp, int dim) { return central42(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42(const Array& d1) { return central42(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42(Array& d1) { return central42(d1.wrap()); } /** Defines a stencil ET difference operator "central14" that operates on a multicomponent array and returns an array. */ template class central14_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central14_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central14_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central14_et_multi(const central14_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central14_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central14_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central14_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central14_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central14_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central14_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central14_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central14_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central14_et_multi T_slice; }; template central14_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central14_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central14(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14(const Array& d1, int comp, int dim) { return central14(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14(Array& d1, int comp, int dim) { return central14(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14(const Array& d1) { return central14(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14(Array& d1) { return central14(d1.wrap()); } /** Defines a stencil ET difference operator "central24" that operates on a multicomponent array and returns an array. */ template class central24_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central24_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central24_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central24_et_multi(const central24_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central24_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central24_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central24_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central24_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central24_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central24_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central24_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central24_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central24_et_multi T_slice; }; template central24_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central24_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central24(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24(const Array& d1, int comp, int dim) { return central24(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24(Array& d1, int comp, int dim) { return central24(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24(const Array& d1) { return central24(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24(Array& d1) { return central24(d1.wrap()); } /** Defines a stencil ET difference operator "central34" that operates on a multicomponent array and returns an array. */ template class central34_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central34_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central34_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central34_et_multi(const central34_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central34_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central34_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central34_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central34_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central34_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central34_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central34_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central34_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central34_et_multi T_slice; }; template central34_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central34_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central34(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34(const Array& d1, int comp, int dim) { return central34(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34(Array& d1, int comp, int dim) { return central34(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34(const Array& d1) { return central34(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34(Array& d1) { return central34(d1.wrap()); } /** Defines a stencil ET difference operator "central44" that operates on a multicomponent array and returns an array. */ template class central44_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central44_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central44_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central44_et_multi(const central44_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central44_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central44_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central44_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central44_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central44_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central44_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central44_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central44_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central44_et_multi T_slice; }; template central44_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central44_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central44(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44(const Array& d1, int comp, int dim) { return central44(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44(Array& d1, int comp, int dim) { return central44(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44(const Array& d1) { return central44(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44(Array& d1) { return central44(d1.wrap()); } /** Defines a stencil ET difference operator "central12n" that operates on a multicomponent array and returns an array. */ template class central12n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central12n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central12n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central12n_et_multi(const central12n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central12n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central12n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central12n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central12n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central12n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central12n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central12n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central12n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central12n_et_multi T_slice; }; template central12n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central12n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central12n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12n(const Array& d1, int comp, int dim) { return central12n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12n(Array& d1, int comp, int dim) { return central12n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12n(const Array& d1) { return central12n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central12n(Array& d1) { return central12n(d1.wrap()); } /** Defines a stencil ET difference operator "central22n" that operates on a multicomponent array and returns an array. */ template class central22n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central22n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central22n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central22n_et_multi(const central22n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central22n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central22n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central22n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central22n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central22n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central22n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central22n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central22n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central22n_et_multi T_slice; }; template central22n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central22n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central22n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22n(const Array& d1, int comp, int dim) { return central22n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22n(Array& d1, int comp, int dim) { return central22n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22n(const Array& d1) { return central22n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central22n(Array& d1) { return central22n(d1.wrap()); } /** Defines a stencil ET difference operator "central32n" that operates on a multicomponent array and returns an array. */ template class central32n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central32n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central32n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central32n_et_multi(const central32n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central32n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central32n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central32n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central32n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central32n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central32n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central32n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central32n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central32n_et_multi T_slice; }; template central32n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central32n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central32n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32n(const Array& d1, int comp, int dim) { return central32n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32n(Array& d1, int comp, int dim) { return central32n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32n(const Array& d1) { return central32n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central32n(Array& d1) { return central32n(d1.wrap()); } /** Defines a stencil ET difference operator "central42n" that operates on a multicomponent array and returns an array. */ template class central42n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central42n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central42n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central42n_et_multi(const central42n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central42n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central42n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central42n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central42n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central42n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central42n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central42n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central42n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central42n_et_multi T_slice; }; template central42n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central42n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central42n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42n(const Array& d1, int comp, int dim) { return central42n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42n(Array& d1, int comp, int dim) { return central42n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42n(const Array& d1) { return central42n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central42n(Array& d1) { return central42n(d1.wrap()); } /** Defines a stencil ET difference operator "central14n" that operates on a multicomponent array and returns an array. */ template class central14n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central14n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central14n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central14n_et_multi(const central14n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central14n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central14n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central14n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central14n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central14n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central14n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central14n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central14n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central14n_et_multi T_slice; }; template central14n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central14n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central14n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14n(const Array& d1, int comp, int dim) { return central14n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14n(Array& d1, int comp, int dim) { return central14n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14n(const Array& d1) { return central14n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central14n(Array& d1) { return central14n(d1.wrap()); } /** Defines a stencil ET difference operator "central24n" that operates on a multicomponent array and returns an array. */ template class central24n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central24n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central24n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central24n_et_multi(const central24n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central24n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central24n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central24n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central24n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central24n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central24n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central24n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central24n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central24n_et_multi T_slice; }; template central24n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central24n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central24n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24n(const Array& d1, int comp, int dim) { return central24n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24n(Array& d1, int comp, int dim) { return central24n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24n(const Array& d1) { return central24n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central24n(Array& d1) { return central24n(d1.wrap()); } /** Defines a stencil ET difference operator "central34n" that operates on a multicomponent array and returns an array. */ template class central34n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central34n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central34n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central34n_et_multi(const central34n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central34n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central34n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central34n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central34n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central34n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central34n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central34n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central34n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central34n_et_multi T_slice; }; template central34n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central34n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central34n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34n(const Array& d1, int comp, int dim) { return central34n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34n(Array& d1, int comp, int dim) { return central34n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34n(const Array& d1) { return central34n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central34n(Array& d1) { return central34n(d1.wrap()); } /** Defines a stencil ET difference operator "central44n" that operates on a multicomponent array and returns an array. */ template class central44n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef central44n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef central44n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: central44n_et_multi(const central44n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } central44n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } central44n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return central44n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return central44n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return central44n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = central44n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = central44n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = central44n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef central44n_et_multi T_slice; }; template central44n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return central44n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > central44n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44n(const Array& d1, int comp, int dim) { return central44n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44n(Array& d1, int comp, int dim) { return central44n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44n(const Array& d1) { return central44n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > central44n(Array& d1) { return central44n(d1.wrap()); } /** Defines a stencil ET difference operator "backward11" that operates on a multicomponent array and returns an array. */ template class backward11_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward11_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward11_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward11_et_multi(const backward11_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward11_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward11_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward11_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward11_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward11_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward11_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward11_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward11_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward11_et_multi T_slice; }; template backward11_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward11_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward11(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11(const Array& d1, int comp, int dim) { return backward11(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11(Array& d1, int comp, int dim) { return backward11(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11(const Array& d1) { return backward11(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11(Array& d1) { return backward11(d1.wrap()); } /** Defines a stencil ET difference operator "backward21" that operates on a multicomponent array and returns an array. */ template class backward21_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward21_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward21_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward21_et_multi(const backward21_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward21_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward21_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward21_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward21_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward21_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward21_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward21_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward21_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward21_et_multi T_slice; }; template backward21_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward21_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward21(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21(const Array& d1, int comp, int dim) { return backward21(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21(Array& d1, int comp, int dim) { return backward21(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21(const Array& d1) { return backward21(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21(Array& d1) { return backward21(d1.wrap()); } /** Defines a stencil ET difference operator "backward31" that operates on a multicomponent array and returns an array. */ template class backward31_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward31_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward31_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward31_et_multi(const backward31_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward31_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward31_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward31_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward31_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward31_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward31_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward31_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward31_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward31_et_multi T_slice; }; template backward31_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward31_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward31(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-3; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31(const Array& d1, int comp, int dim) { return backward31(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31(Array& d1, int comp, int dim) { return backward31(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31(const Array& d1) { return backward31(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31(Array& d1) { return backward31(d1.wrap()); } /** Defines a stencil ET difference operator "backward41" that operates on a multicomponent array and returns an array. */ template class backward41_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward41_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward41_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward41_et_multi(const backward41_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward41_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward41_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward41_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward41_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward41_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward41_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward41_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward41_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward41_et_multi T_slice; }; template backward41_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward41_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward41(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-4; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41(const Array& d1, int comp, int dim) { return backward41(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41(Array& d1, int comp, int dim) { return backward41(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41(const Array& d1) { return backward41(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41(Array& d1) { return backward41(d1.wrap()); } /** Defines a stencil ET difference operator "backward12" that operates on a multicomponent array and returns an array. */ template class backward12_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward12_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward12_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward12_et_multi(const backward12_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward12_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward12_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward12_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward12_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward12_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward12_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward12_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward12_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward12_et_multi T_slice; }; template backward12_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward12_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward12(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12(const Array& d1, int comp, int dim) { return backward12(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12(Array& d1, int comp, int dim) { return backward12(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12(const Array& d1) { return backward12(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12(Array& d1) { return backward12(d1.wrap()); } /** Defines a stencil ET difference operator "backward22" that operates on a multicomponent array and returns an array. */ template class backward22_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward22_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward22_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward22_et_multi(const backward22_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward22_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward22_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward22_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward22_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward22_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward22_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward22_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward22_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward22_et_multi T_slice; }; template backward22_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward22_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward22(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-3; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22(const Array& d1, int comp, int dim) { return backward22(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22(Array& d1, int comp, int dim) { return backward22(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22(const Array& d1) { return backward22(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22(Array& d1) { return backward22(d1.wrap()); } /** Defines a stencil ET difference operator "backward32" that operates on a multicomponent array and returns an array. */ template class backward32_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward32_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward32_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward32_et_multi(const backward32_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward32_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward32_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward32_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward32_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward32_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward32_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward32_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward32_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward32_et_multi T_slice; }; template backward32_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward32_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward32(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-4; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32(const Array& d1, int comp, int dim) { return backward32(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32(Array& d1, int comp, int dim) { return backward32(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32(const Array& d1) { return backward32(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32(Array& d1) { return backward32(d1.wrap()); } /** Defines a stencil ET difference operator "backward42" that operates on a multicomponent array and returns an array. */ template class backward42_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward42_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward42_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward42_et_multi(const backward42_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward42_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward42_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward42_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward42_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward42_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward42_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward42_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward42_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward42_et_multi T_slice; }; template backward42_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward42_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward42(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-5; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42(const Array& d1, int comp, int dim) { return backward42(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42(Array& d1, int comp, int dim) { return backward42(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42(const Array& d1) { return backward42(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42(Array& d1) { return backward42(d1.wrap()); } /** Defines a stencil ET difference operator "backward11n" that operates on a multicomponent array and returns an array. */ template class backward11n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward11n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward11n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward11n_et_multi(const backward11n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward11n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward11n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward11n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward11n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward11n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward11n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward11n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward11n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward11n_et_multi T_slice; }; template backward11n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward11n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward11n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-1; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11n(const Array& d1, int comp, int dim) { return backward11n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11n(Array& d1, int comp, int dim) { return backward11n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11n(const Array& d1) { return backward11n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward11n(Array& d1) { return backward11n(d1.wrap()); } /** Defines a stencil ET difference operator "backward21n" that operates on a multicomponent array and returns an array. */ template class backward21n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward21n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward21n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward21n_et_multi(const backward21n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward21n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward21n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward21n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward21n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward21n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward21n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward21n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward21n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward21n_et_multi T_slice; }; template backward21n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward21n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward21n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21n(const Array& d1, int comp, int dim) { return backward21n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21n(Array& d1, int comp, int dim) { return backward21n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21n(const Array& d1) { return backward21n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward21n(Array& d1) { return backward21n(d1.wrap()); } /** Defines a stencil ET difference operator "backward31n" that operates on a multicomponent array and returns an array. */ template class backward31n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward31n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward31n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward31n_et_multi(const backward31n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward31n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward31n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward31n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward31n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward31n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward31n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward31n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward31n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward31n_et_multi T_slice; }; template backward31n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward31n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward31n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-3; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31n(const Array& d1, int comp, int dim) { return backward31n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31n(Array& d1, int comp, int dim) { return backward31n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31n(const Array& d1) { return backward31n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward31n(Array& d1) { return backward31n(d1.wrap()); } /** Defines a stencil ET difference operator "backward41n" that operates on a multicomponent array and returns an array. */ template class backward41n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward41n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward41n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward41n_et_multi(const backward41n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward41n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward41n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward41n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward41n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward41n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward41n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward41n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward41n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward41n_et_multi T_slice; }; template backward41n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward41n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward41n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-4; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41n(const Array& d1, int comp, int dim) { return backward41n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41n(Array& d1, int comp, int dim) { return backward41n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41n(const Array& d1) { return backward41n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward41n(Array& d1) { return backward41n(d1.wrap()); } /** Defines a stencil ET difference operator "backward12n" that operates on a multicomponent array and returns an array. */ template class backward12n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward12n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward12n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward12n_et_multi(const backward12n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward12n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward12n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward12n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward12n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward12n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward12n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward12n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward12n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward12n_et_multi T_slice; }; template backward12n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward12n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward12n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-2; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12n(const Array& d1, int comp, int dim) { return backward12n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12n(Array& d1, int comp, int dim) { return backward12n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12n(const Array& d1) { return backward12n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward12n(Array& d1) { return backward12n(d1.wrap()); } /** Defines a stencil ET difference operator "backward22n" that operates on a multicomponent array and returns an array. */ template class backward22n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward22n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward22n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward22n_et_multi(const backward22n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward22n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward22n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward22n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward22n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward22n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward22n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward22n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward22n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward22n_et_multi T_slice; }; template backward22n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward22n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward22n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-3; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22n(const Array& d1, int comp, int dim) { return backward22n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22n(Array& d1, int comp, int dim) { return backward22n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22n(const Array& d1) { return backward22n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward22n(Array& d1) { return backward22n(d1.wrap()); } /** Defines a stencil ET difference operator "backward32n" that operates on a multicomponent array and returns an array. */ template class backward32n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward32n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward32n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward32n_et_multi(const backward32n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward32n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward32n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward32n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward32n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward32n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward32n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward32n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward32n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward32n_et_multi T_slice; }; template backward32n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward32n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward32n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-4; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32n(const Array& d1, int comp, int dim) { return backward32n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32n(Array& d1, int comp, int dim) { return backward32n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32n(const Array& d1) { return backward32n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward32n(Array& d1) { return backward32n(d1.wrap()); } /** Defines a stencil ET difference operator "backward42n" that operates on a multicomponent array and returns an array. */ template class backward42n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef backward42n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef backward42n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: backward42n_et_multi(const backward42n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } backward42n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } backward42n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return backward42n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return backward42n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return backward42n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = backward42n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = backward42n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = backward42n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef backward42n_et_multi T_slice; }; template backward42n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return backward42n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > backward42n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=-5; maxb[dim]=0; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42n(const Array& d1, int comp, int dim) { return backward42n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42n(Array& d1, int comp, int dim) { return backward42n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42n(const Array& d1) { return backward42n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > backward42n(Array& d1) { return backward42n(d1.wrap()); } /** Defines a stencil ET difference operator "forward11" that operates on a multicomponent array and returns an array. */ template class forward11_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward11_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward11_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward11_et_multi(const forward11_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward11_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward11_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward11_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward11_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward11_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward11_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward11_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward11_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward11_et_multi T_slice; }; template forward11_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward11_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward11(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11(const Array& d1, int comp, int dim) { return forward11(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11(Array& d1, int comp, int dim) { return forward11(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11(const Array& d1) { return forward11(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11(Array& d1) { return forward11(d1.wrap()); } /** Defines a stencil ET difference operator "forward21" that operates on a multicomponent array and returns an array. */ template class forward21_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward21_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward21_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward21_et_multi(const forward21_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward21_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward21_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward21_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward21_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward21_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward21_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward21_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward21_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward21_et_multi T_slice; }; template forward21_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward21_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward21(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21(const Array& d1, int comp, int dim) { return forward21(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21(Array& d1, int comp, int dim) { return forward21(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21(const Array& d1) { return forward21(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21(Array& d1) { return forward21(d1.wrap()); } /** Defines a stencil ET difference operator "forward31" that operates on a multicomponent array and returns an array. */ template class forward31_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward31_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward31_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward31_et_multi(const forward31_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward31_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward31_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward31_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward31_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward31_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward31_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward31_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward31_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward31_et_multi T_slice; }; template forward31_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward31_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward31(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=3; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31(const Array& d1, int comp, int dim) { return forward31(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31(Array& d1, int comp, int dim) { return forward31(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31(const Array& d1) { return forward31(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31(Array& d1) { return forward31(d1.wrap()); } /** Defines a stencil ET difference operator "forward41" that operates on a multicomponent array and returns an array. */ template class forward41_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward41_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward41_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward41_et_multi(const forward41_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward41_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward41_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward41_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward41_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward41_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward41_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward41_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward41_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward41_et_multi T_slice; }; template forward41_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward41_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward41(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=4; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41(const Array& d1, int comp, int dim) { return forward41(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41(Array& d1, int comp, int dim) { return forward41(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41(const Array& d1) { return forward41(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41(Array& d1) { return forward41(d1.wrap()); } /** Defines a stencil ET difference operator "forward12" that operates on a multicomponent array and returns an array. */ template class forward12_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward12_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward12_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward12_et_multi(const forward12_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward12_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward12_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward12_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward12_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward12_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward12_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward12_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward12_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward12_et_multi T_slice; }; template forward12_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward12_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward12(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12(const Array& d1, int comp, int dim) { return forward12(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12(Array& d1, int comp, int dim) { return forward12(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12(const Array& d1) { return forward12(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12(Array& d1) { return forward12(d1.wrap()); } /** Defines a stencil ET difference operator "forward22" that operates on a multicomponent array and returns an array. */ template class forward22_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward22_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward22_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward22_et_multi(const forward22_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward22_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward22_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward22_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward22_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward22_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward22_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward22_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward22_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward22_et_multi T_slice; }; template forward22_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward22_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward22(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=3; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22(const Array& d1, int comp, int dim) { return forward22(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22(Array& d1, int comp, int dim) { return forward22(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22(const Array& d1) { return forward22(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22(Array& d1) { return forward22(d1.wrap()); } /** Defines a stencil ET difference operator "forward32" that operates on a multicomponent array and returns an array. */ template class forward32_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward32_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward32_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward32_et_multi(const forward32_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward32_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward32_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward32_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward32_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward32_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward32_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward32_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward32_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward32_et_multi T_slice; }; template forward32_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward32_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward32(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=4; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32(const Array& d1, int comp, int dim) { return forward32(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32(Array& d1, int comp, int dim) { return forward32(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32(const Array& d1) { return forward32(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32(Array& d1) { return forward32(d1.wrap()); } /** Defines a stencil ET difference operator "forward42" that operates on a multicomponent array and returns an array. */ template class forward42_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward42_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward42_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward42_et_multi(const forward42_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward42_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward42_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward42_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward42_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward42_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward42_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward42_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward42_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward42_et_multi T_slice; }; template forward42_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward42_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward42(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=5; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42(const Array& d1, int comp, int dim) { return forward42(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42(Array& d1, int comp, int dim) { return forward42(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42(const Array& d1) { return forward42(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42(Array& d1) { return forward42(d1.wrap()); } /** Defines a stencil ET difference operator "forward11n" that operates on a multicomponent array and returns an array. */ template class forward11n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward11n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward11n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward11n_et_multi(const forward11n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward11n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward11n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward11n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward11n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward11n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward11n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward11n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward11n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward11n_et_multi T_slice; }; template forward11n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward11n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward11n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11n(const Array& d1, int comp, int dim) { return forward11n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11n(Array& d1, int comp, int dim) { return forward11n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11n(const Array& d1) { return forward11n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward11n(Array& d1) { return forward11n(d1.wrap()); } /** Defines a stencil ET difference operator "forward21n" that operates on a multicomponent array and returns an array. */ template class forward21n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward21n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward21n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward21n_et_multi(const forward21n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward21n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward21n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward21n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward21n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward21n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward21n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward21n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward21n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward21n_et_multi T_slice; }; template forward21n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward21n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward21n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21n(const Array& d1, int comp, int dim) { return forward21n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21n(Array& d1, int comp, int dim) { return forward21n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21n(const Array& d1) { return forward21n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward21n(Array& d1) { return forward21n(d1.wrap()); } /** Defines a stencil ET difference operator "forward31n" that operates on a multicomponent array and returns an array. */ template class forward31n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward31n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward31n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward31n_et_multi(const forward31n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward31n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward31n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward31n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward31n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward31n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward31n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward31n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward31n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward31n_et_multi T_slice; }; template forward31n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward31n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward31n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=3; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31n(const Array& d1, int comp, int dim) { return forward31n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31n(Array& d1, int comp, int dim) { return forward31n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31n(const Array& d1) { return forward31n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward31n(Array& d1) { return forward31n(d1.wrap()); } /** Defines a stencil ET difference operator "forward41n" that operates on a multicomponent array and returns an array. */ template class forward41n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward41n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward41n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward41n_et_multi(const forward41n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward41n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward41n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward41n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward41n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward41n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward41n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward41n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward41n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward41n_et_multi T_slice; }; template forward41n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward41n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward41n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=4; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41n(const Array& d1, int comp, int dim) { return forward41n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41n(Array& d1, int comp, int dim) { return forward41n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41n(const Array& d1) { return forward41n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward41n(Array& d1) { return forward41n(d1.wrap()); } /** Defines a stencil ET difference operator "forward12n" that operates on a multicomponent array and returns an array. */ template class forward12n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward12n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward12n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward12n_et_multi(const forward12n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward12n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward12n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward12n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward12n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward12n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward12n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward12n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward12n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward12n_et_multi T_slice; }; template forward12n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward12n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward12n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12n(const Array& d1, int comp, int dim) { return forward12n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12n(Array& d1, int comp, int dim) { return forward12n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12n(const Array& d1) { return forward12n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward12n(Array& d1) { return forward12n(d1.wrap()); } /** Defines a stencil ET difference operator "forward22n" that operates on a multicomponent array and returns an array. */ template class forward22n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward22n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward22n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward22n_et_multi(const forward22n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward22n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward22n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward22n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward22n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward22n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward22n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward22n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward22n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward22n_et_multi T_slice; }; template forward22n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward22n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward22n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=3; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22n(const Array& d1, int comp, int dim) { return forward22n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22n(Array& d1, int comp, int dim) { return forward22n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22n(const Array& d1) { return forward22n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward22n(Array& d1) { return forward22n(d1.wrap()); } /** Defines a stencil ET difference operator "forward32n" that operates on a multicomponent array and returns an array. */ template class forward32n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward32n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward32n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward32n_et_multi(const forward32n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward32n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward32n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward32n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward32n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward32n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward32n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward32n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward32n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward32n_et_multi T_slice; }; template forward32n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward32n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward32n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=4; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32n(const Array& d1, int comp, int dim) { return forward32n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32n(Array& d1, int comp, int dim) { return forward32n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32n(const Array& d1) { return forward32n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward32n(Array& d1) { return forward32n(d1.wrap()); } /** Defines a stencil ET difference operator "forward42n" that operates on a multicomponent array and returns an array. */ template class forward42n_et_multi : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef forward42n_et_multi< typename T_expr::template tvresult::Type> Type; }; typedef forward42n_et_multi<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: forward42n_et_multi(const forward42n_et_multi& a) : _bz_StencilExpr(a), comp_(a.comp_), dim_(a.dim_) { } forward42n_et_multi(BZ_ETPARM(T_expr) a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } forward42n_et_multi(_bz_typename T_expr::T_ctorArg1 a, int comp, int dim) : _bz_StencilExpr(a), comp_(comp), dim_(dim) { } T_numtype operator*() const { return forward42n_stencilop(iter_, comp_, dim_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return forward42n_stencilop(iter_, comp_, dim_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), comp_, dim_); } T_numtype operator[](int i) const { return forward42n_stencilop(iter_[i], comp_, dim_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = forward42n_stencilop (iter_, comp_, dim_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),comp_,dim_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = forward42n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = forward42n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef forward42n_et_multi T_slice; }; template forward42n_et_multi operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return forward42n_et_multi (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)),comp_, dim_); } private: int comp_; int dim_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > forward42n(const BZ_BLITZ_SCOPE(ETBase)& d1, int comp, int dim) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim]=0; maxb[dim]=5; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), comp, dim); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42n(const Array& d1, int comp, int dim) { return forward42n(d1.wrap(), comp, dim); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42n(Array& d1, int comp, int dim) { return forward42n(d1.wrap(), comp, dim); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42n(const Array& d1) { return forward42n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > forward42n(Array& d1) { return forward42n(d1.wrap()); } /** Defines a stencil ET "Laplacian2D" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-1,-1)-shape(1,1). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class Laplacian2D_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef Laplacian2D_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef Laplacian2D_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: Laplacian2D_et(const Laplacian2D_et& a) : _bz_StencilExpr(a) { } Laplacian2D_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } Laplacian2D_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return Laplacian2D_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return Laplacian2D_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return Laplacian2D_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = Laplacian2D_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = Laplacian2D_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = Laplacian2D_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "Laplacian2D (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef Laplacian2D_et T_slice; }; template Laplacian2D_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return Laplacian2D_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > Laplacian2D(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1), shape(1,1)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian2D(const Array& d1) { return Laplacian2D(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian2D(Array& d1) { return Laplacian2D(d1.wrap()); } /** Defines a stencil ET "Laplacian3D" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-1,-1,-1)-shape(1,1,1). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class Laplacian3D_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef Laplacian3D_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef Laplacian3D_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: Laplacian3D_et(const Laplacian3D_et& a) : _bz_StencilExpr(a) { } Laplacian3D_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } Laplacian3D_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return Laplacian3D_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return Laplacian3D_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return Laplacian3D_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = Laplacian3D_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = Laplacian3D_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = Laplacian3D_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "Laplacian3D (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef Laplacian3D_et T_slice; }; template Laplacian3D_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return Laplacian3D_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > Laplacian3D(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1,-1), shape(1,1,1)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian3D(const Array& d1) { return Laplacian3D(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian3D(Array& d1) { return Laplacian3D(d1.wrap()); } /** Defines a stencil ET "Laplacian2D4" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-2,-2)-shape(2,2). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class Laplacian2D4_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef Laplacian2D4_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef Laplacian2D4_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: Laplacian2D4_et(const Laplacian2D4_et& a) : _bz_StencilExpr(a) { } Laplacian2D4_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } Laplacian2D4_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return Laplacian2D4_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return Laplacian2D4_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return Laplacian2D4_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = Laplacian2D4_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = Laplacian2D4_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = Laplacian2D4_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "Laplacian2D4 (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef Laplacian2D4_et T_slice; }; template Laplacian2D4_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return Laplacian2D4_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > Laplacian2D4(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian2D4(const Array& d1) { return Laplacian2D4(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian2D4(Array& d1) { return Laplacian2D4(d1.wrap()); } /** Defines a stencil ET "Laplacian2D4n" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-2,-2)-shape(2,2). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class Laplacian2D4n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef Laplacian2D4n_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef Laplacian2D4n_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: Laplacian2D4n_et(const Laplacian2D4n_et& a) : _bz_StencilExpr(a) { } Laplacian2D4n_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } Laplacian2D4n_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return Laplacian2D4n_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return Laplacian2D4n_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return Laplacian2D4n_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = Laplacian2D4n_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = Laplacian2D4n_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = Laplacian2D4n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "Laplacian2D4n (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef Laplacian2D4n_et T_slice; }; template Laplacian2D4n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return Laplacian2D4n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > Laplacian2D4n(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian2D4n(const Array& d1) { return Laplacian2D4n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian2D4n(Array& d1) { return Laplacian2D4n(d1.wrap()); } /** Defines a stencil ET "Laplacian3D4" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-2,-2,-2)-shape(2,2,2). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class Laplacian3D4_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef Laplacian3D4_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef Laplacian3D4_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: Laplacian3D4_et(const Laplacian3D4_et& a) : _bz_StencilExpr(a) { } Laplacian3D4_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } Laplacian3D4_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return Laplacian3D4_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return Laplacian3D4_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return Laplacian3D4_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = Laplacian3D4_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = Laplacian3D4_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = Laplacian3D4_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "Laplacian3D4 (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef Laplacian3D4_et T_slice; }; template Laplacian3D4_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return Laplacian3D4_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > Laplacian3D4(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2,-2), shape(2,2,2)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian3D4(const Array& d1) { return Laplacian3D4(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian3D4(Array& d1) { return Laplacian3D4(d1.wrap()); } /** Defines a stencil ET "Laplacian3D4n" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-2,-2,-2)-shape(2,2,2). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class Laplacian3D4n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef Laplacian3D4n_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef Laplacian3D4n_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: Laplacian3D4n_et(const Laplacian3D4n_et& a) : _bz_StencilExpr(a) { } Laplacian3D4n_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } Laplacian3D4n_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return Laplacian3D4n_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return Laplacian3D4n_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return Laplacian3D4n_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = Laplacian3D4n_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = Laplacian3D4n_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = Laplacian3D4n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "Laplacian3D4n (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef Laplacian3D4n_et T_slice; }; template Laplacian3D4n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return Laplacian3D4n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > Laplacian3D4n(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2,-2), shape(2,2,2)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian3D4n(const Array& d1) { return Laplacian3D4n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > Laplacian3D4n(Array& d1) { return Laplacian3D4n(d1.wrap()); } /* Defines a stencil ET "grad2D" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class grad2D_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef grad2D_et< typename T_expr::template tvresult::Type> Type; }; typedef grad2D_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: grad2D_et(const grad2D_et& a) : _bz_StencilExpr(a) { } grad2D_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } grad2D_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return grad2D_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return grad2D_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return grad2D_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = grad2D_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = grad2D_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = grad2D_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef grad2D_et T_slice; }; template grad2D_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return grad2D_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > grad2D(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1), shape(1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad2D(const Array& d1) { return grad2D(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad2D(Array& d1) { return grad2D(d1.wrap()); } /* Defines a stencil ET "grad2D4" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class grad2D4_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef grad2D4_et< typename T_expr::template tvresult::Type> Type; }; typedef grad2D4_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: grad2D4_et(const grad2D4_et& a) : _bz_StencilExpr(a) { } grad2D4_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } grad2D4_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return grad2D4_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return grad2D4_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return grad2D4_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = grad2D4_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = grad2D4_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = grad2D4_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef grad2D4_et T_slice; }; template grad2D4_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return grad2D4_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > grad2D4(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad2D4(const Array& d1) { return grad2D4(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad2D4(Array& d1) { return grad2D4(d1.wrap()); } /* Defines a stencil ET "grad3D" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class grad3D_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef grad3D_et< typename T_expr::template tvresult::Type> Type; }; typedef grad3D_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: grad3D_et(const grad3D_et& a) : _bz_StencilExpr(a) { } grad3D_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } grad3D_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return grad3D_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return grad3D_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return grad3D_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = grad3D_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = grad3D_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = grad3D_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef grad3D_et T_slice; }; template grad3D_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return grad3D_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > grad3D(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1,-1), shape(1,1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad3D(const Array& d1) { return grad3D(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad3D(Array& d1) { return grad3D(d1.wrap()); } /* Defines a stencil ET "grad3D4" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class grad3D4_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef grad3D4_et< typename T_expr::template tvresult::Type> Type; }; typedef grad3D4_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: grad3D4_et(const grad3D4_et& a) : _bz_StencilExpr(a) { } grad3D4_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } grad3D4_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return grad3D4_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return grad3D4_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return grad3D4_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = grad3D4_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = grad3D4_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = grad3D4_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef grad3D4_et T_slice; }; template grad3D4_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return grad3D4_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > grad3D4(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2,-2), shape(2,2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad3D4(const Array& d1) { return grad3D4(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad3D4(Array& d1) { return grad3D4(d1.wrap()); } /* Defines a stencil ET "grad2Dn" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class grad2Dn_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef grad2Dn_et< typename T_expr::template tvresult::Type> Type; }; typedef grad2Dn_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: grad2Dn_et(const grad2Dn_et& a) : _bz_StencilExpr(a) { } grad2Dn_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } grad2Dn_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return grad2Dn_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return grad2Dn_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return grad2Dn_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = grad2Dn_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = grad2Dn_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = grad2Dn_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef grad2Dn_et T_slice; }; template grad2Dn_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return grad2Dn_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > grad2Dn(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1), shape(1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad2Dn(const Array& d1) { return grad2Dn(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad2Dn(Array& d1) { return grad2Dn(d1.wrap()); } /* Defines a stencil ET "grad2D4n" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class grad2D4n_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef grad2D4n_et< typename T_expr::template tvresult::Type> Type; }; typedef grad2D4n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: grad2D4n_et(const grad2D4n_et& a) : _bz_StencilExpr(a) { } grad2D4n_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } grad2D4n_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return grad2D4n_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return grad2D4n_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return grad2D4n_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = grad2D4n_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = grad2D4n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = grad2D4n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef grad2D4n_et T_slice; }; template grad2D4n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return grad2D4n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > grad2D4n(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad2D4n(const Array& d1) { return grad2D4n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad2D4n(Array& d1) { return grad2D4n(d1.wrap()); } /* Defines a stencil ET "grad3Dn" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class grad3Dn_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef grad3Dn_et< typename T_expr::template tvresult::Type> Type; }; typedef grad3Dn_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: grad3Dn_et(const grad3Dn_et& a) : _bz_StencilExpr(a) { } grad3Dn_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } grad3Dn_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return grad3Dn_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return grad3Dn_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return grad3Dn_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = grad3Dn_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = grad3Dn_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = grad3Dn_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef grad3Dn_et T_slice; }; template grad3Dn_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return grad3Dn_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > grad3Dn(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1,-1), shape(1,1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad3Dn(const Array& d1) { return grad3Dn(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad3Dn(Array& d1) { return grad3Dn(d1.wrap()); } /* Defines a stencil ET "grad3D4n" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class grad3D4n_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef grad3D4n_et< typename T_expr::template tvresult::Type> Type; }; typedef grad3D4n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: grad3D4n_et(const grad3D4n_et& a) : _bz_StencilExpr(a) { } grad3D4n_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } grad3D4n_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return grad3D4n_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return grad3D4n_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return grad3D4n_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = grad3D4n_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = grad3D4n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = grad3D4n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef grad3D4n_et T_slice; }; template grad3D4n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return grad3D4n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > grad3D4n(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2,-2), shape(2,2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad3D4n(const Array& d1) { return grad3D4n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > grad3D4n(Array& d1) { return grad3D4n(d1.wrap()); } /* Defines a stencil ET "gradSqr2D" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class gradSqr2D_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef gradSqr2D_et< typename T_expr::template tvresult::Type> Type; }; typedef gradSqr2D_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: gradSqr2D_et(const gradSqr2D_et& a) : _bz_StencilExpr(a) { } gradSqr2D_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } gradSqr2D_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return gradSqr2D_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return gradSqr2D_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return gradSqr2D_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = gradSqr2D_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = gradSqr2D_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = gradSqr2D_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef gradSqr2D_et T_slice; }; template gradSqr2D_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return gradSqr2D_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > gradSqr2D(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1), shape(1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr2D(const Array& d1) { return gradSqr2D(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr2D(Array& d1) { return gradSqr2D(d1.wrap()); } /* Defines a stencil ET "gradSqr2D4" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class gradSqr2D4_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef gradSqr2D4_et< typename T_expr::template tvresult::Type> Type; }; typedef gradSqr2D4_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: gradSqr2D4_et(const gradSqr2D4_et& a) : _bz_StencilExpr(a) { } gradSqr2D4_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } gradSqr2D4_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return gradSqr2D4_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return gradSqr2D4_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return gradSqr2D4_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = gradSqr2D4_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = gradSqr2D4_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = gradSqr2D4_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef gradSqr2D4_et T_slice; }; template gradSqr2D4_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return gradSqr2D4_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > gradSqr2D4(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr2D4(const Array& d1) { return gradSqr2D4(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr2D4(Array& d1) { return gradSqr2D4(d1.wrap()); } /* Defines a stencil ET "gradSqr3D" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class gradSqr3D_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef gradSqr3D_et< typename T_expr::template tvresult::Type> Type; }; typedef gradSqr3D_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: gradSqr3D_et(const gradSqr3D_et& a) : _bz_StencilExpr(a) { } gradSqr3D_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } gradSqr3D_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return gradSqr3D_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return gradSqr3D_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return gradSqr3D_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = gradSqr3D_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = gradSqr3D_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = gradSqr3D_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef gradSqr3D_et T_slice; }; template gradSqr3D_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return gradSqr3D_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > gradSqr3D(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1,-1), shape(1,1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr3D(const Array& d1) { return gradSqr3D(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr3D(Array& d1) { return gradSqr3D(d1.wrap()); } /* Defines a stencil ET "gradSqr3D4" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class gradSqr3D4_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef gradSqr3D4_et< typename T_expr::template tvresult::Type> Type; }; typedef gradSqr3D4_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: gradSqr3D4_et(const gradSqr3D4_et& a) : _bz_StencilExpr(a) { } gradSqr3D4_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } gradSqr3D4_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return gradSqr3D4_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return gradSqr3D4_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return gradSqr3D4_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = gradSqr3D4_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = gradSqr3D4_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = gradSqr3D4_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef gradSqr3D4_et T_slice; }; template gradSqr3D4_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return gradSqr3D4_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > gradSqr3D4(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2,-2), shape(2,2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr3D4(const Array& d1) { return gradSqr3D4(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr3D4(Array& d1) { return gradSqr3D4(d1.wrap()); } /* Defines a stencil ET "gradSqr2Dn" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class gradSqr2Dn_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef gradSqr2Dn_et< typename T_expr::template tvresult::Type> Type; }; typedef gradSqr2Dn_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: gradSqr2Dn_et(const gradSqr2Dn_et& a) : _bz_StencilExpr(a) { } gradSqr2Dn_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } gradSqr2Dn_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return gradSqr2Dn_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return gradSqr2Dn_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return gradSqr2Dn_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = gradSqr2Dn_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = gradSqr2Dn_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = gradSqr2Dn_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef gradSqr2Dn_et T_slice; }; template gradSqr2Dn_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return gradSqr2Dn_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > gradSqr2Dn(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1), shape(1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr2Dn(const Array& d1) { return gradSqr2Dn(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr2Dn(Array& d1) { return gradSqr2Dn(d1.wrap()); } /* Defines a stencil ET "gradSqr2D4n" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class gradSqr2D4n_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef gradSqr2D4n_et< typename T_expr::template tvresult::Type> Type; }; typedef gradSqr2D4n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: gradSqr2D4n_et(const gradSqr2D4n_et& a) : _bz_StencilExpr(a) { } gradSqr2D4n_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } gradSqr2D4n_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return gradSqr2D4n_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return gradSqr2D4n_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return gradSqr2D4n_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = gradSqr2D4n_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = gradSqr2D4n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = gradSqr2D4n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef gradSqr2D4n_et T_slice; }; template gradSqr2D4n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return gradSqr2D4n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > gradSqr2D4n(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr2D4n(const Array& d1) { return gradSqr2D4n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr2D4n(Array& d1) { return gradSqr2D4n(d1.wrap()); } /* Defines a stencil ET "gradSqr3Dn" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class gradSqr3Dn_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef gradSqr3Dn_et< typename T_expr::template tvresult::Type> Type; }; typedef gradSqr3Dn_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: gradSqr3Dn_et(const gradSqr3Dn_et& a) : _bz_StencilExpr(a) { } gradSqr3Dn_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } gradSqr3Dn_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return gradSqr3Dn_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return gradSqr3Dn_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return gradSqr3Dn_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = gradSqr3Dn_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = gradSqr3Dn_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = gradSqr3Dn_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef gradSqr3Dn_et T_slice; }; template gradSqr3Dn_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return gradSqr3Dn_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > gradSqr3Dn(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1,-1), shape(1,1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr3Dn(const Array& d1) { return gradSqr3Dn(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr3Dn(Array& d1) { return gradSqr3Dn(d1.wrap()); } /* Defines a stencil ET "gradSqr3D4n" that operates on a (scalar) array and returns a multicomponent array >, N_rank>. */ template class gradSqr3D4n_et : public _bz_StencilExpr > { public: typedef _bz_StencilExpr > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, we assume P_numtype is scalar // and that we are returning a TinyVector. This needs to be returned // as a FastTVCopyIterator that keeps a copy of the TV it is // iterating over, since the result of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef typename T_expr::T_numtype T_optype; template struct tvresult { typedef gradSqr3D4n_et< typename T_expr::template tvresult::Type> Type; }; typedef gradSqr3D4n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: gradSqr3D4n_et(const gradSqr3D4n_et& a) : _bz_StencilExpr(a) { } gradSqr3D4n_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } gradSqr3D4n_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return gradSqr3D4n_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return gradSqr3D4n_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return gradSqr3D4n_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = gradSqr3D4n_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = gradSqr3D4n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = gradSqr3D4n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef gradSqr3D4n_et T_slice; }; template gradSqr3D4n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return gradSqr3D4n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > gradSqr3D4n(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2,-2), shape(2,2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr3D4n(const Array& d1) { return gradSqr3D4n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > gradSqr3D4n(Array& d1) { return gradSqr3D4n(d1.wrap()); } /* Defines a stencil ET "Jacobian3D" that operates on an array array and returns a multicomponent array >, N_rank>. P_numtype can be a TinyVector or a scalar, I think. */ template class Jacobian3D_et : public _bz_StencilExpr::T_element, 3, 3> > { public: typedef _bz_StencilExpr::T_element, 3, 3> > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, as we are returning a // TinyMatrix. This must be returned as a FastTMCopyIterator since the // output of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr::T_element, 3, 3> > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef Jacobian3D_et< typename T_expr::template tvresult::Type> Type; }; typedef Jacobian3D_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: Jacobian3D_et(const Jacobian3D_et& a) : _bz_StencilExpr(a) { } Jacobian3D_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } Jacobian3D_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return Jacobian3D_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return Jacobian3D_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return Jacobian3D_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = Jacobian3D_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = Jacobian3D_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = Jacobian3D_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef Jacobian3D_et T_slice; }; template Jacobian3D_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return Jacobian3D_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > Jacobian3D(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1,-1), shape(1,1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > Jacobian3D(const Array& d1) { return Jacobian3D(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > Jacobian3D(Array& d1) { return Jacobian3D(d1.wrap()); } /* Defines a stencil ET "Jacobian3Dn" that operates on an array array and returns a multicomponent array >, N_rank>. P_numtype can be a TinyVector or a scalar, I think. */ template class Jacobian3Dn_et : public _bz_StencilExpr::T_element, 3, 3> > { public: typedef _bz_StencilExpr::T_element, 3, 3> > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, as we are returning a // TinyMatrix. This must be returned as a FastTMCopyIterator since the // output of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr::T_element, 3, 3> > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef Jacobian3Dn_et< typename T_expr::template tvresult::Type> Type; }; typedef Jacobian3Dn_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: Jacobian3Dn_et(const Jacobian3Dn_et& a) : _bz_StencilExpr(a) { } Jacobian3Dn_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } Jacobian3Dn_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return Jacobian3Dn_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return Jacobian3Dn_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return Jacobian3Dn_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = Jacobian3Dn_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = Jacobian3Dn_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = Jacobian3Dn_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef Jacobian3Dn_et T_slice; }; template Jacobian3Dn_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return Jacobian3Dn_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > Jacobian3Dn(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1,-1), shape(1,1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > Jacobian3Dn(const Array& d1) { return Jacobian3Dn(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > Jacobian3Dn(Array& d1) { return Jacobian3Dn(d1.wrap()); } /* Defines a stencil ET "Jacobian3D4" that operates on an array array and returns a multicomponent array >, N_rank>. P_numtype can be a TinyVector or a scalar, I think. */ template class Jacobian3D4_et : public _bz_StencilExpr::T_element, 3, 3> > { public: typedef _bz_StencilExpr::T_element, 3, 3> > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, as we are returning a // TinyMatrix. This must be returned as a FastTMCopyIterator since the // output of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr::T_element, 3, 3> > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef Jacobian3D4_et< typename T_expr::template tvresult::Type> Type; }; typedef Jacobian3D4_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: Jacobian3D4_et(const Jacobian3D4_et& a) : _bz_StencilExpr(a) { } Jacobian3D4_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } Jacobian3D4_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return Jacobian3D4_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return Jacobian3D4_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return Jacobian3D4_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = Jacobian3D4_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = Jacobian3D4_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = Jacobian3D4_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef Jacobian3D4_et T_slice; }; template Jacobian3D4_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return Jacobian3D4_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > Jacobian3D4(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2,-2), shape(2,2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > Jacobian3D4(const Array& d1) { return Jacobian3D4(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > Jacobian3D4(Array& d1) { return Jacobian3D4(d1.wrap()); } /* Defines a stencil ET "Jacobian3D4n" that operates on an array array and returns a multicomponent array >, N_rank>. P_numtype can be a TinyVector or a scalar, I think. */ template class Jacobian3D4n_et : public _bz_StencilExpr::T_element, 3, 3> > { public: typedef _bz_StencilExpr::T_element, 3, 3> > T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no return type selection, as we are returning a // TinyMatrix. This must be returned as a FastTMCopyIterator since the // output of the stencil operator is a temporary. typedef ETBase<_bz_ArrayExpr::T_element, 3, 3> > > T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef Jacobian3D4n_et< typename T_expr::template tvresult::Type> Type; }; typedef Jacobian3D4n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: Jacobian3D4n_et(const Jacobian3D4n_et& a) : _bz_StencilExpr(a) { } Jacobian3D4n_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } Jacobian3D4n_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return Jacobian3D4n_stencilop(iter_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return Jacobian3D4n_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return Jacobian3D4n_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = Jacobian3D4n_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = Jacobian3D4n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = Jacobian3D4n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef Jacobian3D4n_et T_slice; }; template Jacobian3D4n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return Jacobian3D4n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > Jacobian3D4n(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2,-2), shape(2,2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > Jacobian3D4n(const Array& d1) { return Jacobian3D4n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > Jacobian3D4n(Array& d1) { return Jacobian3D4n(d1.wrap()); } /** Defines a stencil ET "curl3D" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-1,-1,-1)-shape(1,1,1). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class curl3D_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef curl3D_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef curl3D_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: curl3D_et(const curl3D_et& a) : _bz_StencilExpr(a) { } curl3D_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } curl3D_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return curl3D_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return curl3D_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return curl3D_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = curl3D_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = curl3D_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = curl3D_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "curl3D (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef curl3D_et T_slice; }; template curl3D_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return curl3D_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > curl3D(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1,-1), shape(1,1,1)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl3D(const Array& d1) { return curl3D(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl3D(Array& d1) { return curl3D(d1.wrap()); } /** Defines a stencil ET "curl3Dn" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-1,-1,-1)-shape(1,1,1). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class curl3Dn_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef curl3Dn_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef curl3Dn_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: curl3Dn_et(const curl3Dn_et& a) : _bz_StencilExpr(a) { } curl3Dn_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } curl3Dn_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return curl3Dn_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return curl3Dn_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return curl3Dn_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = curl3Dn_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = curl3Dn_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = curl3Dn_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "curl3Dn (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef curl3Dn_et T_slice; }; template curl3Dn_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return curl3Dn_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > curl3Dn(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1,-1), shape(1,1,1)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl3Dn(const Array& d1) { return curl3Dn(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl3Dn(Array& d1) { return curl3Dn(d1.wrap()); } /** Defines a stencil ET "curl3D4" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-2,-2,-2)-shape(2,2,2). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class curl3D4_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef curl3D4_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef curl3D4_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: curl3D4_et(const curl3D4_et& a) : _bz_StencilExpr(a) { } curl3D4_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } curl3D4_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return curl3D4_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return curl3D4_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return curl3D4_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = curl3D4_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = curl3D4_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = curl3D4_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "curl3D4 (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef curl3D4_et T_slice; }; template curl3D4_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return curl3D4_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > curl3D4(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2,-2), shape(2,2,2)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl3D4(const Array& d1) { return curl3D4(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl3D4(Array& d1) { return curl3D4(d1.wrap()); } /** Defines a stencil ET "curl3D4n" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-2,-2,-2)-shape(2,2,2). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class curl3D4n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef curl3D4n_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef curl3D4n_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: curl3D4n_et(const curl3D4n_et& a) : _bz_StencilExpr(a) { } curl3D4n_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } curl3D4n_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return curl3D4n_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return curl3D4n_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return curl3D4n_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = curl3D4n_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = curl3D4n_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = curl3D4n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "curl3D4n (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef curl3D4n_et T_slice; }; template curl3D4n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return curl3D4n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > curl3D4n(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2,-2), shape(2,2,2)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl3D4n(const Array& d1) { return curl3D4n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl3D4n(Array& d1) { return curl3D4n(d1.wrap()); } /** Defines a stencil ET "curl2D" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-1,-1)-shape(1,1). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class curl2D_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef curl2D_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef curl2D_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: curl2D_et(const curl2D_et& a) : _bz_StencilExpr(a) { } curl2D_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } curl2D_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return curl2D_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return curl2D_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return curl2D_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = curl2D_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = curl2D_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = curl2D_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "curl2D (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef curl2D_et T_slice; }; template curl2D_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return curl2D_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > curl2D(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1), shape(1,1)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl2D(const Array& d1) { return curl2D(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl2D(Array& d1) { return curl2D(d1.wrap()); } /** Defines a stencil ET "curl2Dn" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-1,-1)-shape(1,1). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class curl2Dn_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef curl2Dn_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef curl2Dn_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: curl2Dn_et(const curl2Dn_et& a) : _bz_StencilExpr(a) { } curl2Dn_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } curl2Dn_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return curl2Dn_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return curl2Dn_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return curl2Dn_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = curl2Dn_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = curl2Dn_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = curl2Dn_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "curl2Dn (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef curl2Dn_et T_slice; }; template curl2Dn_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return curl2Dn_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > curl2Dn(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1), shape(1,1)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl2Dn(const Array& d1) { return curl2Dn(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl2Dn(Array& d1) { return curl2Dn(d1.wrap()); } /** Defines a stencil ET "curl2D4" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-2,-2)-shape(2,2). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class curl2D4_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef curl2D4_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef curl2D4_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: curl2D4_et(const curl2D4_et& a) : _bz_StencilExpr(a) { } curl2D4_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } curl2D4_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return curl2D4_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return curl2D4_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return curl2D4_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = curl2D4_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = curl2D4_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = curl2D4_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "curl2D4 (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef curl2D4_et T_slice; }; template curl2D4_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return curl2D4_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > curl2D4(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl2D4(const Array& d1) { return curl2D4(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl2D4(Array& d1) { return curl2D4(d1.wrap()); } /** Defines a stencil ET "curl2D4n" that operates on an Array and specifies the return type as Array. The result type is used when running on an array and the etresult type when running on an expression. The extent of the stencil is shape(-2,-2)-shape(2,2). If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. The stencil ET calls the stencil operator name_stencilop, defined in stencilops.h. **/ template class curl2D4n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef curl2D4n_et< typename T_expr::template tvresult::Type, T_numtype> Type; }; typedef curl2D4n_et<_bz_typename P_expr::T_range_result, T_numtype> T_range_result; using T_base::iter_; using T_base::rank_; public: curl2D4n_et(const curl2D4n_et& a) : _bz_StencilExpr(a) { } curl2D4n_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } curl2D4n_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_result operator*() const { return curl2D4n_stencilop(iter_); } /* this is not really const, because we don't undo the moveTo, but that should not be visible to outside. It would be if we used some kind of mixed index and stack traversal, but that will screw things up, const or not. */ template T_result operator()(const TinyVector& i) const { iter_.moveTo(i); return curl2D4n_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_result operator[](int i) const { return curl2D4n_stencilop(iter_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_result r = curl2D4n_stencilop(iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_result shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_result r = curl2D4n_stencilop(iter_); iter_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = curl2D4n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "curl2D4n (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef curl2D4n_et T_slice; }; template curl2D4n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { /* because stencils work inherently in several dimensions it's complicated to slice the domain. slices will be changed to unit ranges instead. slicing stencil result thus *never* changes the rank of the expression, unlike the normal case. */ return curl2D4n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* generate an ET object from an expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > curl2D4n(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* redirect calls with bare arrays to the main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl2D4n(const Array& d1) { return curl2D4n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, T> > curl2D4n(Array& d1) { return curl2D4n(d1.wrap()); } /** Defines a stencil ET "div2D" that operates on a multicomponent array and returns a scalar array. */ template class div2D_et : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // scalar T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef div2D_et< typename T_expr::template tvresult::Type> Type; }; typedef div2D_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: div2D_et(const div2D_et& a) : _bz_StencilExpr(a) { } div2D_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } div2D_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_numtype operator*() const { return div2D_stencilop(iter_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return div2D_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_numtype operator[](int i) const { return div2D_stencilop(iter_[i]); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = div2D_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = div2D_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = div2D_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef div2D_et T_slice; }; template div2D_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return div2D_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > div2D(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1), shape(1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > div2D(const Array& d1) { return div2D(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > div2D(Array& d1) { return div2D(d1.wrap()); } /** Defines a stencil ET "div2Dn" that operates on a multicomponent array and returns a scalar array. */ template class div2Dn_et : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // scalar T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef div2Dn_et< typename T_expr::template tvresult::Type> Type; }; typedef div2Dn_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: div2Dn_et(const div2Dn_et& a) : _bz_StencilExpr(a) { } div2Dn_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } div2Dn_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_numtype operator*() const { return div2Dn_stencilop(iter_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return div2Dn_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_numtype operator[](int i) const { return div2Dn_stencilop(iter_[i]); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = div2Dn_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = div2Dn_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = div2Dn_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef div2Dn_et T_slice; }; template div2Dn_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return div2Dn_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > div2Dn(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1), shape(1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > div2Dn(const Array& d1) { return div2Dn(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > div2Dn(Array& d1) { return div2Dn(d1.wrap()); } /** Defines a stencil ET "div2D4" that operates on a multicomponent array and returns a scalar array. */ template class div2D4_et : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // scalar T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef div2D4_et< typename T_expr::template tvresult::Type> Type; }; typedef div2D4_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: div2D4_et(const div2D4_et& a) : _bz_StencilExpr(a) { } div2D4_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } div2D4_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_numtype operator*() const { return div2D4_stencilop(iter_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return div2D4_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_numtype operator[](int i) const { return div2D4_stencilop(iter_[i]); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = div2D4_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = div2D4_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = div2D4_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef div2D4_et T_slice; }; template div2D4_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return div2D4_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > div2D4(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > div2D4(const Array& d1) { return div2D4(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > div2D4(Array& d1) { return div2D4(d1.wrap()); } /** Defines a stencil ET "div2D4n" that operates on a multicomponent array and returns a scalar array. */ template class div2D4n_et : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // scalar T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef div2D4n_et< typename T_expr::template tvresult::Type> Type; }; typedef div2D4n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: div2D4n_et(const div2D4n_et& a) : _bz_StencilExpr(a) { } div2D4n_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } div2D4n_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_numtype operator*() const { return div2D4n_stencilop(iter_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return div2D4n_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_numtype operator[](int i) const { return div2D4n_stencilop(iter_[i]); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = div2D4n_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = div2D4n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = div2D4n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef div2D4n_et T_slice; }; template div2D4n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return div2D4n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > div2D4n(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > div2D4n(const Array& d1) { return div2D4n(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > div2D4n(Array& d1) { return div2D4n(d1.wrap()); } /** Defines a stencil ET "div3D" that operates on a multicomponent array and returns a scalar array. */ template class div3D_et : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // scalar T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef div3D_et< typename T_expr::template tvresult::Type> Type; }; typedef div3D_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: div3D_et(const div3D_et& a) : _bz_StencilExpr(a) { } div3D_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } div3D_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_numtype operator*() const { return div3D_stencilop(iter_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return div3D_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_numtype operator[](int i) const { return div3D_stencilop(iter_[i]); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = div3D_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = div3D_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = div3D_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef div3D_et T_slice; }; template div3D_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return div3D_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > div3D(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1,-1), shape(1,1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > div3D(const Array& d1) { return div3D(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > div3D(Array& d1) { return div3D(d1.wrap()); } /** Defines a stencil ET "div3Dn" that operates on a multicomponent array and returns a scalar array. */ template class div3Dn_et : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // scalar T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef div3Dn_et< typename T_expr::template tvresult::Type> Type; }; typedef div3Dn_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: div3Dn_et(const div3Dn_et& a) : _bz_StencilExpr(a) { } div3Dn_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } div3Dn_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_numtype operator*() const { return div3Dn_stencilop(iter_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return div3Dn_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_numtype operator[](int i) const { return div3Dn_stencilop(iter_[i]); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = div3Dn_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = div3Dn_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = div3Dn_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef div3Dn_et T_slice; }; template div3Dn_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return div3Dn_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > div3Dn(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1,-1), shape(1,1,1)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > div3Dn(const Array& d1) { return div3Dn(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > div3Dn(Array& d1) { return div3Dn(d1.wrap()); } /** Defines a stencil ET "div3D4" that operates on a multicomponent array and returns a scalar array. */ template class div3D4_et : public _bz_StencilExpr::T_element> { public: typedef _bz_typename multicomponent_traits::T_element T_result; typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // there is no selecting return type here. because we *know* it is // scalar T_result, there's no question of whether we could be doing // multicomponent evaluations. typedef T_result T_typeprop; typedef T_numtype T_optype; template struct tvresult { typedef div3D4_et< typename T_expr::template tvresult::Type> Type; }; typedef div3D4_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: div3D4_et(const div3D4_et& a) : _bz_StencilExpr(a) { } div3D4_et(BZ_ETPARM(T_expr) a) : _bz_StencilExpr(a) { } div3D4_et(_bz_typename T_expr::T_ctorArg1 a) : _bz_StencilExpr(a) { } T_numtype operator*() const { return div3D4_stencilop(iter_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return div3D4_stencilop(iter_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d)); } T_numtype operator[](int i) const { return div3D4_stencilop(iter_[i]); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = div3D4_stencilop (iter_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return iter_.fastRead_tv(i); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = div3D4_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = div3D4_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef div3D4_et T_slice; }; template div3D4_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return div3D4_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > div3D4(const BZ_BLITZ_SCOPE(ETBase)& d1) { return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2,-2), shape(2,2,2)))); } /* Explicit operators for arrays for stencil name. */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > div3D4(const Array& d1) { return div3D4(d1.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > div3D4(Array& d1) { return div3D4(d1.wrap()); } /** Defines a stencil "div" ET that operates on two arrays of arbitrary type and specifies the return type as array. The result type is used when running on an array and the etresult type when running on an expression. If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. */ template class div_et2 : public _bz_StencilExpr2 { public: typedef _bz_StencilExpr2 T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr1 T_expr1; typedef _bz_typename T_base::T_expr2 T_expr2; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; /// dummy template struct tvresult { typedef div_et2< typename T_expr1::template tvresult::Type, typename T_expr2::template tvresult::Type, T_numtype> Type; }; typedef div_et2<_bz_typename P_expr1::T_range_result, _bz_typename P_expr2::T_range_result, T_numtype> T_range_result; using T_base::iter1_; using T_base::iter2_; using T_base::rank_; public: div_et2(const div_et2& a) : _bz_StencilExpr2(a) { } div_et2(BZ_ETPARM(T_expr1) a, BZ_ETPARM(T_expr2) b) : _bz_StencilExpr2(a, b) { } T_result operator*() const { return div_stencilop(iter1_, iter2_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter1_.moveTo(i); iter2_.moveTo(i); return div_stencilop(iter1_, iter2_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter1_(d), iter2_(d)); } T_result operator[](int i) const { return div_stencilop(iter1_[i], iter2_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter1_._bz_offsetData(i); iter2_._bz_offsetData(i); T_result r = div_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-i); iter2_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter1_.fastRead_tv(i), iter2_.fastRead_tv(i)); } T_result shift(int offset, int dim) const { iter1_._bz_offsetData(offset, dim); iter2_._bz_offsetData(offset, dim); T_result r = div_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-offset, dim); iter2_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter1_._bz_offsetData(offset1, dim1, offset2, dim2); iter2_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = div_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-offset1, dim1, -offset2, dim2); iter2_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter1_.prettyPrint(str, format); str += ", "; iter2_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef div_et2 T_slice; }; template div_et2 operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return div_et2 (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET object from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, BZ_PROMOTE(typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype)> > div(const BZ_BLITZ_SCOPE(ETBase)& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, BZ_PROMOTE(typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype)> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1), shape(1,1))), BZ_BLITZ_SCOPE(asExpr)::getExpr(d2.unwrap())(_bz_shrinkDomain(d2.unwrap().domain(),shape(-1,-1), shape(1,1)))); } /* matches to calls involving bare arrays (this is very annoying because we have to exactly match every possible call combination to ensure that this matches instead of the operator in stencilops.h) */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div(const BZ_BLITZ_SCOPE(ETBase)& d1, Array& d2) { return div(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div(const BZ_BLITZ_SCOPE(ETBase)& d1, const Array& d2) { return div(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, double> > div(Array& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return div(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, double> > div(const Array& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return div(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div(const Array& d1, Array& d2) { return div(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div(Array& d1, const Array& d2) { return div(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div(Array& d1, Array& d2) { return div(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div(const Array& d1, const Array& d2) { return div(d1.wrap(), d2.wrap()); } /** Defines a stencil "divn" ET that operates on two arrays of arbitrary type and specifies the return type as array. The result type is used when running on an array and the etresult type when running on an expression. If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. */ template class divn_et2 : public _bz_StencilExpr2 { public: typedef _bz_StencilExpr2 T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr1 T_expr1; typedef _bz_typename T_base::T_expr2 T_expr2; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; /// dummy template struct tvresult { typedef divn_et2< typename T_expr1::template tvresult::Type, typename T_expr2::template tvresult::Type, T_numtype> Type; }; typedef divn_et2<_bz_typename P_expr1::T_range_result, _bz_typename P_expr2::T_range_result, T_numtype> T_range_result; using T_base::iter1_; using T_base::iter2_; using T_base::rank_; public: divn_et2(const divn_et2& a) : _bz_StencilExpr2(a) { } divn_et2(BZ_ETPARM(T_expr1) a, BZ_ETPARM(T_expr2) b) : _bz_StencilExpr2(a, b) { } T_result operator*() const { return divn_stencilop(iter1_, iter2_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter1_.moveTo(i); iter2_.moveTo(i); return divn_stencilop(iter1_, iter2_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter1_(d), iter2_(d)); } T_result operator[](int i) const { return divn_stencilop(iter1_[i], iter2_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter1_._bz_offsetData(i); iter2_._bz_offsetData(i); T_result r = divn_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-i); iter2_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter1_.fastRead_tv(i), iter2_.fastRead_tv(i)); } T_result shift(int offset, int dim) const { iter1_._bz_offsetData(offset, dim); iter2_._bz_offsetData(offset, dim); T_result r = divn_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-offset, dim); iter2_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter1_._bz_offsetData(offset1, dim1, offset2, dim2); iter2_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = divn_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-offset1, dim1, -offset2, dim2); iter2_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter1_.prettyPrint(str, format); str += ", "; iter2_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef divn_et2 T_slice; }; template divn_et2 operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return divn_et2 (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET object from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, BZ_PROMOTE(typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype)> > divn(const BZ_BLITZ_SCOPE(ETBase)& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, BZ_PROMOTE(typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype)> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-1,-1), shape(1,1))), BZ_BLITZ_SCOPE(asExpr)::getExpr(d2.unwrap())(_bz_shrinkDomain(d2.unwrap().domain(),shape(-1,-1), shape(1,1)))); } /* matches to calls involving bare arrays (this is very annoying because we have to exactly match every possible call combination to ensure that this matches instead of the operator in stencilops.h) */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > divn(const BZ_BLITZ_SCOPE(ETBase)& d1, Array& d2) { return divn(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > divn(const BZ_BLITZ_SCOPE(ETBase)& d1, const Array& d2) { return divn(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, double> > divn(Array& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return divn(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, double> > divn(const Array& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return divn(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > divn(const Array& d1, Array& d2) { return divn(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > divn(Array& d1, const Array& d2) { return divn(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > divn(Array& d1, Array& d2) { return divn(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > divn(const Array& d1, const Array& d2) { return divn(d1.wrap(), d2.wrap()); } /** Defines a stencil "div4" ET that operates on two arrays of arbitrary type and specifies the return type as array. The result type is used when running on an array and the etresult type when running on an expression. If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. */ template class div4_et2 : public _bz_StencilExpr2 { public: typedef _bz_StencilExpr2 T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr1 T_expr1; typedef _bz_typename T_base::T_expr2 T_expr2; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; /// dummy template struct tvresult { typedef div4_et2< typename T_expr1::template tvresult::Type, typename T_expr2::template tvresult::Type, T_numtype> Type; }; typedef div4_et2<_bz_typename P_expr1::T_range_result, _bz_typename P_expr2::T_range_result, T_numtype> T_range_result; using T_base::iter1_; using T_base::iter2_; using T_base::rank_; public: div4_et2(const div4_et2& a) : _bz_StencilExpr2(a) { } div4_et2(BZ_ETPARM(T_expr1) a, BZ_ETPARM(T_expr2) b) : _bz_StencilExpr2(a, b) { } T_result operator*() const { return div4_stencilop(iter1_, iter2_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter1_.moveTo(i); iter2_.moveTo(i); return div4_stencilop(iter1_, iter2_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter1_(d), iter2_(d)); } T_result operator[](int i) const { return div4_stencilop(iter1_[i], iter2_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter1_._bz_offsetData(i); iter2_._bz_offsetData(i); T_result r = div4_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-i); iter2_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter1_.fastRead_tv(i), iter2_.fastRead_tv(i)); } T_result shift(int offset, int dim) const { iter1_._bz_offsetData(offset, dim); iter2_._bz_offsetData(offset, dim); T_result r = div4_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-offset, dim); iter2_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter1_._bz_offsetData(offset1, dim1, offset2, dim2); iter2_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = div4_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-offset1, dim1, -offset2, dim2); iter2_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter1_.prettyPrint(str, format); str += ", "; iter2_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef div4_et2 T_slice; }; template div4_et2 operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return div4_et2 (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET object from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, BZ_PROMOTE(typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype)> > div4(const BZ_BLITZ_SCOPE(ETBase)& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, BZ_PROMOTE(typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype)> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2))), BZ_BLITZ_SCOPE(asExpr)::getExpr(d2.unwrap())(_bz_shrinkDomain(d2.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* matches to calls involving bare arrays (this is very annoying because we have to exactly match every possible call combination to ensure that this matches instead of the operator in stencilops.h) */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4(const BZ_BLITZ_SCOPE(ETBase)& d1, Array& d2) { return div4(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4(const BZ_BLITZ_SCOPE(ETBase)& d1, const Array& d2) { return div4(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, double> > div4(Array& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return div4(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, double> > div4(const Array& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return div4(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4(const Array& d1, Array& d2) { return div4(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4(Array& d1, const Array& d2) { return div4(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4(Array& d1, Array& d2) { return div4(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4(const Array& d1, const Array& d2) { return div4(d1.wrap(), d2.wrap()); } /** Defines a stencil "div4n" ET that operates on two arrays of arbitrary type and specifies the return type as array. The result type is used when running on an array and the etresult type when running on an expression. If you want to refer to the native type of the expression, set result="P_numtype" and etresult="typename T1::T_numtype". Sorry for that ugliness, but they define types differently. */ template class div4n_et2 : public _bz_StencilExpr2 { public: typedef _bz_StencilExpr2 T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr1 T_expr1; typedef _bz_typename T_base::T_expr2 T_expr2; // if P_numtype is an ET-type, we need to return an expr typedef typename selectET > > >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; /// dummy template struct tvresult { typedef div4n_et2< typename T_expr1::template tvresult::Type, typename T_expr2::template tvresult::Type, T_numtype> Type; }; typedef div4n_et2<_bz_typename P_expr1::T_range_result, _bz_typename P_expr2::T_range_result, T_numtype> T_range_result; using T_base::iter1_; using T_base::iter2_; using T_base::rank_; public: div4n_et2(const div4n_et2& a) : _bz_StencilExpr2(a) { } div4n_et2(BZ_ETPARM(T_expr1) a, BZ_ETPARM(T_expr2) b) : _bz_StencilExpr2(a, b) { } T_result operator*() const { return div4n_stencilop(iter1_, iter2_); } T_result operator()(_bz_typename _bz_IndexParameter >::type i) const { iter1_.moveTo(i); iter2_.moveTo(i); return div4n_stencilop(iter1_, iter2_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter1_(d), iter2_(d)); } T_result operator[](int i) const { return div4n_stencilop(iter1_[i], iter2_[i]); } T_result fastRead(diffType i) const {/* this probably isn't very fast... */ iter1_._bz_offsetData(i); iter2_._bz_offsetData(i); T_result r = div4n_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-i); iter2_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter1_.fastRead_tv(i), iter2_.fastRead_tv(i)); } T_result shift(int offset, int dim) const { iter1_._bz_offsetData(offset, dim); iter2_._bz_offsetData(offset, dim); T_result r = div4n_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-offset, dim); iter2_._bz_offsetData(-offset, dim); return r; } T_result shift(int offset1, int dim1, int offset2, int dim2) const { iter1_._bz_offsetData(offset1, dim1, offset2, dim2); iter2_._bz_offsetData(offset1, dim1, offset2, dim2); T_result r = div4n_stencilop (iter1_, iter2_); iter1_._bz_offsetData(-offset1, dim1, -offset2, dim2); iter2_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter1_.prettyPrint(str, format); str += ", "; iter2_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef div4n_et2 T_slice; }; template div4n_et2 operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return div4n_et2 (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11))); } }; /* create ET object from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, BZ_PROMOTE(typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype)> > div4n(const BZ_BLITZ_SCOPE(ETBase)& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, BZ_PROMOTE(typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_numtype)> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),shape(-2,-2), shape(2,2))), BZ_BLITZ_SCOPE(asExpr)::getExpr(d2.unwrap())(_bz_shrinkDomain(d2.unwrap().domain(),shape(-2,-2), shape(2,2)))); } /* matches to calls involving bare arrays (this is very annoying because we have to exactly match every possible call combination to ensure that this matches instead of the operator in stencilops.h) */ template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4n(const BZ_BLITZ_SCOPE(ETBase)& d1, Array& d2) { return div4n(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4n(const BZ_BLITZ_SCOPE(ETBase)& d1, const Array& d2) { return div4n(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, double> > div4n(Array& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return div4n(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr)::T_expr::T_range_result, double> > div4n(const Array& d1, const BZ_BLITZ_SCOPE(ETBase)& d2) { return div4n(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4n(const Array& d1, Array& d2) { return div4n(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4n(Array& d1, const Array& d2) { return div4n(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4n(Array& d1, Array& d2) { return div4n(d1.wrap(), d2.wrap()); } template inline _bz_ArrayExpr >::T_expr::T_range_result, typename BZ_BLITZ_SCOPE(asExpr) >::T_expr::T_range_result, double> > div4n(const Array& d1, const Array& d2) { return div4n(d1.wrap(), d2.wrap()); } /** Defines a stencil ET double-difference operator "mixed22" that operates on an array and returns an array of identical type. (The only significance of the "double-difference" aspect is that the operator is assumed to take two extra arguments which are the dimensions to do the differences in). */ template class mixed22_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef mixed22_et< typename T_expr::template tvresult::Type> Type; }; typedef mixed22_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: mixed22_et(const mixed22_et& a) : _bz_StencilExpr(a), dim1_(a.dim1_), dim2_(a.dim2_) { } mixed22_et(BZ_ETPARM(T_expr) a, int dim1, int dim2) : _bz_StencilExpr(a), dim1_(dim1), dim2_(dim2) { } mixed22_et(_bz_typename T_expr::T_ctorArg1 a, int dim1, int dim2) : _bz_StencilExpr(a), dim1_(dim1), dim2_(dim2) { } T_numtype operator*() const { return mixed22_stencilop(iter_, dim1_, dim2_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return mixed22_stencilop(iter_, dim1_, dim2_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim1_, dim2_); } T_numtype operator[](int i) const { return mixed22_stencilop(iter_[i], dim1_, dim2_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = mixed22_stencilop (iter_, dim1_, dim2_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim1_,dim2_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = mixed22_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = mixed22_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef mixed22_et T_slice; }; template mixed22_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return mixed22_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)), dim1_, dim2_); } private: int dim1_, dim2_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > mixed22(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim1, int dim2) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim1]=-1; maxb[dim1]=1; minb[dim2]=-1; maxb[dim2]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim1, dim2); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > mixed22(const Array& d1, int dim1, int dim2) { return mixed22(d1.wrap(), dim1, dim2); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > mixed22(Array& d1, int dim1, int dim2) { return mixed22(d1.wrap(), dim1, dim2); } /** Defines a stencil ET double-difference operator "mixed22n" that operates on an array and returns an array of identical type. (The only significance of the "double-difference" aspect is that the operator is assumed to take two extra arguments which are the dimensions to do the differences in). */ template class mixed22n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef mixed22n_et< typename T_expr::template tvresult::Type> Type; }; typedef mixed22n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: mixed22n_et(const mixed22n_et& a) : _bz_StencilExpr(a), dim1_(a.dim1_), dim2_(a.dim2_) { } mixed22n_et(BZ_ETPARM(T_expr) a, int dim1, int dim2) : _bz_StencilExpr(a), dim1_(dim1), dim2_(dim2) { } mixed22n_et(_bz_typename T_expr::T_ctorArg1 a, int dim1, int dim2) : _bz_StencilExpr(a), dim1_(dim1), dim2_(dim2) { } T_numtype operator*() const { return mixed22n_stencilop(iter_, dim1_, dim2_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return mixed22n_stencilop(iter_, dim1_, dim2_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim1_, dim2_); } T_numtype operator[](int i) const { return mixed22n_stencilop(iter_[i], dim1_, dim2_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = mixed22n_stencilop (iter_, dim1_, dim2_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim1_,dim2_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = mixed22n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = mixed22n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef mixed22n_et T_slice; }; template mixed22n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return mixed22n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)), dim1_, dim2_); } private: int dim1_, dim2_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > mixed22n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim1, int dim2) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim1]=-1; maxb[dim1]=1; minb[dim2]=-1; maxb[dim2]=1; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim1, dim2); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > mixed22n(const Array& d1, int dim1, int dim2) { return mixed22n(d1.wrap(), dim1, dim2); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > mixed22n(Array& d1, int dim1, int dim2) { return mixed22n(d1.wrap(), dim1, dim2); } /** Defines a stencil ET double-difference operator "mixed24" that operates on an array and returns an array of identical type. (The only significance of the "double-difference" aspect is that the operator is assumed to take two extra arguments which are the dimensions to do the differences in). */ template class mixed24_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef mixed24_et< typename T_expr::template tvresult::Type> Type; }; typedef mixed24_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: mixed24_et(const mixed24_et& a) : _bz_StencilExpr(a), dim1_(a.dim1_), dim2_(a.dim2_) { } mixed24_et(BZ_ETPARM(T_expr) a, int dim1, int dim2) : _bz_StencilExpr(a), dim1_(dim1), dim2_(dim2) { } mixed24_et(_bz_typename T_expr::T_ctorArg1 a, int dim1, int dim2) : _bz_StencilExpr(a), dim1_(dim1), dim2_(dim2) { } T_numtype operator*() const { return mixed24_stencilop(iter_, dim1_, dim2_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return mixed24_stencilop(iter_, dim1_, dim2_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim1_, dim2_); } T_numtype operator[](int i) const { return mixed24_stencilop(iter_[i], dim1_, dim2_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = mixed24_stencilop (iter_, dim1_, dim2_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim1_,dim2_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = mixed24_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = mixed24_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef mixed24_et T_slice; }; template mixed24_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return mixed24_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)), dim1_, dim2_); } private: int dim1_, dim2_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > mixed24(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim1, int dim2) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim1]=-2; maxb[dim1]=2; minb[dim2]=-2; maxb[dim2]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim1, dim2); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > mixed24(const Array& d1, int dim1, int dim2) { return mixed24(d1.wrap(), dim1, dim2); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > mixed24(Array& d1, int dim1, int dim2) { return mixed24(d1.wrap(), dim1, dim2); } /** Defines a stencil ET double-difference operator "mixed24n" that operates on an array and returns an array of identical type. (The only significance of the "double-difference" aspect is that the operator is assumed to take two extra arguments which are the dimensions to do the differences in). */ template class mixed24n_et : public _bz_StencilExpr { public: typedef _bz_StencilExpr T_base; typedef _bz_typename T_base::T_numtype T_numtype; typedef _bz_typename T_base::T_expr T_expr; // select return type typedef typename unwrapET::T_unwrapped test; typedef typename selectET >::T_selected T_typeprop; typedef typename unwrapET::T_unwrapped T_result; typedef T_numtype T_optype; template struct tvresult { typedef mixed24n_et< typename T_expr::template tvresult::Type> Type; }; typedef mixed24n_et<_bz_typename P_expr::T_range_result> T_range_result; using T_base::iter_; using T_base::rank_; public: mixed24n_et(const mixed24n_et& a) : _bz_StencilExpr(a), dim1_(a.dim1_), dim2_(a.dim2_) { } mixed24n_et(BZ_ETPARM(T_expr) a, int dim1, int dim2) : _bz_StencilExpr(a), dim1_(dim1), dim2_(dim2) { } mixed24n_et(_bz_typename T_expr::T_ctorArg1 a, int dim1, int dim2) : _bz_StencilExpr(a), dim1_(dim1), dim2_(dim2) { } T_numtype operator*() const { return mixed24n_stencilop(iter_, dim1_, dim2_); } T_numtype operator()(_bz_typename _bz_IndexParameter >::type i) const { iter_.moveTo(i); return mixed24n_stencilop(iter_, dim1_, dim2_); } T_range_result operator()(const RectDomain& d) const { return T_range_result(iter_(d), dim1_, dim2_); } T_numtype operator[](int i) const { return mixed24n_stencilop(iter_[i], dim1_, dim2_); } T_numtype fastRead(diffType i) const {/* this probably isn't very fast... */ iter_._bz_offsetData(i); T_numtype r = mixed24n_stencilop (iter_, dim1_, dim2_); iter_._bz_offsetData(-i); return r; } /** This way of vectorizing won't work on stencils. */ template typename tvresult::Type fastRead_tv(diffType i) const { BZPRECHECK(0, "Can't vectorize stencils"); return typename tvresult::Type(iter_.fastRead_tv(i),dim1_,dim2_); } T_numtype shift(int offset, int dim) const { iter_._bz_offsetData(offset, dim); T_numtype r = mixed24n_stencilop (iter_); iter_._bz_offsetData(-offset, dim); return r; } T_numtype shift(int offset1, int dim1, int offset2, int dim2) const { iter_._bz_offsetData(offset1, dim1, offset2, dim2); T_numtype r = mixed24n_stencilop (iter_); iter_._bz_offsetData(-offset1, dim1, -offset2, dim2); return r; } void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format) const { str += "name (stencil)"; str += "("; iter_.prettyPrint(str, format); str += ")"; } template class SliceInfo { public: typedef mixed24n_et T_slice; }; template mixed24n_et operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const { return mixed24n_et (iter_(_bz_makeRange(r1), _bz_makeRange(r2), _bz_makeRange(r3), _bz_makeRange(r4), _bz_makeRange(r5), _bz_makeRange(r6), _bz_makeRange(r7), _bz_makeRange(r8), _bz_makeRange(r9), _bz_makeRange(r10), _bz_makeRange(r11)), dim1_, dim2_); } private: int dim1_, dim2_; }; /* create ET from application to expression */ template inline _bz_ArrayExpr::T_expr::T_range_result> > mixed24n(const BZ_BLITZ_SCOPE(ETBase)& d1, int dim1, int dim2) { TinyVector::T_expr::rank_> minb(0), maxb(0); minb[dim1]=-2; maxb[dim1]=2; minb[dim2]=-2; maxb[dim2]=2; return _bz_ArrayExpr::T_expr::T_range_result> > (BZ_BLITZ_SCOPE(asExpr)::getExpr(d1.unwrap())(_bz_shrinkDomain(d1.unwrap().domain(),minb, maxb)), dim1, dim2); } /* forward operations on arrays to main function */ template inline _bz_ArrayExpr >::T_expr::T_range_result> > mixed24n(const Array& d1, int dim1, int dim2) { return mixed24n(d1.wrap(), dim1, dim2); } template inline _bz_ArrayExpr >::T_expr::T_range_result> > mixed24n(Array& d1, int dim1, int dim2) { return mixed24n(d1.wrap(), dim1, dim2); } BZ_NAMESPACE_END