| [658] | 1 | /***************************************************************************
 | 
|---|
 | 2 |  * blitz/array/map.h      Declaration of the ArrayIndexMapping class
 | 
|---|
 | 3 |  *
 | 
|---|
 | 4 |  * $Id: map.h,v 1.1.1.1 1999-11-26 16:37:07 ansari Exp $
 | 
|---|
 | 5 |  *
 | 
|---|
 | 6 |  * Copyright (C) 1997,1998 Todd Veldhuizen <tveldhui@seurat.uwaterloo.ca>
 | 
|---|
 | 7 |  *
 | 
|---|
 | 8 |  * This program is free software; you can redistribute it and/or
 | 
|---|
 | 9 |  * modify it under the terms of the GNU General Public License
 | 
|---|
 | 10 |  * as published by the Free Software Foundation; either version 2
 | 
|---|
 | 11 |  * of the License, or (at your option) any later version.
 | 
|---|
 | 12 |  *
 | 
|---|
 | 13 |  * This program is distributed in the hope that it will be useful,
 | 
|---|
 | 14 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
 | 15 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
 | 16 |  * GNU General Public License for more details.
 | 
|---|
 | 17 |  *
 | 
|---|
 | 18 |  * Suggestions:          blitz-suggest@cybervision.com
 | 
|---|
 | 19 |  * Bugs:                 blitz-bugs@cybervision.com
 | 
|---|
 | 20 |  *
 | 
|---|
 | 21 |  * For more information, please see the Blitz++ Home Page:
 | 
|---|
 | 22 |  *    http://seurat.uwaterloo.ca/blitz/
 | 
|---|
 | 23 |  *
 | 
|---|
 | 24 |  ***************************************************************************
 | 
|---|
 | 25 |  * $Log: not supported by cvs2svn $
 | 
|---|
 | 26 |  * Revision 1.1.1.1  1999/04/09  17:59:03  ansari
 | 
|---|
 | 27 |  * Creation module DPC/Blitz (blitz 0.4) Reza 09/04/99
 | 
|---|
 | 28 |  *
 | 
|---|
 | 29 |  * Revision 1.2  1998/03/14 00:04:47  tveldhui
 | 
|---|
 | 30 |  * 0.2-alpha-05
 | 
|---|
 | 31 |  *
 | 
|---|
 | 32 |  * Revision 1.1  1997/07/16 14:51:20  tveldhui
 | 
|---|
 | 33 |  * Update: Alpha release 0.2 (Arrays)
 | 
|---|
 | 34 |  *
 | 
|---|
 | 35 |  */
 | 
|---|
 | 36 | 
 | 
|---|
 | 37 | /*
 | 
|---|
 | 38 |  * ArrayIndexMapping is used to implement tensor array notation.  For
 | 
|---|
 | 39 |  * example:
 | 
|---|
 | 40 |  *
 | 
|---|
 | 41 |  * Array<float, 2> A, B;
 | 
|---|
 | 42 |  * firstIndex i;
 | 
|---|
 | 43 |  * secondIndex j;
 | 
|---|
 | 44 |  * thirdIndex k;
 | 
|---|
 | 45 |  * Array<float, 3> C = A(i,j) * B(j,k);
 | 
|---|
 | 46 |  *
 | 
|---|
 | 47 |  * For expression templates purposes, something like B(j,k) is represented
 | 
|---|
 | 48 |  * by an instance of class ArrayIndexMapping.  This class maps an array onto
 | 
|---|
 | 49 |  * the destination array coordinate system, e.g. B(j,k) -> C(i,j,k)
 | 
|---|
 | 50 |  */
 | 
|---|
 | 51 | 
 | 
|---|
 | 52 | #ifndef BZ_ARRAYMAP_H
 | 
|---|
 | 53 | #define BZ_ARRAYMAP_H
 | 
|---|
 | 54 | 
 | 
|---|
 | 55 | #ifndef BZ_ARRAY_H
 | 
|---|
 | 56 |  #error <blitz/array/map.h> must be included via <blitz/array.h>
 | 
|---|
 | 57 | #endif
 | 
|---|
 | 58 | 
 | 
|---|
 | 59 | BZ_NAMESPACE(blitz)
 | 
