28 #ifndef util_ArrayPrivate_hpp
29 #define util_ArrayPrivate_hpp
42 const unsigned *
const stride );
47 const unsigned *
const stride ,
48 unsigned *
const dim );
53 const unsigned *
const stride ,
54 const unsigned offset ,
55 unsigned *
const indices );
60 #ifndef DOXYGEN_COMPILE
62 void array_check_rank(
const unsigned rank ,
63 const unsigned test_rank );
65 void array_check_ordinal(
const unsigned rank ,
66 const unsigned test_ordinal );
68 void array_check_index(
const unsigned dim ,
69 const unsigned index );
71 void array_check_offset(
const unsigned size ,
72 const unsigned test_offset );
74 void array_check_indices(
const bool ,
76 const unsigned *
const stride ,
88 template<
unsigned ,
unsigned >
struct array_check_ordinal_is_less ;
90 template<>
struct array_check_ordinal_is_less<0,8> {};
91 template<>
struct array_check_ordinal_is_less<1,8> {};
92 template<>
struct array_check_ordinal_is_less<2,8> {};
93 template<>
struct array_check_ordinal_is_less<3,8> {};
94 template<>
struct array_check_ordinal_is_less<4,8> {};
95 template<>
struct array_check_ordinal_is_less<5,8> {};
96 template<>
struct array_check_ordinal_is_less<6,8> {};
97 template<>
struct array_check_ordinal_is_less<7,8> {};
99 template<>
struct array_check_ordinal_is_less<0,7> {};
100 template<>
struct array_check_ordinal_is_less<1,7> {};
101 template<>
struct array_check_ordinal_is_less<2,7> {};
102 template<>
struct array_check_ordinal_is_less<3,7> {};
103 template<>
struct array_check_ordinal_is_less<4,7> {};
104 template<>
struct array_check_ordinal_is_less<5,7> {};
105 template<>
struct array_check_ordinal_is_less<6,7> {};
107 template<>
struct array_check_ordinal_is_less<0,6> {};
108 template<>
struct array_check_ordinal_is_less<1,6> {};
109 template<>
struct array_check_ordinal_is_less<2,6> {};
110 template<>
struct array_check_ordinal_is_less<3,6> {};
111 template<>
struct array_check_ordinal_is_less<4,6> {};
112 template<>
struct array_check_ordinal_is_less<5,6> {};
114 template<>
struct array_check_ordinal_is_less<0,5> {};
115 template<>
struct array_check_ordinal_is_less<1,5> {};
116 template<>
struct array_check_ordinal_is_less<2,5> {};
117 template<>
struct array_check_ordinal_is_less<3,5> {};
118 template<>
struct array_check_ordinal_is_less<4,5> {};
120 template<>
struct array_check_ordinal_is_less<0,4> {};
121 template<>
struct array_check_ordinal_is_less<1,4> {};
122 template<>
struct array_check_ordinal_is_less<2,4> {};
123 template<>
struct array_check_ordinal_is_less<3,4> {};
125 template<>
struct array_check_ordinal_is_less<0,3> {};
126 template<>
struct array_check_ordinal_is_less<1,3> {};
127 template<>
struct array_check_ordinal_is_less<2,3> {};
129 template<>
struct array_check_ordinal_is_less<0,2> {};
130 template<>
struct array_check_ordinal_is_less<1,2> {};
132 template<>
struct array_check_ordinal_is_less<0,1> {};
136 template<
class ,
unsigned >
struct ArrayTagAt ;
138 template<
typename Scalar ,
ArrayOrder order ,
139 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
140 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
141 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,0>
142 {
typedef Tag1 type ; };
144 template<
typename Scalar ,
ArrayOrder order ,
145 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
146 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
147 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,1>
148 {
typedef Tag2 type ; };
150 template<
typename Scalar ,
ArrayOrder order ,
151 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
152 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
153 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,2>
154 {
typedef Tag3 type ; };
156 template<
typename Scalar ,
ArrayOrder order ,
157 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
158 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
159 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,3>
160 {
typedef Tag4 type ; };
162 template<
typename Scalar ,
ArrayOrder order ,
163 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
164 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
165 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,4>
166 {
typedef Tag5 type ; };
168 template<
typename Scalar ,
ArrayOrder order ,
169 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
170 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
171 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,5>
172 {
typedef Tag6 type ; };
174 template<
typename Scalar ,
ArrayOrder order ,
175 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
176 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
177 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,6>
178 {
typedef Tag7 type ; };
180 template<
typename Scalar ,
ArrayOrder order ,
181 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
182 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
183 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,7>
184 {
typedef Tag8 type ; };
189 template<
typename Scalar ,
190 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
191 class Tag5 ,
class Tag6 ,
class Tag7 ,
class TApp >
193 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> , TApp >
196 Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7> type ;
199 template<
typename Scalar ,
200 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
201 class Tag5 ,
class Tag6 ,
class Tag7 ,
class TApp >
203 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> , TApp >
206 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,TApp> type ;
209 template<
typename Scalar ,
210 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
211 class Tag5 ,
class Tag6 ,
class TApp >
213 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> , TApp >
216 Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void> type ;
219 template<
typename Scalar ,
220 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
221 class Tag5 ,
class Tag6 ,
class TApp >
223 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> , TApp >
226 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,TApp,void> type ;
229 template<
typename Scalar ,
230 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
231 class Tag5 ,
class TApp >
233 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> , TApp >
236 Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,Tag3,Tag4,Tag5,void,void> type ;
239 template<
typename Scalar ,
240 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
241 class Tag5 ,
class TApp >
243 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> , TApp >
246 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,TApp,void,void> type ;
249 template<
typename Scalar ,
250 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
class TApp >
252 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> , TApp >
255 Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,Tag3,Tag4,void,void,void> type ;
258 template<
typename Scalar ,
259 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
class TApp >
261 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> , TApp >
264 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,TApp,void,void,void> type ;
267 template<
typename Scalar ,
268 class Tag1 ,
class Tag2 ,
class Tag3 ,
class TApp >
270 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,void,void,void,void,void> , TApp >
273 Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,Tag3,void,void,void,void> type ;
276 template<
typename Scalar ,
277 class Tag1 ,
class Tag2 ,
class Tag3 ,
class TApp >
279 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void> , TApp >
282 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,TApp,void,void,void,void> type ;
285 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class TApp >
287 Array<Scalar,
NaturalOrder,Tag1,Tag2,void,void,void,void,void,void> , TApp >
290 Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,void,void,void,void,void> type ;
293 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class TApp >
295 Array<Scalar,
FortranOrder,Tag1,Tag2,void,void,void,void,void,void> , TApp >
298 Array<Scalar,FortranOrder,Tag1,Tag2,TApp,void,void,void,void,void> type ;
301 template<
typename Scalar ,
class Tag1 ,
class TApp >
303 Array<Scalar,
NaturalOrder,Tag1,void,void,void,void,void,void,void> , TApp >
306 Array<Scalar,NaturalOrder,TApp,Tag1,void,void,void,void,void,void> type ;
309 template<
typename Scalar ,
class Tag1 ,
class TApp >
311 Array<Scalar,
FortranOrder,Tag1,void,void,void,void,void,void,void> , TApp >
314 Array<Scalar,FortranOrder,Tag1,TApp,void,void,void,void,void,void> type ;
317 template<
typename Scalar ,
class TApp >
319 Array<Scalar,
RankZero,void,void,void,void,void,void,void,void> , TApp >
322 Array<Scalar,NaturalOrder,TApp,void,void,void,void,void,void,void> type ;
325 template<
typename Scalar ,
class TApp >
327 Array<Scalar,
NaturalOrder,void,void,void,void,void,void,void,void> , TApp >
330 template<
typename Scalar ,
class TApp >
332 Array<Scalar,
FortranOrder,void,void,void,void,void,void,void,void> , TApp >
338 template<
class A >
struct ArrayReverse ;
340 template<
typename Scalar ,
341 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
342 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
344 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8> >
347 Array<Scalar,FortranOrder,Tag8,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1> type ;
350 template<
typename Scalar ,
351 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
352 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
354 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8> >
357 Array<Scalar,NaturalOrder,Tag8,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1> type ;
361 template<
typename Scalar ,
362 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
363 class Tag5 ,
class Tag6 ,
class Tag7 >
365 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> >
368 Array<Scalar,FortranOrder,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void> type ;
371 template<
typename Scalar ,
372 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
373 class Tag5 ,
class Tag6 ,
class Tag7 >
375 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> >
378 Array<Scalar,NaturalOrder,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void> type ;
382 template<
typename Scalar ,
383 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
384 class Tag5 ,
class Tag6 >
386 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> >
389 Array<Scalar,FortranOrder,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void,void> type ;
392 template<
typename Scalar ,
393 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
394 class Tag5 ,
class Tag6 >
396 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> >
399 Array<Scalar,NaturalOrder,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void,void> type ;
403 template<
typename Scalar ,
404 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
407 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> >
410 Array<Scalar,FortranOrder,Tag5,Tag4,Tag3,Tag2,Tag1,void,void,void> type ;
413 template<
typename Scalar ,
414 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
417 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> >
420 Array<Scalar,NaturalOrder,Tag5,Tag4,Tag3,Tag2,Tag1,void,void,void> type ;
424 template<
typename Scalar ,
425 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 >
427 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> >
430 Array<Scalar,FortranOrder,Tag4,Tag3,Tag2,Tag1,void,void,void,void> type ;
433 template<
typename Scalar ,
434 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 >
436 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> >
439 Array<Scalar,NaturalOrder,Tag4,Tag3,Tag2,Tag1,void,void,void,void> type ;
443 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class Tag3 >
445 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,void,void,void,void,void> >
448 Array<Scalar,FortranOrder,Tag3,Tag2,Tag1,void,void,void,void,void> type ;
451 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class Tag3 >
453 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void> >
456 Array<Scalar,NaturalOrder,Tag3,Tag2,Tag1,void,void,void,void,void> type ;
460 template<
typename Scalar ,
class Tag1 ,
class Tag2 >
462 Array<Scalar,
NaturalOrder,Tag1,Tag2,void,void,void,void,void,void> >
465 Array<Scalar,FortranOrder,Tag2,Tag1,void,void,void,void,void,void> type ;
468 template<
typename Scalar ,
class Tag1 ,
class Tag2 >
470 Array<Scalar,
FortranOrder,Tag1,Tag2,void,void,void,void,void,void> >
473 Array<Scalar,NaturalOrder,Tag2,Tag1,void,void,void,void,void,void> type ;
477 template<
typename Scalar ,
class Tag1 >
479 Array<Scalar,
NaturalOrder,Tag1,void,void,void,void,void,void,void> >
482 Array<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void> type ;
485 template<
typename Scalar ,
class Tag1 >
487 Array<Scalar,
FortranOrder,Tag1,void,void,void,void,void,void,void> >
490 Array<Scalar,NaturalOrder,Tag1,void,void,void,void,void,void,void> type ;
494 template<
typename Scalar >
496 Array<Scalar,
NaturalOrder,void,void,void,void,void,void,void,void> >
499 Array<Scalar,FortranOrder,void,void,void,void,void,void,void,void> type ;
502 template<
typename Scalar >
504 Array<Scalar,
FortranOrder,void,void,void,void,void,void,void,void> >
507 Array<Scalar,NaturalOrder,void,void,void,void,void,void,void,void> type ;
514 template<
class A >
struct ArrayTruncate ;
516 template<
typename Scalar ,
517 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
518 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
519 struct ArrayTruncate<
520 Array<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8> >
523 Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8,void> type ;
526 template<
typename Scalar ,
class Tag1 >
527 struct ArrayTruncate<
528 Array<Scalar,
NaturalOrder,Tag1,void,void,void,void,void,void,void> >
530 typedef Array<Scalar,RankZero,void,void,void,void,void,void,void,void> type ;
533 template<
typename Scalar ,
class Tag1 >
534 struct ArrayTruncate<
535 Array<Scalar,
FortranOrder,Tag1,void,void,void,void,void,void,void> >
537 typedef Array<Scalar,RankZero,void,void,void,void,void,void,void,void> type ;
540 template<
typename Scalar ,
class Tag1 ,
class Tag2 >
541 struct ArrayTruncate<
542 Array<Scalar,
FortranOrder,Tag1,Tag2,void,void,void,void,void,void> >
545 Array<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void> type ;
548 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class Tag3 >
549 struct ArrayTruncate<
550 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void> >
553 Array<Scalar,FortranOrder,Tag1,Tag2,void,void,void,void,void,void> type ;
556 template<
typename Scalar ,
557 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 >
558 struct ArrayTruncate<
559 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> >
562 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void> type ;
565 template<
typename Scalar ,
566 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
568 struct ArrayTruncate<
569 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> >
572 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> type ;
575 template<
typename Scalar ,
576 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
577 class Tag5 ,
class Tag6 >
578 struct ArrayTruncate<
579 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> >
582 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> type ;
585 template<
typename Scalar ,
586 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
587 class Tag5 ,
class Tag6 ,
class Tag7 >
588 struct ArrayTruncate<
589 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> >
592 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> type ;
595 template<
typename Scalar ,
596 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
597 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
598 struct ArrayTruncate<
599 Array<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8> >
602 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> type ;
608 template< ArrayOrder ,
unsigned Rank ,
unsigned Ordinal = 0 >
609 struct ArrayStrideDim ;
611 template<
unsigned Rank ,
unsigned Ordinal >
612 struct ArrayStrideDim<
RankZero,Rank,Ordinal> {
614 static unsigned dimension(
const unsigned * )
617 static unsigned dimension(
const unsigned * ,
const unsigned & )
621 template<
unsigned Rank >
623 static unsigned dimension(
const unsigned * stride )
624 {
return stride[0]; }
626 static unsigned dimension(
const unsigned * stride ,
627 const unsigned & ordinal )
628 {
return ordinal ? stride[ordinal] / stride[ordinal-1] : stride[0] ; }
631 template<
unsigned Rank >
633 static unsigned dimension(
const unsigned * stride ) {
return stride[0]; }
635 static unsigned dimension(
const unsigned * stride ,
636 const unsigned & ordinal )
638 const unsigned i = ( Rank - 1 ) - ordinal ;
639 return i ? stride[i] / stride[i-1] : stride[0] ;
643 template<
unsigned Rank ,
unsigned Ordinal >
645 static unsigned dimension(
const unsigned * stride )
646 {
return stride[Ordinal] / stride[Ordinal-1]; }
649 template<
unsigned Rank ,
unsigned Ordinal >
651 static unsigned dimension(
const unsigned * stride )
653 enum { I = ( Rank - 1 ) - Ordinal };
654 return stride[I] / stride[I-1];
662 template<
class Tag >
const ArrayDimTag * array_dim_tag();
666 const ArrayDimTag * array_dim_tag<void>() {
return NULL ; }
668 template<
class Tag >
670 const ArrayDimTag * array_dim_tag() {
return & Tag::tag(); }
672 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
673 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
674 const ArrayDimTag *
const * array_dim_tags()
676 static const ArrayDimTag * t[8] =
678 array_dim_tag< Tag1 >() ,
679 array_dim_tag< Tag2 >() ,
680 array_dim_tag< Tag3 >() ,
681 array_dim_tag< Tag4 >() ,
682 array_dim_tag< Tag5 >() ,
683 array_dim_tag< Tag6 >() ,
684 array_dim_tag< Tag7 >() ,
685 array_dim_tag< Tag8 >()
695 template< ArrayOrder array_order ,
unsigned rank >
696 unsigned array_offset(
697 const unsigned *
const ,
698 const unsigned & i1 ,
const unsigned & i2 ,
699 const unsigned & i3 ,
const unsigned & i4 ,
700 const unsigned & i5 ,
const unsigned & i6 ,
701 const unsigned & i7 ,
const unsigned & i8 );
703 template< ArrayOrder array_order ,
unsigned rank >
704 unsigned array_offset(
705 const unsigned *
const ,
706 const unsigned & i1 ,
const unsigned & i2 ,
707 const unsigned & i3 ,
const unsigned & i4 ,
708 const unsigned & i5 ,
const unsigned & i6 ,
709 const unsigned & i7 );
711 template< ArrayOrder array_order ,
unsigned rank >
712 unsigned array_offset(
713 const unsigned *
const ,
714 const unsigned & i1 ,
const unsigned & i2 ,
715 const unsigned & i3 ,
const unsigned & i4 ,
716 const unsigned & i5 ,
const unsigned & i6 );
718 template< ArrayOrder array_order ,
unsigned rank >
719 unsigned array_offset(
720 const unsigned *
const ,
721 const unsigned & i1 ,
const unsigned & i2 ,
722 const unsigned & i3 ,
const unsigned & i4 ,
723 const unsigned & i5 );
725 template< ArrayOrder array_order ,
unsigned rank >
726 unsigned array_offset(
727 const unsigned *
const ,
728 const unsigned & i1 ,
const unsigned & i2 ,
729 const unsigned & i3 ,
const unsigned & i4 );
731 template< ArrayOrder array_order ,
unsigned rank >
732 unsigned array_offset(
733 const unsigned *
const ,
734 const unsigned & i1 ,
const unsigned & i2 ,
735 const unsigned & i3 );
737 template< ArrayOrder array_order ,
unsigned rank >
738 unsigned array_offset(
739 const unsigned *
const ,
740 const unsigned & i1 ,
const unsigned & i2 );
742 template< ArrayOrder array_order ,
unsigned rank >
743 unsigned array_offset(
744 const unsigned *
const ,
745 const unsigned & i1 );
750 unsigned array_offset<FortranOrder,8>(
751 const unsigned *
const stride ,
752 const unsigned & i1 ,
const unsigned & i2 ,
753 const unsigned & i3 ,
const unsigned & i4 ,
754 const unsigned & i5 ,
const unsigned & i6 ,
755 const unsigned & i7 ,
const unsigned & i8 )
757 ARRAY_CHECK(array_check_indices(
false,8,stride,i1,i2,i3,i4,i5,i6,i7,i8));
758 return i1 + i2 * stride[0] +
759 i3 * stride[1] + i4 * stride[2] +
760 i5 * stride[3] + i6 * stride[4] +
761 i7 * stride[5] + i8 * stride[6] ;
765 unsigned array_offset<FortranOrder,7>(
766 const unsigned *
const stride ,
767 const unsigned & i1 ,
const unsigned & i2 ,
768 const unsigned & i3 ,
const unsigned & i4 ,
769 const unsigned & i5 ,
const unsigned & i6 ,
770 const unsigned & i7 )
772 ARRAY_CHECK(array_check_indices(
false,7,stride,i1,i2,i3,i4,i5,i6,i7));
773 return i1 + i2 * stride[0] +
774 i3 * stride[1] + i4 * stride[2] +
775 i5 * stride[3] + i6 * stride[4] +
780 unsigned array_offset<FortranOrder,6>(
781 const unsigned *
const stride ,
782 const unsigned & i1 ,
const unsigned & i2 ,
783 const unsigned & i3 ,
const unsigned & i4 ,
784 const unsigned & i5 ,
const unsigned & i6 )
786 ARRAY_CHECK(array_check_indices(
false,6,stride,i1,i2,i3,i4,i5,i6));
787 return i1 + i2 * stride[0] +
788 i3 * stride[1] + i4 * stride[2] +
789 i5 * stride[3] + i6 * stride[4] ;
793 unsigned array_offset<FortranOrder,5>(
794 const unsigned *
const stride ,
795 const unsigned & i1 ,
const unsigned & i2 ,
796 const unsigned & i3 ,
const unsigned & i4 ,
797 const unsigned & i5 )
799 ARRAY_CHECK(array_check_indices(
false,5,stride,i1,i2,i3,i4,i5));
800 return i1 + i2 * stride[0] +
801 i3 * stride[1] + i4 * stride[2] +
806 unsigned array_offset<FortranOrder,4>(
807 const unsigned *
const stride ,
808 const unsigned & i1 ,
const unsigned & i2 ,
809 const unsigned & i3 ,
const unsigned & i4 )
811 ARRAY_CHECK(array_check_indices(
false,4,stride,i1,i2,i3,i4));
812 return i1 + i2 * stride[0] +
813 i3 * stride[1] + i4 * stride[2] ;
817 unsigned array_offset<FortranOrder,3>(
818 const unsigned *
const stride ,
819 const unsigned & i1 ,
const unsigned & i2 ,
820 const unsigned & i3 )
822 ARRAY_CHECK(array_check_indices(
false,3,stride,i1,i2,i3));
823 return i1 + i2 * stride[0] + i3 * stride[1] ;
827 unsigned array_offset<FortranOrder,2>(
828 const unsigned *
const stride ,
829 const unsigned & i1 ,
const unsigned & i2 )
831 ARRAY_CHECK(array_check_indices(
false,2,stride,i1,i2));
832 return i1 + i2 * stride[0] ;
836 unsigned array_offset<FortranOrder,1>(
837 const unsigned *
const ARRAY_CHECK( stride ) ,
838 const unsigned & i1 )
840 ARRAY_CHECK(array_check_indices(
false,1,stride,i1));
847 unsigned array_offset<NaturalOrder,8>(
848 const unsigned *
const stride ,
849 const unsigned & i1 ,
const unsigned & i2 ,
850 const unsigned & i3 ,
const unsigned & i4 ,
851 const unsigned & i5 ,
const unsigned & i6 ,
852 const unsigned & i7 ,
const unsigned & i8 )
854 ARRAY_CHECK(array_check_indices(
true,8,stride,i1,i2,i3,i4,i5,i6,i7,i8));
855 return i8 + i7 * stride[0] +
856 i6 * stride[1] + i5 * stride[2] +
857 i4 * stride[3] + i3 * stride[4] +
858 i2 * stride[5] + i1 * stride[6] ;
862 unsigned array_offset<NaturalOrder,7>(
863 const unsigned *
const stride ,
864 const unsigned & i1 ,
const unsigned & i2 ,
865 const unsigned & i3 ,
const unsigned & i4 ,
866 const unsigned & i5 ,
const unsigned & i6 ,
867 const unsigned & i7 )
869 ARRAY_CHECK(array_check_indices(
true,7,stride,i1,i2,i3,i4,i5,i6,i7));
870 return i7 + i6 * stride[0] +
871 i5 * stride[1] + i4 * stride[2] +
872 i3 * stride[3] + i2 * stride[4] +
877 unsigned array_offset<NaturalOrder,6>(
878 const unsigned *
const stride ,
879 const unsigned & i1 ,
const unsigned & i2 ,
880 const unsigned & i3 ,
const unsigned & i4 ,
881 const unsigned & i5 ,
const unsigned & i6 )
883 ARRAY_CHECK(array_check_indices(
true,6,stride,i1,i2,i3,i4,i5,i6));
884 return i6 + i5 * stride[0] +
885 i4 * stride[1] + i3 * stride[2] +
886 i2 * stride[3] + i1 * stride[4] ;
890 unsigned array_offset<NaturalOrder,5>(
891 const unsigned *
const stride ,
892 const unsigned & i1 ,
const unsigned & i2 ,
893 const unsigned & i3 ,
const unsigned & i4 ,
894 const unsigned & i5 )
896 ARRAY_CHECK(array_check_indices(
true,5,stride,i1,i2,i3,i4,i5));
897 return i5 + i4 * stride[0] +
898 i3 * stride[1] + i2 * stride[2] +
903 unsigned array_offset<NaturalOrder,4>(
904 const unsigned *
const stride ,
905 const unsigned & i1 ,
const unsigned & i2 ,
906 const unsigned & i3 ,
const unsigned & i4 )
908 ARRAY_CHECK(array_check_indices(
true,4,stride,i1,i2,i3,i4));
909 return i4 + i3 * stride[0] +
910 i2 * stride[1] + i1 * stride[2] ;
914 unsigned array_offset<NaturalOrder,3>(
915 const unsigned *
const stride ,
916 const unsigned & i1 ,
const unsigned & i2 ,
917 const unsigned & i3 )
919 ARRAY_CHECK(array_check_indices(
true,3,stride,i1,i2,i3));
920 return i3 + i2 * stride[0] + i1 * stride[1] ;
924 unsigned array_offset<NaturalOrder,2>(
925 const unsigned *
const stride ,
926 const unsigned & i1 ,
const unsigned & i2 )
928 ARRAY_CHECK(array_check_indices(
true,2,stride,i1,i2));
929 return i2 + i1 * stride[0] ;
933 unsigned array_offset<NaturalOrder,1>(
934 const unsigned *
const ARRAY_CHECK( stride ) ,
935 const unsigned & i1 )
937 ARRAY_CHECK(array_check_indices(
true,1,stride,i1));
943 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
944 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
945 struct Array<void,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
949 static void assign(
unsigned * stride )
951 stride[7] = Tag8::Size * (
952 stride[6] = Tag7::Size * (
953 stride[5] = Tag6::Size * (
954 stride[4] = Tag5::Size * (
955 stride[3] = Tag4::Size * (
956 stride[2] = Tag3::Size * (
957 stride[1] = Tag2::Size * (
958 stride[0] = Tag1::Size )))))));
961 static void assign(
unsigned * stride ,
962 const unsigned & n8 )
965 stride[6] = Tag7::Size * (
966 stride[5] = Tag6::Size * (
967 stride[4] = Tag5::Size * (
968 stride[3] = Tag4::Size * (
969 stride[2] = Tag3::Size * (
970 stride[1] = Tag2::Size * (
971 stride[0] = Tag1::Size )))))));
974 static void assign(
unsigned * stride ,
975 const unsigned & n7 ,
976 const unsigned & n8 )
980 stride[5] = Tag6::Size * (
981 stride[4] = Tag5::Size * (
982 stride[3] = Tag4::Size * (
983 stride[2] = Tag3::Size * (
984 stride[1] = Tag2::Size * (
985 stride[0] = Tag1::Size )))))));
988 static void assign(
unsigned * stride ,
989 const unsigned & n6 ,
990 const unsigned & n7 ,
991 const unsigned & n8 )
996 stride[4] = Tag5::Size * (
997 stride[3] = Tag4::Size * (
998 stride[2] = Tag3::Size * (
999 stride[1] = Tag2::Size * (
1000 stride[0] = Tag1::Size )))))));
1003 static void assign(
unsigned * stride ,
1004 const unsigned & n5 ,
1005 const unsigned & n6 ,
1006 const unsigned & n7 ,
1007 const unsigned & n8 )
1013 stride[3] = Tag4::Size * (
1014 stride[2] = Tag3::Size * (
1015 stride[1] = Tag2::Size * (
1016 stride[0] = Tag1::Size )))))));
1019 static void assign(
unsigned * stride ,
1020 const unsigned & n4 ,
1021 const unsigned & n5 ,
1022 const unsigned & n6 ,
1023 const unsigned & n7 ,
1024 const unsigned & n8 )
1031 stride[2] = Tag3::Size * (
1032 stride[1] = Tag2::Size * (
1033 stride[0] = Tag1::Size )))))));
1036 static void assign(
unsigned * stride ,
1037 const unsigned & n3 ,
1038 const unsigned & n4 ,
1039 const unsigned & n5 ,
1040 const unsigned & n6 ,
1041 const unsigned & n7 ,
1042 const unsigned & n8 )
1050 stride[1] = Tag2::Size * (
1051 stride[0] = Tag1::Size )))))));
1054 static void assign(
unsigned * stride ,
1055 const unsigned & n2 ,
1056 const unsigned & n3 ,
1057 const unsigned & n4 ,
1058 const unsigned & n5 ,
1059 const unsigned & n6 ,
1060 const unsigned & n7 ,
1061 const unsigned & n8 )
1070 stride[0] = Tag1::Size )))))));
1073 static void assign(
unsigned * stride ,
1074 const unsigned & n1 ,
1075 const unsigned & n2 ,
1076 const unsigned & n3 ,
1077 const unsigned & n4 ,
1078 const unsigned & n5 ,
1079 const unsigned & n6 ,
1080 const unsigned & n7 ,
1081 const unsigned & n8 )
1090 stride[0] = n1 )))))));
1093 static void assign(
unsigned * stride ,
1094 const unsigned *
const dims )
1096 stride[7] = dims[7] * (
1097 stride[6] = dims[6] * (
1098 stride[5] = dims[5] * (
1099 stride[4] = dims[4] * (
1100 stride[3] = dims[3] * (
1101 stride[2] = dims[2] * (
1102 stride[1] = dims[1] * (
1103 stride[0] = dims[0] )))))));
1107 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1108 class Tag5 ,
class Tag6 ,
class Tag7 >
1109 struct Array<void,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
1113 static void assign(
unsigned * stride )
1115 stride[6] = Tag7::Size * (
1116 stride[5] = Tag6::Size * (
1117 stride[4] = Tag5::Size * (
1118 stride[3] = Tag4::Size * (
1119 stride[2] = Tag3::Size * (
1120 stride[1] = Tag2::Size * (
1121 stride[0] = Tag1::Size ))))));
1124 static void assign(
unsigned * stride ,
1125 const unsigned & n7 )
1128 stride[5] = Tag6::Size * (
1129 stride[4] = Tag5::Size * (
1130 stride[3] = Tag4::Size * (
1131 stride[2] = Tag3::Size * (
1132 stride[1] = Tag2::Size * (
1133 stride[0] = Tag1::Size ))))));
1136 static void assign(
unsigned * stride ,
1137 const unsigned & n6 ,
1138 const unsigned & n7 )
1142 stride[4] = Tag5::Size * (
1143 stride[3] = Tag4::Size * (
1144 stride[2] = Tag3::Size * (
1145 stride[1] = Tag2::Size * (
1146 stride[0] = Tag1::Size ))))));
1149 static void assign(
unsigned * stride ,
1150 const unsigned & n5 ,
1151 const unsigned & n6 ,
1152 const unsigned & n7 )
1157 stride[3] = Tag4::Size * (
1158 stride[2] = Tag3::Size * (
1159 stride[1] = Tag2::Size * (
1160 stride[0] = Tag1::Size ))))));
1163 static void assign(
unsigned * stride ,
1164 const unsigned & n4 ,
1165 const unsigned & n5 ,
1166 const unsigned & n6 ,
1167 const unsigned & n7 )
1173 stride[2] = Tag3::Size * (
1174 stride[1] = Tag2::Size * (
1175 stride[0] = Tag1::Size ))))));
1178 static void assign(
unsigned * stride ,
1179 const unsigned & n3 ,
1180 const unsigned & n4 ,
1181 const unsigned & n5 ,
1182 const unsigned & n6 ,
1183 const unsigned & n7 )
1190 stride[1] = Tag2::Size * (
1191 stride[0] = Tag1::Size ))))));
1194 static void assign(
unsigned * stride ,
1195 const unsigned & n2 ,
1196 const unsigned & n3 ,
1197 const unsigned & n4 ,
1198 const unsigned & n5 ,
1199 const unsigned & n6 ,
1200 const unsigned & n7 )
1208 stride[0] = Tag1::Size ))))));
1211 static void assign(
unsigned * stride ,
1212 const unsigned & n1 ,
1213 const unsigned & n2 ,
1214 const unsigned & n3 ,
1215 const unsigned & n4 ,
1216 const unsigned & n5 ,
1217 const unsigned & n6 ,
1218 const unsigned & n7 )
1226 stride[0] = n1 ))))));
1229 static void assign(
unsigned * stride ,
1230 const unsigned *
const dims )
1232 stride[6] = dims[6] * (
1233 stride[5] = dims[5] * (
1234 stride[4] = dims[4] * (
1235 stride[3] = dims[3] * (
1236 stride[2] = dims[2] * (
1237 stride[1] = dims[1] * (
1238 stride[0] = dims[0] ))))));
1242 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1243 class Tag5 ,
class Tag6 >
1244 struct Array<void,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void>
1248 static void assign(
unsigned * stride )
1250 stride[5] = Tag6::Size * (
1251 stride[4] = Tag5::Size * (
1252 stride[3] = Tag4::Size * (
1253 stride[2] = Tag3::Size * (
1254 stride[1] = Tag2::Size * (
1255 stride[0] = Tag1::Size )))));
1258 static void assign(
unsigned * stride ,
1259 const unsigned & n6 )
1262 stride[4] = Tag5::Size * (
1263 stride[3] = Tag4::Size * (
1264 stride[2] = Tag3::Size * (
1265 stride[1] = Tag2::Size * (
1266 stride[0] = Tag1::Size )))));
1269 static void assign(
unsigned * stride ,
1270 const unsigned & n5 ,
1271 const unsigned & n6 )
1275 stride[3] = Tag4::Size * (
1276 stride[2] = Tag3::Size * (
1277 stride[1] = Tag2::Size * (
1278 stride[0] = Tag1::Size )))));
1281 static void assign(
unsigned * stride ,
1282 const unsigned & n4 ,
1283 const unsigned & n5 ,
1284 const unsigned & n6 )
1289 stride[2] = Tag3::Size * (
1290 stride[1] = Tag2::Size * (
1291 stride[0] = Tag1::Size )))));
1294 static void assign(
unsigned * stride ,
1295 const unsigned & n3 ,
1296 const unsigned & n4 ,
1297 const unsigned & n5 ,
1298 const unsigned & n6 )
1304 stride[1] = Tag2::Size * (
1305 stride[0] = Tag1::Size )))));
1308 static void assign(
unsigned * stride ,
1309 const unsigned & n2 ,
1310 const unsigned & n3 ,
1311 const unsigned & n4 ,
1312 const unsigned & n5 ,
1313 const unsigned & n6 )
1320 stride[0] = Tag1::Size )))));
1323 static void assign(
unsigned * stride ,
1324 const unsigned & n1 ,
1325 const unsigned & n2 ,
1326 const unsigned & n3 ,
1327 const unsigned & n4 ,
1328 const unsigned & n5 ,
1329 const unsigned & n6 )
1336 stride[0] = n1 )))));
1339 static void assign(
unsigned * stride ,
1340 const unsigned *
const dims )
1342 stride[5] = dims[5] * (
1343 stride[4] = dims[4] * (
1344 stride[3] = dims[3] * (
1345 stride[2] = dims[2] * (
1346 stride[1] = dims[1] * (
1347 stride[0] = dims[0] )))));
1351 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1353 struct Array<void,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void>
1357 static void assign(
unsigned * stride )
1359 stride[4] = Tag5::Size * (
1360 stride[3] = Tag4::Size * (
1361 stride[2] = Tag3::Size * (
1362 stride[1] = Tag2::Size * (
1363 stride[0] = Tag1::Size ))));
1366 static void assign(
unsigned * stride ,
1367 const unsigned & n5 )
1370 stride[3] = Tag4::Size * (
1371 stride[2] = Tag3::Size * (
1372 stride[1] = Tag2::Size * (
1373 stride[0] = Tag1::Size ))));
1376 static void assign(
unsigned * stride ,
1377 const unsigned & n4 ,
1378 const unsigned & n5 )
1382 stride[2] = Tag3::Size * (
1383 stride[1] = Tag2::Size * (
1384 stride[0] = Tag1::Size ))));
1387 static void assign(
unsigned * stride ,
1388 const unsigned & n3 ,
1389 const unsigned & n4 ,
1390 const unsigned & n5 )
1395 stride[1] = Tag2::Size * (
1396 stride[0] = Tag1::Size ))));
1399 static void assign(
unsigned * stride ,
1400 const unsigned & n2 ,
1401 const unsigned & n3 ,
1402 const unsigned & n4 ,
1403 const unsigned & n5 )
1409 stride[0] = Tag1::Size ))));
1412 static void assign(
unsigned * stride ,
1413 const unsigned & n1 ,
1414 const unsigned & n2 ,
1415 const unsigned & n3 ,
1416 const unsigned & n4 ,
1417 const unsigned & n5 )
1423 stride[0] = n1 ))));
1426 static void assign(
unsigned * stride ,
1427 const unsigned *
const dims )
1429 stride[4] = dims[4] * (
1430 stride[3] = dims[3] * (
1431 stride[2] = dims[2] * (
1432 stride[1] = dims[1] * (
1433 stride[0] = dims[0] ))));
1438 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 >
1439 struct Array<void,
FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void>
1443 static void assign(
unsigned * stride )
1445 stride[3] = Tag4::Size * (
1446 stride[2] = Tag3::Size * (
1447 stride[1] = Tag2::Size * (
1448 stride[0] = Tag1::Size )));
1451 static void assign(
unsigned * stride ,
1452 const unsigned & n4 )
1455 stride[2] = Tag3::Size * (
1456 stride[1] = Tag2::Size * (
1457 stride[0] = Tag1::Size )));
1460 static void assign(
unsigned * stride ,
1461 const unsigned & n3 ,
1462 const unsigned & n4 )
1466 stride[1] = Tag2::Size * (
1467 stride[0] = Tag1::Size )));
1470 static void assign(
unsigned * stride ,
1471 const unsigned & n2 ,
1472 const unsigned & n3 ,
1473 const unsigned & n4 )
1478 stride[0] = Tag1::Size )));
1481 static void assign(
unsigned * stride ,
1482 const unsigned & n1 ,
1483 const unsigned & n2 ,
1484 const unsigned & n3 ,
1485 const unsigned & n4 )
1493 static void assign(
unsigned * stride ,
1494 const unsigned *
const dims )
1496 stride[3] = dims[3] * (
1497 stride[2] = dims[2] * (
1498 stride[1] = dims[1] * (
1499 stride[0] = dims[0] )));
1503 template<
class Tag1 ,
class Tag2 ,
class Tag3 >
1504 struct Array<void,
FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void>
1508 static void assign(
unsigned * stride )
1510 stride[2] = Tag3::Size * (
1511 stride[1] = Tag2::Size * (
1512 stride[0] = Tag1::Size ));
1515 static void assign(
unsigned * stride ,
1516 const unsigned & n3 )
1519 stride[1] = Tag2::Size * (
1520 stride[0] = Tag1::Size ));
1523 static void assign(
unsigned * stride ,
1524 const unsigned & n2 ,
1525 const unsigned & n3 )
1529 stride[0] = Tag1::Size ));
1532 static void assign(
unsigned * stride ,
1533 const unsigned & n1 ,
1534 const unsigned & n2 ,
1535 const unsigned & n3 )
1542 static void assign(
unsigned * stride ,
1543 const unsigned *
const dims )
1545 stride[2] = dims[2] * (
1546 stride[1] = dims[1] * (
1547 stride[0] = dims[0] ));
1551 template<
class Tag1 ,
class Tag2 >
1552 struct Array<void,
FortranOrder,Tag1,Tag2,void,void,void,void,void,void>
1556 static void assign(
unsigned * stride )
1557 { stride[1] = Tag2::Size * ( stride[0] = Tag1::Size ); }
1559 static void assign(
unsigned * stride ,
1560 const unsigned & n2 )
1561 { stride[1] = n2 * ( stride[0] = Tag1::Size ); }
1563 static void assign(
unsigned * stride ,
1564 const unsigned & n1 ,
1565 const unsigned & n2 )
1566 { stride[1] = n2 * ( stride[0] = n1 ); }
1568 static void assign(
unsigned * stride ,
1569 const unsigned *
const dims )
1570 { stride[1] = dims[1] * ( stride[0] = dims[0] ); }
1573 template<
class Tag1 >
1574 struct Array<void,
FortranOrder,Tag1,void,void,void,void,void,void,void>
1578 static void assign(
unsigned * stride ) { stride[0] = Tag1::Size ; }
1580 static void assign(
unsigned * stride ,
1581 const unsigned & n1 ) { stride[0] = n1 ; }
1583 static void assign(
unsigned * stride ,
1584 const unsigned *
const dims )
1585 { stride[0] = dims[0] ; }
1590 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1591 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
1592 struct Array<void,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
1596 static void assign(
unsigned * stride )
1598 stride[7] = Tag1::Size * (
1599 stride[6] = Tag2::Size * (
1600 stride[5] = Tag3::Size * (
1601 stride[4] = Tag4::Size * (
1602 stride[3] = Tag5::Size * (
1603 stride[2] = Tag6::Size * (
1604 stride[1] = Tag7::Size * (
1605 stride[0] = Tag8::Size )))))));
1608 static void assign(
unsigned * stride ,
1609 const unsigned & n1 )
1612 stride[6] = Tag2::Size * (
1613 stride[5] = Tag3::Size * (
1614 stride[4] = Tag4::Size * (
1615 stride[3] = Tag5::Size * (
1616 stride[2] = Tag6::Size * (
1617 stride[1] = Tag7::Size * (
1618 stride[0] = Tag8::Size )))))));
1621 static void assign(
unsigned * stride ,
1622 const unsigned & n1 ,
1623 const unsigned & n2 )
1627 stride[5] = Tag3::Size * (
1628 stride[4] = Tag4::Size * (
1629 stride[3] = Tag5::Size * (
1630 stride[2] = Tag6::Size * (
1631 stride[1] = Tag7::Size * (
1632 stride[0] = Tag8::Size )))))));
1635 static void assign(
unsigned * stride ,
1636 const unsigned & n1 ,
1637 const unsigned & n2 ,
1638 const unsigned & n3 )
1643 stride[4] = Tag4::Size * (
1644 stride[3] = Tag5::Size * (
1645 stride[2] = Tag6::Size * (
1646 stride[1] = Tag7::Size * (
1647 stride[0] = Tag8::Size )))))));
1650 static void assign(
unsigned * stride ,
1651 const unsigned & n1 ,
1652 const unsigned & n2 ,
1653 const unsigned & n3 ,
1654 const unsigned & n4 )
1660 stride[3] = Tag5::Size * (
1661 stride[2] = Tag6::Size * (
1662 stride[1] = Tag7::Size * (
1663 stride[0] = Tag8::Size )))))));
1666 static void assign(
unsigned * stride ,
1667 const unsigned & n1 ,
1668 const unsigned & n2 ,
1669 const unsigned & n3 ,
1670 const unsigned & n4 ,
1671 const unsigned & n5 )
1678 stride[2] = Tag6::Size * (
1679 stride[1] = Tag7::Size * (
1680 stride[0] = Tag8::Size )))))));
1683 static void assign(
unsigned * stride ,
1684 const unsigned & n1 ,
1685 const unsigned & n2 ,
1686 const unsigned & n3 ,
1687 const unsigned & n4 ,
1688 const unsigned & n5 ,
1689 const unsigned & n6 )
1697 stride[1] = Tag7::Size * (
1698 stride[0] = Tag8::Size )))))));
1701 static void assign(
unsigned * stride ,
1702 const unsigned & n1 ,
1703 const unsigned & n2 ,
1704 const unsigned & n3 ,
1705 const unsigned & n4 ,
1706 const unsigned & n5 ,
1707 const unsigned & n6 ,
1708 const unsigned & n7 )
1717 stride[0] = Tag8::Size )))))));
1720 static void assign(
unsigned * stride ,
1721 const unsigned & n1 ,
1722 const unsigned & n2 ,
1723 const unsigned & n3 ,
1724 const unsigned & n4 ,
1725 const unsigned & n5 ,
1726 const unsigned & n6 ,
1727 const unsigned & n7 ,
1728 const unsigned & n8 )
1737 stride[0] = n8 )))))));
1740 static void assign(
unsigned * stride ,
1741 const unsigned *
const dims )
1743 stride[7] = dims[0] * (
1744 stride[6] = dims[1] * (
1745 stride[5] = dims[2] * (
1746 stride[4] = dims[3] * (
1747 stride[3] = dims[4] * (
1748 stride[2] = dims[5] * (
1749 stride[1] = dims[6] * (
1750 stride[0] = dims[7] )))))));
1754 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1755 class Tag5 ,
class Tag6 ,
class Tag7 >
1756 struct Array<void,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
1760 static void assign(
unsigned * stride )
1762 stride[6] = Tag1::Size * (
1763 stride[5] = Tag2::Size * (
1764 stride[4] = Tag3::Size * (
1765 stride[3] = Tag4::Size * (
1766 stride[2] = Tag5::Size * (
1767 stride[1] = Tag6::Size * (
1768 stride[0] = Tag7::Size ))))));
1771 static void assign(
unsigned * stride ,
1772 const unsigned & n1 )
1775 stride[5] = Tag2::Size * (
1776 stride[4] = Tag3::Size * (
1777 stride[3] = Tag4::Size * (
1778 stride[2] = Tag5::Size * (
1779 stride[1] = Tag6::Size * (
1780 stride[0] = Tag7::Size ))))));
1783 static void assign(
unsigned * stride ,
1784 const unsigned & n1 ,
1785 const unsigned & n2 )
1789 stride[4] = Tag3::Size * (
1790 stride[3] = Tag4::Size * (
1791 stride[2] = Tag5::Size * (
1792 stride[1] = Tag6::Size * (
1793 stride[0] = Tag7::Size ))))));
1796 static void assign(
unsigned * stride ,
1797 const unsigned & n1 ,
1798 const unsigned & n2 ,
1799 const unsigned & n3 )
1804 stride[3] = Tag4::Size * (
1805 stride[2] = Tag5::Size * (
1806 stride[1] = Tag6::Size * (
1807 stride[0] = Tag7::Size ))))));
1810 static void assign(
unsigned * stride ,
1811 const unsigned & n1 ,
1812 const unsigned & n2 ,
1813 const unsigned & n3 ,
1814 const unsigned & n4 )
1820 stride[2] = Tag5::Size * (
1821 stride[1] = Tag6::Size * (
1822 stride[0] = Tag7::Size ))))));
1825 static void assign(
unsigned * stride ,
1826 const unsigned & n1 ,
1827 const unsigned & n2 ,
1828 const unsigned & n3 ,
1829 const unsigned & n4 ,
1830 const unsigned & n5 )
1837 stride[1] = Tag6::Size * (
1838 stride[0] = Tag7::Size ))))));
1841 static void assign(
unsigned * stride ,
1842 const unsigned & n1 ,
1843 const unsigned & n2 ,
1844 const unsigned & n3 ,
1845 const unsigned & n4 ,
1846 const unsigned & n5 ,
1847 const unsigned & n6 )
1855 stride[0] = Tag7::Size ))))));
1858 static void assign(
unsigned * stride ,
1859 const unsigned & n1 ,
1860 const unsigned & n2 ,
1861 const unsigned & n3 ,
1862 const unsigned & n4 ,
1863 const unsigned & n5 ,
1864 const unsigned & n6 ,
1865 const unsigned & n7 )
1873 stride[0] = n7 ))))));
1876 static void assign(
unsigned * stride ,
1877 const unsigned *
const dims )
1879 stride[6] = dims[0] * (
1880 stride[5] = dims[1] * (
1881 stride[4] = dims[2] * (
1882 stride[3] = dims[3] * (
1883 stride[2] = dims[4] * (
1884 stride[1] = dims[5] * (
1885 stride[0] = dims[6] ))))));
1889 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1890 class Tag5 ,
class Tag6 >
1891 struct Array<void,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void>
1895 static void assign(
unsigned * stride )
1897 stride[5] = Tag1::Size * (
1898 stride[4] = Tag2::Size * (
1899 stride[3] = Tag3::Size * (
1900 stride[2] = Tag4::Size * (
1901 stride[1] = Tag5::Size * (
1902 stride[0] = Tag6::Size )))));
1905 static void assign(
unsigned * stride ,
1906 const unsigned & n1 )
1909 stride[4] = Tag2::Size * (
1910 stride[3] = Tag3::Size * (
1911 stride[2] = Tag4::Size * (
1912 stride[1] = Tag5::Size * (
1913 stride[0] = Tag6::Size )))));
1916 static void assign(
unsigned * stride ,
1917 const unsigned & n1 ,
1918 const unsigned & n2 )
1922 stride[3] = Tag3::Size * (
1923 stride[2] = Tag4::Size * (
1924 stride[1] = Tag5::Size * (
1925 stride[0] = Tag6::Size )))));
1928 static void assign(
unsigned * stride ,
1929 const unsigned & n1 ,
1930 const unsigned & n2 ,
1931 const unsigned & n3 )
1936 stride[2] = Tag4::Size * (
1937 stride[1] = Tag5::Size * (
1938 stride[0] = Tag6::Size )))));
1941 static void assign(
unsigned * stride ,
1942 const unsigned & n1 ,
1943 const unsigned & n2 ,
1944 const unsigned & n3 ,
1945 const unsigned & n4 )
1951 stride[1] = Tag5::Size * (
1952 stride[0] = Tag6::Size )))));
1955 static void assign(
unsigned * stride ,
1956 const unsigned & n1 ,
1957 const unsigned & n2 ,
1958 const unsigned & n3 ,
1959 const unsigned & n4 ,
1960 const unsigned & n5 )
1967 stride[0] = Tag6::Size )))));
1970 static void assign(
unsigned * stride ,
1971 const unsigned & n1 ,
1972 const unsigned & n2 ,
1973 const unsigned & n3 ,
1974 const unsigned & n4 ,
1975 const unsigned & n5 ,
1976 const unsigned & n6 )
1983 stride[0] = n6 )))));
1986 static void assign(
unsigned * stride ,
1987 const unsigned *
const dims )
1989 stride[5] = dims[0] * (
1990 stride[4] = dims[1] * (
1991 stride[3] = dims[2] * (
1992 stride[2] = dims[3] * (
1993 stride[1] = dims[4] * (
1994 stride[0] = dims[5] )))));
1998 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
2000 struct Array<void,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void>
2004 static void assign(
unsigned * stride )
2006 stride[4] = Tag1::Size * (
2007 stride[3] = Tag2::Size * (
2008 stride[2] = Tag3::Size * (
2009 stride[1] = Tag4::Size * (
2010 stride[0] = Tag5::Size ))));
2013 static void assign(
unsigned * stride ,
2014 const unsigned & n1 )
2017 stride[3] = Tag2::Size * (
2018 stride[2] = Tag3::Size * (
2019 stride[1] = Tag4::Size * (
2020 stride[0] = Tag5::Size ))));
2023 static void assign(
unsigned * stride ,
2024 const unsigned & n1 ,
2025 const unsigned & n2 )
2029 stride[2] = Tag3::Size * (
2030 stride[1] = Tag4::Size * (
2031 stride[0] = Tag5::Size ))));
2034 static void assign(
unsigned * stride ,
2035 const unsigned & n1 ,
2036 const unsigned & n2 ,
2037 const unsigned & n3 )
2042 stride[1] = Tag4::Size * (
2043 stride[0] = Tag5::Size ))));
2046 static void assign(
unsigned * stride ,
2047 const unsigned & n1 ,
2048 const unsigned & n2 ,
2049 const unsigned & n3 ,
2050 const unsigned & n4 )
2056 stride[0] = Tag5::Size ))));
2059 static void assign(
unsigned * stride ,
2060 const unsigned & n1 ,
2061 const unsigned & n2 ,
2062 const unsigned & n3 ,
2063 const unsigned & n4 ,
2064 const unsigned & n5 )
2070 stride[0] = n5 ))));
2073 static void assign(
unsigned * stride ,
2074 const unsigned *
const dims )
2076 stride[4] = dims[0] * (
2077 stride[3] = dims[1] * (
2078 stride[2] = dims[2] * (
2079 stride[1] = dims[3] * (
2080 stride[0] = dims[4] ))));
2085 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 >
2086 struct Array<void,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void>
2090 static void assign(
unsigned * stride )
2092 stride[3] = Tag1::Size * (
2093 stride[2] = Tag2::Size * (
2094 stride[1] = Tag3::Size * (
2095 stride[0] = Tag4::Size )));
2098 static void assign(
unsigned * stride ,
2099 const unsigned & n1 )
2102 stride[2] = Tag2::Size * (
2103 stride[1] = Tag3::Size * (
2104 stride[0] = Tag4::Size )));
2107 static void assign(
unsigned * stride ,
2108 const unsigned & n1 ,
2109 const unsigned & n2 )
2113 stride[1] = Tag3::Size * (
2114 stride[0] = Tag4::Size )));
2117 static void assign(
unsigned * stride ,
2118 const unsigned & n1 ,
2119 const unsigned & n2 ,
2120 const unsigned & n3 )
2125 stride[0] = Tag4::Size )));
2128 static void assign(
unsigned * stride ,
2129 const unsigned & n1 ,
2130 const unsigned & n2 ,
2131 const unsigned & n3 ,
2132 const unsigned & n4 )
2140 static void assign(
unsigned * stride ,
2141 const unsigned *
const dims )
2143 stride[3] = dims[0] * (
2144 stride[2] = dims[1] * (
2145 stride[1] = dims[2] * (
2146 stride[0] = dims[3] )));
2150 template<
class Tag1 ,
class Tag2 ,
class Tag3 >
2151 struct Array<void,
NaturalOrder,Tag1,Tag2,Tag3,void,void,void,void,void>
2155 static void assign(
unsigned * stride )
2157 stride[2] = Tag1::Size * (
2158 stride[1] = Tag2::Size * (
2159 stride[0] = Tag3::Size ));
2162 static void assign(
unsigned * stride ,
2163 const unsigned & n1 )
2166 stride[1] = Tag2::Size * (
2167 stride[0] = Tag3::Size ));
2170 static void assign(
unsigned * stride ,
2171 const unsigned & n1 ,
2172 const unsigned & n2 )
2176 stride[0] = Tag3::Size ));
2179 static void assign(
unsigned * stride ,
2180 const unsigned & n1 ,
2181 const unsigned & n2 ,
2182 const unsigned & n3 )
2189 static void assign(
unsigned * stride ,
2190 const unsigned *
const dims )
2192 stride[2] = dims[0] * (
2193 stride[1] = dims[1] * (
2194 stride[0] = dims[2] ));
2198 template<
class Tag1 ,
class Tag2 >
2199 struct Array<void,
NaturalOrder,Tag1,Tag2,void,void,void,void,void,void>
2203 static void assign(
unsigned * stride )
2204 { stride[1] = Tag1::Size * ( stride[0] = Tag2::Size ); }
2206 static void assign(
unsigned * stride ,
2207 const unsigned & n1 )
2208 { stride[1] = n1 * ( stride[0] = Tag2::Size ); }
2210 static void assign(
unsigned * stride ,
2211 const unsigned & n1 ,
2212 const unsigned & n2 )
2213 { stride[1] = n1 * ( stride[0] = n2 ); }
2215 static void assign(
unsigned * stride ,
2216 const unsigned *
const dims )
2218 stride[1] = dims[0] * (
2219 stride[0] = dims[1] );
2223 template<
class Tag1 >
2224 struct Array<void,
NaturalOrder,Tag1,void,void,void,void,void,void,void>
2228 static void assign(
unsigned * stride ) { stride[0] = Tag1::Size ; }
2230 static void assign(
unsigned * stride ,
2231 const unsigned & n1 ) { stride[0] = n1 ; }
2233 static void assign(
unsigned * stride ,
2234 const unsigned *
const dims )
2235 { stride[0] = dims[0] ; }
2241 struct Array<void,
RankZero,void,void,void,void,void,void,void,void>
2245 static void assign(
unsigned * ) {}
unsigned array_stride_size(const unsigned rank, const unsigned *const stride)
Return the total number of members from the array stride.
Use the Natural or C-language ordering for multi-dimensions where the right-most dimension is stride-...
Use the Reverse or Fortran-language ordering for multi-dimensions where the left-most dimension is st...
void array_stride_to_natural_indices(const unsigned rank, const unsigned *const stride, const unsigned offset, unsigned *const indices)
Generate natural indices from array stride.
ArrayOrder
Define Natural (C-language) or Fortran ordering of array dimensions. A RankZero array does not ha...
void array_stride_to_natural_dimensions(const unsigned rank, const unsigned *const stride, unsigned *const dim)
Generate natural dimension from array stride.
Special tag to indicate that an array specification has degenerated to rank-zero, i...