10 #ifndef Shards_Array_hpp
11 #define Shards_Array_hpp
17 #include <Shards_SimpleArrayOps.hpp>
22 #ifdef SHARDS_ARRAY_BOUNDS_CHECKING
23 #define SHARDS_ARRAY_CHECK( X ) X
25 #define SHARDS_ARRAY_CHECK( X )
36 namespace array_traits {
66 class Tag1 = void ,
class Tag2 = void ,
67 class Tag3 = void ,
class Tag4 = void ,
68 class Tag5 = void ,
class Tag6 = void ,
69 class Tag7 = void ,
class Tag8 =
void >
100 typedef array_traits::int_t size_type ;
103 virtual const char *
name()
const = 0 ;
109 virtual std::string
to_string( size_type dimension ,
110 size_type index )
const ;
116 virtual size_type
to_index( size_type dimension ,
117 const std::string & label )
const ;
135 const char *
name()
const ;
150 #define SHARDS_ARRAY_DIM_TAG_SIMPLE_DECLARATION( ADT ) \
151 class ADT : public shards::ArrayDimTag { \
153 const char * name() const ; \
154 static const ADT & tag(); \
158 ADT( const ADT & ); \
159 ADT & operator = ( const ADT & ); \
165 #define SHARDS_ARRAY_DIM_TAG_SIMPLE_IMPLEMENTATION( ADT ) \
168 const char * ADT::name() const { static const char n[] = # ADT; return n; } \
169 const ADT & ADT::tag() { static const ADT self ; return self ; }
182 #ifndef DOXYGEN_COMPILE
185 namespace array_traits {
189 template<
typename iType >
193 const iType *
const stride )
194 {
return 0 < rank ? stride[ rank - 1 ] : 0 ; }
197 template<
typename iType >
199 void stride_to_natural_dimensions(
201 const iType *
const stride ,
205 for ( iType i = 0 ; i < rank ; ++i )
206 { dim[(rank-1)-i] = stride[i] / n ; n = stride[i] ; }
210 template<
typename iType >
212 void stride_to_natural_indices(
214 const iType *
const stride ,
216 iType *
const indices )
218 iType * i = indices ;
219 for (
const iType * s = stride + rank - 1 ; stride < s-- ; ++i ) {
227 template<
typename iType >
229 void stride_from_natural_dimensions(
231 iType *
const stride ,
232 const iType *
const dim )
235 for ( iType i = 0 ; i < rank ; ++i ) { stride[i] = n *= dim[(rank-1)-i]; }
240 void throw_bad_conversion(
const int_t lhs_rank ,
241 const ArrayDimTag *
const lhs_tags[] ,
242 const int_t rhs_rank ,
243 const ArrayDimTag *
const rhs_tags[] );
245 void check_rank(
const int_t rank ,
246 const int_t test_rank );
248 void check_range(
const int_t index ,
const int_t bound );
250 void check_indices(
const bool ,
252 const int_t *
const stride ,
264 const int_t src_dimension[] ,
265 const int_t rank ,
const bool natural );
268 const ArrayDimTag * dst_tag[] ,
269 const ArrayDimTag *
const src_tag[] ,
270 const int_t rank ,
const bool natural );
274 template<
int_t ,
int_t >
struct CheckRank ;
276 template<>
struct CheckRank<0,0> {
static void ok(){} };
277 template<>
struct CheckRank<1,1> {
static void ok(){} };
278 template<>
struct CheckRank<2,2> {
static void ok(){} };
279 template<>
struct CheckRank<3,3> {
static void ok(){} };
280 template<>
struct CheckRank<4,4> {
static void ok(){} };
281 template<>
struct CheckRank<5,5> {
static void ok(){} };
282 template<>
struct CheckRank<6,6> {
static void ok(){} };
283 template<>
struct CheckRank<7,7> {
static void ok(){} };
284 template<>
struct CheckRank<8,8> {
static void ok(){} };
288 template<
int_t Index ,
int_t Bound >
struct CheckRange ;
290 template<>
struct CheckRange<0,8> {
static void ok(){} };
291 template<>
struct CheckRange<1,8> {
static void ok(){} };
292 template<>
struct CheckRange<2,8> {
static void ok(){} };
293 template<>
struct CheckRange<3,8> {
static void ok(){} };
294 template<>
struct CheckRange<4,8> {
static void ok(){} };
295 template<>
struct CheckRange<5,8> {
static void ok(){} };
296 template<>
struct CheckRange<6,8> {
static void ok(){} };
297 template<>
struct CheckRange<7,8> {
static void ok(){} };
299 template<>
struct CheckRange<0,7> {
static void ok(){} };
300 template<>
struct CheckRange<1,7> {
static void ok(){} };
301 template<>
struct CheckRange<2,7> {
static void ok(){} };
302 template<>
struct CheckRange<3,7> {
static void ok(){} };
303 template<>
struct CheckRange<4,7> {
static void ok(){} };
304 template<>
struct CheckRange<5,7> {
static void ok(){} };
305 template<>
struct CheckRange<6,7> {
static void ok(){} };
307 template<>
struct CheckRange<0,6> {
static void ok(){} };
308 template<>
struct CheckRange<1,6> {
static void ok(){} };
309 template<>
struct CheckRange<2,6> {
static void ok(){} };
310 template<>
struct CheckRange<3,6> {
static void ok(){} };
311 template<>
struct CheckRange<4,6> {
static void ok(){} };
312 template<>
struct CheckRange<5,6> {
static void ok(){} };
314 template<>
struct CheckRange<0,5> {
static void ok(){} };
315 template<>
struct CheckRange<1,5> {
static void ok(){} };
316 template<>
struct CheckRange<2,5> {
static void ok(){} };
317 template<>
struct CheckRange<3,5> {
static void ok(){} };
318 template<>
struct CheckRange<4,5> {
static void ok(){} };
320 template<>
struct CheckRange<0,4> {
static void ok(){} };
321 template<>
struct CheckRange<1,4> {
static void ok(){} };
322 template<>
struct CheckRange<2,4> {
static void ok(){} };
323 template<>
struct CheckRange<3,4> {
static void ok(){} };
325 template<>
struct CheckRange<0,3> {
static void ok(){} };
326 template<>
struct CheckRange<1,3> {
static void ok(){} };
327 template<>
struct CheckRange<2,3> {
static void ok(){} };
329 template<>
struct CheckRange<0,2> {
static void ok(){} };
330 template<>
struct CheckRange<1,2> {
static void ok(){} };
332 template<>
struct CheckRange<0,1> {
static void ok(){} };
336 template<
class ,
int_t >
struct TagAt ;
338 template<
typename Scalar ,
ArrayOrder order ,
339 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
340 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
341 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,0>
342 {
typedef Tag1 type ; };
344 template<
typename Scalar ,
ArrayOrder order ,
345 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
346 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
347 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,1>
348 {
typedef Tag2 type ; };
350 template<
typename Scalar ,
ArrayOrder order ,
351 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
352 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
353 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,2>
354 {
typedef Tag3 type ; };
356 template<
typename Scalar ,
ArrayOrder order ,
357 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
358 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
359 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,3>
360 {
typedef Tag4 type ; };
362 template<
typename Scalar ,
ArrayOrder order ,
363 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
364 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
365 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,4>
366 {
typedef Tag5 type ; };
368 template<
typename Scalar ,
ArrayOrder order ,
369 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
370 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
371 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,5>
372 {
typedef Tag6 type ; };
374 template<
typename Scalar ,
ArrayOrder order ,
375 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
376 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
377 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,6>
378 {
typedef Tag7 type ; };
380 template<
typename Scalar ,
ArrayOrder order ,
381 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
382 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
383 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,7>
384 {
typedef Tag8 type ; };
389 template< ArrayOrder ,
int_t Rank ,
int_t Ordinal = 0 >
struct StrideDim ;
391 template<
int_t Rank ,
int_t Ordinal >
392 struct StrideDim<RankZero,Rank,Ordinal> {
394 template<
typename iType >
395 static iType dimension(
const iType * )
398 template<
typename iType >
399 static iType dimension(
const iType * , iType )
403 template<
int_t Rank >
404 struct StrideDim<FortranOrder,Rank,0> {
406 template<
typename iType >
407 static iType dimension(
const iType * stride )
409 array_traits::CheckRange<0,Rank>::ok();
413 template<
typename iType >
414 static iType dimension(
const iType * stride , iType ordinal )
416 array_traits::check_range(ordinal,Rank);
417 return ordinal ? stride[ordinal] / stride[ordinal-1] : stride[0] ;
421 template<
int_t Rank >
422 struct StrideDim<NaturalOrder,Rank,0> {
424 template<
typename iType >
425 static iType dimension(
const iType * stride )
427 array_traits::CheckRange<0,Rank>::ok();
431 template<
typename iType >
432 static iType dimension(
const iType * stride , iType ordinal )
434 array_traits::check_range(ordinal,Rank);
435 ordinal = ( Rank - 1 ) - ordinal ;
436 return ordinal ? stride[ordinal] / stride[ordinal-1] : stride[0] ;
440 template<
int_t Rank ,
int_t Ordinal >
441 struct StrideDim<FortranOrder,Rank,Ordinal> {
443 template<
typename iType >
444 static iType dimension(
const iType * stride )
446 array_traits::CheckRange<Ordinal,Rank>::ok();
447 return stride[Ordinal] / stride[Ordinal-1];
451 template<
int_t Rank ,
int_t Ordinal >
452 struct StrideDim<NaturalOrder,Rank,Ordinal> {
454 template<
typename iType >
455 static iType dimension(
const iType * stride )
457 enum { I = ( Rank - 1 ) - Ordinal };
458 array_traits::CheckRange<Ordinal,Rank>::ok();
459 return stride[I] / stride[I-1];
465 template< ArrayOrder >
struct Offset ;
468 struct Offset<FortranOrder> {
470 template<
typename isType ,
typename iType >
471 static iType op(
const isType *
const stride ,
472 const iType & i1 ,
const iType & i2 ,
473 const iType & i3 ,
const iType & i4 ,
474 const iType & i5 ,
const iType & i6 ,
475 const iType & i7 ,
const iType & i8 )
477 SHARDS_ARRAY_CHECK(check_indices(
false,8,stride,i1,i2,i3,i4,i5,i6,i7,i8));
478 return i1 + i2 * stride[0] +
479 i3 * stride[1] + i4 * stride[2] +
480 i5 * stride[3] + i6 * stride[4] +
481 i7 * stride[5] + i8 * stride[6] ;
484 template<
typename isType ,
typename iType >
485 static iType op(
const isType *
const stride ,
486 const iType & i1 ,
const iType & i2 ,
487 const iType & i3 ,
const iType & i4 ,
488 const iType & i5 ,
const iType & i6 ,
491 SHARDS_ARRAY_CHECK(check_indices(
false,7,stride,i1,i2,i3,i4,i5,i6,i7));
492 return i1 + i2 * stride[0] +
493 i3 * stride[1] + i4 * stride[2] +
494 i5 * stride[3] + i6 * stride[4] +
498 template<
typename isType ,
typename iType >
499 static iType op(
const isType *
const stride ,
500 const iType & i1 ,
const iType & i2 ,
501 const iType & i3 ,
const iType & i4 ,
502 const iType & i5 ,
const iType & i6 )
504 SHARDS_ARRAY_CHECK(check_indices(
false,6,stride,i1,i2,i3,i4,i5,i6));
505 return i1 + i2 * stride[0] +
506 i3 * stride[1] + i4 * stride[2] +
507 i5 * stride[3] + i6 * stride[4] ;
510 template<
typename isType ,
typename iType >
511 static iType op(
const isType *
const stride ,
512 const iType & i1 ,
const iType & i2 ,
513 const iType & i3 ,
const iType & i4 ,
516 SHARDS_ARRAY_CHECK(check_indices(
false,5,stride,i1,i2,i3,i4,i5));
517 return i1 + i2 * stride[0] +
518 i3 * stride[1] + i4 * stride[2] +
522 template<
typename isType ,
typename iType >
523 static iType op(
const isType *
const stride ,
524 const iType & i1 ,
const iType & i2 ,
525 const iType & i3 ,
const iType & i4 )
527 SHARDS_ARRAY_CHECK(check_indices(
false,4,stride,i1,i2,i3,i4));
528 return i1 + i2 * stride[0] +
529 i3 * stride[1] + i4 * stride[2] ;
532 template<
typename isType ,
typename iType >
533 static iType op(
const isType *
const stride ,
534 const iType & i1 ,
const iType & i2 ,
537 SHARDS_ARRAY_CHECK(check_indices(
false,3,stride,i1,i2,i3));
538 return i1 + i2 * stride[0] + i3 * stride[1] ;
541 template<
typename isType ,
typename iType >
542 static iType op(
const isType *
const stride ,
543 const iType & i1 ,
const iType & i2 )
545 SHARDS_ARRAY_CHECK(check_indices(
false,2,stride,i1,i2));
546 return i1 + i2 * stride[0] ;
549 template<
typename isType ,
typename iType >
550 static iType op(
const isType *
const SHARDS_ARRAY_CHECK( stride ) ,
553 SHARDS_ARRAY_CHECK(check_indices(
false,1,stride,i1));
561 struct Offset<NaturalOrder> {
563 template<
typename isType ,
typename iType >
564 static iType op(
const isType *
const stride ,
565 const iType & i1 ,
const iType & i2 ,
566 const iType & i3 ,
const iType & i4 ,
567 const iType & i5 ,
const iType & i6 ,
568 const iType & i7 ,
const iType & i8 )
570 SHARDS_ARRAY_CHECK(check_indices(
true,8,stride,i1,i2,i3,i4,i5,i6,i7,i8));
571 return i8 + i7 * stride[0] +
572 i6 * stride[1] + i5 * stride[2] +
573 i4 * stride[3] + i3 * stride[4] +
574 i2 * stride[5] + i1 * stride[6] ;
577 template<
typename isType ,
typename iType >
578 static iType op(
const isType *
const stride ,
579 const iType & i1 ,
const iType & i2 ,
580 const iType & i3 ,
const iType & i4 ,
581 const iType & i5 ,
const iType & i6 ,
584 SHARDS_ARRAY_CHECK(check_indices(
true,7,stride,i1,i2,i3,i4,i5,i6,i7));
585 return i7 + i6 * stride[0] +
586 i5 * stride[1] + i4 * stride[2] +
587 i3 * stride[3] + i2 * stride[4] +
591 template<
typename isType ,
typename iType >
592 static iType op(
const isType *
const stride ,
593 const iType & i1 ,
const iType & i2 ,
594 const iType & i3 ,
const iType & i4 ,
595 const iType & i5 ,
const iType & i6 )
597 SHARDS_ARRAY_CHECK(check_indices(
true,6,stride,i1,i2,i3,i4,i5,i6));
598 return i6 + i5 * stride[0] +
599 i4 * stride[1] + i3 * stride[2] +
600 i2 * stride[3] + i1 * stride[4] ;
603 template<
typename isType ,
typename iType >
604 static iType op(
const isType *
const stride ,
605 const iType & i1 ,
const iType & i2 ,
606 const iType & i3 ,
const iType & i4 ,
609 SHARDS_ARRAY_CHECK(check_indices(
true,5,stride,i1,i2,i3,i4,i5));
610 return i5 + i4 * stride[0] +
611 i3 * stride[1] + i2 * stride[2] +
615 template<
typename isType ,
typename iType >
616 static iType op(
const isType *
const stride ,
617 const iType & i1 ,
const iType & i2 ,
618 const iType & i3 ,
const iType & i4 )
620 SHARDS_ARRAY_CHECK(check_indices(
true,4,stride,i1,i2,i3,i4));
621 return i4 + i3 * stride[0] +
622 i2 * stride[1] + i1 * stride[2] ;
625 template<
typename isType ,
typename iType >
626 static iType op(
const isType *
const stride ,
627 const iType & i1 ,
const iType & i2 ,
630 SHARDS_ARRAY_CHECK(check_indices(
true,3,stride,i1,i2,i3));
631 return i3 + i2 * stride[0] + i1 * stride[1] ;
634 template<
typename isType ,
typename iType >
635 static iType op(
const isType *
const stride ,
636 const iType & i1 ,
const iType & i2 )
638 SHARDS_ARRAY_CHECK(check_indices(
true,2,stride,i1,i2));
639 return i2 + i1 * stride[0] ;
642 template<
typename isType ,
typename iType >
643 static iType op(
const isType *
const SHARDS_ARRAY_CHECK( stride ) ,
646 SHARDS_ARRAY_CHECK(check_indices(
true,1,stride,i1));
654 template<
typename Scalar ,
ArrayOrder Order ,
655 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
656 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
662 template<
typename Scalar ,
663 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
664 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
665 struct Helper<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
668 Array<Scalar,FortranOrder,Tag8,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1>
672 Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8,void>
677 static bool verify(
const int_t rank ,
const ArrayDimTag *
const tags[] )
679 return rank == Rank &&
680 tags[0] == & Tag8::tag() &&
681 tags[1] == & Tag7::tag() &&
682 tags[2] == & Tag6::tag() &&
683 tags[3] == & Tag5::tag() &&
684 tags[4] == & Tag4::tag() &&
685 tags[5] == & Tag3::tag() &&
686 tags[6] == & Tag2::tag() &&
687 tags[7] == & Tag1::tag() ;
690 static void assign_tags(
const ArrayDimTag * tags[] )
692 tags[0] = & Tag8::tag();
693 tags[1] = & Tag7::tag();
694 tags[2] = & Tag6::tag();
695 tags[3] = & Tag5::tag();
696 tags[4] = & Tag4::tag();
697 tags[5] = & Tag3::tag();
698 tags[6] = & Tag2::tag();
699 tags[7] = & Tag1::tag();
702 template<
typename iType >
703 static void assign( iType * stride )
705 stride[7] = Tag1::Size * (
706 stride[6] = Tag2::Size * (
707 stride[5] = Tag3::Size * (
708 stride[4] = Tag4::Size * (
709 stride[3] = Tag5::Size * (
710 stride[2] = Tag6::Size * (
711 stride[1] = Tag7::Size * (
712 stride[0] = Tag8::Size )))))));
715 template<
typename iType >
716 static void assign( iType * stride ,
720 stride[6] = Tag2::Size * (
721 stride[5] = Tag3::Size * (
722 stride[4] = Tag4::Size * (
723 stride[3] = Tag5::Size * (
724 stride[2] = Tag6::Size * (
725 stride[1] = Tag7::Size * (
726 stride[0] = Tag8::Size )))))));
729 template<
typename iType >
730 static void assign( iType * stride ,
736 stride[5] = Tag3::Size * (
737 stride[4] = Tag4::Size * (
738 stride[3] = Tag5::Size * (
739 stride[2] = Tag6::Size * (
740 stride[1] = Tag7::Size * (
741 stride[0] = Tag8::Size )))))));
744 template<
typename iType >
745 static void assign( iType * stride ,
753 stride[4] = Tag4::Size * (
754 stride[3] = Tag5::Size * (
755 stride[2] = Tag6::Size * (
756 stride[1] = Tag7::Size * (
757 stride[0] = Tag8::Size )))))));
760 template<
typename iType >
761 static void assign( iType * stride ,
771 stride[3] = Tag5::Size * (
772 stride[2] = Tag6::Size * (
773 stride[1] = Tag7::Size * (
774 stride[0] = Tag8::Size )))))));
777 template<
typename iType >
778 static void assign( iType * stride ,
790 stride[2] = Tag6::Size * (
791 stride[1] = Tag7::Size * (
792 stride[0] = Tag8::Size )))))));
795 template<
typename iType >
796 static void assign( iType * stride ,
810 stride[1] = Tag7::Size * (
811 stride[0] = Tag8::Size )))))));
814 template<
typename iType >
815 static void assign( iType * stride ,
831 stride[0] = Tag8::Size )))))));
834 template<
typename iType >
835 static void assign( iType * stride ,
852 stride[0] = n8 )))))));
855 template<
typename iType >
856 static void assign( iType * stride ,
857 const iType *
const dims )
859 stride[7] = dims[0] * (
860 stride[6] = dims[1] * (
861 stride[5] = dims[2] * (
862 stride[4] = dims[3] * (
863 stride[3] = dims[4] * (
864 stride[2] = dims[5] * (
865 stride[1] = dims[6] * (
866 stride[0] = dims[7] )))))));
870 template<
typename Scalar ,
871 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
872 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
873 struct Helper<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
876 Array<Scalar,NaturalOrder,Tag8,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1>
880 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
885 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
887 return rank == Rank &&
888 tags[0] == & Tag1::tag() &&
889 tags[1] == & Tag2::tag() &&
890 tags[2] == & Tag3::tag() &&
891 tags[3] == & Tag4::tag() &&
892 tags[4] == & Tag5::tag() &&
893 tags[5] == & Tag6::tag() &&
894 tags[6] == & Tag7::tag() &&
895 tags[7] == & Tag8::tag();
898 static void assign_tags(
const ArrayDimTag * tags[] )
900 tags[0] = & Tag1::tag();
901 tags[1] = & Tag2::tag();
902 tags[2] = & Tag3::tag();
903 tags[3] = & Tag4::tag();
904 tags[4] = & Tag5::tag();
905 tags[5] = & Tag6::tag();
906 tags[6] = & Tag7::tag();
907 tags[7] = & Tag8::tag();
910 template<
typename iType >
911 static void assign( iType * stride )
913 stride[7] = Tag8::Size * (
914 stride[6] = Tag7::Size * (
915 stride[5] = Tag6::Size * (
916 stride[4] = Tag5::Size * (
917 stride[3] = Tag4::Size * (
918 stride[2] = Tag3::Size * (
919 stride[1] = Tag2::Size * (
920 stride[0] = Tag1::Size )))))));
923 template<
typename iType >
924 static void assign( iType * stride ,
928 stride[6] = Tag7::Size * (
929 stride[5] = Tag6::Size * (
930 stride[4] = Tag5::Size * (
931 stride[3] = Tag4::Size * (
932 stride[2] = Tag3::Size * (
933 stride[1] = Tag2::Size * (
934 stride[0] = Tag1::Size )))))));
937 template<
typename iType >
938 static void assign( iType * stride ,
944 stride[5] = Tag6::Size * (
945 stride[4] = Tag5::Size * (
946 stride[3] = Tag4::Size * (
947 stride[2] = Tag3::Size * (
948 stride[1] = Tag2::Size * (
949 stride[0] = Tag1::Size )))))));
952 template<
typename iType >
953 static void assign( iType * stride ,
961 stride[4] = Tag5::Size * (
962 stride[3] = Tag4::Size * (
963 stride[2] = Tag3::Size * (
964 stride[1] = Tag2::Size * (
965 stride[0] = Tag1::Size )))))));
968 template<
typename iType >
969 static void assign( iType * stride ,
979 stride[3] = Tag4::Size * (
980 stride[2] = Tag3::Size * (
981 stride[1] = Tag2::Size * (
982 stride[0] = Tag1::Size )))))));
985 template<
typename iType >
986 static void assign( iType * stride ,
998 stride[2] = Tag3::Size * (
999 stride[1] = Tag2::Size * (
1000 stride[0] = Tag1::Size )))))));
1003 template<
typename iType >
1004 static void assign( iType * stride ,
1018 stride[1] = Tag2::Size * (
1019 stride[0] = Tag1::Size )))))));
1022 template<
typename iType >
1023 static void assign( iType * stride ,
1039 stride[0] = Tag1::Size )))))));
1042 template<
typename iType >
1043 static void assign( iType * stride ,
1060 stride[0] = n1 )))))));
1063 template<
typename iType >
1064 static void assign( iType * stride ,
1065 const iType *
const dims )
1067 stride[7] = dims[7] * (
1068 stride[6] = dims[6] * (
1069 stride[5] = dims[5] * (
1070 stride[4] = dims[4] * (
1071 stride[3] = dims[3] * (
1072 stride[2] = dims[2] * (
1073 stride[1] = dims[1] * (
1074 stride[0] = dims[0] )))))));
1081 template<
typename Scalar ,
1082 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1083 class Tag5 ,
class Tag6 ,
class Tag7 >
1084 struct Helper<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
1087 Array<Scalar,FortranOrder,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void>
1091 Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void,void>
1094 template<
class TagA >
1097 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>
1101 Array<Scalar,FortranOrder,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,TagA>
1104 typedef natural type ;
1105 typedef fortran reverse ;
1110 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
1112 return rank == Rank &&
1113 tags[0] == & Tag7::tag() &&
1114 tags[1] == & Tag6::tag() &&
1115 tags[2] == & Tag5::tag() &&
1116 tags[3] == & Tag4::tag() &&
1117 tags[4] == & Tag3::tag() &&
1118 tags[5] == & Tag2::tag() &&
1119 tags[6] == & Tag1::tag() ;
1122 static void assign_tags(
const ArrayDimTag * tags[] )
1124 tags[0] = & Tag7::tag();
1125 tags[1] = & Tag6::tag();
1126 tags[2] = & Tag5::tag();
1127 tags[3] = & Tag4::tag();
1128 tags[4] = & Tag3::tag();
1129 tags[5] = & Tag2::tag();
1130 tags[6] = & Tag1::tag();
1134 template<
typename iType >
1135 static void assign( iType * stride )
1138 stride[6] = Tag1::Size * (
1139 stride[5] = Tag2::Size * (
1140 stride[4] = Tag3::Size * (
1141 stride[3] = Tag4::Size * (
1142 stride[2] = Tag5::Size * (
1143 stride[1] = Tag6::Size * (
1144 stride[0] = Tag7::Size ))))));
1147 template<
typename iType >
1148 static void assign( iType * stride ,
1153 stride[5] = Tag2::Size * (
1154 stride[4] = Tag3::Size * (
1155 stride[3] = Tag4::Size * (
1156 stride[2] = Tag5::Size * (
1157 stride[1] = Tag6::Size * (
1158 stride[0] = Tag7::Size ))))));
1161 template<
typename iType >
1162 static void assign( iType * stride ,
1169 stride[4] = Tag3::Size * (
1170 stride[3] = Tag4::Size * (
1171 stride[2] = Tag5::Size * (
1172 stride[1] = Tag6::Size * (
1173 stride[0] = Tag7::Size ))))));
1176 template<
typename iType >
1177 static void assign( iType * stride ,
1186 stride[3] = Tag4::Size * (
1187 stride[2] = Tag5::Size * (
1188 stride[1] = Tag6::Size * (
1189 stride[0] = Tag7::Size ))))));
1192 template<
typename iType >
1193 static void assign( iType * stride ,
1204 stride[2] = Tag5::Size * (
1205 stride[1] = Tag6::Size * (
1206 stride[0] = Tag7::Size ))))));
1209 template<
typename iType >
1210 static void assign( iType * stride ,
1223 stride[1] = Tag6::Size * (
1224 stride[0] = Tag7::Size ))))));
1227 template<
typename iType >
1228 static void assign( iType * stride ,
1243 stride[0] = Tag7::Size ))))));
1246 template<
typename iType >
1247 static void assign( iType * stride ,
1263 stride[0] = n7 ))))));
1266 template<
typename iType >
1267 static void assign( iType * stride ,
1268 const iType *
const dims )
1271 stride[6] = dims[0] * (
1272 stride[5] = dims[1] * (
1273 stride[4] = dims[2] * (
1274 stride[3] = dims[3] * (
1275 stride[2] = dims[4] * (
1276 stride[1] = dims[5] * (
1277 stride[0] = dims[6] ))))));
1281 template<
typename Scalar ,
1282 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1283 class Tag5 ,
class Tag6 ,
class Tag7 >
1284 struct Helper<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
1287 Array<Scalar,NaturalOrder,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void>
1291 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void>
1294 template<
class TagA >
1297 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,TagA>
1301 Array<Scalar,NaturalOrder,TagA,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1>
1304 typedef fortran type ;
1305 typedef natural reverse ;
1310 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
1312 return rank == Rank &&
1313 tags[0] == & Tag1::tag() &&
1314 tags[1] == & Tag2::tag() &&
1315 tags[2] == & Tag3::tag() &&
1316 tags[3] == & Tag4::tag() &&
1317 tags[4] == & Tag5::tag() &&
1318 tags[5] == & Tag6::tag() &&
1319 tags[6] == & Tag7::tag();
1322 static void assign_tags(
const ArrayDimTag * tags[] )
1324 tags[0] = & Tag1::tag();
1325 tags[1] = & Tag2::tag();
1326 tags[2] = & Tag3::tag();
1327 tags[3] = & Tag4::tag();
1328 tags[4] = & Tag5::tag();
1329 tags[5] = & Tag6::tag();
1330 tags[6] = & Tag7::tag();
1334 template<
typename iType >
1335 static void assign( iType * stride )
1338 stride[6] = Tag7::Size * (
1339 stride[5] = Tag6::Size * (
1340 stride[4] = Tag5::Size * (
1341 stride[3] = Tag4::Size * (
1342 stride[2] = Tag3::Size * (
1343 stride[1] = Tag2::Size * (
1344 stride[0] = Tag1::Size ))))));
1347 template<
typename iType >
1348 static void assign( iType * stride ,
1353 stride[5] = Tag6::Size * (
1354 stride[4] = Tag5::Size * (
1355 stride[3] = Tag4::Size * (
1356 stride[2] = Tag3::Size * (
1357 stride[1] = Tag2::Size * (
1358 stride[0] = Tag1::Size ))))));
1361 template<
typename iType >
1362 static void assign( iType * stride ,
1369 stride[4] = Tag5::Size * (
1370 stride[3] = Tag4::Size * (
1371 stride[2] = Tag3::Size * (
1372 stride[1] = Tag2::Size * (
1373 stride[0] = Tag1::Size ))))));
1376 template<
typename iType >
1377 static void assign( iType * stride ,
1386 stride[3] = Tag4::Size * (
1387 stride[2] = Tag3::Size * (
1388 stride[1] = Tag2::Size * (
1389 stride[0] = Tag1::Size ))))));
1392 template<
typename iType >
1393 static void assign( iType * stride ,
1404 stride[2] = Tag3::Size * (
1405 stride[1] = Tag2::Size * (
1406 stride[0] = Tag1::Size ))))));
1409 template<
typename iType >
1410 static void assign( iType * stride ,
1423 stride[1] = Tag2::Size * (
1424 stride[0] = Tag1::Size ))))));
1427 template<
typename iType >
1428 static void assign( iType * stride ,
1443 stride[0] = Tag1::Size ))))));
1446 template<
typename iType >
1447 static void assign( iType * stride ,
1463 stride[0] = n1 ))))));
1466 template<
typename iType >
1467 static void assign( iType * stride ,
1468 const iType *
const dims )
1471 stride[6] = dims[6] * (
1472 stride[5] = dims[5] * (
1473 stride[4] = dims[4] * (
1474 stride[3] = dims[3] * (
1475 stride[2] = dims[2] * (
1476 stride[1] = dims[1] * (
1477 stride[0] = dims[0] ))))));
1484 template<
typename Scalar ,
1485 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1486 class Tag5 ,
class Tag6 >
1487 struct Helper<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void>
1490 Array<Scalar,FortranOrder,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void,void>
1494 Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,Tag5,Tag6,void,void,void>
1497 template<
class TagA >
1500 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void>
1504 Array<Scalar,FortranOrder,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,TagA,void>
1507 typedef natural type ;
1508 typedef fortran reverse ;
1513 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
1515 return rank == Rank &&
1516 tags[0] == & Tag6::tag() &&
1517 tags[1] == & Tag5::tag() &&
1518 tags[2] == & Tag4::tag() &&
1519 tags[3] == & Tag3::tag() &&
1520 tags[4] == & Tag2::tag() &&
1521 tags[5] == & Tag1::tag();
1524 static void assign_tags(
const ArrayDimTag * tags[] )
1526 tags[0] = & Tag6::tag();
1527 tags[1] = & Tag5::tag();
1528 tags[2] = & Tag4::tag();
1529 tags[3] = & Tag3::tag();
1530 tags[4] = & Tag2::tag();
1531 tags[5] = & Tag1::tag();
1536 template<
typename iType >
1537 static void assign( iType * stride )
1541 stride[5] = Tag1::Size * (
1542 stride[4] = Tag2::Size * (
1543 stride[3] = Tag3::Size * (
1544 stride[2] = Tag4::Size * (
1545 stride[1] = Tag5::Size * (
1546 stride[0] = Tag6::Size )))));
1549 template<
typename iType >
1550 static void assign( iType * stride ,
1556 stride[4] = Tag2::Size * (
1557 stride[3] = Tag3::Size * (
1558 stride[2] = Tag4::Size * (
1559 stride[1] = Tag5::Size * (
1560 stride[0] = Tag6::Size )))));
1563 template<
typename iType >
1564 static void assign( iType * stride ,
1572 stride[3] = Tag3::Size * (
1573 stride[2] = Tag4::Size * (
1574 stride[1] = Tag5::Size * (
1575 stride[0] = Tag6::Size )))));
1578 template<
typename iType >
1579 static void assign( iType * stride ,
1589 stride[2] = Tag4::Size * (
1590 stride[1] = Tag5::Size * (
1591 stride[0] = Tag6::Size )))));
1594 template<
typename iType >
1595 static void assign( iType * stride ,
1607 stride[1] = Tag5::Size * (
1608 stride[0] = Tag6::Size )))));
1611 template<
typename iType >
1612 static void assign( iType * stride ,
1626 stride[0] = Tag6::Size )))));
1629 template<
typename iType >
1630 static void assign( iType * stride ,
1645 stride[0] = n6 )))));
1648 template<
typename iType >
1649 static void assign( iType * stride ,
1650 const iType *
const dims )
1654 stride[5] = dims[0] * (
1655 stride[4] = dims[1] * (
1656 stride[3] = dims[2] * (
1657 stride[2] = dims[3] * (
1658 stride[1] = dims[4] * (
1659 stride[0] = dims[5] )))));
1663 template<
typename Scalar ,
1664 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1665 class Tag5 ,
class Tag6 >
1666 struct Helper<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void>
1669 Array<Scalar,NaturalOrder,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void,void>
1673 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void>
1676 template<
class TagA >
1679 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,TagA,void>
1683 Array<Scalar,NaturalOrder,TagA,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void>
1686 typedef fortran type ;
1687 typedef natural reverse ;
1692 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
1694 return rank == Rank &&
1695 tags[0] == & Tag1::tag() &&
1696 tags[1] == & Tag2::tag() &&
1697 tags[2] == & Tag3::tag() &&
1698 tags[3] == & Tag4::tag() &&
1699 tags[4] == & Tag5::tag() &&
1700 tags[5] == & Tag6::tag();
1703 static void assign_tags(
const ArrayDimTag * tags[] )
1705 tags[0] = & Tag1::tag();
1706 tags[1] = & Tag2::tag();
1707 tags[2] = & Tag3::tag();
1708 tags[3] = & Tag4::tag();
1709 tags[4] = & Tag5::tag();
1710 tags[5] = & Tag6::tag();
1715 template<
typename iType >
1716 static void assign( iType * stride )
1720 stride[5] = Tag6::Size * (
1721 stride[4] = Tag5::Size * (
1722 stride[3] = Tag4::Size * (
1723 stride[2] = Tag3::Size * (
1724 stride[1] = Tag2::Size * (
1725 stride[0] = Tag1::Size )))));
1728 template<
typename iType >
1729 static void assign( iType * stride ,
1735 stride[4] = Tag5::Size * (
1736 stride[3] = Tag4::Size * (
1737 stride[2] = Tag3::Size * (
1738 stride[1] = Tag2::Size * (
1739 stride[0] = Tag1::Size )))));
1742 template<
typename iType >
1743 static void assign( iType * stride ,
1751 stride[3] = Tag4::Size * (
1752 stride[2] = Tag3::Size * (
1753 stride[1] = Tag2::Size * (
1754 stride[0] = Tag1::Size )))));
1757 template<
typename iType >
1758 static void assign( iType * stride ,
1768 stride[2] = Tag3::Size * (
1769 stride[1] = Tag2::Size * (
1770 stride[0] = Tag1::Size )))));
1773 template<
typename iType >
1774 static void assign( iType * stride ,
1786 stride[1] = Tag2::Size * (
1787 stride[0] = Tag1::Size )))));
1790 template<
typename iType >
1791 static void assign( iType * stride ,
1805 stride[0] = Tag1::Size )))));
1808 template<
typename iType >
1809 static void assign( iType * stride ,
1824 stride[0] = n1 )))));
1827 template<
typename iType >
1828 static void assign( iType * stride ,
1829 const iType *
const dims )
1833 stride[5] = dims[5] * (
1834 stride[4] = dims[4] * (
1835 stride[3] = dims[3] * (
1836 stride[2] = dims[2] * (
1837 stride[1] = dims[1] * (
1838 stride[0] = dims[0] )))));
1845 template<
typename Scalar ,
1846 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
class Tag5 >
1847 struct Helper<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void>
1850 Array<Scalar,FortranOrder,Tag5,Tag4,Tag3,Tag2,Tag1,void,void,void>
1854 Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,Tag5,void,void,void,void>
1857 template<
class TagA >
1860 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,Tag3,Tag4,Tag5,void,void>
1864 Array<Scalar,FortranOrder,Tag5,Tag4,Tag3,Tag2,Tag1,TagA,void,void>
1867 typedef natural type ;
1868 typedef fortran reverse ;
1873 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
1875 return rank == Rank &&
1876 tags[0] == & Tag5::tag() &&
1877 tags[1] == & Tag4::tag() &&
1878 tags[2] == & Tag3::tag() &&
1879 tags[3] == & Tag2::tag() &&
1880 tags[4] == & Tag1::tag();
1883 static void assign_tags(
const ArrayDimTag * tags[] )
1885 tags[0] = & Tag5::tag();
1886 tags[1] = & Tag4::tag();
1887 tags[2] = & Tag3::tag();
1888 tags[3] = & Tag2::tag();
1889 tags[4] = & Tag1::tag();
1895 template<
typename iType >
1896 static void assign( iType * stride )
1901 stride[4] = Tag1::Size * (
1902 stride[3] = Tag2::Size * (
1903 stride[2] = Tag3::Size * (
1904 stride[1] = Tag4::Size * (
1905 stride[0] = Tag5::Size ))));
1908 template<
typename iType >
1909 static void assign( iType * stride ,
1916 stride[3] = Tag2::Size * (
1917 stride[2] = Tag3::Size * (
1918 stride[1] = Tag4::Size * (
1919 stride[0] = Tag5::Size ))));
1922 template<
typename iType >
1923 static void assign( iType * stride ,
1932 stride[2] = Tag3::Size * (
1933 stride[1] = Tag4::Size * (
1934 stride[0] = Tag5::Size ))));
1937 template<
typename iType >
1938 static void assign( iType * stride ,
1949 stride[1] = Tag4::Size * (
1950 stride[0] = Tag5::Size ))));
1953 template<
typename iType >
1954 static void assign( iType * stride ,
1967 stride[0] = Tag5::Size ))));
1970 template<
typename iType >
1971 static void assign( iType * stride ,
1985 stride[0] = n5 ))));
1988 template<
typename iType >
1989 static void assign( iType * stride ,
1990 const iType *
const dims )
1995 stride[4] = dims[0] * (
1996 stride[3] = dims[1] * (
1997 stride[2] = dims[2] * (
1998 stride[1] = dims[3] * (
1999 stride[0] = dims[4] ))));
2003 template<
typename Scalar ,
2004 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
class Tag5 >
2005 struct Helper<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void>
2008 Array<Scalar,NaturalOrder,Tag5,Tag4,Tag3,Tag2,Tag1,void,void,void>
2012 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void>
2015 template<
class TagA >
2018 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,TagA,void,void>
2022 Array<Scalar,NaturalOrder,TagA,Tag5,Tag4,Tag3,Tag2,Tag1,void,void>
2025 typedef fortran type ;
2026 typedef natural reverse ;
2031 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2033 return rank == Rank &&
2034 tags[0] == & Tag1::tag() &&
2035 tags[1] == & Tag2::tag() &&
2036 tags[2] == & Tag3::tag() &&
2037 tags[3] == & Tag4::tag() &&
2038 tags[4] == & Tag5::tag();
2041 static void assign_tags(
const ArrayDimTag * tags[] )
2043 tags[0] = & Tag1::tag();
2044 tags[1] = & Tag2::tag();
2045 tags[2] = & Tag3::tag();
2046 tags[3] = & Tag4::tag();
2047 tags[4] = & Tag5::tag();
2053 template<
typename iType >
2054 static void assign( iType * stride )
2059 stride[4] = Tag5::Size * (
2060 stride[3] = Tag4::Size * (
2061 stride[2] = Tag3::Size * (
2062 stride[1] = Tag2::Size * (
2063 stride[0] = Tag1::Size ))));
2066 template<
typename iType >
2067 static void assign( iType * stride ,
2074 stride[3] = Tag4::Size * (
2075 stride[2] = Tag3::Size * (
2076 stride[1] = Tag2::Size * (
2077 stride[0] = Tag1::Size ))));
2080 template<
typename iType >
2081 static void assign( iType * stride ,
2090 stride[2] = Tag3::Size * (
2091 stride[1] = Tag2::Size * (
2092 stride[0] = Tag1::Size ))));
2095 template<
typename iType >
2096 static void assign( iType * stride ,
2107 stride[1] = Tag2::Size * (
2108 stride[0] = Tag1::Size ))));
2111 template<
typename iType >
2112 static void assign( iType * stride ,
2125 stride[0] = Tag1::Size ))));
2128 template<
typename iType >
2129 static void assign( iType * stride ,
2143 stride[0] = n1 ))));
2146 template<
typename iType >
2147 static void assign( iType * stride ,
2148 const iType *
const dims )
2153 stride[4] = dims[4] * (
2154 stride[3] = dims[3] * (
2155 stride[2] = dims[2] * (
2156 stride[1] = dims[1] * (
2157 stride[0] = dims[0] ))));
2164 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 >
2165 struct Helper<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void>
2168 Array<Scalar,FortranOrder,Tag4,Tag3,Tag2,Tag1,void,void,void,void>
2172 Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,void,void,void,void,void>
2175 template<
class TagA >
2178 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,Tag3,Tag4,void,void,void>
2182 Array<Scalar,FortranOrder,Tag4,Tag3,Tag2,Tag1,TagA,void,void,void>
2185 typedef natural type ;
2186 typedef fortran reverse ;
2191 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2193 return rank == Rank &&
2194 tags[0] == & Tag4::tag() &&
2195 tags[1] == & Tag3::tag() &&
2196 tags[2] == & Tag2::tag() &&
2197 tags[3] == & Tag1::tag();
2200 static void assign_tags(
const ArrayDimTag * tags[] )
2202 tags[0] = & Tag4::tag();
2203 tags[1] = & Tag3::tag();
2204 tags[2] = & Tag2::tag();
2205 tags[3] = & Tag1::tag();
2212 template<
typename iType >
2213 static void assign( iType * stride )
2219 stride[3] = Tag1::Size * (
2220 stride[2] = Tag2::Size * (
2221 stride[1] = Tag3::Size * (
2222 stride[0] = Tag4::Size )));
2225 template<
typename iType >
2226 static void assign( iType * stride ,
2234 stride[2] = Tag2::Size * (
2235 stride[1] = Tag3::Size * (
2236 stride[0] = Tag4::Size )));
2239 template<
typename iType >
2240 static void assign( iType * stride ,
2250 stride[1] = Tag3::Size * (
2251 stride[0] = Tag4::Size )));
2254 template<
typename iType >
2255 static void assign( iType * stride ,
2267 stride[0] = Tag4::Size )));
2270 template<
typename iType >
2271 static void assign( iType * stride ,
2287 template<
typename iType >
2288 static void assign( iType * stride ,
2289 const iType *
const dims )
2295 stride[3] = dims[0] * (
2296 stride[2] = dims[1] * (
2297 stride[1] = dims[2] * (
2298 stride[0] = dims[3] )));
2302 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 >
2303 struct Helper<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void>
2306 Array<Scalar,NaturalOrder,Tag4,Tag3,Tag2,Tag1,void,void,void,void>
2310 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void>
2313 template<
class TagA >
2316 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,TagA,void,void,void>
2320 Array<Scalar,NaturalOrder,TagA,Tag4,Tag3,Tag2,Tag1,void,void,void>
2323 typedef fortran type ;
2324 typedef natural reverse ;
2329 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2331 return rank == Rank &&
2332 tags[0] == & Tag1::tag() &&
2333 tags[1] == & Tag2::tag() &&
2334 tags[2] == & Tag3::tag() &&
2335 tags[3] == & Tag4::tag();
2338 static void assign_tags(
const ArrayDimTag * tags[] )
2340 tags[0] = & Tag1::tag();
2341 tags[1] = & Tag2::tag();
2342 tags[2] = & Tag3::tag();
2343 tags[3] = & Tag4::tag();
2350 template<
typename iType >
2351 static void assign( iType * stride )
2357 stride[3] = Tag4::Size * (
2358 stride[2] = Tag3::Size * (
2359 stride[1] = Tag2::Size * (
2360 stride[0] = Tag1::Size )));
2363 template<
typename iType >
2364 static void assign( iType * stride ,
2372 stride[2] = Tag3::Size * (
2373 stride[1] = Tag2::Size * (
2374 stride[0] = Tag1::Size )));
2377 template<
typename iType >
2378 static void assign( iType * stride ,
2388 stride[1] = Tag2::Size * (
2389 stride[0] = Tag1::Size )));
2392 template<
typename iType >
2393 static void assign( iType * stride ,
2405 stride[0] = Tag1::Size )));
2408 template<
typename iType >
2409 static void assign( iType * stride ,
2425 template<
typename iType >
2426 static void assign( iType * stride ,
2427 const iType *
const dims )
2433 stride[3] = dims[3] * (
2434 stride[2] = dims[2] * (
2435 stride[1] = dims[1] * (
2436 stride[0] = dims[0] )));
2443 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class Tag3 >
2444 struct Helper<Scalar,NaturalOrder,Tag1,Tag2,Tag3,void,void,void,void,void>
2447 Array<Scalar,FortranOrder,Tag3,Tag2,Tag1,void,void,void,void,void>
2451 Array<Scalar,NaturalOrder,Tag2,Tag3,void,void,void,void,void,void>
2454 template<
class TagA >
2457 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,Tag3,void,void,void,void>
2461 Array<Scalar,FortranOrder,Tag3,Tag2,Tag1,TagA,void,void,void,void>
2464 typedef natural type ;
2465 typedef fortran reverse ;
2470 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2472 return rank == Rank &&
2473 tags[0] == & Tag3::tag() &&
2474 tags[1] == & Tag2::tag() &&
2475 tags[2] == & Tag1::tag();
2478 static void assign_tags(
const ArrayDimTag * tags[] )
2480 tags[0] = & Tag3::tag();
2481 tags[1] = & Tag2::tag();
2482 tags[2] = & Tag1::tag();
2490 template<
typename iType >
2491 static void assign( iType * stride )
2498 stride[2] = Tag1::Size * (
2499 stride[1] = Tag2::Size * (
2500 stride[0] = Tag3::Size ));
2503 template<
typename iType >
2504 static void assign( iType * stride ,
2513 stride[1] = Tag2::Size * (
2514 stride[0] = Tag3::Size ));
2517 template<
typename iType >
2518 static void assign( iType * stride ,
2529 stride[0] = Tag3::Size ));
2532 template<
typename iType >
2533 static void assign( iType * stride ,
2548 template<
typename iType >
2549 static void assign( iType * stride ,
2550 const iType *
const dims )
2557 stride[2] = dims[0] * (
2558 stride[1] = dims[1] * (
2559 stride[0] = dims[2] ));
2563 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class Tag3 >
2564 struct Helper<Scalar,FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void>
2567 Array<Scalar,NaturalOrder,Tag3,Tag2,Tag1,void,void,void,void,void>
2571 Array<Scalar,FortranOrder,Tag1,Tag2,void,void,void,void,void,void>
2574 template<
class TagA >
2577 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,TagA,void,void,void,void>
2581 Array<Scalar,NaturalOrder,TagA,Tag3,Tag2,Tag1,void,void,void,void>
2584 typedef fortran type ;
2585 typedef natural reverse ;
2590 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2592 return rank == Rank &&
2593 tags[0] == & Tag1::tag() &&
2594 tags[1] == & Tag2::tag() &&
2595 tags[2] == & Tag3::tag();
2598 static void assign_tags(
const ArrayDimTag * tags[] )
2600 tags[0] = & Tag1::tag();
2601 tags[1] = & Tag2::tag();
2602 tags[2] = & Tag3::tag();
2610 template<
typename iType >
2611 static void assign( iType * stride )
2618 stride[2] = Tag3::Size * (
2619 stride[1] = Tag2::Size * (
2620 stride[0] = Tag1::Size ));
2623 template<
typename iType >
2624 static void assign( iType * stride ,
2633 stride[1] = Tag2::Size * (
2634 stride[0] = Tag1::Size ));
2637 template<
typename iType >
2638 static void assign( iType * stride ,
2649 stride[0] = Tag1::Size ));
2652 template<
typename iType >
2653 static void assign( iType * stride ,
2668 template<
typename iType >
2669 static void assign( iType * stride ,
2670 const iType *
const dims )
2677 stride[2] = dims[2] * (
2678 stride[1] = dims[1] * (
2679 stride[0] = dims[0] ));
2686 template<
typename Scalar ,
class Tag1 ,
class Tag2 >
2687 struct Helper<Scalar,NaturalOrder,Tag1,Tag2,void,void,void,void,void,void>
2690 Array<Scalar,FortranOrder,Tag2,Tag1,void,void,void,void,void,void>
2694 Array<Scalar,NaturalOrder,Tag2,void,void,void,void,void,void,void>
2697 template<
class TagA >
2700 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,void,void,void,void,void>
2704 Array<Scalar,FortranOrder,Tag2,Tag1,TagA,void,void,void,void,void>
2707 typedef natural type ;
2708 typedef fortran reverse ;
2713 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2715 return rank == Rank &&
2716 tags[0] == & Tag2::tag() &&
2717 tags[1] == & Tag1::tag();
2720 static void assign_tags(
const ArrayDimTag * tags[] )
2722 tags[0] = & Tag2::tag();
2723 tags[1] = & Tag1::tag();
2732 template<
typename iType >
2733 static void assign( iType * stride )
2741 stride[1] = Tag1::Size * (
2742 stride[0] = Tag2::Size );
2745 template<
typename iType >
2746 static void assign( iType * stride ,
2756 stride[0] = Tag2::Size );
2759 template<
typename iType >
2760 static void assign( iType * stride ,
2774 template<
typename iType >
2775 static void assign( iType * stride ,
2776 const iType *
const dims )
2784 stride[1] = dims[0] * (
2785 stride[0] = dims[1] );
2789 template<
typename Scalar ,
class Tag1 ,
class Tag2 >
2790 struct Helper<Scalar,FortranOrder,Tag1,Tag2,void,void,void,void,void,void>
2793 Array<Scalar,NaturalOrder,Tag2,Tag1,void,void,void,void,void,void>
2797 Array<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void>
2800 template<
class TagA >
2803 Array<Scalar,FortranOrder,Tag1,Tag2,TagA,void,void,void,void,void>
2807 Array<Scalar,NaturalOrder,TagA,Tag2,Tag1,void,void,void,void,void>
2810 typedef fortran type ;
2811 typedef natural reverse ;
2816 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2818 return rank == Rank &&
2819 tags[0] = & Tag1::tag() &&
2820 tags[1] = & Tag2::tag();
2823 static void assign_tags(
const ArrayDimTag * tags[] )
2825 tags[0] = & Tag1::tag();
2826 tags[1] = & Tag2::tag();
2835 template<
typename iType >
2836 static void assign( iType * stride )
2844 stride[1] = Tag2::Size * (
2845 stride[0] = Tag1::Size );
2848 template<
typename iType >
2849 static void assign( iType * stride ,
2859 stride[0] = Tag1::Size );
2862 template<
typename iType >
2863 static void assign( iType * stride ,
2877 template<
typename iType >
2878 static void assign( iType * stride ,
2879 const iType *
const dims )
2887 stride[1] = dims[1] * (
2888 stride[0] = dims[0] );
2895 template<
typename Scalar ,
class Tag1 >
2896 struct Helper<Scalar,NaturalOrder,Tag1,void,void,void,void,void,void,void>
2899 Array<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void>
2903 Array<Scalar,RankZero,void,void,void,void,void,void,void,void>
2906 template<
class TagA >
2909 Array<Scalar,NaturalOrder,TagA,Tag1,void,void,void,void,void,void>
2913 Array<Scalar,FortranOrder,Tag1,TagA,void,void,void,void,void,void>
2916 typedef natural type ;
2917 typedef fortran reverse ;
2922 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2923 {
return rank == Rank && tags[0] == & Tag1::tag(); }
2925 static void assign_tags(
const ArrayDimTag * tags[] )
2927 tags[0] = & Tag1::tag();
2937 template<
typename iType >
2938 static void assign( iType * stride )
2947 stride[0] = Tag1::Size ;
2950 template<
typename iType >
2951 static void assign( iType * stride ,
2964 template<
typename iType >
2965 static void assign( iType * stride ,
2966 const iType *
const dims )
2975 stride[0] = dims[0] ;
2979 template<
typename Scalar ,
class Tag1 >
2980 struct Helper<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void>
2983 Array<Scalar,NaturalOrder,Tag1,void,void,void,void,void,void,void>
2987 Array<Scalar,RankZero,void,void,void,void,void,void,void,void>
2990 template<
class TagA >
2993 Array<Scalar,FortranOrder,Tag1,TagA,void,void,void,void,void,void>
2997 Array<Scalar,NaturalOrder,TagA,Tag1,void,void,void,void,void,void>
3000 typedef fortran type ;
3001 typedef natural reverse ;
3006 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
3007 {
return rank == Rank && tags[0] == & Tag1::tag(); }
3009 static void assign_tags(
const ArrayDimTag * tags[] )
3011 tags[0] = & Tag1::tag();
3021 template<
typename iType >
3022 static void assign( iType * stride )
3031 stride[0] = Tag1::Size ;
3034 template<
typename iType >
3035 static void assign( iType * stride ,
const iType & n1 )
3047 template<
typename iType >
3048 static void assign( iType * stride ,
const iType *
const dims )
3056 stride[0] = dims[0] ;
3063 template<
typename Scalar >
3064 struct Helper<Scalar,RankZero,void,void,void,void,void,void,void,void>
3067 Array<Scalar,RankZero,void,void,void,void,void,void,void,void>
3070 template<
class TagA >
3073 Array<Scalar,NaturalOrder,TagA,void,void,void,void,void,void,void>
3077 Array<Scalar,FortranOrder,TagA,void,void,void,void,void,void,void>
3080 typedef natural type ;
3081 typedef fortran reverse ;
3086 template<
typename iType >
3087 static void assign( iType * ) {}
3093 template<
typename Scalar >
3094 struct Helper<Scalar,NaturalOrder,void,void,void,void,void,void,void,void>
3097 Array<Scalar,FortranOrder,void,void,void,void,void,void,void,void>
3101 template<
typename Scalar >
3102 struct Helper<Scalar,FortranOrder,void,void,void,void,void,void,void,void>
3105 Array<Scalar,NaturalOrder,void,void,void,void,void,void,void,void>
3113 template<
class ArrayType ,
class TagA >
struct ArrayAppend {};
3115 template<
typename Scalar ,
ArrayOrder Order ,
3116 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3117 class Tag5 ,
class Tag6 ,
class Tag7 ,
class TagA >
3119 Array<Scalar,Order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> , TagA >
3123 array_traits::Helper<Scalar,Order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
3124 ::template append<TagA> helper ;
3126 typedef typename helper::type type ;
3127 typedef typename helper::natural natural ;
3128 typedef typename helper::fortran fortran ;
3157 template<
typename Scalar , ArrayOrder array_order >
3158 class Array<Scalar,array_order,void,void,void,void,void,void,void,void>
3161 typedef typename array_traits::Offset<array_order> Offset ;
3185 enum { Contiguous =
true };
3204 array_traits::check_range( ord , m_rank );
3205 if ( Natural ) { ord = ( m_rank - 1 ) - ord ; }
3214 array_traits::check_range( ord , m_rank );
3215 if ( Natural ) { ord = ( m_rank - 1 ) - ord ; }
3216 return ord ? m_stride[ord] / m_stride[ord-1] : m_stride[ord] ;
3220 template<
typename iType >
3224 for (
size_type i = 0 ; i < m_rank ; ++i ) { n[i] = dimension(i); }
3239 template<
typename iType >
3241 {
return Array( *
this , i ); }
3247 template<
typename iType >
3250 SHARDS_ARRAY_CHECK( array_traits::check_range(i,size()) );
3256 template<
typename iType >
3258 const iType & i3 ,
const iType & i4 ,
3259 const iType & i5 ,
const iType & i6 ,
3260 const iType & i7 ,
const iType & i8 )
const
3262 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 8 ) );
3263 return m_ptr[ Offset::op(m_stride,i1,i2,i3,i4,i5,i6,i7,i8) ];
3266 template<
typename iType >
3267 value_type & operator()(
const iType & i1 ,
const iType & i2 ,
3268 const iType & i3 ,
const iType & i4 ,
3269 const iType & i5 ,
const iType & i6 ,
3270 const iType & i7 )
const
3272 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 7 ) );
3273 return m_ptr[ Offset::op(m_stride,i1,i2,i3,i4,i5,i6,i7) ];
3276 template<
typename iType >
3277 value_type & operator()(
const iType & i1 ,
const iType & i2 ,
3278 const iType & i3 ,
const iType & i4 ,
3279 const iType & i5 ,
const iType & i6 )
const
3281 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 6 ) );
3282 return m_ptr[ Offset::op(m_stride,i1,i2,i3,i4,i5,i6) ];
3285 template<
typename iType >
3286 value_type & operator()(
const iType & i1 ,
const iType & i2 ,
3287 const iType & i3 ,
const iType & i4 ,
3288 const iType & i5 )
const
3290 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 5 ) );
3291 return m_ptr[ Offset::op(m_stride,i1,i2,i3,i4,i5) ];
3294 template<
typename iType >
3295 value_type & operator()(
const iType & i1 ,
const iType & i2 ,
3296 const iType & i3 ,
const iType & i4 )
const
3298 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 4 ) );
3299 return m_ptr[ Offset::op(m_stride,i1,i2,i3,i4) ];
3302 template<
typename iType >
3303 value_type & operator()(
const iType & i1 ,
const iType & i2 ,
3304 const iType & i3 )
const
3306 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 3 ) );
3307 return m_ptr[ Offset::op(m_stride,i1,i2,i3) ];
3310 template<
typename iType >
3311 value_type & operator()(
const iType & i1 ,
const iType & i2 )
const
3313 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 2 ) );
3314 return m_ptr[ Offset::op(m_stride,i1,i2) ];
3317 template<
typename iType >
3318 value_type & operator()(
const iType & i1 )
const
3320 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 1 ) );
3321 return m_ptr[ Offset::op(m_stride,i1) ];
3331 array_traits::Helper<Scalar,array_order,void,void,void,void,void,void,void,void>
3332 ::reverse ReverseType ;
3337 : m_ptr(NULL), m_rank(0)
3339 Copy<8>( m_stride , (size_type) 0 );
3340 Copy<8>( m_tag , (tag_type) NULL );
3343 Array(
const Array & rhs )
3344 : m_ptr( rhs.m_ptr ), m_rank( rhs.m_rank )
3346 Copy<8>( m_stride , rhs.m_stride );
3347 Copy<8>( m_tag , rhs.m_tag );
3350 Array & operator = (
const Array & rhs )
3353 m_rank = rhs.m_rank ;
3354 Copy<8>( m_stride , rhs.m_stride );
3355 Copy<8>( m_tag , rhs.m_tag );
3361 : m_ptr( rhs.m_ptr ), m_rank( rhs.m_rank )
3363 Copy<8>( m_stride , rhs.m_stride );
3368 Array & operator = (
const ReverseType & rhs )
3371 m_rank = rhs.m_rank ;
3372 Copy<8>( m_stride , rhs.m_stride );
3380 Array( value_type * ptr ,
3381 const size_type input_rank ,
3382 const size_type *
const dims ,
3383 const tag_type *
const tags )
3384 : m_ptr( ptr ), m_rank( input_rank )
3386 array_traits::init_dim( m_stride, dims, input_rank, Natural);
3387 array_traits::init_tags( m_tag, tags, input_rank, Natural);
3392 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3393 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
3394 Array & assign( value_type * ptr ,
3395 size_type n1 , size_type n2 , size_type n3 , size_type n4 ,
3396 size_type n5 , size_type n6 , size_type n7 , size_type n8 )
3399 array_traits::Helper<Scalar,array_order,
3400 Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
3403 m_rank = helper::Rank ;
3404 helper::assign_tags( m_tag );
3405 helper::assign( m_stride, n1, n2, n3, n4, n5, n6, n7, n8 );
3409 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3410 class Tag5 ,
class Tag6 ,
class Tag7 >
3411 Array & assign( value_type * ptr ,
3412 size_type n1 , size_type n2 , size_type n3 , size_type n4 ,
3413 size_type n5 , size_type n6 , size_type n7 )
3416 array_traits::Helper<Scalar,array_order,
3417 Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,
void>
3420 m_rank = helper::Rank ;
3421 helper::assign_tags( m_tag );
3422 helper::assign( m_stride, n1, n2, n3, n4, n5, n6, n7 );
return *this ;
3425 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3426 class Tag5 ,
class Tag6 >
3427 Array & assign( value_type * ptr ,
3428 size_type n1 , size_type n2 , size_type n3 , size_type n4 ,
3429 size_type n5 , size_type n6 )
3432 array_traits::Helper<Scalar,array_order,
3433 Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,
void>
3436 m_rank = helper::Rank ;
3437 helper::assign_tags( m_tag );
3438 helper::assign( m_stride, n1, n2, n3, n4, n5, n6 );
3442 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3444 Array & assign( value_type * ptr ,
3445 size_type n1 , size_type n2 , size_type n3 , size_type n4 ,
3449 array_traits::Helper<Scalar,array_order,
3450 Tag1,Tag2,Tag3,Tag4,Tag5,void,void,
void>
3453 m_rank = helper::Rank ;
3454 helper::assign_tags( m_tag );
3455 helper::assign( m_stride, n1, n2, n3, n4, n5 );
3459 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 >
3460 Array & assign( value_type * ptr ,
3461 size_type n1 , size_type n2 , size_type n3 , size_type n4 )
3464 array_traits::Helper<Scalar,array_order,
3465 Tag1,Tag2,Tag3,Tag4,void,void,void,
void>
3468 m_rank = helper::Rank ;
3469 helper::assign_tags( m_tag );
3470 helper::assign( m_stride, n1, n2, n3, n4 );
3474 template<
class Tag1 ,
class Tag2 ,
class Tag3 >
3475 Array & assign( value_type * ptr ,
3476 size_type n1 , size_type n2 , size_type n3 )
3479 array_traits::Helper<Scalar,array_order,
3480 Tag1,Tag2,Tag3,void,void,void,void,
void>
3483 m_rank = helper::Rank ;
3484 helper::assign_tags( m_tag );
3485 helper::assign( m_stride, n1, n2, n3 );
3489 template<
class Tag1 ,
class Tag2 >
3490 Array & assign( value_type * ptr ,
3491 size_type n1 , size_type n2 )
3494 array_traits::Helper<Scalar,array_order,
3495 Tag1,Tag2,void,void,void,void,void,
void>
3498 m_rank = helper::Rank ;
3499 helper::assign_tags( m_tag );
3500 helper::assign( m_stride, n1, n2 );
3504 template<
class Tag1 >
3505 Array & assign( value_type * ptr ,
3509 array_traits::Helper<Scalar,array_order,
3510 Tag1,void,void,void,void,void,void,
void>
3513 m_rank = helper::Rank ;
3514 helper::assign_tags( m_tag );
3515 helper::assign( m_stride, n1 );
3522 Array(
const Array & rhs ,
const size_type i )
3523 : m_ptr( NULL ), m_rank( 0 )
3525 if ( 1 < rhs.m_rank ) {
3526 Copy<8>( m_stride , rhs.m_stride );
3527 Copy<8>( m_tag , rhs.m_tag );
3528 m_rank = rhs.m_rank - 1 ;
3529 m_ptr = rhs.m_ptr + ( m_rank ? m_stride[ m_rank - 1 ] * i : i );
3530 m_stride[ m_rank ] = 0 ;
3531 m_tag[ m_rank ] = 0 ;
3534 Copy<8>( m_stride , (size_type) 0 );
3535 Copy<8>( m_tag , (tag_type) NULL );
3540 value_type * m_ptr ;
3546 size_type m_stride[8];
3552 class , class , class , class ,
3553 class , class , class ,
class >
3576 template<
typename Scalar ,
ArrayOrder array_order ,
3577 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3578 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
3583 #ifndef DOXYGEN_COMPILE
3585 array_traits::Helper<Scalar,array_order,
3586 Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
3607 enum { Rank = helper::Rank };
3616 enum { Contiguous =
true };
3632 #ifndef DOXYGEN_COMPILE
3634 template <
size_type ordinate >
3636 typedef typename array_traits::TagAt<Array,ordinate>::type type ;
3642 {
return m_array.tag( ordinate ); }
3648 typedef array_traits::StrideDim<array_order,Rank,ordinate> StrideDim ;
3649 return StrideDim::dimension(m_array.m_stride);
3655 typedef array_traits::StrideDim<array_order,Rank> StrideDim ;
3656 return StrideDim::dimension(m_array.m_stride,ordinate);
3660 template<
typename iType >
3662 { m_array.template dimensions<iType>( n ); }
3682 template<
typename iType >
3691 template<
typename iType >
3693 {
return m_array[i]; }
3696 template<
typename iType >
3698 const iType & i3 ,
const iType & i4 ,
3699 const iType & i5 ,
const iType & i6 ,
3700 const iType & i7 ,
const iType & i8 )
const
3702 array_traits::CheckRank<8,Rank>::ok();
3703 return m_array(i1,i2,i3,i4,i5,i6,i7,i8);
3707 template<
typename iType >
3709 const iType & i3 ,
const iType & i4 ,
3710 const iType & i5 ,
const iType & i6 ,
3711 const iType & i7 )
const
3713 array_traits::CheckRank<7,Rank>::ok();
3714 return m_array(i1,i2,i3,i4,i5,i6,i7);
3718 template<
typename iType >
3720 const iType & i3 ,
const iType & i4 ,
3721 const iType & i5 ,
const iType & i6 )
const
3723 array_traits::CheckRank<6,Rank>::ok();
3724 return m_array(i1,i2,i3,i4,i5,i6);
3728 template<
typename iType >
3730 const iType & i3 ,
const iType & i4 ,
3731 const iType & i5 )
const
3733 array_traits::CheckRank<5,Rank>::ok();
3734 return m_array(i1,i2,i3,i4,i5);
3738 template<
typename iType >
3740 const iType & i3 ,
const iType & i4 )
const
3742 array_traits::CheckRank<4,Rank>::ok();
3743 return m_array(i1,i2,i3,i4);
3747 template<
typename iType >
3749 const iType & i3 )
const
3751 array_traits::CheckRank<3,Rank>::ok();
3752 return m_array(i1,i2,i3);
3756 template<
typename iType >
3759 array_traits::CheckRank<2,Rank>::ok();
3760 return m_array(i1,i2);
3764 template<
typename iType >
3767 array_traits::CheckRank<1,Rank>::ok();
3784 { m_array.m_rank = Rank ; helper::assign_tags( m_array.m_tag ); }
3791 { m_array.operator=(rhs.m_array);
return *this ; }
3798 { m_array.operator=(rhs.m_array);
return *this ; }
3803 m_array.m_ptr = arg_ptr ;
3804 array_traits::init_dim( m_array.m_stride , dims , Rank , Natural );
3812 m_array.m_rank = Rank ;
3813 helper::assign_tags( m_array.m_tag );
3814 assign( arg_ptr , dims );
3824 array_traits::CheckRange<7,Rank>::ok();
3825 m_array.m_ptr = arg_ptr ;
3826 helper::assign( m_array.m_stride, n1, n2, n3, n4, n5, n6, n7, n8 );
3838 m_array.m_rank = Rank ;
3839 helper::assign_tags( m_array.m_tag );
3840 assign( arg_ptr, n1, n2, n3, n4, n5, n6, n7, n8 );
3852 array_traits::CheckRange<6,Rank>::ok();
3853 m_array.m_ptr = arg_ptr ;
3854 helper::assign( m_array.m_stride, n1, n2, n3, n4, n5, n6, n7 );
3868 m_array.m_rank = Rank ;
3869 helper::assign_tags( m_array.m_tag );
3870 assign( arg_ptr, n1, n2, n3, n4, n5, n6, n7 );
3881 array_traits::CheckRange<5,Rank>::ok();
3882 m_array.m_ptr = arg_ptr ;
3883 helper::assign( m_array.m_stride, n1, n2, n3, n4, n5, n6 );
3896 m_array.m_rank = Rank ;
3897 helper::assign_tags( m_array.m_tag );
3898 assign( arg_ptr, n1, n2, n3, n4, n5, n6 );
3909 array_traits::CheckRange<4,Rank>::ok();
3910 m_array.m_ptr = arg_ptr ;
3911 helper::assign( m_array.m_stride, n1, n2, n3, n4, n5 );
3924 m_array.m_rank = Rank ;
3925 helper::assign_tags( m_array.m_tag );
3926 assign( arg_ptr, n1, n2, n3, n4, n5 );
3936 array_traits::CheckRange<3,Rank>::ok();
3937 m_array.m_ptr = arg_ptr ;
3938 helper::assign( m_array.m_stride, n1, n2, n3, n4 );
3950 m_array.m_rank = Rank ;
3951 helper::assign_tags( m_array.m_tag );
3952 assign( arg_ptr, n1, n2, n3, n4 );
3962 array_traits::CheckRange<2,Rank>::ok();
3963 m_array.m_ptr = arg_ptr ;
3964 helper::assign( m_array.m_stride, n1, n2, n3 );
3976 m_array.m_rank = Rank ;
3977 helper::assign_tags( m_array.m_tag );
3978 assign( arg_ptr , n1, n2, n3 );
3987 array_traits::CheckRange<1,Rank>::ok();
3988 m_array.m_ptr = arg_ptr ;
3989 helper::assign( m_array.m_stride, n1, n2 );
3999 m_array.m_rank = Rank ;
4000 helper::assign_tags( m_array.m_tag );
4001 assign( arg_ptr, n1, n2 );
4009 array_traits::CheckRange<0,Rank>::ok();
4010 m_array.m_ptr = arg_ptr ;
4011 helper::assign( m_array.m_stride, n1 );
4021 m_array.m_rank = Rank ;
4022 helper::assign_tags( m_array.m_tag );
4023 assign( arg_ptr, n1 );
4029 m_array.m_ptr = arg_ptr ;
4030 helper::assign( m_array.m_stride );
4038 m_array.m_rank = Rank ;
4039 helper::assign_tags( m_array.m_tag );
4047 if ( ! helper::verify( m_array.m_rank , m_array.m_tag ) ) {
4048 m_array.m_rank = Rank ;
4049 helper::assign_tags( m_array.m_tag );
4050 array_traits::throw_bad_conversion( m_array.m_rank , m_array.m_tag ,
4051 rhs.m_rank , rhs.m_tag );
4066 m_array.m_ptr = arg_ptr ;
4076 m_array.m_ptr = arg_ptr ;
4077 Copy<Rank-1>( m_array.m_stride , arg_stride );
4078 m_array.m_stride[Rank-1] = m_array.m_stride[Rank-2] * arg_final_dim ;
4086 : m_array( rhs , i )
4088 if ( ! helper::verify( m_array.m_rank , m_array.m_tag ) ) {
4089 m_array.m_rank = Rank ;
4090 helper::assign_tags( m_array.m_tag );
4091 array_traits::throw_bad_conversion( m_array.m_rank , m_array.m_tag ,
4092 rhs.m_rank - 1 , rhs.m_tag );
4096 Array<value_type,array_order> m_array ;
4099 class , class , class , class ,
4100 class , class , class ,
class >
4109 template<
typename Scalar >
4132 enum { Natural =
false };
4135 enum { Reverse =
false };
4138 enum { Contiguous =
true };
4175 Array() : m_ptr(NULL) {}
4177 Array(
const Array & rhs ) : m_ptr( rhs.m_ptr ) {}
4179 Array & operator = (
const Array & rhs )
4180 { m_ptr = rhs.m_ptr ;
return *this ; }
4185 Array( value_type * arg_ptr ) : m_ptr( arg_ptr ) {}
4190 #ifndef DOXYGEN_COMPILE
4191 value_type * m_ptr ;
4194 class , class , class , class ,
4195 class , class , class ,
class >
4209 #undef SHARDS_ARRAY_CHECK
value_type * contiguous_data() const
Pointer to contiguous block of member data.
The preferred multi-dimensional Array interface with compile-time user-defined dimension ordinate...
helper::reverse ReverseType
The compatible multidimensional array with reversed multi-index ordering and dimension tags...
Array(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3, const size_type n4, const size_type n5, const size_type n6, const size_type n7)
Construct a Rank 7..8 array; use Tag#::Size for defaults. The input dimensions are the 7 slowest stri...
static const ArrayDimension & tag()
Singleton tag for ArrayDimension.
value_type & operator[](const iType &i) const
Access member via offset into contiguous block.
bool contiguous() const
If the member data storage is contiguous.
virtual size_type to_index(size_type dimension, const std::string &label) const
Given a dimension and input strige produce an index.
bool contiguous() const
If the member data storage is contiguous.
Array(value_type *arg_ptr, const size_type n1)
Construct a Rank 1..8 array; use Tag#::Size for defaults. The input dimension is the slowest stride...
value_type & operator()(const iType &i1) const
Access member of a Rank 1 array.
ArrayOrder
Define Natural (C-language) or Fortran ordering of array dimensions. A RankZero array does not ha...
Array(value_type *arg_ptr, const size_type *const dims)
Construct with array of dimensions.
Array & assign(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3, const size_type n4, const size_type n5)
Construct a Rank 5..8 array; use Tag#::Size for defaults. The input dimensions are the 5 slowest stri...
Array(const ReverseType &rhs)
Copy constructor for reverse type.
const char * name() const
Name of the tag, typically the name of the derived class.
Array & assign(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3, const size_type n4, const size_type n5, const size_type n6)
Construct a Rank 6..8 array; use Tag#::Size for defaults. The input dimensions are the 6 slowest stri...
value_type * contiguous_data() const
Pointer to contiguous block of member data.
Array & assign(value_type *arg_ptr)
Construct a Rank 1..8 array; use Tag#::Size for defaults.
value_type & operator()(const iType &i1, const iType &i2, const iType &i3, const iType &i4, const iType &i5, const iType &i6, const iType &i7) const
Access member of a Rank 7 array.
array_traits::int_t size_type
Type for sizes.
Scalar value_type
Type of member data.
size_type dimension(size_type ord) const
Dimension of the given ordinate.
size_type size() const
Total number of member data items.
size_type rank() const
Rank of the array is the number of non-void dimension tags.
array_traits::int_t size_type
Type for sizes.
Abstract base class for array dimension tags supplied to the Array template class.
bool reverse() const
If the multidimension follows the reverse (Fortran) ordering.
Scalar value_type
Type of member data.
helper::truncate TruncateType
Subarray type that removes the slowest striding dimension (first natural or last fortran ordinate)...
void assign_stride(value_type *arg_ptr, const size_type *arg_stride)
Assign stride and pointer.
bool natural() const
If the multidimension follows the natural ordering.
tag_type tag(const size_type ordinate) const
Access the dimension tag-singleton for a given ordinate.
Array & assign(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3, const size_type n4, const size_type n5, const size_type n6, const size_type n7, const size_type n8)
Construct a Rank 8 array.
An anonymous array dimension tag, which is NOT the recommended usage.
Array & assign(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3, const size_type n4, const size_type n5, const size_type n6, const size_type n7)
Construct a Rank 7..8 array; use Tag#::Size for defaults. The input dimensions are the 7 slowest stri...
Array(const Array< Scalar, array_order > &rhs)
Construct compile-time array from run-time array.
value_type & operator[](const iType &i) const
Access member via full ordering of members.
value_type & operator()(const iType &i1, const iType &i2, const iType &i3, const iType &i4, const iType &i5, const iType &i6) const
Access member of a Rank 6 array.
value_type & operator()(const iType &i1, const iType &i2, const iType &i3, const iType &i4, const iType &i5, const iType &i6, const iType &i7, const iType &i8) const
Access member via Rank 8 multi-index.
const ArrayDimTag * tag_type
Type of runtime dimension tags.
value_type & operator()(const iType &i1, const iType &i2) const
Access member of a Rank 2 array.
bool reverse() const
If the multidimension follows the reverse (Fortran) ordering.
Array(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3, const size_type n4, const size_type n5)
Construct a Rank 5..8 array; use Tag#::Size for defaults. The input dimensions are the 5 slowest stri...
size_type dimension(const size_type ordinate) const
Dimension of the given ordinate.
Array & assign(value_type *arg_ptr, const size_type *const dims)
Assign pointer and dimensions.
Array(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3, const size_type n4, const size_type n5, const size_type n6, const size_type n7, const size_type n8)
Construct a Rank 8 array.
value_type & operator()(const iType &i1, const iType &i2, const iType &i3, const iType &i4, const iType &i5, const iType &i6, const iType &i7, const iType &i8) const
Access member of a Rank 8 array.
void dimensions(std::vector< iType > &n)
Dimensions of all ordinates.
void dimensions(std::vector< iType > &n)
Dimension of all ordinate.
value_type * contiguous_data() const
Pointer to contiguous block of member data.
value_type & operator()(const iType &i1, const iType &i2, const iType &i3, const iType &i4) const
Access member of a Rank 4 array.
size_type size() const
Total number of data items.
value_type & operator()(const iType &i1, const iType &i2, const iType &i3, const iType &i4, const iType &i5) const
Access member of a Rank 5 array.
virtual const char * name() const =0
Name of the tag, typically the name of the derived class.
const ArrayDimTag * tag_type
Type of runtime dimension tags.
Array(const ReverseType &rhs)
Copy constructor for compatible reverse type.
Array(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3, const size_type n4, const size_type n5, const size_type n6)
Construct a Rank 6..8 array; use Tag#::Size for defaults. The input dimensions are the 6 slowest stri...
Array & assign(value_type *arg_ptr, const size_type n1, const size_type n2)
Construct a Rank 2..8 array; use Tag#::Size for defaults. The input dimensions are the 2 slowest stri...
TruncateType truncate(const iType &i) const
Generate a subarray view of the array with the slowest striding ordinate offset by i and removed...
Array & assign(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3, const size_type n4)
Construct a Rank 4..8 array; use Tag#::Size for defaults. The input dimensions are the 4 slowest stri...
size_type size() const
Total number of member data items.
Special tag to indicate that an array specification has degenerated to rank-zero, i...
bool contiguous() const
If the member data storage is contiguous.
bool reverse() const
If the multidimension follows the reverse (Fortran) ordering.
Array(value_type *arg_ptr, const size_type n1, const size_type n2)
Construct a Rank 2..8 array; use Tag#::Size for defaults. The input dimensions are the 2 slowest stri...
Array truncate(const iType &i) const
Generate a subarray view of the array with the slowest striding ordinate offset by i and removed...
Array & assign(value_type *arg_ptr, const size_type n1)
Construct a Rank 1..8 array; use Tag#::Size for defaults. The input dimension is the slowest stride...
Use the Natural or C-language ordering for multi-dimensions where the right-most dimension is stride-...
Array & assign(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3)
Construct a Rank 3..8 array; use Tag#::Size for defaults. The input dimensions are the 3 slowest stri...
Use the Reverse or Fortran-language ordering for multi-dimensions where the left-most dimension is st...
tag_type tag(size_type ord) const
Access the dimension tag-singleton for a given ordinate.
Array()
Default constructor.
Array(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3, const size_type n4)
Construct a Rank 4..8 array; use Tag#::Size for defaults. The input dimensions are the 4 slowest stri...
bool natural() const
If the multidimension follows the natural ordering.
void assign_stride(value_type *arg_ptr, const size_type *arg_stride, size_type arg_final_dim)
Assign stride and pointer.
size_type dimension() const
Dimension of the given ordinate.
Array(const Array &rhs)
Copy constructor.
const ArrayDimTag * tag_type
Type of runtime dimension tags.
array_traits::int_t size_type
Type for sizes.
bool natural() const
If the multidimension follows the natural ordering.
virtual std::string to_string(size_type dimension, size_type index) const
Given a dimension and index produce a string for output.
value_type & operator()() const
Access member via Rank 0 multi-index.
Array(value_type *arg_ptr, const size_type n1, const size_type n2, const size_type n3)
Construct a Rank 3..8 array; use Tag#::Size for defaults. The input dimensions are the 3 slowest stri...
size_type rank() const
Rank of the array is the number of non-void dimension tags.
value_type & operator()(const iType &i1, const iType &i2, const iType &i3) const
Access member of a Rank 3 array.
size_type rank() const
Rank of the array is the number of non-void dimension tags.
Scalar value_type
Type of member data.
Array(value_type *arg_ptr)
Construct a Rank 1..8 array; use Tag#::Size for defaults.