|---|
 | 60 | 
 | 
|---|
 | 61 | /*
 | 
|---|
 | 62 |  * _bz_doArrayIndexMapping is a helper class.  It is specialized for
 | 
|---|
 | 63 |  * ranks 1, 2, 3, ..., 11.
 | 
|---|
 | 64 |  */
 | 
|---|
 | 65 | 
 | 
|---|
 | 66 | template<int N_rank>
 | 
|---|
 | 67 | struct _bz_doArrayIndexMapping {
 | 
|---|
 | 68 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 69 |     static T_numtype map(const Array<T_numtype, N_rank>&, 
 | 
|---|
 | 70 |         const TinyVector<int,N_destRank>&, int, int, int, int, int, int,
 | 
|---|
 | 71 |         int, int, int, int, int)
 | 
|---|
 | 72 |     {
 | 
|---|
 | 73 |         // If you try to use an array index mapping on an array with
 | 
|---|
 | 74 |         // rank greater than 11, then you'll get a precondition failure
 | 
|---|
 | 75 |         // here.
 | 
|---|
 | 76 |         BZPRECONDITION(0);
 | 
|---|
 | 77 |     }
 | 
|---|
 | 78 | };
 | 
|---|
 | 79 | 
 | 
|---|
 | 80 | template<>
 | 
|---|
 | 81 | struct _bz_doArrayIndexMapping<1> {
 | 
|---|
 | 82 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 83 |     static T_numtype map(const Array<T_numtype, 1>& array,
 | 
|---|
 | 84 |         const TinyVector<int,N_destRank>& index, int i0, int, int, int, int, 
 | 
|---|
 | 85 |         int, int, int, int, int, int)
 | 
|---|
 | 86 |     {
 | 
|---|
 | 87 |         return array(index[i0]);
 | 
|---|
 | 88 |     }
 | 
|---|
 | 89 | };
 | 
|---|
 | 90 | 
 | 
|---|
 | 91 | 
 | 
|---|
 | 92 | template<>
 | 
|---|
 | 93 | struct _bz_doArrayIndexMapping<2> {
 | 
|---|
 | 94 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 95 |     static T_numtype map(const Array<T_numtype, 2>& array,
 | 
|---|
 | 96 |         const TinyVector<int,N_destRank>& index, int i0, int i1, int, 
 | 
|---|
 | 97 |         int, int, int, int, int, int, int, int)
 | 
|---|
 | 98 |     {
 | 
|---|
 | 99 |         return array(index[i0], index[i1]);
 | 
|---|
 | 100 |     }
 | 
|---|
 | 101 | };
 | 
|---|
 | 102 | 
 | 
|---|
 | 103 | template<>
 | 
|---|
 | 104 | struct _bz_doArrayIndexMapping<3> {
 | 
|---|
 | 105 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 106 |     static T_numtype map(const Array<T_numtype, 3>& array,
 | 
|---|
 | 107 |         const TinyVector<int,N_destRank>& index, int i0, int i1, int i2,
 | 
|---|
 | 108 |         int, int, int, int, int, int, int, int)
 | 
|---|
 | 109 |     {
 | 
|---|
 | 110 |         return array(index[i0], index[i1], index[i2]);
 | 
|---|
 | 111 |     }
 | 
|---|
 | 112 | };
 | 
|---|
 | 113 | 
 | 
|---|
 | 114 | template<>
 | 
|---|
 | 115 | struct _bz_doArrayIndexMapping<4> {
 | 
|---|
 | 116 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 117 |     static T_numtype map(const Array<T_numtype, 4>& array,
 | 
|---|
 | 118 |         const TinyVector<int,N_destRank>& index, int i0, int i1, int i2,
 | 
|---|
 | 119 |         int i3, int, int, int, int, int, int, int)
 | 
|---|
 | 120 |     {
 | 
|---|
 | 121 |         return array(index[i0], index[i1], index[i2], index[i3]);
 | 
|---|
 | 122 |     }
 | 
|---|
 | 123 | };
 | 
|---|
 | 124 | 
 | 
|---|
 | 125 | template<>
 | 
