46 #ifndef Shards_Array_hpp 47 #define Shards_Array_hpp 53 #include <Shards_SimpleArrayOps.hpp> 58 #ifdef SHARDS_ARRAY_BOUNDS_CHECKING 59 #define SHARDS_ARRAY_CHECK( X ) X 61 #define SHARDS_ARRAY_CHECK( X ) 72 namespace array_traits {
101 template<
typename Scalar ,
ArrayOrder Order ,
102 class Tag1 = void ,
class Tag2 = void ,
103 class Tag3 = void ,
class Tag4 = void ,
104 class Tag5 = void ,
class Tag6 = void ,
105 class Tag7 = void ,
class Tag8 =
void >
136 typedef array_traits::int_t size_type ;
139 virtual const char *
name()
const = 0 ;
145 virtual std::string
to_string( size_type dimension ,
146 size_type index )
const ;
152 virtual size_type
to_index( size_type dimension ,
153 const std::string & label )
const ;
171 const char *
name()
const ;
186 #define SHARDS_ARRAY_DIM_TAG_SIMPLE_DECLARATION( ADT ) \ 187 class ADT : public shards::ArrayDimTag { \ 189 const char * name() const ; \ 190 static const ADT & tag(); \ 194 ADT( const ADT & ); \ 195 ADT & operator = ( const ADT & ); \ 201 #define SHARDS_ARRAY_DIM_TAG_SIMPLE_IMPLEMENTATION( ADT ) \ 204 const char * ADT::name() const { static const char n[] = # ADT; return n; } \ 205 const ADT & ADT::tag() { static const ADT self ; return self ; } 218 #ifndef DOXYGEN_COMPILE 221 namespace array_traits {
225 template<
typename iType >
229 const iType *
const stride )
230 {
return 0 < rank ? stride[ rank - 1 ] : 0 ; }
233 template<
typename iType >
235 void stride_to_natural_dimensions(
237 const iType *
const stride ,
241 for ( iType i = 0 ; i < rank ; ++i )
242 { dim[(rank-1)-i] = stride[i] / n ; n = stride[i] ; }
246 template<
typename iType >
248 void stride_to_natural_indices(
250 const iType *
const stride ,
252 iType *
const indices )
254 iType * i = indices ;
255 for (
const iType * s = stride + rank - 1 ; stride < s-- ; ++i ) {
263 template<
typename iType >
265 void stride_from_natural_dimensions(
267 iType *
const stride ,
268 const iType *
const dim )
271 for ( iType i = 0 ; i < rank ; ++i ) { stride[i] = n *= dim[(rank-1)-i]; }
276 void throw_bad_conversion(
const int_t lhs_rank ,
277 const ArrayDimTag *
const lhs_tags[] ,
278 const int_t rhs_rank ,
279 const ArrayDimTag *
const rhs_tags[] );
281 void check_rank(
const int_t rank ,
282 const int_t test_rank );
284 void check_range(
const int_t index ,
const int_t bound );
286 void check_indices(
const bool ,
288 const int_t *
const stride ,
300 const int_t src_dimension[] ,
301 const int_t rank ,
const bool natural );
304 const ArrayDimTag * dst_tag[] ,
305 const ArrayDimTag *
const src_tag[] ,
306 const int_t rank ,
const bool natural );
310 template<
int_t ,
int_t >
struct CheckRank ;
312 template<>
struct CheckRank<0,0> {
static void ok(){} };
313 template<>
struct CheckRank<1,1> {
static void ok(){} };
314 template<>
struct CheckRank<2,2> {
static void ok(){} };
315 template<>
struct CheckRank<3,3> {
static void ok(){} };
316 template<>
struct CheckRank<4,4> {
static void ok(){} };
317 template<>
struct CheckRank<5,5> {
static void ok(){} };
318 template<>
struct CheckRank<6,6> {
static void ok(){} };
319 template<>
struct CheckRank<7,7> {
static void ok(){} };
320 template<>
struct CheckRank<8,8> {
static void ok(){} };
324 template<
int_t Index ,
int_t Bound >
struct CheckRange ;
326 template<>
struct CheckRange<0,8> {
static void ok(){} };
327 template<>
struct CheckRange<1,8> {
static void ok(){} };
328 template<>
struct CheckRange<2,8> {
static void ok(){} };
329 template<>
struct CheckRange<3,8> {
static void ok(){} };
330 template<>
struct CheckRange<4,8> {
static void ok(){} };
331 template<>
struct CheckRange<5,8> {
static void ok(){} };
332 template<>
struct CheckRange<6,8> {
static void ok(){} };
333 template<>
struct CheckRange<7,8> {
static void ok(){} };
335 template<>
struct CheckRange<0,7> {
static void ok(){} };
336 template<>
struct CheckRange<1,7> {
static void ok(){} };
337 template<>
struct CheckRange<2,7> {
static void ok(){} };
338 template<>
struct CheckRange<3,7> {
static void ok(){} };
339 template<>
struct CheckRange<4,7> {
static void ok(){} };
340 template<>
struct CheckRange<5,7> {
static void ok(){} };
341 template<>
struct CheckRange<6,7> {
static void ok(){} };
343 template<>
struct CheckRange<0,6> {
static void ok(){} };
344 template<>
struct CheckRange<1,6> {
static void ok(){} };
345 template<>
struct CheckRange<2,6> {
static void ok(){} };
346 template<>
struct CheckRange<3,6> {
static void ok(){} };
347 template<>
struct CheckRange<4,6> {
static void ok(){} };
348 template<>
struct CheckRange<5,6> {
static void ok(){} };
350 template<>
struct CheckRange<0,5> {
static void ok(){} };
351 template<>
struct CheckRange<1,5> {
static void ok(){} };
352 template<>
struct CheckRange<2,5> {
static void ok(){} };
353 template<>
struct CheckRange<3,5> {
static void ok(){} };
354 template<>
struct CheckRange<4,5> {
static void ok(){} };
356 template<>
struct CheckRange<0,4> {
static void ok(){} };
357 template<>
struct CheckRange<1,4> {
static void ok(){} };
358 template<>
struct CheckRange<2,4> {
static void ok(){} };
359 template<>
struct CheckRange<3,4> {
static void ok(){} };
361 template<>
struct CheckRange<0,3> {
static void ok(){} };
362 template<>
struct CheckRange<1,3> {
static void ok(){} };
363 template<>
struct CheckRange<2,3> {
static void ok(){} };
365 template<>
struct CheckRange<0,2> {
static void ok(){} };
366 template<>
struct CheckRange<1,2> {
static void ok(){} };
368 template<>
struct CheckRange<0,1> {
static void ok(){} };
372 template<
class ,
int_t >
struct TagAt ;
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>,0>
378 {
typedef Tag1 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>,1>
384 {
typedef Tag2 type ; };
386 template<
typename Scalar ,
ArrayOrder order ,
387 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
388 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
389 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,2>
390 {
typedef Tag3 type ; };
392 template<
typename Scalar ,
ArrayOrder order ,
393 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
394 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
395 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,3>
396 {
typedef Tag4 type ; };
398 template<
typename Scalar ,
ArrayOrder order ,
399 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
400 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
401 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,4>
402 {
typedef Tag5 type ; };
404 template<
typename Scalar ,
ArrayOrder order ,
405 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
406 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
407 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,5>
408 {
typedef Tag6 type ; };
410 template<
typename Scalar ,
ArrayOrder order ,
411 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
412 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
413 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,6>
414 {
typedef Tag7 type ; };
416 template<
typename Scalar ,
ArrayOrder order ,
417 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
418 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
419 struct TagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,7>
420 {
typedef Tag8 type ; };
425 template< ArrayOrder ,
int_t Rank ,
int_t Ordinal = 0 >
struct StrideDim ;
427 template<
int_t Rank ,
int_t Ordinal >
428 struct StrideDim<
RankZero,Rank,Ordinal> {
430 template<
typename iType >
431 static iType dimension(
const iType * )
434 template<
typename iType >
435 static iType dimension(
const iType * , iType )
439 template<
int_t Rank >
442 template<
typename iType >
443 static iType dimension(
const iType * stride )
445 array_traits::CheckRange<0,Rank>::ok();
449 template<
typename iType >
450 static iType dimension(
const iType * stride , iType ordinal )
452 array_traits::check_range(ordinal,Rank);
453 return ordinal ? stride[ordinal] / stride[ordinal-1] : stride[0] ;
457 template<
int_t Rank >
460 template<
typename iType >
461 static iType dimension(
const iType * stride )
463 array_traits::CheckRange<0,Rank>::ok();
467 template<
typename iType >
468 static iType dimension(
const iType * stride , iType ordinal )
470 array_traits::check_range(ordinal,Rank);
471 ordinal = ( Rank - 1 ) - ordinal ;
472 return ordinal ? stride[ordinal] / stride[ordinal-1] : stride[0] ;
476 template<
int_t Rank ,
int_t Ordinal >
479 template<
typename iType >
480 static iType dimension(
const iType * stride )
482 array_traits::CheckRange<Ordinal,Rank>::ok();
483 return stride[Ordinal] / stride[Ordinal-1];
487 template<
int_t Rank ,
int_t Ordinal >
490 template<
typename iType >
491 static iType dimension(
const iType * stride )
493 enum { I = ( Rank - 1 ) - Ordinal };
494 array_traits::CheckRange<Ordinal,Rank>::ok();
495 return stride[I] / stride[I-1];
501 template< ArrayOrder >
struct Offset ;
506 template<
typename isType ,
typename iType >
507 static iType op(
const isType *
const stride ,
508 const iType & i1 ,
const iType & i2 ,
509 const iType & i3 ,
const iType & i4 ,
510 const iType & i5 ,
const iType & i6 ,
511 const iType & i7 ,
const iType & i8 )
513 SHARDS_ARRAY_CHECK(check_indices(
false,8,stride,i1,i2,i3,i4,i5,i6,i7,i8));
514 return i1 + i2 * stride[0] +
515 i3 * stride[1] + i4 * stride[2] +
516 i5 * stride[3] + i6 * stride[4] +
517 i7 * stride[5] + i8 * stride[6] ;
520 template<
typename isType ,
typename iType >
521 static iType op(
const isType *
const stride ,
522 const iType & i1 ,
const iType & i2 ,
523 const iType & i3 ,
const iType & i4 ,
524 const iType & i5 ,
const iType & i6 ,
527 SHARDS_ARRAY_CHECK(check_indices(
false,7,stride,i1,i2,i3,i4,i5,i6,i7));
528 return i1 + i2 * stride[0] +
529 i3 * stride[1] + i4 * stride[2] +
530 i5 * stride[3] + i6 * stride[4] +
534 template<
typename isType ,
typename iType >
535 static iType op(
const isType *
const stride ,
536 const iType & i1 ,
const iType & i2 ,
537 const iType & i3 ,
const iType & i4 ,
538 const iType & i5 ,
const iType & i6 )
540 SHARDS_ARRAY_CHECK(check_indices(
false,6,stride,i1,i2,i3,i4,i5,i6));
541 return i1 + i2 * stride[0] +
542 i3 * stride[1] + i4 * stride[2] +
543 i5 * stride[3] + i6 * stride[4] ;
546 template<
typename isType ,
typename iType >
547 static iType op(
const isType *
const stride ,
548 const iType & i1 ,
const iType & i2 ,
549 const iType & i3 ,
const iType & i4 ,
552 SHARDS_ARRAY_CHECK(check_indices(
false,5,stride,i1,i2,i3,i4,i5));
553 return i1 + i2 * stride[0] +
554 i3 * stride[1] + i4 * stride[2] +
558 template<
typename isType ,
typename iType >
559 static iType op(
const isType *
const stride ,
560 const iType & i1 ,
const iType & i2 ,
561 const iType & i3 ,
const iType & i4 )
563 SHARDS_ARRAY_CHECK(check_indices(
false,4,stride,i1,i2,i3,i4));
564 return i1 + i2 * stride[0] +
565 i3 * stride[1] + i4 * stride[2] ;
568 template<
typename isType ,
typename iType >
569 static iType op(
const isType *
const stride ,
570 const iType & i1 ,
const iType & i2 ,
573 SHARDS_ARRAY_CHECK(check_indices(
false,3,stride,i1,i2,i3));
574 return i1 + i2 * stride[0] + i3 * stride[1] ;
577 template<
typename isType ,
typename iType >
578 static iType op(
const isType *
const stride ,
579 const iType & i1 ,
const iType & i2 )
581 SHARDS_ARRAY_CHECK(check_indices(
false,2,stride,i1,i2));
582 return i1 + i2 * stride[0] ;
585 template<
typename isType ,
typename iType >
586 static iType op(
const isType *
const SHARDS_ARRAY_CHECK( stride ) ,
589 SHARDS_ARRAY_CHECK(check_indices(
false,1,stride,i1));
599 template<
typename isType ,
typename iType >
600 static iType op(
const isType *
const stride ,
601 const iType & i1 ,
const iType & i2 ,
602 const iType & i3 ,
const iType & i4 ,
603 const iType & i5 ,
const iType & i6 ,
604 const iType & i7 ,
const iType & i8 )
606 SHARDS_ARRAY_CHECK(check_indices(
true,8,stride,i1,i2,i3,i4,i5,i6,i7,i8));
607 return i8 + i7 * stride[0] +
608 i6 * stride[1] + i5 * stride[2] +
609 i4 * stride[3] + i3 * stride[4] +
610 i2 * stride[5] + i1 * stride[6] ;
613 template<
typename isType ,
typename iType >
614 static iType op(
const isType *
const stride ,
615 const iType & i1 ,
const iType & i2 ,
616 const iType & i3 ,
const iType & i4 ,
617 const iType & i5 ,
const iType & i6 ,
620 SHARDS_ARRAY_CHECK(check_indices(
true,7,stride,i1,i2,i3,i4,i5,i6,i7));
621 return i7 + i6 * stride[0] +
622 i5 * stride[1] + i4 * stride[2] +
623 i3 * stride[3] + i2 * stride[4] +
627 template<
typename isType ,
typename iType >
628 static iType op(
const isType *
const stride ,
629 const iType & i1 ,
const iType & i2 ,
630 const iType & i3 ,
const iType & i4 ,
631 const iType & i5 ,
const iType & i6 )
633 SHARDS_ARRAY_CHECK(check_indices(
true,6,stride,i1,i2,i3,i4,i5,i6));
634 return i6 + i5 * stride[0] +
635 i4 * stride[1] + i3 * stride[2] +
636 i2 * stride[3] + i1 * stride[4] ;
639 template<
typename isType ,
typename iType >
640 static iType op(
const isType *
const stride ,
641 const iType & i1 ,
const iType & i2 ,
642 const iType & i3 ,
const iType & i4 ,
645 SHARDS_ARRAY_CHECK(check_indices(
true,5,stride,i1,i2,i3,i4,i5));
646 return i5 + i4 * stride[0] +
647 i3 * stride[1] + i2 * stride[2] +
651 template<
typename isType ,
typename iType >
652 static iType op(
const isType *
const stride ,
653 const iType & i1 ,
const iType & i2 ,
654 const iType & i3 ,
const iType & i4 )
656 SHARDS_ARRAY_CHECK(check_indices(
true,4,stride,i1,i2,i3,i4));
657 return i4 + i3 * stride[0] +
658 i2 * stride[1] + i1 * stride[2] ;
661 template<
typename isType ,
typename iType >
662 static iType op(
const isType *
const stride ,
663 const iType & i1 ,
const iType & i2 ,
666 SHARDS_ARRAY_CHECK(check_indices(
true,3,stride,i1,i2,i3));
667 return i3 + i2 * stride[0] + i1 * stride[1] ;
670 template<
typename isType ,
typename iType >
671 static iType op(
const isType *
const stride ,
672 const iType & i1 ,
const iType & i2 )
674 SHARDS_ARRAY_CHECK(check_indices(
true,2,stride,i1,i2));
675 return i2 + i1 * stride[0] ;
678 template<
typename isType ,
typename iType >
679 static iType op(
const isType *
const SHARDS_ARRAY_CHECK( stride ) ,
682 SHARDS_ARRAY_CHECK(check_indices(
true,1,stride,i1));
690 template<
typename Scalar ,
ArrayOrder Order ,
691 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
692 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
698 template<
typename Scalar ,
699 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
700 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
701 struct Helper<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
704 Array<Scalar,FortranOrder,Tag8,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1>
708 Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8,void>
713 static bool verify(
const int_t rank ,
const ArrayDimTag *
const tags[] )
715 return rank == Rank &&
716 tags[0] == & Tag8::tag() &&
717 tags[1] == & Tag7::tag() &&
718 tags[2] == & Tag6::tag() &&
719 tags[3] == & Tag5::tag() &&
720 tags[4] == & Tag4::tag() &&
721 tags[5] == & Tag3::tag() &&
722 tags[6] == & Tag2::tag() &&
723 tags[7] == & Tag1::tag() ;
726 static void assign_tags(
const ArrayDimTag * tags[] )
728 tags[0] = & Tag8::tag();
729 tags[1] = & Tag7::tag();
730 tags[2] = & Tag6::tag();
731 tags[3] = & Tag5::tag();
732 tags[4] = & Tag4::tag();
733 tags[5] = & Tag3::tag();
734 tags[6] = & Tag2::tag();
735 tags[7] = & Tag1::tag();
738 template<
typename iType >
739 static void assign( iType * stride )
741 stride[7] = Tag1::Size * (
742 stride[6] = Tag2::Size * (
743 stride[5] = Tag3::Size * (
744 stride[4] = Tag4::Size * (
745 stride[3] = Tag5::Size * (
746 stride[2] = Tag6::Size * (
747 stride[1] = Tag7::Size * (
748 stride[0] = Tag8::Size )))))));
751 template<
typename iType >
752 static void assign( iType * stride ,
756 stride[6] = Tag2::Size * (
757 stride[5] = Tag3::Size * (
758 stride[4] = Tag4::Size * (
759 stride[3] = Tag5::Size * (
760 stride[2] = Tag6::Size * (
761 stride[1] = Tag7::Size * (
762 stride[0] = Tag8::Size )))))));
765 template<
typename iType >
766 static void assign( iType * stride ,
772 stride[5] = Tag3::Size * (
773 stride[4] = Tag4::Size * (
774 stride[3] = Tag5::Size * (
775 stride[2] = Tag6::Size * (
776 stride[1] = Tag7::Size * (
777 stride[0] = Tag8::Size )))))));
780 template<
typename iType >
781 static void assign( iType * stride ,
789 stride[4] = Tag4::Size * (
790 stride[3] = Tag5::Size * (
791 stride[2] = Tag6::Size * (
792 stride[1] = Tag7::Size * (
793 stride[0] = Tag8::Size )))))));
796 template<
typename iType >
797 static void assign( iType * stride ,
807 stride[3] = Tag5::Size * (
808 stride[2] = Tag6::Size * (
809 stride[1] = Tag7::Size * (
810 stride[0] = Tag8::Size )))))));
813 template<
typename iType >
814 static void assign( iType * stride ,
826 stride[2] = Tag6::Size * (
827 stride[1] = Tag7::Size * (
828 stride[0] = Tag8::Size )))))));
831 template<
typename iType >
832 static void assign( iType * stride ,
846 stride[1] = Tag7::Size * (
847 stride[0] = Tag8::Size )))))));
850 template<
typename iType >
851 static void assign( iType * stride ,
867 stride[0] = Tag8::Size )))))));
870 template<
typename iType >
871 static void assign( iType * stride ,
888 stride[0] = n8 )))))));
891 template<
typename iType >
892 static void assign( iType * stride ,
893 const iType *
const dims )
895 stride[7] = dims[0] * (
896 stride[6] = dims[1] * (
897 stride[5] = dims[2] * (
898 stride[4] = dims[3] * (
899 stride[3] = dims[4] * (
900 stride[2] = dims[5] * (
901 stride[1] = dims[6] * (
902 stride[0] = dims[7] )))))));
906 template<
typename Scalar ,
907 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
908 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
909 struct Helper<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
912 Array<Scalar,NaturalOrder,Tag8,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1>
916 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
921 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
923 return rank == Rank &&
924 tags[0] == & Tag1::tag() &&
925 tags[1] == & Tag2::tag() &&
926 tags[2] == & Tag3::tag() &&
927 tags[3] == & Tag4::tag() &&
928 tags[4] == & Tag5::tag() &&
929 tags[5] == & Tag6::tag() &&
930 tags[6] == & Tag7::tag() &&
931 tags[7] == & Tag8::tag();
934 static void assign_tags(
const ArrayDimTag * tags[] )
936 tags[0] = & Tag1::tag();
937 tags[1] = & Tag2::tag();
938 tags[2] = & Tag3::tag();
939 tags[3] = & Tag4::tag();
940 tags[4] = & Tag5::tag();
941 tags[5] = & Tag6::tag();
942 tags[6] = & Tag7::tag();
943 tags[7] = & Tag8::tag();
946 template<
typename iType >
947 static void assign( iType * stride )
949 stride[7] = Tag8::Size * (
950 stride[6] = Tag7::Size * (
951 stride[5] = Tag6::Size * (
952 stride[4] = Tag5::Size * (
953 stride[3] = Tag4::Size * (
954 stride[2] = Tag3::Size * (
955 stride[1] = Tag2::Size * (
956 stride[0] = Tag1::Size )))))));
959 template<
typename iType >
960 static void assign( iType * stride ,
964 stride[6] = Tag7::Size * (
965 stride[5] = Tag6::Size * (
966 stride[4] = Tag5::Size * (
967 stride[3] = Tag4::Size * (
968 stride[2] = Tag3::Size * (
969 stride[1] = Tag2::Size * (
970 stride[0] = Tag1::Size )))))));
973 template<
typename iType >
974 static void assign( iType * stride ,
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 template<
typename iType >
989 static void assign( iType * stride ,
997 stride[4] = Tag5::Size * (
998 stride[3] = Tag4::Size * (
999 stride[2] = Tag3::Size * (
1000 stride[1] = Tag2::Size * (
1001 stride[0] = Tag1::Size )))))));
1004 template<
typename iType >
1005 static void assign( iType * stride ,
1015 stride[3] = Tag4::Size * (
1016 stride[2] = Tag3::Size * (
1017 stride[1] = Tag2::Size * (
1018 stride[0] = Tag1::Size )))))));
1021 template<
typename iType >
1022 static void assign( iType * stride ,
1034 stride[2] = Tag3::Size * (
1035 stride[1] = Tag2::Size * (
1036 stride[0] = Tag1::Size )))))));
1039 template<
typename iType >
1040 static void assign( iType * stride ,
1054 stride[1] = Tag2::Size * (
1055 stride[0] = Tag1::Size )))))));
1058 template<
typename iType >
1059 static void assign( iType * stride ,
1075 stride[0] = Tag1::Size )))))));
1078 template<
typename iType >
1079 static void assign( iType * stride ,
1096 stride[0] = n1 )))))));
1099 template<
typename iType >
1100 static void assign( iType * stride ,
1101 const iType *
const dims )
1103 stride[7] = dims[7] * (
1104 stride[6] = dims[6] * (
1105 stride[5] = dims[5] * (
1106 stride[4] = dims[4] * (
1107 stride[3] = dims[3] * (
1108 stride[2] = dims[2] * (
1109 stride[1] = dims[1] * (
1110 stride[0] = dims[0] )))))));
1117 template<
typename Scalar ,
1118 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1119 class Tag5 ,
class Tag6 ,
class Tag7 >
1120 struct Helper<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
1123 Array<Scalar,FortranOrder,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void>
1127 Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void,void>
1130 template<
class TagA >
1133 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>
1137 Array<Scalar,FortranOrder,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,TagA>
1140 typedef natural type ;
1141 typedef fortran reverse ;
1146 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
1148 return rank == Rank &&
1149 tags[0] == & Tag7::tag() &&
1150 tags[1] == & Tag6::tag() &&
1151 tags[2] == & Tag5::tag() &&
1152 tags[3] == & Tag4::tag() &&
1153 tags[4] == & Tag3::tag() &&
1154 tags[5] == & Tag2::tag() &&
1155 tags[6] == & Tag1::tag() ;
1158 static void assign_tags(
const ArrayDimTag * tags[] )
1160 tags[0] = & Tag7::tag();
1161 tags[1] = & Tag6::tag();
1162 tags[2] = & Tag5::tag();
1163 tags[3] = & Tag4::tag();
1164 tags[4] = & Tag3::tag();
1165 tags[5] = & Tag2::tag();
1166 tags[6] = & Tag1::tag();
1170 template<
typename iType >
1171 static void assign( iType * stride )
1174 stride[6] = Tag1::Size * (
1175 stride[5] = Tag2::Size * (
1176 stride[4] = Tag3::Size * (
1177 stride[3] = Tag4::Size * (
1178 stride[2] = Tag5::Size * (
1179 stride[1] = Tag6::Size * (
1180 stride[0] = Tag7::Size ))))));
1183 template<
typename iType >
1184 static void assign( iType * stride ,
1189 stride[5] = Tag2::Size * (
1190 stride[4] = Tag3::Size * (
1191 stride[3] = Tag4::Size * (
1192 stride[2] = Tag5::Size * (
1193 stride[1] = Tag6::Size * (
1194 stride[0] = Tag7::Size ))))));
1197 template<
typename iType >
1198 static void assign( iType * stride ,
1205 stride[4] = Tag3::Size * (
1206 stride[3] = Tag4::Size * (
1207 stride[2] = Tag5::Size * (
1208 stride[1] = Tag6::Size * (
1209 stride[0] = Tag7::Size ))))));
1212 template<
typename iType >
1213 static void assign( iType * stride ,
1222 stride[3] = Tag4::Size * (
1223 stride[2] = Tag5::Size * (
1224 stride[1] = Tag6::Size * (
1225 stride[0] = Tag7::Size ))))));
1228 template<
typename iType >
1229 static void assign( iType * stride ,
1240 stride[2] = Tag5::Size * (
1241 stride[1] = Tag6::Size * (
1242 stride[0] = Tag7::Size ))))));
1245 template<
typename iType >
1246 static void assign( iType * stride ,
1259 stride[1] = Tag6::Size * (
1260 stride[0] = Tag7::Size ))))));
1263 template<
typename iType >
1264 static void assign( iType * stride ,
1279 stride[0] = Tag7::Size ))))));
1282 template<
typename iType >
1283 static void assign( iType * stride ,
1299 stride[0] = n7 ))))));
1302 template<
typename iType >
1303 static void assign( iType * stride ,
1304 const iType *
const dims )
1307 stride[6] = dims[0] * (
1308 stride[5] = dims[1] * (
1309 stride[4] = dims[2] * (
1310 stride[3] = dims[3] * (
1311 stride[2] = dims[4] * (
1312 stride[1] = dims[5] * (
1313 stride[0] = dims[6] ))))));
1317 template<
typename Scalar ,
1318 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1319 class Tag5 ,
class Tag6 ,
class Tag7 >
1320 struct Helper<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
1323 Array<Scalar,NaturalOrder,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void>
1327 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void>
1330 template<
class TagA >
1333 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,TagA>
1337 Array<Scalar,NaturalOrder,TagA,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1>
1340 typedef fortran type ;
1341 typedef natural reverse ;
1346 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
1348 return rank == Rank &&
1349 tags[0] == & Tag1::tag() &&
1350 tags[1] == & Tag2::tag() &&
1351 tags[2] == & Tag3::tag() &&
1352 tags[3] == & Tag4::tag() &&
1353 tags[4] == & Tag5::tag() &&
1354 tags[5] == & Tag6::tag() &&
1355 tags[6] == & Tag7::tag();
1358 static void assign_tags(
const ArrayDimTag * tags[] )
1360 tags[0] = & Tag1::tag();
1361 tags[1] = & Tag2::tag();
1362 tags[2] = & Tag3::tag();
1363 tags[3] = & Tag4::tag();
1364 tags[4] = & Tag5::tag();
1365 tags[5] = & Tag6::tag();
1366 tags[6] = & Tag7::tag();
1370 template<
typename iType >
1371 static void assign( iType * stride )
1374 stride[6] = Tag7::Size * (
1375 stride[5] = Tag6::Size * (
1376 stride[4] = Tag5::Size * (
1377 stride[3] = Tag4::Size * (
1378 stride[2] = Tag3::Size * (
1379 stride[1] = Tag2::Size * (
1380 stride[0] = Tag1::Size ))))));
1383 template<
typename iType >
1384 static void assign( iType * stride ,
1389 stride[5] = Tag6::Size * (
1390 stride[4] = Tag5::Size * (
1391 stride[3] = Tag4::Size * (
1392 stride[2] = Tag3::Size * (
1393 stride[1] = Tag2::Size * (
1394 stride[0] = Tag1::Size ))))));
1397 template<
typename iType >
1398 static void assign( iType * stride ,
1405 stride[4] = Tag5::Size * (
1406 stride[3] = Tag4::Size * (
1407 stride[2] = Tag3::Size * (
1408 stride[1] = Tag2::Size * (
1409 stride[0] = Tag1::Size ))))));
1412 template<
typename iType >
1413 static void assign( iType * stride ,
1422 stride[3] = Tag4::Size * (
1423 stride[2] = Tag3::Size * (
1424 stride[1] = Tag2::Size * (
1425 stride[0] = Tag1::Size ))))));
1428 template<
typename iType >
1429 static void assign( iType * stride ,
1440 stride[2] = Tag3::Size * (
1441 stride[1] = Tag2::Size * (
1442 stride[0] = Tag1::Size ))))));
1445 template<
typename iType >
1446 static void assign( iType * stride ,
1459 stride[1] = Tag2::Size * (
1460 stride[0] = Tag1::Size ))))));
1463 template<
typename iType >
1464 static void assign( iType * stride ,
1479 stride[0] = Tag1::Size ))))));
1482 template<
typename iType >
1483 static void assign( iType * stride ,
1499 stride[0] = n1 ))))));
1502 template<
typename iType >
1503 static void assign( iType * stride ,
1504 const iType *
const dims )
1507 stride[6] = dims[6] * (
1508 stride[5] = dims[5] * (
1509 stride[4] = dims[4] * (
1510 stride[3] = dims[3] * (
1511 stride[2] = dims[2] * (
1512 stride[1] = dims[1] * (
1513 stride[0] = dims[0] ))))));
1520 template<
typename Scalar ,
1521 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1522 class Tag5 ,
class Tag6 >
1523 struct Helper<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void>
1526 Array<Scalar,FortranOrder,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void,void>
1530 Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,Tag5,Tag6,void,void,void>
1533 template<
class TagA >
1536 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void>
1540 Array<Scalar,FortranOrder,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,TagA,void>
1543 typedef natural type ;
1544 typedef fortran reverse ;
1549 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
1551 return rank == Rank &&
1552 tags[0] == & Tag6::tag() &&
1553 tags[1] == & Tag5::tag() &&
1554 tags[2] == & Tag4::tag() &&
1555 tags[3] == & Tag3::tag() &&
1556 tags[4] == & Tag2::tag() &&
1557 tags[5] == & Tag1::tag();
1560 static void assign_tags(
const ArrayDimTag * tags[] )
1562 tags[0] = & Tag6::tag();
1563 tags[1] = & Tag5::tag();
1564 tags[2] = & Tag4::tag();
1565 tags[3] = & Tag3::tag();
1566 tags[4] = & Tag2::tag();
1567 tags[5] = & Tag1::tag();
1572 template<
typename iType >
1573 static void assign( iType * stride )
1577 stride[5] = Tag1::Size * (
1578 stride[4] = Tag2::Size * (
1579 stride[3] = Tag3::Size * (
1580 stride[2] = Tag4::Size * (
1581 stride[1] = Tag5::Size * (
1582 stride[0] = Tag6::Size )))));
1585 template<
typename iType >
1586 static void assign( iType * stride ,
1592 stride[4] = Tag2::Size * (
1593 stride[3] = Tag3::Size * (
1594 stride[2] = Tag4::Size * (
1595 stride[1] = Tag5::Size * (
1596 stride[0] = Tag6::Size )))));
1599 template<
typename iType >
1600 static void assign( iType * stride ,
1608 stride[3] = Tag3::Size * (
1609 stride[2] = Tag4::Size * (
1610 stride[1] = Tag5::Size * (
1611 stride[0] = Tag6::Size )))));
1614 template<
typename iType >
1615 static void assign( iType * stride ,
1625 stride[2] = Tag4::Size * (
1626 stride[1] = Tag5::Size * (
1627 stride[0] = Tag6::Size )))));
1630 template<
typename iType >
1631 static void assign( iType * stride ,
1643 stride[1] = Tag5::Size * (
1644 stride[0] = Tag6::Size )))));
1647 template<
typename iType >
1648 static void assign( iType * stride ,
1662 stride[0] = Tag6::Size )))));
1665 template<
typename iType >
1666 static void assign( iType * stride ,
1681 stride[0] = n6 )))));
1684 template<
typename iType >
1685 static void assign( iType * stride ,
1686 const iType *
const dims )
1690 stride[5] = dims[0] * (
1691 stride[4] = dims[1] * (
1692 stride[3] = dims[2] * (
1693 stride[2] = dims[3] * (
1694 stride[1] = dims[4] * (
1695 stride[0] = dims[5] )))));
1699 template<
typename Scalar ,
1700 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
1701 class Tag5 ,
class Tag6 >
1702 struct Helper<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void>
1705 Array<Scalar,NaturalOrder,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void,void>
1709 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void>
1712 template<
class TagA >
1715 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,TagA,void>
1719 Array<Scalar,NaturalOrder,TagA,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void>
1722 typedef fortran type ;
1723 typedef natural reverse ;
1728 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
1730 return rank == Rank &&
1731 tags[0] == & Tag1::tag() &&
1732 tags[1] == & Tag2::tag() &&
1733 tags[2] == & Tag3::tag() &&
1734 tags[3] == & Tag4::tag() &&
1735 tags[4] == & Tag5::tag() &&
1736 tags[5] == & Tag6::tag();
1739 static void assign_tags(
const ArrayDimTag * tags[] )
1741 tags[0] = & Tag1::tag();
1742 tags[1] = & Tag2::tag();
1743 tags[2] = & Tag3::tag();
1744 tags[3] = & Tag4::tag();
1745 tags[4] = & Tag5::tag();
1746 tags[5] = & Tag6::tag();
1751 template<
typename iType >
1752 static void assign( iType * stride )
1756 stride[5] = Tag6::Size * (
1757 stride[4] = Tag5::Size * (
1758 stride[3] = Tag4::Size * (
1759 stride[2] = Tag3::Size * (
1760 stride[1] = Tag2::Size * (
1761 stride[0] = Tag1::Size )))));
1764 template<
typename iType >
1765 static void assign( iType * stride ,
1771 stride[4] = Tag5::Size * (
1772 stride[3] = Tag4::Size * (
1773 stride[2] = Tag3::Size * (
1774 stride[1] = Tag2::Size * (
1775 stride[0] = Tag1::Size )))));
1778 template<
typename iType >
1779 static void assign( iType * stride ,
1787 stride[3] = Tag4::Size * (
1788 stride[2] = Tag3::Size * (
1789 stride[1] = Tag2::Size * (
1790 stride[0] = Tag1::Size )))));
1793 template<
typename iType >
1794 static void assign( iType * stride ,
1804 stride[2] = Tag3::Size * (
1805 stride[1] = Tag2::Size * (
1806 stride[0] = Tag1::Size )))));
1809 template<
typename iType >
1810 static void assign( iType * stride ,
1822 stride[1] = Tag2::Size * (
1823 stride[0] = Tag1::Size )))));
1826 template<
typename iType >
1827 static void assign( iType * stride ,
1841 stride[0] = Tag1::Size )))));
1844 template<
typename iType >
1845 static void assign( iType * stride ,
1860 stride[0] = n1 )))));
1863 template<
typename iType >
1864 static void assign( iType * stride ,
1865 const iType *
const dims )
1869 stride[5] = dims[5] * (
1870 stride[4] = dims[4] * (
1871 stride[3] = dims[3] * (
1872 stride[2] = dims[2] * (
1873 stride[1] = dims[1] * (
1874 stride[0] = dims[0] )))));
1881 template<
typename Scalar ,
1882 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
class Tag5 >
1883 struct Helper<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void>
1886 Array<Scalar,FortranOrder,Tag5,Tag4,Tag3,Tag2,Tag1,void,void,void>
1890 Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,Tag5,void,void,void,void>
1893 template<
class TagA >
1896 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,Tag3,Tag4,Tag5,void,void>
1900 Array<Scalar,FortranOrder,Tag5,Tag4,Tag3,Tag2,Tag1,TagA,void,void>
1903 typedef natural type ;
1904 typedef fortran reverse ;
1909 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
1911 return rank == Rank &&
1912 tags[0] == & Tag5::tag() &&
1913 tags[1] == & Tag4::tag() &&
1914 tags[2] == & Tag3::tag() &&
1915 tags[3] == & Tag2::tag() &&
1916 tags[4] == & Tag1::tag();
1919 static void assign_tags(
const ArrayDimTag * tags[] )
1921 tags[0] = & Tag5::tag();
1922 tags[1] = & Tag4::tag();
1923 tags[2] = & Tag3::tag();
1924 tags[3] = & Tag2::tag();
1925 tags[4] = & Tag1::tag();
1931 template<
typename iType >
1932 static void assign( iType * stride )
1937 stride[4] = Tag1::Size * (
1938 stride[3] = Tag2::Size * (
1939 stride[2] = Tag3::Size * (
1940 stride[1] = Tag4::Size * (
1941 stride[0] = Tag5::Size ))));
1944 template<
typename iType >
1945 static void assign( iType * stride ,
1952 stride[3] = Tag2::Size * (
1953 stride[2] = Tag3::Size * (
1954 stride[1] = Tag4::Size * (
1955 stride[0] = Tag5::Size ))));
1958 template<
typename iType >
1959 static void assign( iType * stride ,
1968 stride[2] = Tag3::Size * (
1969 stride[1] = Tag4::Size * (
1970 stride[0] = Tag5::Size ))));
1973 template<
typename iType >
1974 static void assign( iType * stride ,
1985 stride[1] = Tag4::Size * (
1986 stride[0] = Tag5::Size ))));
1989 template<
typename iType >
1990 static void assign( iType * stride ,
2003 stride[0] = Tag5::Size ))));
2006 template<
typename iType >
2007 static void assign( iType * stride ,
2021 stride[0] = n5 ))));
2024 template<
typename iType >
2025 static void assign( iType * stride ,
2026 const iType *
const dims )
2031 stride[4] = dims[0] * (
2032 stride[3] = dims[1] * (
2033 stride[2] = dims[2] * (
2034 stride[1] = dims[3] * (
2035 stride[0] = dims[4] ))));
2039 template<
typename Scalar ,
2040 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
class Tag5 >
2041 struct Helper<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void>
2044 Array<Scalar,NaturalOrder,Tag5,Tag4,Tag3,Tag2,Tag1,void,void,void>
2048 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void>
2051 template<
class TagA >
2054 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,TagA,void,void>
2058 Array<Scalar,NaturalOrder,TagA,Tag5,Tag4,Tag3,Tag2,Tag1,void,void>
2061 typedef fortran type ;
2062 typedef natural reverse ;
2067 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2069 return rank == Rank &&
2070 tags[0] == & Tag1::tag() &&
2071 tags[1] == & Tag2::tag() &&
2072 tags[2] == & Tag3::tag() &&
2073 tags[3] == & Tag4::tag() &&
2074 tags[4] == & Tag5::tag();
2077 static void assign_tags(
const ArrayDimTag * tags[] )
2079 tags[0] = & Tag1::tag();
2080 tags[1] = & Tag2::tag();
2081 tags[2] = & Tag3::tag();
2082 tags[3] = & Tag4::tag();
2083 tags[4] = & Tag5::tag();
2089 template<
typename iType >
2090 static void assign( iType * stride )
2095 stride[4] = Tag5::Size * (
2096 stride[3] = Tag4::Size * (
2097 stride[2] = Tag3::Size * (
2098 stride[1] = Tag2::Size * (
2099 stride[0] = Tag1::Size ))));
2102 template<
typename iType >
2103 static void assign( iType * stride ,
2110 stride[3] = Tag4::Size * (
2111 stride[2] = Tag3::Size * (
2112 stride[1] = Tag2::Size * (
2113 stride[0] = Tag1::Size ))));
2116 template<
typename iType >
2117 static void assign( iType * stride ,
2126 stride[2] = Tag3::Size * (
2127 stride[1] = Tag2::Size * (
2128 stride[0] = Tag1::Size ))));
2131 template<
typename iType >
2132 static void assign( iType * stride ,
2143 stride[1] = Tag2::Size * (
2144 stride[0] = Tag1::Size ))));
2147 template<
typename iType >
2148 static void assign( iType * stride ,
2161 stride[0] = Tag1::Size ))));
2164 template<
typename iType >
2165 static void assign( iType * stride ,
2179 stride[0] = n1 ))));
2182 template<
typename iType >
2183 static void assign( iType * stride ,
2184 const iType *
const dims )
2189 stride[4] = dims[4] * (
2190 stride[3] = dims[3] * (
2191 stride[2] = dims[2] * (
2192 stride[1] = dims[1] * (
2193 stride[0] = dims[0] ))));
2200 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 >
2201 struct Helper<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void>
2204 Array<Scalar,FortranOrder,Tag4,Tag3,Tag2,Tag1,void,void,void,void>
2208 Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,void,void,void,void,void>
2211 template<
class TagA >
2214 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,Tag3,Tag4,void,void,void>
2218 Array<Scalar,FortranOrder,Tag4,Tag3,Tag2,Tag1,TagA,void,void,void>
2221 typedef natural type ;
2222 typedef fortran reverse ;
2227 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2229 return rank == Rank &&
2230 tags[0] == & Tag4::tag() &&
2231 tags[1] == & Tag3::tag() &&
2232 tags[2] == & Tag2::tag() &&
2233 tags[3] == & Tag1::tag();
2236 static void assign_tags(
const ArrayDimTag * tags[] )
2238 tags[0] = & Tag4::tag();
2239 tags[1] = & Tag3::tag();
2240 tags[2] = & Tag2::tag();
2241 tags[3] = & Tag1::tag();
2248 template<
typename iType >
2249 static void assign( iType * stride )
2255 stride[3] = Tag1::Size * (
2256 stride[2] = Tag2::Size * (
2257 stride[1] = Tag3::Size * (
2258 stride[0] = Tag4::Size )));
2261 template<
typename iType >
2262 static void assign( iType * stride ,
2270 stride[2] = Tag2::Size * (
2271 stride[1] = Tag3::Size * (
2272 stride[0] = Tag4::Size )));
2275 template<
typename iType >
2276 static void assign( iType * stride ,
2286 stride[1] = Tag3::Size * (
2287 stride[0] = Tag4::Size )));
2290 template<
typename iType >
2291 static void assign( iType * stride ,
2303 stride[0] = Tag4::Size )));
2306 template<
typename iType >
2307 static void assign( iType * stride ,
2323 template<
typename iType >
2324 static void assign( iType * stride ,
2325 const iType *
const dims )
2331 stride[3] = dims[0] * (
2332 stride[2] = dims[1] * (
2333 stride[1] = dims[2] * (
2334 stride[0] = dims[3] )));
2338 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 >
2339 struct Helper<Scalar,
FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void>
2342 Array<Scalar,NaturalOrder,Tag4,Tag3,Tag2,Tag1,void,void,void,void>
2346 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void>
2349 template<
class TagA >
2352 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,TagA,void,void,void>
2356 Array<Scalar,NaturalOrder,TagA,Tag4,Tag3,Tag2,Tag1,void,void,void>
2359 typedef fortran type ;
2360 typedef natural reverse ;
2365 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2367 return rank == Rank &&
2368 tags[0] == & Tag1::tag() &&
2369 tags[1] == & Tag2::tag() &&
2370 tags[2] == & Tag3::tag() &&
2371 tags[3] == & Tag4::tag();
2374 static void assign_tags(
const ArrayDimTag * tags[] )
2376 tags[0] = & Tag1::tag();
2377 tags[1] = & Tag2::tag();
2378 tags[2] = & Tag3::tag();
2379 tags[3] = & Tag4::tag();
2386 template<
typename iType >
2387 static void assign( iType * stride )
2393 stride[3] = Tag4::Size * (
2394 stride[2] = Tag3::Size * (
2395 stride[1] = Tag2::Size * (
2396 stride[0] = Tag1::Size )));
2399 template<
typename iType >
2400 static void assign( iType * stride ,
2408 stride[2] = Tag3::Size * (
2409 stride[1] = Tag2::Size * (
2410 stride[0] = Tag1::Size )));
2413 template<
typename iType >
2414 static void assign( iType * stride ,
2424 stride[1] = Tag2::Size * (
2425 stride[0] = Tag1::Size )));
2428 template<
typename iType >
2429 static void assign( iType * stride ,
2441 stride[0] = Tag1::Size )));
2444 template<
typename iType >
2445 static void assign( iType * stride ,
2461 template<
typename iType >
2462 static void assign( iType * stride ,
2463 const iType *
const dims )
2469 stride[3] = dims[3] * (
2470 stride[2] = dims[2] * (
2471 stride[1] = dims[1] * (
2472 stride[0] = dims[0] )));
2479 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class Tag3 >
2480 struct Helper<Scalar,
NaturalOrder,Tag1,Tag2,Tag3,void,void,void,void,void>
2483 Array<Scalar,FortranOrder,Tag3,Tag2,Tag1,void,void,void,void,void>
2487 Array<Scalar,NaturalOrder,Tag2,Tag3,void,void,void,void,void,void>
2490 template<
class TagA >
2493 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,Tag3,void,void,void,void>
2497 Array<Scalar,FortranOrder,Tag3,Tag2,Tag1,TagA,void,void,void,void>
2500 typedef natural type ;
2501 typedef fortran reverse ;
2506 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2508 return rank == Rank &&
2509 tags[0] == & Tag3::tag() &&
2510 tags[1] == & Tag2::tag() &&
2511 tags[2] == & Tag1::tag();
2514 static void assign_tags(
const ArrayDimTag * tags[] )
2516 tags[0] = & Tag3::tag();
2517 tags[1] = & Tag2::tag();
2518 tags[2] = & Tag1::tag();
2526 template<
typename iType >
2527 static void assign( iType * stride )
2534 stride[2] = Tag1::Size * (
2535 stride[1] = Tag2::Size * (
2536 stride[0] = Tag3::Size ));
2539 template<
typename iType >
2540 static void assign( iType * stride ,
2549 stride[1] = Tag2::Size * (
2550 stride[0] = Tag3::Size ));
2553 template<
typename iType >
2554 static void assign( iType * stride ,
2565 stride[0] = Tag3::Size ));
2568 template<
typename iType >
2569 static void assign( iType * stride ,
2584 template<
typename iType >
2585 static void assign( iType * stride ,
2586 const iType *
const dims )
2593 stride[2] = dims[0] * (
2594 stride[1] = dims[1] * (
2595 stride[0] = dims[2] ));
2599 template<
typename Scalar ,
class Tag1 ,
class Tag2 ,
class Tag3 >
2600 struct Helper<Scalar,
FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void>
2603 Array<Scalar,NaturalOrder,Tag3,Tag2,Tag1,void,void,void,void,void>
2607 Array<Scalar,FortranOrder,Tag1,Tag2,void,void,void,void,void,void>
2610 template<
class TagA >
2613 Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,TagA,void,void,void,void>
2617 Array<Scalar,NaturalOrder,TagA,Tag3,Tag2,Tag1,void,void,void,void>
2620 typedef fortran type ;
2621 typedef natural reverse ;
2626 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2628 return rank == Rank &&
2629 tags[0] == & Tag1::tag() &&
2630 tags[1] == & Tag2::tag() &&
2631 tags[2] == & Tag3::tag();
2634 static void assign_tags(
const ArrayDimTag * tags[] )
2636 tags[0] = & Tag1::tag();
2637 tags[1] = & Tag2::tag();
2638 tags[2] = & Tag3::tag();
2646 template<
typename iType >
2647 static void assign( iType * stride )
2654 stride[2] = Tag3::Size * (
2655 stride[1] = Tag2::Size * (
2656 stride[0] = Tag1::Size ));
2659 template<
typename iType >
2660 static void assign( iType * stride ,
2669 stride[1] = Tag2::Size * (
2670 stride[0] = Tag1::Size ));
2673 template<
typename iType >
2674 static void assign( iType * stride ,
2685 stride[0] = Tag1::Size ));
2688 template<
typename iType >
2689 static void assign( iType * stride ,
2704 template<
typename iType >
2705 static void assign( iType * stride ,
2706 const iType *
const dims )
2713 stride[2] = dims[2] * (
2714 stride[1] = dims[1] * (
2715 stride[0] = dims[0] ));
2722 template<
typename Scalar ,
class Tag1 ,
class Tag2 >
2723 struct Helper<Scalar,
NaturalOrder,Tag1,Tag2,void,void,void,void,void,void>
2726 Array<Scalar,FortranOrder,Tag2,Tag1,void,void,void,void,void,void>
2730 Array<Scalar,NaturalOrder,Tag2,void,void,void,void,void,void,void>
2733 template<
class TagA >
2736 Array<Scalar,NaturalOrder,TagA,Tag1,Tag2,void,void,void,void,void>
2740 Array<Scalar,FortranOrder,Tag2,Tag1,TagA,void,void,void,void,void>
2743 typedef natural type ;
2744 typedef fortran reverse ;
2749 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2751 return rank == Rank &&
2752 tags[0] == & Tag2::tag() &&
2753 tags[1] == & Tag1::tag();
2756 static void assign_tags(
const ArrayDimTag * tags[] )
2758 tags[0] = & Tag2::tag();
2759 tags[1] = & Tag1::tag();
2768 template<
typename iType >
2769 static void assign( iType * stride )
2777 stride[1] = Tag1::Size * (
2778 stride[0] = Tag2::Size );
2781 template<
typename iType >
2782 static void assign( iType * stride ,
2792 stride[0] = Tag2::Size );
2795 template<
typename iType >
2796 static void assign( iType * stride ,
2810 template<
typename iType >
2811 static void assign( iType * stride ,
2812 const iType *
const dims )
2820 stride[1] = dims[0] * (
2821 stride[0] = dims[1] );
2825 template<
typename Scalar ,
class Tag1 ,
class Tag2 >
2826 struct Helper<Scalar,
FortranOrder,Tag1,Tag2,void,void,void,void,void,void>
2829 Array<Scalar,NaturalOrder,Tag2,Tag1,void,void,void,void,void,void>
2833 Array<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void>
2836 template<
class TagA >
2839 Array<Scalar,FortranOrder,Tag1,Tag2,TagA,void,void,void,void,void>
2843 Array<Scalar,NaturalOrder,TagA,Tag2,Tag1,void,void,void,void,void>
2846 typedef fortran type ;
2847 typedef natural reverse ;
2852 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2854 return rank == Rank &&
2855 tags[0] = & Tag1::tag() &&
2856 tags[1] = & Tag2::tag();
2859 static void assign_tags(
const ArrayDimTag * tags[] )
2861 tags[0] = & Tag1::tag();
2862 tags[1] = & Tag2::tag();
2871 template<
typename iType >
2872 static void assign( iType * stride )
2880 stride[1] = Tag2::Size * (
2881 stride[0] = Tag1::Size );
2884 template<
typename iType >
2885 static void assign( iType * stride ,
2895 stride[0] = Tag1::Size );
2898 template<
typename iType >
2899 static void assign( iType * stride ,
2913 template<
typename iType >
2914 static void assign( iType * stride ,
2915 const iType *
const dims )
2923 stride[1] = dims[1] * (
2924 stride[0] = dims[0] );
2931 template<
typename Scalar ,
class Tag1 >
2932 struct Helper<Scalar,
NaturalOrder,Tag1,void,void,void,void,void,void,void>
2935 Array<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void>
2939 Array<Scalar,RankZero,void,void,void,void,void,void,void,void>
2942 template<
class TagA >
2945 Array<Scalar,NaturalOrder,TagA,Tag1,void,void,void,void,void,void>
2949 Array<Scalar,FortranOrder,Tag1,TagA,void,void,void,void,void,void>
2952 typedef natural type ;
2953 typedef fortran reverse ;
2958 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
2959 {
return rank == Rank && tags[0] == & Tag1::tag(); }
2961 static void assign_tags(
const ArrayDimTag * tags[] )
2963 tags[0] = & Tag1::tag();
2973 template<
typename iType >
2974 static void assign( iType * stride )
2983 stride[0] = Tag1::Size ;
2986 template<
typename iType >
2987 static void assign( iType * stride ,
3000 template<
typename iType >
3001 static void assign( iType * stride ,
3002 const iType *
const dims )
3011 stride[0] = dims[0] ;
3015 template<
typename Scalar ,
class Tag1 >
3016 struct Helper<Scalar,
FortranOrder,Tag1,void,void,void,void,void,void,void>
3019 Array<Scalar,NaturalOrder,Tag1,void,void,void,void,void,void,void>
3023 Array<Scalar,RankZero,void,void,void,void,void,void,void,void>
3026 template<
class TagA >
3029 Array<Scalar,FortranOrder,Tag1,TagA,void,void,void,void,void,void>
3033 Array<Scalar,NaturalOrder,TagA,Tag1,void,void,void,void,void,void>
3036 typedef fortran type ;
3037 typedef natural reverse ;
3042 static bool verify( int_t rank ,
const ArrayDimTag * tags[] )
3043 {
return rank == Rank && tags[0] == & Tag1::tag(); }
3045 static void assign_tags(
const ArrayDimTag * tags[] )
3047 tags[0] = & Tag1::tag();
3057 template<
typename iType >
3058 static void assign( iType * stride )
3067 stride[0] = Tag1::Size ;
3070 template<
typename iType >
3071 static void assign( iType * stride ,
const iType & n1 )
3083 template<
typename iType >
3084 static void assign( iType * stride ,
const iType *
const dims )
3092 stride[0] = dims[0] ;
3099 template<
typename Scalar >
3100 struct Helper<Scalar,
RankZero,void,void,void,void,void,void,void,void>
3103 Array<Scalar,RankZero,void,void,void,void,void,void,void,void>
3106 template<
class TagA >
3109 Array<Scalar,NaturalOrder,TagA,void,void,void,void,void,void,void>
3113 Array<Scalar,FortranOrder,TagA,void,void,void,void,void,void,void>
3116 typedef natural type ;
3117 typedef fortran reverse ;
3122 template<
typename iType >
3123 static void assign( iType * ) {}
3129 template<
typename Scalar >
3130 struct Helper<Scalar,
NaturalOrder,void,void,void,void,void,void,void,void>
3133 Array<Scalar,FortranOrder,void,void,void,void,void,void,void,void>
3137 template<
typename Scalar >
3138 struct Helper<Scalar,
FortranOrder,void,void,void,void,void,void,void,void>
3141 Array<Scalar,NaturalOrder,void,void,void,void,void,void,void,void>
3149 template<
class ArrayType ,
class TagA >
struct ArrayAppend {};
3151 template<
typename Scalar ,
ArrayOrder Order ,
3152 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3153 class Tag5 ,
class Tag6 ,
class Tag7 ,
class TagA >
3155 Array<Scalar,Order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> , TagA >
3159 array_traits::Helper<Scalar,Order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
3160 ::template append<TagA> helper ;
3162 typedef typename helper::type type ;
3163 typedef typename helper::natural natural ;
3164 typedef typename helper::fortran fortran ;
3193 template<
typename Scalar , ArrayOrder array_order >
3194 class Array<Scalar,array_order,void,void,void,void,void,void,void,void>
3197 typedef typename array_traits::Offset<array_order> Offset ;
3221 enum { Contiguous =
true };
3240 array_traits::check_range( ord , m_rank );
3241 if ( Natural ) { ord = ( m_rank - 1 ) - ord ; }
3250 array_traits::check_range( ord , m_rank );
3251 if ( Natural ) { ord = ( m_rank - 1 ) - ord ; }
3252 return ord ? m_stride[ord] / m_stride[ord-1] : m_stride[ord] ;
3256 template<
typename iType >
3275 template<
typename iType >
3277 {
return Array( *
this , i ); }
3283 template<
typename iType >
3286 SHARDS_ARRAY_CHECK( array_traits::check_range(i,
size()) );
3292 template<
typename iType >
3294 const iType & i3 ,
const iType & i4 ,
3295 const iType & i5 ,
const iType & i6 ,
3296 const iType & i7 ,
const iType & i8 )
const 3298 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 8 ) );
3299 return m_ptr[ Offset::op(m_stride,i1,i2,i3,i4,i5,i6,i7,i8) ];
3302 template<
typename iType >
3304 const iType & i3 ,
const iType & i4 ,
3305 const iType & i5 ,
const iType & i6 ,
3306 const iType & i7 )
const 3308 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 7 ) );
3309 return m_ptr[ Offset::op(m_stride,i1,i2,i3,i4,i5,i6,i7) ];
3312 template<
typename iType >
3314 const iType & i3 ,
const iType & i4 ,
3315 const iType & i5 ,
const iType & i6 )
const 3317 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 6 ) );
3318 return m_ptr[ Offset::op(m_stride,i1,i2,i3,i4,i5,i6) ];
3321 template<
typename iType >
3323 const iType & i3 ,
const iType & i4 ,
3324 const iType & i5 )
const 3326 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 5 ) );
3327 return m_ptr[ Offset::op(m_stride,i1,i2,i3,i4,i5) ];
3330 template<
typename iType >
3332 const iType & i3 ,
const iType & i4 )
const 3334 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 4 ) );
3335 return m_ptr[ Offset::op(m_stride,i1,i2,i3,i4) ];
3338 template<
typename iType >
3340 const iType & i3 )
const 3342 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 3 ) );
3343 return m_ptr[ Offset::op(m_stride,i1,i2,i3) ];
3346 template<
typename iType >
3349 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 2 ) );
3350 return m_ptr[ Offset::op(m_stride,i1,i2) ];
3353 template<
typename iType >
3356 SHARDS_ARRAY_CHECK( array_traits::check_rank( m_rank , 1 ) );
3357 return m_ptr[ Offset::op(m_stride,i1) ];
3367 array_traits::Helper<Scalar,array_order,void,void,void,void,void,void,void,void>
3373 : m_ptr(NULL), m_rank(0)
3376 Copy<8>( m_tag , (
tag_type) NULL );
3380 : m_ptr( rhs.m_ptr ), m_rank( rhs.m_rank )
3382 Copy<8>( m_stride , rhs.m_stride );
3383 Copy<8>( m_tag , rhs.m_tag );
3389 m_rank = rhs.m_rank ;
3390 Copy<8>( m_stride , rhs.m_stride );
3391 Copy<8>( m_tag , rhs.m_tag );
3397 : m_ptr( rhs.m_ptr ), m_rank( rhs.m_rank )
3399 Copy<8>( m_stride , rhs.m_stride );
3407 m_rank = rhs.m_rank ;
3408 Copy<8>( m_stride , rhs.m_stride );
3420 : m_ptr( ptr ), m_rank( input_rank )
3422 array_traits::init_dim( m_stride, dims, input_rank, Natural);
3423 array_traits::init_tags( m_tag, tags, input_rank, Natural);
3428 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3429 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
3435 array_traits::Helper<Scalar,array_order,
3436 Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
3439 m_rank = helper::Rank ;
3440 helper::assign_tags( m_tag );
3441 helper::assign( m_stride, n1, n2, n3, n4, n5, n6, n7, n8 );
3445 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3446 class Tag5 ,
class Tag6 ,
class Tag7 >
3452 array_traits::Helper<Scalar,array_order,
3453 Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,
void>
3456 m_rank = helper::Rank ;
3457 helper::assign_tags( m_tag );
3458 helper::assign( m_stride, n1, n2, n3, n4, n5, n6, n7 );
return *this ;
3461 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3462 class Tag5 ,
class Tag6 >
3468 array_traits::Helper<Scalar,array_order,
3469 Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,
void>
3472 m_rank = helper::Rank ;
3473 helper::assign_tags( m_tag );
3474 helper::assign( m_stride, n1, n2, n3, n4, n5, n6 );
3478 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3485 array_traits::Helper<Scalar,array_order,
3486 Tag1,Tag2,Tag3,Tag4,Tag5,void,void,
void>
3489 m_rank = helper::Rank ;
3490 helper::assign_tags( m_tag );
3491 helper::assign( m_stride, n1, n2, n3, n4, n5 );
3495 template<
class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 >
3500 array_traits::Helper<Scalar,array_order,
3501 Tag1,Tag2,Tag3,Tag4,void,void,void,
void>
3504 m_rank = helper::Rank ;
3505 helper::assign_tags( m_tag );
3506 helper::assign( m_stride, n1, n2, n3, n4 );
3510 template<
class Tag1 ,
class Tag2 ,
class Tag3 >
3515 array_traits::Helper<Scalar,array_order,
3516 Tag1,Tag2,Tag3,void,void,void,void,
void>
3519 m_rank = helper::Rank ;
3520 helper::assign_tags( m_tag );
3521 helper::assign( m_stride, n1, n2, n3 );
3525 template<
class Tag1 ,
class Tag2 >
3530 array_traits::Helper<Scalar,array_order,
3531 Tag1,Tag2,void,void,void,void,void,
void>
3534 m_rank = helper::Rank ;
3535 helper::assign_tags( m_tag );
3536 helper::assign( m_stride, n1, n2 );
3540 template<
class Tag1 >
3545 array_traits::Helper<Scalar,array_order,
3546 Tag1,void,void,void,void,void,void,
void>
3549 m_rank = helper::Rank ;
3550 helper::assign_tags( m_tag );
3551 helper::assign( m_stride, n1 );
3559 : m_ptr( NULL ), m_rank( 0 )
3561 if ( 1 < rhs.m_rank ) {
3562 Copy<8>( m_stride , rhs.m_stride );
3563 Copy<8>( m_tag , rhs.m_tag );
3564 m_rank = rhs.m_rank - 1 ;
3565 m_ptr = rhs.m_ptr + ( m_rank ? m_stride[ m_rank - 1 ] * i : i );
3566 m_stride[ m_rank ] = 0 ;
3567 m_tag[ m_rank ] = 0 ;
3571 Copy<8>( m_tag , (
tag_type) NULL );
3588 class , class , class , class ,
3589 class , class , class ,
class >
3612 template<
typename Scalar ,
ArrayOrder array_order ,
3613 class Tag1 ,
class Tag2 ,
class Tag3 ,
class Tag4 ,
3614 class Tag5 ,
class Tag6 ,
class Tag7 ,
class Tag8 >
3619 #ifndef DOXYGEN_COMPILE 3621 array_traits::Helper<Scalar,array_order,
3622 Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
3643 enum { Rank = helper::Rank };
3652 enum { Contiguous =
true };
3668 #ifndef DOXYGEN_COMPILE 3670 template <
size_type ordinate >
3672 typedef typename array_traits::TagAt<Array,ordinate>::type type ;
3678 {
return m_array.tag( ordinate ); }
3684 typedef array_traits::StrideDim<array_order,Rank,ordinate> StrideDim ;
3685 return StrideDim::dimension(m_array.m_stride);
3691 typedef array_traits::StrideDim<array_order,Rank> StrideDim ;
3692 return StrideDim::dimension(m_array.m_stride,ordinate);
3696 template<
typename iType >
3698 { m_array.template dimensions<iType>( n ); }
3718 template<
typename iType >
3727 template<
typename iType >
3729 {
return m_array[i]; }
3732 template<
typename iType >
3734 const iType & i3 ,
const iType & i4 ,
3735 const iType & i5 ,
const iType & i6 ,
3736 const iType & i7 ,
const iType & i8 )
const 3738 array_traits::CheckRank<8,Rank>::ok();
3739 return m_array(i1,i2,i3,i4,i5,i6,i7,i8);
3743 template<
typename iType >
3745 const iType & i3 ,
const iType & i4 ,
3746 const iType & i5 ,
const iType & i6 ,
3747 const iType & i7 )
const 3749 array_traits::CheckRank<7,Rank>::ok();
3750 return m_array(i1,i2,i3,i4,i5,i6,i7);
3754 template<
typename iType >
3756 const iType & i3 ,
const iType & i4 ,
3757 const iType & i5 ,
const iType & i6 )
const 3759 array_traits::CheckRank<6,Rank>::ok();
3760 return m_array(i1,i2,i3,i4,i5,i6);
3764 template<
typename iType >
3766 const iType & i3 ,
const iType & i4 ,
3767 const iType & i5 )
const 3769 array_traits::CheckRank<5,Rank>::ok();
3770 return m_array(i1,i2,i3,i4,i5);
3774 template<
typename iType >
3776 const iType & i3 ,
const iType & i4 )
const 3778 array_traits::CheckRank<4,Rank>::ok();
3779 return m_array(i1,i2,i3,i4);
3783 template<
typename iType >
3785 const iType & i3 )
const 3787 array_traits::CheckRank<3,Rank>::ok();
3788 return m_array(i1,i2,i3);
3792 template<
typename iType >
3795 array_traits::CheckRank<2,Rank>::ok();
3796 return m_array(i1,i2);
3800 template<
typename iType >
3803 array_traits::CheckRank<1,Rank>::ok();
3820 { m_array.m_rank = Rank ; helper::assign_tags( m_array.m_tag ); }
3827 { m_array.operator=(rhs.m_array);
return *this ; }
3834 { m_array.operator=(rhs.m_array);
return *this ; }
3839 m_array.m_ptr = arg_ptr ;
3840 array_traits::init_dim( m_array.m_stride , dims , Rank , Natural );
3848 m_array.m_rank = Rank ;
3849 helper::assign_tags( m_array.m_tag );
3850 assign( arg_ptr , dims );
3860 array_traits::CheckRange<7,Rank>::ok();
3861 m_array.m_ptr = arg_ptr ;
3862 helper::assign( m_array.m_stride, n1, n2, n3, n4, n5, n6, n7, n8 );
3874 m_array.m_rank = Rank ;
3875 helper::assign_tags( m_array.m_tag );
3876 assign( arg_ptr, n1, n2, n3, n4, n5, n6, n7, n8 );
3888 array_traits::CheckRange<6,Rank>::ok();
3889 m_array.m_ptr = arg_ptr ;
3890 helper::assign( m_array.m_stride, n1, n2, n3, n4, n5, n6, n7 );
3904 m_array.m_rank = Rank ;
3905 helper::assign_tags( m_array.m_tag );
3906 assign( arg_ptr, n1, n2, n3, n4, n5, n6, n7 );
3917 array_traits::CheckRange<5,Rank>::ok();
3918 m_array.m_ptr = arg_ptr ;
3919 helper::assign( m_array.m_stride, n1, n2, n3, n4, n5, n6 );
3932 m_array.m_rank = Rank ;
3933 helper::assign_tags( m_array.m_tag );
3934 assign( arg_ptr, n1, n2, n3, n4, n5, n6 );
3945 array_traits::CheckRange<4,Rank>::ok();
3946 m_array.m_ptr = arg_ptr ;
3947 helper::assign( m_array.m_stride, n1, n2, n3, n4, n5 );
3960 m_array.m_rank = Rank ;
3961 helper::assign_tags( m_array.m_tag );
3962 assign( arg_ptr, n1, n2, n3, n4, n5 );
3972 array_traits::CheckRange<3,Rank>::ok();
3973 m_array.m_ptr = arg_ptr ;
3974 helper::assign( m_array.m_stride, n1, n2, n3, n4 );
3986 m_array.m_rank = Rank ;
3987 helper::assign_tags( m_array.m_tag );
3988 assign( arg_ptr, n1, n2, n3, n4 );
3998 array_traits::CheckRange<2,Rank>::ok();
3999 m_array.m_ptr = arg_ptr ;
4000 helper::assign( m_array.m_stride, n1, n2, n3 );
4012 m_array.m_rank = Rank ;
4013 helper::assign_tags( m_array.m_tag );
4014 assign( arg_ptr , n1, n2, n3 );
4023 array_traits::CheckRange<1,Rank>::ok();
4024 m_array.m_ptr = arg_ptr ;
4025 helper::assign( m_array.m_stride, n1, n2 );
4035 m_array.m_rank = Rank ;
4036 helper::assign_tags( m_array.m_tag );
4037 assign( arg_ptr, n1, n2 );
4045 array_traits::CheckRange<0,Rank>::ok();
4046 m_array.m_ptr = arg_ptr ;
4047 helper::assign( m_array.m_stride, n1 );
4057 m_array.m_rank = Rank ;
4058 helper::assign_tags( m_array.m_tag );
4065 m_array.m_ptr = arg_ptr ;
4066 helper::assign( m_array.m_stride );
4074 m_array.m_rank = Rank ;
4075 helper::assign_tags( m_array.m_tag );
4083 if ( ! helper::verify( m_array.m_rank , m_array.m_tag ) ) {
4084 m_array.m_rank = Rank ;
4085 helper::assign_tags( m_array.m_tag );
4086 array_traits::throw_bad_conversion( m_array.m_rank , m_array.m_tag ,
4087 rhs.m_rank , rhs.m_tag );
4102 m_array.m_ptr = arg_ptr ;
4112 m_array.m_ptr = arg_ptr ;
4113 Copy<Rank-1>( m_array.m_stride , arg_stride );
4114 m_array.m_stride[Rank-1] = m_array.m_stride[Rank-2] * arg_final_dim ;
4122 : m_array( rhs , i )
4124 if ( ! helper::verify( m_array.m_rank , m_array.m_tag ) ) {
4125 m_array.m_rank = Rank ;
4126 helper::assign_tags( m_array.m_tag );
4127 array_traits::throw_bad_conversion( m_array.m_rank , m_array.m_tag ,
4128 rhs.m_rank - 1 , rhs.m_tag );
4132 Array<value_type,array_order> m_array ;
4135 class , class , class , class ,
4136 class , class , class ,
class >
4145 template<
typename Scalar >
4168 enum { Natural =
false };
4171 enum { Reverse =
false };
4174 enum { Contiguous =
true };
4211 Array() : m_ptr(NULL) {}
4213 Array(
const Array & rhs ) : m_ptr( rhs.m_ptr ) {}
4216 { m_ptr = rhs.m_ptr ;
return *this ; }
4226 #ifndef DOXYGEN_COMPILE 4230 class , class , class , class ,
4231 class , class , class ,
class >
4245 #undef SHARDS_ARRAY_CHECK The preferred multi-dimensional Array interface with compile-time user-defined dimension ordinate...
size_type dimension(const size_type ordinate) const
Dimension of the given ordinate.
static const ArrayDimension & tag()
Singleton tag for ArrayDimension.
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.
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.
bool natural() const
If the multidimension follows the natural ordering.
const char * name() const
Name of the tag, typically the name of the derived class.
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 *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)
Construct a Rank 7..8 array; use Tag#::Size for defaults. The input dimensions are the 7 slowest stri...
value_type & operator()() const
Access member via Rank 0 multi-index.
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.
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.
virtual std::string to_string(size_type dimension, size_type index) const
Given a dimension and index produce a string for output.
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 n1)
Construct a Rank 1..8 array; use Tag#::Size for defaults. The input dimension is the slowest stride...
Array & assign(value_type *arg_ptr)
Construct a Rank 1..8 array; use Tag#::Size for defaults.
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.
Array(const ReverseType &rhs)
Copy constructor for reverse type.
value_type * contiguous_data() const
Pointer to contiguous block of member data.
helper::reverse ReverseType
The compatible multidimensional array with reversed multi-index ordering and dimension tags...
array_traits::int_t size_type
Type for sizes.
bool contiguous() const
If the member data storage is contiguous.
Scalar value_type
Type of member data.
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.
array_traits::int_t size_type
Type for sizes.
Array & operator=(const Array &rhs)
Assignment operator.
bool contiguous() const
If the member data storage is contiguous.
Abstract base class for array dimension tags supplied to the Array template class.
bool natural() const
If the multidimension follows the natural ordering.
Scalar value_type
Type of member data.
Array(const Array< Scalar, array_order > &rhs)
Construct compile-time array from run-time array.
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 data items.
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...
value_type & operator()(const iType &i1, const iType &i2, const iType &i3, const iType &i4) const
Access member of a Rank 4 array.
An anonymous array dimension tag, which is NOT the recommended usage.
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...
virtual size_type to_index(size_type dimension, const std::string &label) const
Given a dimension and input strige produce an index.
size_type dimension(size_type ord) const
Dimension of the given ordinate.
const ArrayDimTag * tag_type
Type of runtime dimension tags.
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...
bool contiguous() const
If the member data storage is contiguous.
value_type & operator[](const iType &i) const
Access member via offset into contiguous block.
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, const size_type n5)
Construct a Rank 5..8 array; use Tag#::Size for defaults. The input dimensions are the 5 slowest stri...
bool natural() const
If the multidimension follows the natural ordering.
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...
helper::truncate TruncateType
Subarray type that removes the slowest striding dimension (first natural or last fortran ordinate)...
void dimensions(std::vector< iType > &n)
Dimension of all ordinate.
Array(value_type *arg_ptr, const size_type *const dims)
Construct with array of dimensions.
bool reverse() const
If the multidimension follows the reverse (Fortran) ordering.
tag_type tag(size_type ord) const
Access the dimension tag-singleton for a given ordinate.
Array(const Array &rhs)
Copy constructor.
size_type rank() const
Rank of the array is the number of non-void dimension tags.
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...
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.
void dimensions(std::vector< iType > &n)
Dimensions of all ordinates.
size_type dimension() const
Dimension of the given ordinate.
Scalar value_type
Type of member data.
size_type rank() const
Rank of the array is the number of non-void dimension tags.
size_type size() const
Total number of member data items.
value_type * contiguous_data() const
Pointer to contiguous block of member data.
void assign_stride(value_type *arg_ptr, const size_type *arg_stride, size_type arg_final_dim)
Assign stride and pointer.
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.
Special tag to indicate that an array specification has degenerated to rank-zero, i...
value_type & operator[](const iType &i) const
Access member via full ordering of members.
void assign_stride(value_type *arg_ptr, const size_type *arg_stride)
Assign stride and pointer.
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...
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.
Use the Natural or C-language ordering for multi-dimensions where the right-most dimension is stride-...
Array()
Default constructor.
Use the Reverse or Fortran-language ordering for multi-dimensions where the left-most dimension is st...
value_type & operator()(const iType &i1) const
Access member of a Rank 1 array.
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 & 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...
size_type size() const
Total number of member data items.
Array truncate(const iType &i) const
Generate a subarray view of the array with the slowest striding ordinate offset by i and removed...
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...
array_traits::int_t size_type
Type for sizes.
Array(const ReverseType &rhs)
Copy constructor for compatible reverse type.
Array(value_type *arg_ptr)
Construct a Rank 1..8 array; use Tag#::Size for defaults.
const ArrayDimTag * tag_type
Type of runtime 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.
value_type * contiguous_data() const
Pointer to contiguous block of member data.
bool reverse() const
If the multidimension follows the reverse (Fortran) ordering.