|---|
 | 126 | struct _bz_doArrayIndexMapping<5> {
 | 
|---|
 | 127 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 128 |     static T_numtype map(const Array<T_numtype, 5>& array,
 | 
|---|
 | 129 |         const TinyVector<int,N_destRank>& index, int i0, int i1, int i2,
 | 
|---|
 | 130 |         int i3, int i4, int, int, int, int, int, int)
 | 
|---|
 | 131 |     {
 | 
|---|
 | 132 |         return array(index[i0], index[i1], index[i2], index[i3], index[i4]);
 | 
|---|
 | 133 |     }
 | 
|---|
 | 134 | };
 | 
|---|
 | 135 | 
 | 
|---|
 | 136 | template<>
 | 
|---|
 | 137 | struct _bz_doArrayIndexMapping<6> {
 | 
|---|
 | 138 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 139 |     static T_numtype map(const Array<T_numtype, 6>& array,
 | 
|---|
 | 140 |         const TinyVector<int,N_destRank>& index, int i0, int i1, int i2,
 | 
|---|
 | 141 |         int i3, int i4, int i5, int, int, int, int, int)
 | 
|---|
 | 142 |     {
 | 
|---|
 | 143 |         return array(index[i0], index[i1], index[i2], index[i3], index[i4],
 | 
|---|
 | 144 |             index[i5]);
 | 
|---|
 | 145 |     }
 | 
|---|
 | 146 | };
 | 
|---|
 | 147 | 
 | 
|---|
 | 148 | template<>
 | 
|---|
 | 149 | struct _bz_doArrayIndexMapping<7> {
 | 
|---|
 | 150 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 151 |     static T_numtype map(const Array<T_numtype, 7>& array,
 | 
|---|
 | 152 |         const TinyVector<int,N_destRank>& index, int i0, int i1, int i2,
 | 
|---|
 | 153 |         int i3, int i4, int i5, int i6, int, int, int, int)
 | 
|---|
 | 154 |     {
 | 
|---|
 | 155 |         return array(index[i0], index[i1], index[i2], index[i3], index[i4],
 | 
|---|
 | 156 |             index[i5], index[i6]);
 | 
|---|
 | 157 |     }
 | 
|---|
 | 158 | };
 | 
|---|
 | 159 | 
 | 
|---|
 | 160 | template<>
 | 
|---|
 | 161 | struct _bz_doArrayIndexMapping<8> {
 | 
|---|
 | 162 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 163 |     static T_numtype map(const Array<T_numtype, 8>& array,
 | 
|---|
 | 164 |         const TinyVector<int,N_destRank>& index, int i0, int i1, int i2,
 | 
|---|
 | 165 |         int i3, int i4, int i5, int i6, int i7, int, int, int)
 | 
|---|
 | 166 |     {
 | 
|---|
 | 167 |         return array(index[i0], index[i1], index[i2], index[i3], index[i4],
 | 
|---|
 | 168 |             index[i5], index[i6], index[i7]);
 | 
|---|
 | 169 |     }
 | 
|---|
 | 170 | };
 | 
|---|
 | 171 | 
 | 
|---|
 | 172 | template<>
 | 
|---|
 | 173 | struct _bz_doArrayIndexMapping<9> {
 | 
|---|
 | 174 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 175 |     static T_numtype map(const Array<T_numtype, 9>& array,
 | 
|---|
 | 176 |         const TinyVector<int,N_destRank>& index, int i0, int i1, int i2,
 | 
|---|
 | 177 |         int i3, int i4, int i5, int i6, int i7, int i8, int, int)
 | 
|---|
 | 178 |     {
 | 
|---|
 | 179 |         return array(index[i0], index[i1], index[i2], index[i3], index[i4],
 | 
|---|
 | 180 |             index[i5], index[i6], index[i7], index[i8]);
 | 
|---|
 | 181 |     }
 | 
|---|
 | 182 | };
 | 
|---|
 | 183 | 
 | 
|---|
 | 184 | template<>
 | 
|---|
 | 185 | struct _bz_doArrayIndexMapping<10> {
 | 
|---|
 | 186 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 187 |     static T_numtype map(const Array<T_numtype, 10>& array,
 | 
|---|
 | 188 |         const TinyVector<int,N_destRank>& index, int i0, int i1, int i2,
 | 
|---|
 | 189 |         int i3, int i4, int i5, int i6, int i7, int i8, int i9, int)
 | 
|---|
 | 190 |     {
 | 
|---|
 | 191 |         return array(index[i0], index[i1], index[i2], index[i3], index[i4],
 | 
|---|
 | 192 |             index[i5], index[i6], index[i7], index[i8], index[i9]);
 | 
|---|
 | 193 |     }
 | 
|---|
 | 194 | };
 | 
|---|
 | 195 | 
 | 
|---|
 | 196 | template<>
 | 
|---|
 | 197 | struct _bz_doArrayIndexMapping<11> {
 | 
|---|
 | 198 |     template<class T_numtype, int N_destRank>
 | 
|---|
 | 199 |     static T_numtype map(const Array<T_numtype, 11>& array,
 | 
|---|
 | 200 |         const TinyVector<int,N_destRank>& index, int i0, int i1, int i2,
 | 
|---|
 | 201 |         int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10)
 | 
|---|
 | 202 |     {
 | 
|---|
 | 203 |         return array(index[i0], index[i1], index[i2], index[i3], index[i4],
 | 
|---|
 | 204 |             index[i5], index[i6], index[i7], index[i8], index[i9],
 | 
|---|
 | 205 |             index[i10]);
 | 
|---|
 | 206 |     }
 | 
|---|
 | 207 | };
 | 
|---|
 | 208 | 
 | 
|---|
 | 209 | template<class P_numtype, int N_rank, int N_map0, int N_map1=0, int N_map2=0,
 | 
|---|
 | 210 |     int N_map3=0, int N_map4=0, int N_map5=0, int N_map6=0, int N_map7=0, 
 | 
|---|
 | 211 |     int N_map8=0, int N_map9=0, int N_map10=0>
 | 
|---|
 | 212 | class ArrayIndexMapping {
 | 
|---|
 | 213 | public:
 | 
|---|
 | 214 |     typedef P_numtype T_numtype;
 | 
|---|
 | 215 |     typedef const Array<T_numtype,N_rank>& T_ctorArg1;
 | 
|---|
 | 216 |     typedef int                            T_ctorArg2;    // dummy
 | 
|---|
 | 217 | 
 | 
|---|
 | 218 |     /*
 | 
|---|
 | 219 |      * This enum block finds the maximum of the N_map0, N_map1, ..., N_map10
 | 
|---|
 | 220 |      * parameters and stores it in maxRank10.  The rank of the expression is
 | 
|---|
 | 221 |      * then maxRank10 + 1, since the IndexPlaceholders start at 0 rather than
 | 
|---|
 | 222 |      * 1.  
 | 
|---|
 | 223 |      */
 | 
|---|
 | 224 |     enum {
 | 
|---|
 | 225 |         maxRank1 = (N_map0 > N_map1) ? N_map0 : N_map1,
 | 
|---|
 | 226 |         maxRank2 = (N_map2 > maxRank1) ? N_map2 : maxRank1,
 | 
|---|
 | 227 |         maxRank3 = (N_map3 > maxRank2) ? N_map3 : maxRank2,
 | 
|---|
 | 228 |         maxRank4 = (N_map4 > maxRank3) ? N_map4 : maxRank3,
 | 
|---|
 | 229 |         maxRank5 = (N_map5 > maxRank4) ? N_map5 : maxRank4,
 | 
|---|
 | 230 |         maxRank6 = (N_map6 > maxRank5) ? N_map6 : maxRank5,
 | 
|---|
 | 231 |         maxRank7 = (N_map7 > maxRank6) ? N_map7 : maxRank6,
 | 
|---|
 | 232 |         maxRank8 = (N_map8 > maxRank7) ? N_map8 : maxRank7,
 | 
|---|
 | 233 |         maxRank9 = (N_map9 > maxRank8) ? N_map9 : maxRank8,
 | 
|---|
 | 234 |         maxRank10 = (N_map10 > maxRank9) ? N_map10 : maxRank9
 | 
|---|
 | 235 |     };
 | 
|---|
 | 236 | 
 | 
|---|
 | 237 |     enum { numArrayOperands = 1, numIndexPlaceholders = 1,
 | 
|---|
 | 238 |         rank = maxRank10 + 1 };
 | 
|---|
 | 239 | 
 | 
|---|
 | 240 |     ArrayIndexMapping(const Array<T_numtype, N_rank>& array)
 | 
|---|
 | 241 |         : array_(array)
 | 
|---|
 | 242 |     { 
 | 
|---|
 | 243 |     }
 | 
|---|
 | 244 | 
 | 
|---|
 | 245 |     ArrayIndexMapping(const ArrayIndexMapping<T_numtype,N_rank,N_map0,
 | 
|---|
 | 246 |         N_map1,N_map2,N_map3,N_map4,N_map5,N_map6,N_map7,N_map8,N_map9,
 | 
|---|
 | 247 |         N_map10>& z)
 | 
|---|
 | 248 |         : array_(z.array_)
 | 
|---|
 | 249 |     { 
 | 
|---|
 | 250 |     }
 | 
|---|
 | 251 | 
 | 
|---|
 | 252 | #ifdef BZ_ARRAY_EXPR_PASS_INDEX_BY_VALUE
 | 
|---|
 | 253 |     template<int N_destRank>
 | 
|---|
 | 254 |     T_numtype operator()(TinyVector<int, N_destRank> i)
 | 
|---|
 | 255 |     {
 | 
|---|
 | 256 |         return _bz_doArrayIndexMapping<N_rank>::map(array_, i,
 | 
|---|
 | 257 |             N_map0, N_map1, N_map2, N_map3, N_map4, N_map5, N_map6,
 | 
|---|
 | 258 |             N_map7, N_map8, N_map9, N_map10);
 | 
|---|
 | 259 |     }
 | 
|---|
 | 260 | #else
 | 
|---|
 | 261 |     template<int N_destRank>
 | 
|---|
 | 262 |     T_numtype operator()(const TinyVector<int, N_destRank>& i)
 | 
|---|
 | 263 |     {
 | 
|---|
 | 264 |         return _bz_doArrayIndexMapping<N_rank>::map(array_, i,
 | 
|---|
 | 265 |             N_map0, N_map1, N_map2, N_map3, N_map4, N_map5, N_map6,
 | 
|---|
 | 266 |             N_map7, N_map8, N_map9, N_map10);
 | 
|---|
 | 267 |     }
 | 
|---|
 | 268 | #endif
 | 
|---|
 | 269 | 
 | 
|---|
 | 270 |     int lbound(int rank)
 | 
|---|
 | 271 |     { 
 | 
|---|
 | 272 |         if (N_map0 == rank)    
 | 
|---|
 | 273 |             return array_.lbound(0);
 | 
|---|
 | 274 |         else if ((N_map1 == rank) && (N_rank > 1))
 | 
|---|
 | 275 |             return array_.lbound(1);
 | 
|---|
 | 276 |         else if ((N_map2 == rank) && (N_rank > 2))
 | 
|---|
 | 277 |             return array_.lbound(2);
 | 
|---|
 | 278 |         else if ((N_map3 == rank) && (N_rank > 3))
 | 
|---|
 | 279 |             return array_.lbound(3);
 | 
|---|
 | 280 |         else if ((N_map4 == rank) && (N_rank > 4))
 | 
|---|
 | 281 |             return array_.lbound(4);
 | 
|---|
 | 282 |         else if ((N_map5 == rank) && (N_rank > 5))
 | 
|---|
 | 283 |             return array_.lbound(5);
 | 
|---|
 | 284 |         else if ((N_map6 == rank) && (N_rank > 6))
 | 
|---|
 | 285 |             return array_.lbound(6);
 | 
|---|
 | 286 |         else if ((N_map7 == rank) && (N_rank > 7))
 | 
|---|
 | 287 |             return array_.lbound(7);
 | 
|---|
 | 288 |         else if ((N_map8 == rank) && (N_rank > 8))
 | 
|---|
 | 289 |             return array_.lbound(8);
 | 
|---|
 | 290 |         else if ((N_map9 == rank) && (N_rank > 9))
 | 
|---|
 | 291 |             return array_.lbound(9);
 | 
|---|
 | 292 |         else if ((N_map10 == rank) && (N_rank > 10))
 | 
|---|
 | 293 |             return array_.lbound(10);
 | 
|---|
 | 294 |         else
 | 
|---|
 | 295 |             return INT_MIN;   // tiny(int());
 | 
|---|
 | 296 |     }
 | 
|---|
 | 297 | 
 | 
|---|
 | 298 |     int ubound(int rank)
 | 
|---|
 | 299 |     {   
 | 
|---|
 | 300 |         if (N_map0 == rank)
 | 
|---|
 | 301 |             return array_.ubound(0);
 | 
|---|
 | 302 |         else if ((N_map1 == rank) && (N_rank > 1))
 | 
|---|
 | 303 |             return array_.ubound(1);
 | 
|---|
 | 304 |         else if ((N_map2 == rank) && (N_rank > 2))
 | 
|---|
 | 305 |             return array_.ubound(2);
 | 
|---|
 | 306 |         else if ((N_map3 == rank) && (N_rank > 3))
 | 
|---|
 | 307 |             return array_.ubound(3);
 | 
|---|
 | 308 |         else if ((N_map4 == rank) && (N_rank > 4))
 | 
|---|
 | 309 |             return array_.ubound(4);
 | 
|---|
 | 310 |         else if ((N_map5 == rank) && (N_rank > 5))
 | 
|---|
 | 311 |             return array_.ubound(5);
 | 
|---|
 | 312 |         else if ((N_map6 == rank) && (N_rank > 6))
 | 
|---|
 | 313 |             return array_.ubound(6);
 | 
|---|
 | 314 |         else if ((N_map7 == rank) && (N_rank > 7))
 | 
|---|
 | 315 |             return array_.ubound(7);
 | 
|---|
 | 316 |         else if ((N_map8 == rank) && (N_rank > 8))
 | 
|---|
 | 317 |             return array_.ubound(8);
 | 
|---|
 | 318 |         else if ((N_map9 == rank) && (N_rank > 9))
 | 
|---|
 | 319 |             return array_.ubound(9);
 | 
|---|
 | 320 |         else if ((N_map10 == rank) && (N_rank > 10))
 | 
|---|
 | 321 |             return array_.ubound(10);
 | 
|---|
 | 322 |         else
 | 
|---|
 | 323 |             return INT_MAX;   // huge(int());
 | 
|---|
 | 324 |     }
 | 
|---|
 | 325 | 
 | 
|---|
 | 326 |     // If you have a precondition failure on this routine, it means
 | 
|---|
 | 327 |     // you are trying to use stack iteration mode on an expression
 | 
|---|
 | 328 |     // which contains an index placeholder.  You must use index
 | 
|---|
 | 329 |     // iteration mode instead.
 | 
|---|
 | 330 |     int operator*()
 | 
|---|
 | 331 |     {
 | 
|---|
 | 332 |         BZPRECONDITION(0);
 | 
|---|
 | 333 |         return 0;
 | 
|---|
 | 334 |     }
 | 
|---|
 | 335 | 
 | 
|---|
 | 336 |     // See operator*() note
 | 
|---|
 | 337 |     void push(int)
 | 
|---|
 | 338 |     {
 | 
|---|
 | 339 |         BZPRECONDITION(0);
 | 
|---|
 | 340 |     }
 | 
|---|
 | 341 | 
 | 
|---|
 | 342 |     // See operator*() note
 | 
|---|
 | 343 |     void pop(int)
 | 
|---|
 | 344 |     {
 | 
|---|
 | 345 |         BZPRECONDITION(0);
 | 
|---|
 | 346 |     }
 | 
|---|
 | 347 | 
 | 
|---|
 | 348 |     // See operator*() note
 | 
|---|
 | 349 |     void advance()
 | 
|---|
 | 350 |     {
 | 
|---|
 | 351 |         BZPRECONDITION(0);
 | 
|---|
 | 352 |     }
 | 
|---|
 | 353 | 
 | 
|---|
 | 354 |     // See operator*() note
 | 
|---|
 | 355 |     void advance(int)
 | 
|---|
 | 356 |     {
 | 
|---|
 | 357 |         BZPRECONDITION(0);
 | 
|---|
 | 358 |     }
 | 
|---|
 | 359 | 
 | 
|---|
 | 360 |     // See operator*() note
 | 
|---|
 | 361 |     void loadStride(int)
 | 
|---|
 | 362 |     {
 | 
|---|
 | 363 |         BZPRECONDITION(0);
 | 
|---|
 | 364 |     }
 | 
|---|
 | 365 | 
 | 
|---|
 | 366 |     _bz_bool isUnitStride(int rank) const
 | 
|---|
 | 367 |     {
 | 
|---|
 | 368 |         BZPRECONDITION(0);
 | 
|---|
 | 369 |         return false;
 | 
|---|
 | 370 |     }
 | 
|---|
 | 371 | 
 | 
|---|
 | 372 |     void advanceUnitStride()
 | 
|---|
 | 373 |     {
 | 
|---|
 | 374 |         BZPRECONDITION(0);
 | 
|---|
 | 375 |     }
 | 
|---|
 | 376 | 
 | 
|---|
 | 377 |     _bz_bool canCollapse(int,int) const
 | 
|---|
 | 378 |     {   BZPRECONDITION(0);  return _bz_false; }
 | 
|---|
 | 379 | 
 | 
|---|
 | 380 |     T_numtype operator[](int)
 | 
|---|
 | 381 |     {   
 | 
|---|
 | 382 |         BZPRECONDITION(0);
 | 
|---|
 | 383 |         return T_numtype();
 | 
|---|
 | 384 |     }
 | 
|---|
 | 385 | 
 | 
|---|
 | 386 |     T_numtype fastRead(int)
 | 
|---|
 | 387 |     {
 | 
|---|
 | 388 |         BZPRECONDITION(0);
 | 
|---|
 | 389 |         return T_numtype();
 | 
|---|
 | 390 |     }
 | 
|---|
 | 391 | 
 | 
|---|
 | 392 |     int suggestStride(int) const
 | 
|---|
 | 393 |     {
 | 
|---|
 | 394 |         BZPRECONDITION(0);
 | 
|---|
 | 395 |         return 0;
 | 
|---|
 | 396 |     }
 | 
|---|
 | 397 | 
 | 
|---|
 | 398 |     _bz_bool isStride(int,int) const
 | 
|---|
 | 399 |     {
 | 
|---|
 | 400 |         BZPRECONDITION(0);
 | 
|---|
 | 401 |         return _bz_true;
 | 
|---|
 | 402 |     }
 | 
|---|
 | 403 | 
 | 
|---|
 | 404 |     template<int N_rank2>
 | 
|---|
 | 405 |     void moveTo(const TinyVector<int,N_rank2>& i)
 | 
|---|
 | 406 |     {
 | 
|---|
 | 407 |         BZPRECONDITION(0);
 | 
|---|
 | 408 |         return ;
 | 
|---|
 | 409 |     }
 | 
|---|
 | 410 | 
 | 
|---|
 | 411 |     void prettyPrint(string& str, prettyPrintFormat& format) const
 | 
|---|
 | 412 |     {
 | 
|---|
 | 413 |         // NEEDS_WORK-- do real formatting for reductions
 | 
|---|
 | 414 |         str += "map[NEEDS_WORK]";
 | 
|---|
 | 415 |     }
 | 
|---|
 | 416 | 
 | 
|---|
 | 417 |     template<class T_shape>
 | 
|---|
 | 418 |     _bz_bool shapeCheck(const T_shape& shape) const
 | 
|---|
 | 419 |     { 
 | 
|---|
 | 420 |         // NEEDS_WORK-- do a real shape check (tricky)
 | 
|---|
 | 421 |         return _bz_true; 
 | 
|---|
 | 422 |     }
 | 
|---|
 | 423 | 
 | 
|---|
 | 424 | private:
 | 
|---|
 | 425 |     ArrayIndexMapping() { }
 | 
|---|
 | 426 | 
 | 
|---|
 | 427 |     const Array<T_numtype, N_rank>& array_;
 | 
|---|
 | 428 | };
 | 
|---|
 | 429 | 
 | 
|---|
 | 430 | BZ_NAMESPACE_END
 | 
|---|
 | 431 | 
 | 
|---|
 | 432 | #endif // BZ_ARRAYMAP_H
 | 
|---|
 | 433 | 
 | 
|---|