phdMesh  Version of the Day
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
ArrayPrivate.hpp
1 /*------------------------------------------------------------------------*/
2 /* phdMesh : Parallel Heterogneous Dynamic unstructured Mesh */
3 /* Copyright (2008) Sandia Corporation */
4 /* */
5 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
6 /* license for use of this work by or on behalf of the U.S. Government. */
7 /* */
8 /* This library is free software; you can redistribute it and/or modify */
9 /* it under the terms of the GNU Lesser General Public License as */
10 /* published by the Free Software Foundation; either version 2.1 of the */
11 /* License, or (at your option) any later version. */
12 /* */
13 /* This library is distributed in the hope that it will be useful, */
14 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
15 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
16 /* Lesser General Public License for more details. */
17 /* */
18 /* You should have received a copy of the GNU Lesser General Public */
19 /* License along with this library; if not, write to the Free Software */
20 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 */
21 /* USA */
22 /*------------------------------------------------------------------------*/
28 #ifndef util_ArrayPrivate_hpp
29 #define util_ArrayPrivate_hpp
30 
31 namespace phdmesh {
32 
33 //----------------------------------------------------------------------
34 
40 unsigned array_stride_size(
41  const unsigned rank ,
42  const unsigned * const stride );
43 
46  const unsigned rank ,
47  const unsigned * const stride ,
48  unsigned * const dim );
49 
52  const unsigned rank ,
53  const unsigned * const stride ,
54  const unsigned offset ,
55  unsigned * const indices );
56 
57 
58 //----------------------------------------------------------------------
59 
60 #ifndef DOXYGEN_COMPILE
61 
62 void array_check_rank( const unsigned rank ,
63  const unsigned test_rank );
64 
65 void array_check_ordinal( const unsigned rank ,
66  const unsigned test_ordinal );
67 
68 void array_check_index( const unsigned dim ,
69  const unsigned index );
70 
71 void array_check_offset( const unsigned size ,
72  const unsigned test_offset );
73 
74 void array_check_indices( const bool ,
75  const unsigned rank ,
76  const unsigned * const stride ,
77  const unsigned = 0 ,
78  const unsigned = 0 ,
79  const unsigned = 0 ,
80  const unsigned = 0 ,
81  const unsigned = 0 ,
82  const unsigned = 0 ,
83  const unsigned = 0 ,
84  const unsigned = 0 );
85 
86 //----------------------------------------------------------------------
87 
88 template< unsigned , unsigned > struct array_check_ordinal_is_less ;
89 
90 template<> struct array_check_ordinal_is_less<0,8> {};
91 template<> struct array_check_ordinal_is_less<1,8> {};
92 template<> struct array_check_ordinal_is_less<2,8> {};
93 template<> struct array_check_ordinal_is_less<3,8> {};
94 template<> struct array_check_ordinal_is_less<4,8> {};
95 template<> struct array_check_ordinal_is_less<5,8> {};
96 template<> struct array_check_ordinal_is_less<6,8> {};
97 template<> struct array_check_ordinal_is_less<7,8> {};
98 
99 template<> struct array_check_ordinal_is_less<0,7> {};
100 template<> struct array_check_ordinal_is_less<1,7> {};
101 template<> struct array_check_ordinal_is_less<2,7> {};
102 template<> struct array_check_ordinal_is_less<3,7> {};
103 template<> struct array_check_ordinal_is_less<4,7> {};
104 template<> struct array_check_ordinal_is_less<5,7> {};
105 template<> struct array_check_ordinal_is_less<6,7> {};
106 
107 template<> struct array_check_ordinal_is_less<0,6> {};
108 template<> struct array_check_ordinal_is_less<1,6> {};
109 template<> struct array_check_ordinal_is_less<2,6> {};
110 template<> struct array_check_ordinal_is_less<3,6> {};
111 template<> struct array_check_ordinal_is_less<4,6> {};
112 template<> struct array_check_ordinal_is_less<5,6> {};
113 
114 template<> struct array_check_ordinal_is_less<0,5> {};
115 template<> struct array_check_ordinal_is_less<1,5> {};
116 template<> struct array_check_ordinal_is_less<2,5> {};
117 template<> struct array_check_ordinal_is_less<3,5> {};
118 template<> struct array_check_ordinal_is_less<4,5> {};
119 
120 template<> struct array_check_ordinal_is_less<0,4> {};
121 template<> struct array_check_ordinal_is_less<1,4> {};
122 template<> struct array_check_ordinal_is_less<2,4> {};
123 template<> struct array_check_ordinal_is_less<3,4> {};
124 
125 template<> struct array_check_ordinal_is_less<0,3> {};
126 template<> struct array_check_ordinal_is_less<1,3> {};
127 template<> struct array_check_ordinal_is_less<2,3> {};
128 
129 template<> struct array_check_ordinal_is_less<0,2> {};
130 template<> struct array_check_ordinal_is_less<1,2> {};
131 
132 template<> struct array_check_ordinal_is_less<0,1> {};
133 
134 //----------------------------------------------------------------------
135 
136 template< class , unsigned > struct ArrayTagAt ;
137 
138 template< typename Scalar , ArrayOrder order ,
139  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
140  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
141 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,0>
142 { typedef Tag1 type ; };
143 
144 template< typename Scalar , ArrayOrder order ,
145  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
146  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
147 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,1>
148 { typedef Tag2 type ; };
149 
150 template< typename Scalar , ArrayOrder order ,
151  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
152  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
153 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,2>
154 { typedef Tag3 type ; };
155 
156 template< typename Scalar , ArrayOrder order ,
157  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
158  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
159 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,3>
160 { typedef Tag4 type ; };
161 
162 template< typename Scalar , ArrayOrder order ,
163  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
164  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
165 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,4>
166 { typedef Tag5 type ; };
167 
168 template< typename Scalar , ArrayOrder order ,
169  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
170  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
171 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,5>
172 { typedef Tag6 type ; };
173 
174 template< typename Scalar , ArrayOrder order ,
175  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
176  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
177 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,6>
178 { typedef Tag7 type ; };
179 
180 template< typename Scalar , ArrayOrder order ,
181  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
182  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
183 struct ArrayTagAt<Array<Scalar,order,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>,7>
184 { typedef Tag8 type ; };
185 
186 //----------------------------------------------------------------------
187 //----------------------------------------------------------------------
188 
189 template< typename Scalar ,
190  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
191  class Tag5 , class Tag6 , class Tag7 , class TApp >
192 struct ArrayAppend<
193  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> , TApp >
194 {
195  typedef
196  Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7> type ;
197 };
198 
199 template< typename Scalar ,
200  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
201  class Tag5 , class Tag6 , class Tag7 , class TApp >
202 struct ArrayAppend<
203  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> , TApp >
204 {
205  typedef
206  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,TApp> type ;
207 };
208 
209 template< typename Scalar ,
210  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
211  class Tag5 , class Tag6 , class TApp >
212 struct ArrayAppend<
213  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> , TApp >
214 {
215  typedef
216  Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void> type ;
217 };
218 
219 template< typename Scalar ,
220  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
221  class Tag5 , class Tag6 , class TApp >
222 struct ArrayAppend<
223  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> , TApp >
224 {
225  typedef
226  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,TApp,void> type ;
227 };
228 
229 template< typename Scalar ,
230  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
231  class Tag5 , class TApp >
232 struct ArrayAppend<
233  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> , TApp >
234 {
235  typedef
236  Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,Tag3,Tag4,Tag5,void,void> type ;
237 };
238 
239 template< typename Scalar ,
240  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
241  class Tag5 , class TApp >
242 struct ArrayAppend<
243  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> , TApp >
244 {
245  typedef
246  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,TApp,void,void> type ;
247 };
248 
249 template< typename Scalar ,
250  class Tag1 , class Tag2 , class Tag3 , class Tag4 , class TApp >
251 struct ArrayAppend<
252  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> , TApp >
253 {
254  typedef
255  Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,Tag3,Tag4,void,void,void> type ;
256 };
257 
258 template< typename Scalar ,
259  class Tag1 , class Tag2 , class Tag3 , class Tag4 , class TApp >
260 struct ArrayAppend<
261  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> , TApp >
262 {
263  typedef
264  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,TApp,void,void,void> type ;
265 };
266 
267 template< typename Scalar ,
268  class Tag1 , class Tag2 , class Tag3 , class TApp >
269 struct ArrayAppend<
270  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,void,void,void,void,void> , TApp >
271 {
272  typedef
273  Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,Tag3,void,void,void,void> type ;
274 };
275 
276 template< typename Scalar ,
277  class Tag1 , class Tag2 , class Tag3 , class TApp >
278 struct ArrayAppend<
279  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void> , TApp >
280 {
281  typedef
282  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,TApp,void,void,void,void> type ;
283 };
284 
285 template< typename Scalar , class Tag1 , class Tag2 , class TApp >
286 struct ArrayAppend<
287  Array<Scalar,NaturalOrder,Tag1,Tag2,void,void,void,void,void,void> , TApp >
288 {
289  typedef
290  Array<Scalar,NaturalOrder,TApp,Tag1,Tag2,void,void,void,void,void> type ;
291 };
292 
293 template< typename Scalar , class Tag1 , class Tag2 , class TApp >
294 struct ArrayAppend<
295  Array<Scalar,FortranOrder,Tag1,Tag2,void,void,void,void,void,void> , TApp >
296 {
297  typedef
298  Array<Scalar,FortranOrder,Tag1,Tag2,TApp,void,void,void,void,void> type ;
299 };
300 
301 template< typename Scalar , class Tag1 , class TApp >
302 struct ArrayAppend<
303  Array<Scalar,NaturalOrder,Tag1,void,void,void,void,void,void,void> , TApp >
304 {
305  typedef
306  Array<Scalar,NaturalOrder,TApp,Tag1,void,void,void,void,void,void> type ;
307 };
308 
309 template< typename Scalar , class Tag1 , class TApp >
310 struct ArrayAppend<
311  Array<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void> , TApp >
312 {
313  typedef
314  Array<Scalar,FortranOrder,Tag1,TApp,void,void,void,void,void,void> type ;
315 };
316 
317 template< typename Scalar , class TApp >
318 struct ArrayAppend<
319  Array<Scalar,RankZero,void,void,void,void,void,void,void,void> , TApp >
320 {
321  typedef
322  Array<Scalar,NaturalOrder,TApp,void,void,void,void,void,void,void> type ;
323 };
324 
325 template< typename Scalar , class TApp >
326 struct ArrayAppend<
327  Array<Scalar,NaturalOrder,void,void,void,void,void,void,void,void> , TApp >
328 { /* Cannot append to runtime-ranked array */ };
329 
330 template< typename Scalar , class TApp >
331 struct ArrayAppend<
332  Array<Scalar,FortranOrder,void,void,void,void,void,void,void,void> , TApp >
333 { /* Cannot append to runtime-ranked array */ };
334 
335 //----------------------------------------------------------------------
336 //----------------------------------------------------------------------
337 
338 template< class A > struct ArrayReverse ;
339 
340 template< typename Scalar ,
341  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
342  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
343 struct ArrayReverse<
344  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8> >
345 {
346  typedef
347  Array<Scalar,FortranOrder,Tag8,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1> type ;
348 };
349 
350 template< typename Scalar ,
351  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
352  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
353 struct ArrayReverse<
354  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8> >
355 {
356  typedef
357  Array<Scalar,NaturalOrder,Tag8,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1> type ;
358 };
359 
360 
361 template< typename Scalar ,
362  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
363  class Tag5 , class Tag6 , class Tag7 >
364 struct ArrayReverse<
365  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> >
366 {
367  typedef
368  Array<Scalar,FortranOrder,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void> type ;
369 };
370 
371 template< typename Scalar ,
372  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
373  class Tag5 , class Tag6 , class Tag7 >
374 struct ArrayReverse<
375  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> >
376 {
377  typedef
378  Array<Scalar,NaturalOrder,Tag7,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void> type ;
379 };
380 
381 
382 template< typename Scalar ,
383  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
384  class Tag5 , class Tag6 >
385 struct ArrayReverse<
386  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> >
387 {
388  typedef
389  Array<Scalar,FortranOrder,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void,void> type ;
390 };
391 
392 template< typename Scalar ,
393  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
394  class Tag5 , class Tag6 >
395 struct ArrayReverse<
396  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> >
397 {
398  typedef
399  Array<Scalar,NaturalOrder,Tag6,Tag5,Tag4,Tag3,Tag2,Tag1,void,void> type ;
400 };
401 
402 
403 template< typename Scalar ,
404  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
405  class Tag5 >
406 struct ArrayReverse<
407  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> >
408 {
409  typedef
410  Array<Scalar,FortranOrder,Tag5,Tag4,Tag3,Tag2,Tag1,void,void,void> type ;
411 };
412 
413 template< typename Scalar ,
414  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
415  class Tag5 >
416 struct ArrayReverse<
417  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> >
418 {
419  typedef
420  Array<Scalar,NaturalOrder,Tag5,Tag4,Tag3,Tag2,Tag1,void,void,void> type ;
421 };
422 
423 
424 template< typename Scalar ,
425  class Tag1 , class Tag2 , class Tag3 , class Tag4 >
426 struct ArrayReverse<
427  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> >
428 {
429  typedef
430  Array<Scalar,FortranOrder,Tag4,Tag3,Tag2,Tag1,void,void,void,void> type ;
431 };
432 
433 template< typename Scalar ,
434  class Tag1 , class Tag2 , class Tag3 , class Tag4 >
435 struct ArrayReverse<
436  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> >
437 {
438  typedef
439  Array<Scalar,NaturalOrder,Tag4,Tag3,Tag2,Tag1,void,void,void,void> type ;
440 };
441 
442 
443 template< typename Scalar , class Tag1 , class Tag2 , class Tag3 >
444 struct ArrayReverse<
445  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,void,void,void,void,void> >
446 {
447  typedef
448  Array<Scalar,FortranOrder,Tag3,Tag2,Tag1,void,void,void,void,void> type ;
449 };
450 
451 template< typename Scalar , class Tag1 , class Tag2 , class Tag3 >
452 struct ArrayReverse<
453  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void> >
454 {
455  typedef
456  Array<Scalar,NaturalOrder,Tag3,Tag2,Tag1,void,void,void,void,void> type ;
457 };
458 
459 
460 template< typename Scalar , class Tag1 , class Tag2 >
461 struct ArrayReverse<
462  Array<Scalar,NaturalOrder,Tag1,Tag2,void,void,void,void,void,void> >
463 {
464  typedef
465  Array<Scalar,FortranOrder,Tag2,Tag1,void,void,void,void,void,void> type ;
466 };
467 
468 template< typename Scalar , class Tag1 , class Tag2 >
469 struct ArrayReverse<
470  Array<Scalar,FortranOrder,Tag1,Tag2,void,void,void,void,void,void> >
471 {
472  typedef
473  Array<Scalar,NaturalOrder,Tag2,Tag1,void,void,void,void,void,void> type ;
474 };
475 
476 
477 template< typename Scalar , class Tag1 >
478 struct ArrayReverse<
479  Array<Scalar,NaturalOrder,Tag1,void,void,void,void,void,void,void> >
480 {
481  typedef
482  Array<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void> type ;
483 };
484 
485 template< typename Scalar , class Tag1 >
486 struct ArrayReverse<
487  Array<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void> >
488 {
489  typedef
490  Array<Scalar,NaturalOrder,Tag1,void,void,void,void,void,void,void> type ;
491 };
492 
493 
494 template< typename Scalar >
495 struct ArrayReverse<
496  Array<Scalar,NaturalOrder,void,void,void,void,void,void,void,void> >
497 {
498  typedef
499  Array<Scalar,FortranOrder,void,void,void,void,void,void,void,void> type ;
500 };
501 
502 template< typename Scalar >
503 struct ArrayReverse<
504  Array<Scalar,FortranOrder,void,void,void,void,void,void,void,void> >
505 {
506  typedef
507  Array<Scalar,NaturalOrder,void,void,void,void,void,void,void,void> type ;
508 };
509 
510 
511 //----------------------------------------------------------------------
512 //----------------------------------------------------------------------
513 
514 template< class A > struct ArrayTruncate ;
515 
516 template< typename Scalar ,
517  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
518  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
519 struct ArrayTruncate<
520  Array<Scalar,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8> >
521 {
522  typedef
523  Array<Scalar,NaturalOrder,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8,void> type ;
524 };
525 
526 template< typename Scalar , class Tag1 >
527 struct ArrayTruncate<
528  Array<Scalar,NaturalOrder,Tag1,void,void,void,void,void,void,void> >
529 {
530  typedef Array<Scalar,RankZero,void,void,void,void,void,void,void,void> type ;
531 };
532 
533 template< typename Scalar , class Tag1 >
534 struct ArrayTruncate<
535  Array<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void> >
536 {
537  typedef Array<Scalar,RankZero,void,void,void,void,void,void,void,void> type ;
538 };
539 
540 template< typename Scalar , class Tag1 , class Tag2 >
541 struct ArrayTruncate<
542  Array<Scalar,FortranOrder,Tag1,Tag2,void,void,void,void,void,void> >
543 {
544  typedef
545  Array<Scalar,FortranOrder,Tag1,void,void,void,void,void,void,void> type ;
546 };
547 
548 template< typename Scalar , class Tag1 , class Tag2 , class Tag3 >
549 struct ArrayTruncate<
550  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void> >
551 {
552  typedef
553  Array<Scalar,FortranOrder,Tag1,Tag2,void,void,void,void,void,void> type ;
554 };
555 
556 template< typename Scalar ,
557  class Tag1 , class Tag2 , class Tag3 , class Tag4 >
558 struct ArrayTruncate<
559  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> >
560 {
561  typedef
562  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void> type ;
563 };
564 
565 template< typename Scalar ,
566  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
567  class Tag5 >
568 struct ArrayTruncate<
569  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> >
570 {
571  typedef
572  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void> type ;
573 };
574 
575 template< typename Scalar ,
576  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
577  class Tag5 , class Tag6 >
578 struct ArrayTruncate<
579  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> >
580 {
581  typedef
582  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void> type ;
583 };
584 
585 template< typename Scalar ,
586  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
587  class Tag5 , class Tag6 , class Tag7 >
588 struct ArrayTruncate<
589  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> >
590 {
591  typedef
592  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void> type ;
593 };
594 
595 template< typename Scalar ,
596  class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
597  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
598 struct ArrayTruncate<
599  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8> >
600 {
601  typedef
602  Array<Scalar,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void> type ;
603 };
604 
605 //----------------------------------------------------------------------
606 //----------------------------------------------------------------------
607 
608 template< ArrayOrder , unsigned Rank , unsigned Ordinal = 0 >
609 struct ArrayStrideDim ;
610 
611 template< unsigned Rank , unsigned Ordinal >
612 struct ArrayStrideDim<RankZero,Rank,Ordinal> {
613 
614  static unsigned dimension( const unsigned * )
615  { return 0 ; }
616 
617  static unsigned dimension( const unsigned * , const unsigned & )
618  { return 0 ; }
619 };
620 
621 template< unsigned Rank >
622 struct ArrayStrideDim<FortranOrder,Rank,0> {
623  static unsigned dimension( const unsigned * stride )
624  { return stride[0]; }
625 
626  static unsigned dimension( const unsigned * stride ,
627  const unsigned & ordinal )
628  { return ordinal ? stride[ordinal] / stride[ordinal-1] : stride[0] ; }
629 };
630 
631 template< unsigned Rank >
632 struct ArrayStrideDim<NaturalOrder,Rank,0> {
633  static unsigned dimension( const unsigned * stride ) { return stride[0]; }
634 
635  static unsigned dimension( const unsigned * stride ,
636  const unsigned & ordinal )
637  {
638  const unsigned i = ( Rank - 1 ) - ordinal ;
639  return i ? stride[i] / stride[i-1] : stride[0] ;
640  }
641 };
642 
643 template< unsigned Rank , unsigned Ordinal >
644 struct ArrayStrideDim<FortranOrder,Rank,Ordinal> {
645  static unsigned dimension( const unsigned * stride )
646  { return stride[Ordinal] / stride[Ordinal-1]; }
647 };
648 
649 template< unsigned Rank , unsigned Ordinal >
650 struct ArrayStrideDim<NaturalOrder,Rank,Ordinal> {
651  static unsigned dimension( const unsigned * stride )
652  {
653  enum { I = ( Rank - 1 ) - Ordinal };
654  return stride[I] / stride[I-1];
655  }
656 };
657 
658 //----------------------------------------------------------------------
659 
660 namespace {
661 
662 template< class Tag > const ArrayDimTag * array_dim_tag();
663 
664 template<>
665 inline
666 const ArrayDimTag * array_dim_tag<void>() { return NULL ; }
667 
668 template< class Tag >
669 inline
670 const ArrayDimTag * array_dim_tag() { return & Tag::tag(); }
671 
672 template< class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
673  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
674 const ArrayDimTag * const * array_dim_tags()
675 {
676  static const ArrayDimTag * t[8] =
677  {
678  array_dim_tag< Tag1 >() ,
679  array_dim_tag< Tag2 >() ,
680  array_dim_tag< Tag3 >() ,
681  array_dim_tag< Tag4 >() ,
682  array_dim_tag< Tag5 >() ,
683  array_dim_tag< Tag6 >() ,
684  array_dim_tag< Tag7 >() ,
685  array_dim_tag< Tag8 >()
686  };
687 
688  return t ;
689 }
690 
691 }
692 
693 //----------------------------------------------------------------------
694 
695 template< ArrayOrder array_order , unsigned rank >
696 unsigned array_offset(
697  const unsigned * const ,
698  const unsigned & i1 , const unsigned & i2 ,
699  const unsigned & i3 , const unsigned & i4 ,
700  const unsigned & i5 , const unsigned & i6 ,
701  const unsigned & i7 , const unsigned & i8 );
702 
703 template< ArrayOrder array_order , unsigned rank >
704 unsigned array_offset(
705  const unsigned * const ,
706  const unsigned & i1 , const unsigned & i2 ,
707  const unsigned & i3 , const unsigned & i4 ,
708  const unsigned & i5 , const unsigned & i6 ,
709  const unsigned & i7 );
710 
711 template< ArrayOrder array_order , unsigned rank >
712 unsigned array_offset(
713  const unsigned * const ,
714  const unsigned & i1 , const unsigned & i2 ,
715  const unsigned & i3 , const unsigned & i4 ,
716  const unsigned & i5 , const unsigned & i6 );
717 
718 template< ArrayOrder array_order , unsigned rank >
719 unsigned array_offset(
720  const unsigned * const ,
721  const unsigned & i1 , const unsigned & i2 ,
722  const unsigned & i3 , const unsigned & i4 ,
723  const unsigned & i5 );
724 
725 template< ArrayOrder array_order , unsigned rank >
726 unsigned array_offset(
727  const unsigned * const ,
728  const unsigned & i1 , const unsigned & i2 ,
729  const unsigned & i3 , const unsigned & i4 );
730 
731 template< ArrayOrder array_order , unsigned rank >
732 unsigned array_offset(
733  const unsigned * const ,
734  const unsigned & i1 , const unsigned & i2 ,
735  const unsigned & i3 );
736 
737 template< ArrayOrder array_order , unsigned rank >
738 unsigned array_offset(
739  const unsigned * const ,
740  const unsigned & i1 , const unsigned & i2 );
741 
742 template< ArrayOrder array_order , unsigned rank >
743 unsigned array_offset(
744  const unsigned * const ,
745  const unsigned & i1 );
746 
747 //----------------------------------------------------------------------
748 
749 template<> inline
750 unsigned array_offset<FortranOrder,8>(
751  const unsigned * const stride ,
752  const unsigned & i1 , const unsigned & i2 ,
753  const unsigned & i3 , const unsigned & i4 ,
754  const unsigned & i5 , const unsigned & i6 ,
755  const unsigned & i7 , const unsigned & i8 )
756 {
757  ARRAY_CHECK(array_check_indices(false,8,stride,i1,i2,i3,i4,i5,i6,i7,i8));
758  return i1 + i2 * stride[0] +
759  i3 * stride[1] + i4 * stride[2] +
760  i5 * stride[3] + i6 * stride[4] +
761  i7 * stride[5] + i8 * stride[6] ;
762 }
763 
764 template<> inline
765 unsigned array_offset<FortranOrder,7>(
766  const unsigned * const stride ,
767  const unsigned & i1 , const unsigned & i2 ,
768  const unsigned & i3 , const unsigned & i4 ,
769  const unsigned & i5 , const unsigned & i6 ,
770  const unsigned & i7 )
771 {
772  ARRAY_CHECK(array_check_indices(false,7,stride,i1,i2,i3,i4,i5,i6,i7));
773  return i1 + i2 * stride[0] +
774  i3 * stride[1] + i4 * stride[2] +
775  i5 * stride[3] + i6 * stride[4] +
776  i7 * stride[5] ;
777 }
778 
779 template<> inline
780 unsigned array_offset<FortranOrder,6>(
781  const unsigned * const stride ,
782  const unsigned & i1 , const unsigned & i2 ,
783  const unsigned & i3 , const unsigned & i4 ,
784  const unsigned & i5 , const unsigned & i6 )
785 {
786  ARRAY_CHECK(array_check_indices(false,6,stride,i1,i2,i3,i4,i5,i6));
787  return i1 + i2 * stride[0] +
788  i3 * stride[1] + i4 * stride[2] +
789  i5 * stride[3] + i6 * stride[4] ;
790 }
791 
792 template<> inline
793 unsigned array_offset<FortranOrder,5>(
794  const unsigned * const stride ,
795  const unsigned & i1 , const unsigned & i2 ,
796  const unsigned & i3 , const unsigned & i4 ,
797  const unsigned & i5 )
798 {
799  ARRAY_CHECK(array_check_indices(false,5,stride,i1,i2,i3,i4,i5));
800  return i1 + i2 * stride[0] +
801  i3 * stride[1] + i4 * stride[2] +
802  i5 * stride[3] ;
803 }
804 
805 template<> inline
806 unsigned array_offset<FortranOrder,4>(
807  const unsigned * const stride ,
808  const unsigned & i1 , const unsigned & i2 ,
809  const unsigned & i3 , const unsigned & i4 )
810 {
811  ARRAY_CHECK(array_check_indices(false,4,stride,i1,i2,i3,i4));
812  return i1 + i2 * stride[0] +
813  i3 * stride[1] + i4 * stride[2] ;
814 }
815 
816 template<> inline
817 unsigned array_offset<FortranOrder,3>(
818  const unsigned * const stride ,
819  const unsigned & i1 , const unsigned & i2 ,
820  const unsigned & i3 )
821 {
822  ARRAY_CHECK(array_check_indices(false,3,stride,i1,i2,i3));
823  return i1 + i2 * stride[0] + i3 * stride[1] ;
824 }
825 
826 template<> inline
827 unsigned array_offset<FortranOrder,2>(
828  const unsigned * const stride ,
829  const unsigned & i1 , const unsigned & i2 )
830 {
831  ARRAY_CHECK(array_check_indices(false,2,stride,i1,i2));
832  return i1 + i2 * stride[0] ;
833 }
834 
835 template<> inline
836 unsigned array_offset<FortranOrder,1>(
837  const unsigned * const ARRAY_CHECK( stride ) ,
838  const unsigned & i1 )
839 {
840  ARRAY_CHECK(array_check_indices(false,1,stride,i1));
841  return i1 ;
842 }
843 
844 //----------------------------------------------------------------------
845 
846 template<> inline
847 unsigned array_offset<NaturalOrder,8>(
848  const unsigned * const stride ,
849  const unsigned & i1 , const unsigned & i2 ,
850  const unsigned & i3 , const unsigned & i4 ,
851  const unsigned & i5 , const unsigned & i6 ,
852  const unsigned & i7 , const unsigned & i8 )
853 {
854  ARRAY_CHECK(array_check_indices(true,8,stride,i1,i2,i3,i4,i5,i6,i7,i8));
855  return i8 + i7 * stride[0] +
856  i6 * stride[1] + i5 * stride[2] +
857  i4 * stride[3] + i3 * stride[4] +
858  i2 * stride[5] + i1 * stride[6] ;
859 }
860 
861 template<> inline
862 unsigned array_offset<NaturalOrder,7>(
863  const unsigned * const stride ,
864  const unsigned & i1 , const unsigned & i2 ,
865  const unsigned & i3 , const unsigned & i4 ,
866  const unsigned & i5 , const unsigned & i6 ,
867  const unsigned & i7 )
868 {
869  ARRAY_CHECK(array_check_indices(true,7,stride,i1,i2,i3,i4,i5,i6,i7));
870  return i7 + i6 * stride[0] +
871  i5 * stride[1] + i4 * stride[2] +
872  i3 * stride[3] + i2 * stride[4] +
873  i1 * stride[5] ;
874 }
875 
876 template<> inline
877 unsigned array_offset<NaturalOrder,6>(
878  const unsigned * const stride ,
879  const unsigned & i1 , const unsigned & i2 ,
880  const unsigned & i3 , const unsigned & i4 ,
881  const unsigned & i5 , const unsigned & i6 )
882 {
883  ARRAY_CHECK(array_check_indices(true,6,stride,i1,i2,i3,i4,i5,i6));
884  return i6 + i5 * stride[0] +
885  i4 * stride[1] + i3 * stride[2] +
886  i2 * stride[3] + i1 * stride[4] ;
887 }
888 
889 template<> inline
890 unsigned array_offset<NaturalOrder,5>(
891  const unsigned * const stride ,
892  const unsigned & i1 , const unsigned & i2 ,
893  const unsigned & i3 , const unsigned & i4 ,
894  const unsigned & i5 )
895 {
896  ARRAY_CHECK(array_check_indices(true,5,stride,i1,i2,i3,i4,i5));
897  return i5 + i4 * stride[0] +
898  i3 * stride[1] + i2 * stride[2] +
899  i1 * stride[3] ;
900 }
901 
902 template<> inline
903 unsigned array_offset<NaturalOrder,4>(
904  const unsigned * const stride ,
905  const unsigned & i1 , const unsigned & i2 ,
906  const unsigned & i3 , const unsigned & i4 )
907 {
908  ARRAY_CHECK(array_check_indices(true,4,stride,i1,i2,i3,i4));
909  return i4 + i3 * stride[0] +
910  i2 * stride[1] + i1 * stride[2] ;
911 }
912 
913 template<> inline
914 unsigned array_offset<NaturalOrder,3>(
915  const unsigned * const stride ,
916  const unsigned & i1 , const unsigned & i2 ,
917  const unsigned & i3 )
918 {
919  ARRAY_CHECK(array_check_indices(true,3,stride,i1,i2,i3));
920  return i3 + i2 * stride[0] + i1 * stride[1] ;
921 }
922 
923 template<> inline
924 unsigned array_offset<NaturalOrder,2>(
925  const unsigned * const stride ,
926  const unsigned & i1 , const unsigned & i2 )
927 {
928  ARRAY_CHECK(array_check_indices(true,2,stride,i1,i2));
929  return i2 + i1 * stride[0] ;
930 }
931 
932 template<> inline
933 unsigned array_offset<NaturalOrder,1>(
934  const unsigned * const ARRAY_CHECK( stride ) ,
935  const unsigned & i1 )
936 {
937  ARRAY_CHECK(array_check_indices(true,1,stride,i1));
938  return i1 ;
939 }
940 
941 //----------------------------------------------------------------------
942 
943 template< class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
944  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
945 struct Array<void,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
946 {
947  enum { Rank = 8 };
948 
949  static void assign( unsigned * stride )
950  {
951  stride[7] = Tag8::Size * (
952  stride[6] = Tag7::Size * (
953  stride[5] = Tag6::Size * (
954  stride[4] = Tag5::Size * (
955  stride[3] = Tag4::Size * (
956  stride[2] = Tag3::Size * (
957  stride[1] = Tag2::Size * (
958  stride[0] = Tag1::Size )))))));
959  }
960 
961  static void assign( unsigned * stride ,
962  const unsigned & n8 )
963  {
964  stride[7] = n8 * (
965  stride[6] = Tag7::Size * (
966  stride[5] = Tag6::Size * (
967  stride[4] = Tag5::Size * (
968  stride[3] = Tag4::Size * (
969  stride[2] = Tag3::Size * (
970  stride[1] = Tag2::Size * (
971  stride[0] = Tag1::Size )))))));
972  }
973 
974  static void assign( unsigned * stride ,
975  const unsigned & n7 ,
976  const unsigned & n8 )
977  {
978  stride[7] = n8 * (
979  stride[6] = n7 * (
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 )))))));
986  }
987 
988  static void assign( unsigned * stride ,
989  const unsigned & n6 ,
990  const unsigned & n7 ,
991  const unsigned & n8 )
992  {
993  stride[7] = n8 * (
994  stride[6] = n7 * (
995  stride[5] = n6 * (
996  stride[4] = Tag5::Size * (
997  stride[3] = Tag4::Size * (
998  stride[2] = Tag3::Size * (
999  stride[1] = Tag2::Size * (
1000  stride[0] = Tag1::Size )))))));
1001  }
1002 
1003  static void assign( unsigned * stride ,
1004  const unsigned & n5 ,
1005  const unsigned & n6 ,
1006  const unsigned & n7 ,
1007  const unsigned & n8 )
1008  {
1009  stride[7] = n8 * (
1010  stride[6] = n7 * (
1011  stride[5] = n6 * (
1012  stride[4] = n5 * (
1013  stride[3] = Tag4::Size * (
1014  stride[2] = Tag3::Size * (
1015  stride[1] = Tag2::Size * (
1016  stride[0] = Tag1::Size )))))));
1017  }
1018 
1019  static void assign( unsigned * stride ,
1020  const unsigned & n4 ,
1021  const unsigned & n5 ,
1022  const unsigned & n6 ,
1023  const unsigned & n7 ,
1024  const unsigned & n8 )
1025  {
1026  stride[7] = n8 * (
1027  stride[6] = n7 * (
1028  stride[5] = n6 * (
1029  stride[4] = n5 * (
1030  stride[3] = n4 * (
1031  stride[2] = Tag3::Size * (
1032  stride[1] = Tag2::Size * (
1033  stride[0] = Tag1::Size )))))));
1034  }
1035 
1036  static void assign( unsigned * stride ,
1037  const unsigned & n3 ,
1038  const unsigned & n4 ,
1039  const unsigned & n5 ,
1040  const unsigned & n6 ,
1041  const unsigned & n7 ,
1042  const unsigned & n8 )
1043  {
1044  stride[7] = n8 * (
1045  stride[6] = n7 * (
1046  stride[5] = n6 * (
1047  stride[4] = n5 * (
1048  stride[3] = n4 * (
1049  stride[2] = n3 * (
1050  stride[1] = Tag2::Size * (
1051  stride[0] = Tag1::Size )))))));
1052  }
1053 
1054  static void assign( unsigned * stride ,
1055  const unsigned & n2 ,
1056  const unsigned & n3 ,
1057  const unsigned & n4 ,
1058  const unsigned & n5 ,
1059  const unsigned & n6 ,
1060  const unsigned & n7 ,
1061  const unsigned & n8 )
1062  {
1063  stride[7] = n8 * (
1064  stride[6] = n7 * (
1065  stride[5] = n6 * (
1066  stride[4] = n5 * (
1067  stride[3] = n4 * (
1068  stride[2] = n3 * (
1069  stride[1] = n2 * (
1070  stride[0] = Tag1::Size )))))));
1071  }
1072 
1073  static void assign( unsigned * stride ,
1074  const unsigned & n1 ,
1075  const unsigned & n2 ,
1076  const unsigned & n3 ,
1077  const unsigned & n4 ,
1078  const unsigned & n5 ,
1079  const unsigned & n6 ,
1080  const unsigned & n7 ,
1081  const unsigned & n8 )
1082  {
1083  stride[7] = n8 * (
1084  stride[6] = n7 * (
1085  stride[5] = n6 * (
1086  stride[4] = n5 * (
1087  stride[3] = n4 * (
1088  stride[2] = n3 * (
1089  stride[1] = n2 * (
1090  stride[0] = n1 )))))));
1091  }
1092 
1093  static void assign( unsigned * stride ,
1094  const unsigned * const dims )
1095  {
1096  stride[7] = dims[7] * (
1097  stride[6] = dims[6] * (
1098  stride[5] = dims[5] * (
1099  stride[4] = dims[4] * (
1100  stride[3] = dims[3] * (
1101  stride[2] = dims[2] * (
1102  stride[1] = dims[1] * (
1103  stride[0] = dims[0] )))))));
1104  }
1105 };
1106 
1107 template< class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
1108  class Tag5 , class Tag6 , class Tag7 >
1109 struct Array<void,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
1110 {
1111  enum { Rank = 7 };
1112 
1113  static void assign( unsigned * stride )
1114  {
1115  stride[6] = Tag7::Size * (
1116  stride[5] = Tag6::Size * (
1117  stride[4] = Tag5::Size * (
1118  stride[3] = Tag4::Size * (
1119  stride[2] = Tag3::Size * (
1120  stride[1] = Tag2::Size * (
1121  stride[0] = Tag1::Size ))))));
1122  }
1123 
1124  static void assign( unsigned * stride ,
1125  const unsigned & n7 )
1126  {
1127  stride[6] = n7 * (
1128  stride[5] = Tag6::Size * (
1129  stride[4] = Tag5::Size * (
1130  stride[3] = Tag4::Size * (
1131  stride[2] = Tag3::Size * (
1132  stride[1] = Tag2::Size * (
1133  stride[0] = Tag1::Size ))))));
1134  }
1135 
1136  static void assign( unsigned * stride ,
1137  const unsigned & n6 ,
1138  const unsigned & n7 )
1139  {
1140  stride[6] = n7 * (
1141  stride[5] = n6 * (
1142  stride[4] = Tag5::Size * (
1143  stride[3] = Tag4::Size * (
1144  stride[2] = Tag3::Size * (
1145  stride[1] = Tag2::Size * (
1146  stride[0] = Tag1::Size ))))));
1147  }
1148 
1149  static void assign( unsigned * stride ,
1150  const unsigned & n5 ,
1151  const unsigned & n6 ,
1152  const unsigned & n7 )
1153  {
1154  stride[6] = n7 * (
1155  stride[5] = n6 * (
1156  stride[4] = n5 * (
1157  stride[3] = Tag4::Size * (
1158  stride[2] = Tag3::Size * (
1159  stride[1] = Tag2::Size * (
1160  stride[0] = Tag1::Size ))))));
1161  }
1162 
1163  static void assign( unsigned * stride ,
1164  const unsigned & n4 ,
1165  const unsigned & n5 ,
1166  const unsigned & n6 ,
1167  const unsigned & n7 )
1168  {
1169  stride[6] = n7 * (
1170  stride[5] = n6 * (
1171  stride[4] = n5 * (
1172  stride[3] = n4 * (
1173  stride[2] = Tag3::Size * (
1174  stride[1] = Tag2::Size * (
1175  stride[0] = Tag1::Size ))))));
1176  }
1177 
1178  static void assign( unsigned * stride ,
1179  const unsigned & n3 ,
1180  const unsigned & n4 ,
1181  const unsigned & n5 ,
1182  const unsigned & n6 ,
1183  const unsigned & n7 )
1184  {
1185  stride[6] = n7 * (
1186  stride[5] = n6 * (
1187  stride[4] = n5 * (
1188  stride[3] = n4 * (
1189  stride[2] = n3 * (
1190  stride[1] = Tag2::Size * (
1191  stride[0] = Tag1::Size ))))));
1192  }
1193 
1194  static void assign( unsigned * stride ,
1195  const unsigned & n2 ,
1196  const unsigned & n3 ,
1197  const unsigned & n4 ,
1198  const unsigned & n5 ,
1199  const unsigned & n6 ,
1200  const unsigned & n7 )
1201  {
1202  stride[6] = n7 * (
1203  stride[5] = n6 * (
1204  stride[4] = n5 * (
1205  stride[3] = n4 * (
1206  stride[2] = n3 * (
1207  stride[1] = n2 * (
1208  stride[0] = Tag1::Size ))))));
1209  }
1210 
1211  static void assign( unsigned * stride ,
1212  const unsigned & n1 ,
1213  const unsigned & n2 ,
1214  const unsigned & n3 ,
1215  const unsigned & n4 ,
1216  const unsigned & n5 ,
1217  const unsigned & n6 ,
1218  const unsigned & n7 )
1219  {
1220  stride[6] = n7 * (
1221  stride[5] = n6 * (
1222  stride[4] = n5 * (
1223  stride[3] = n4 * (
1224  stride[2] = n3 * (
1225  stride[1] = n2 * (
1226  stride[0] = n1 ))))));
1227  }
1228 
1229  static void assign( unsigned * stride ,
1230  const unsigned * const dims )
1231  {
1232  stride[6] = dims[6] * (
1233  stride[5] = dims[5] * (
1234  stride[4] = dims[4] * (
1235  stride[3] = dims[3] * (
1236  stride[2] = dims[2] * (
1237  stride[1] = dims[1] * (
1238  stride[0] = dims[0] ))))));
1239  }
1240 };
1241 
1242 template< class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
1243  class Tag5 , class Tag6 >
1244 struct Array<void,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void>
1245 {
1246  enum { Rank = 6 };
1247 
1248  static void assign( unsigned * stride )
1249  {
1250  stride[5] = Tag6::Size * (
1251  stride[4] = Tag5::Size * (
1252  stride[3] = Tag4::Size * (
1253  stride[2] = Tag3::Size * (
1254  stride[1] = Tag2::Size * (
1255  stride[0] = Tag1::Size )))));
1256  }
1257 
1258  static void assign( unsigned * stride ,
1259  const unsigned & n6 )
1260  {
1261  stride[5] = n6 * (
1262  stride[4] = Tag5::Size * (
1263  stride[3] = Tag4::Size * (
1264  stride[2] = Tag3::Size * (
1265  stride[1] = Tag2::Size * (
1266  stride[0] = Tag1::Size )))));
1267  }
1268 
1269  static void assign( unsigned * stride ,
1270  const unsigned & n5 ,
1271  const unsigned & n6 )
1272  {
1273  stride[5] = n6 * (
1274  stride[4] = n5 * (
1275  stride[3] = Tag4::Size * (
1276  stride[2] = Tag3::Size * (
1277  stride[1] = Tag2::Size * (
1278  stride[0] = Tag1::Size )))));
1279  }
1280 
1281  static void assign( unsigned * stride ,
1282  const unsigned & n4 ,
1283  const unsigned & n5 ,
1284  const unsigned & n6 )
1285  {
1286  stride[5] = n6 * (
1287  stride[4] = n5 * (
1288  stride[3] = n4 * (
1289  stride[2] = Tag3::Size * (
1290  stride[1] = Tag2::Size * (
1291  stride[0] = Tag1::Size )))));
1292  }
1293 
1294  static void assign( unsigned * stride ,
1295  const unsigned & n3 ,
1296  const unsigned & n4 ,
1297  const unsigned & n5 ,
1298  const unsigned & n6 )
1299  {
1300  stride[5] = n6 * (
1301  stride[4] = n5 * (
1302  stride[3] = n4 * (
1303  stride[2] = n3 * (
1304  stride[1] = Tag2::Size * (
1305  stride[0] = Tag1::Size )))));
1306  }
1307 
1308  static void assign( unsigned * stride ,
1309  const unsigned & n2 ,
1310  const unsigned & n3 ,
1311  const unsigned & n4 ,
1312  const unsigned & n5 ,
1313  const unsigned & n6 )
1314  {
1315  stride[5] = n6 * (
1316  stride[4] = n5 * (
1317  stride[3] = n4 * (
1318  stride[2] = n3 * (
1319  stride[1] = n2 * (
1320  stride[0] = Tag1::Size )))));
1321  }
1322 
1323  static void assign( unsigned * stride ,
1324  const unsigned & n1 ,
1325  const unsigned & n2 ,
1326  const unsigned & n3 ,
1327  const unsigned & n4 ,
1328  const unsigned & n5 ,
1329  const unsigned & n6 )
1330  {
1331  stride[5] = n6 * (
1332  stride[4] = n5 * (
1333  stride[3] = n4 * (
1334  stride[2] = n3 * (
1335  stride[1] = n2 * (
1336  stride[0] = n1 )))));
1337  }
1338 
1339  static void assign( unsigned * stride ,
1340  const unsigned * const dims )
1341  {
1342  stride[5] = dims[5] * (
1343  stride[4] = dims[4] * (
1344  stride[3] = dims[3] * (
1345  stride[2] = dims[2] * (
1346  stride[1] = dims[1] * (
1347  stride[0] = dims[0] )))));
1348  }
1349 };
1350 
1351 template< class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
1352  class Tag5 >
1353 struct Array<void,FortranOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void>
1354 {
1355  enum { Rank = 5 };
1356 
1357  static void assign( unsigned * stride )
1358  {
1359  stride[4] = Tag5::Size * (
1360  stride[3] = Tag4::Size * (
1361  stride[2] = Tag3::Size * (
1362  stride[1] = Tag2::Size * (
1363  stride[0] = Tag1::Size ))));
1364  }
1365 
1366  static void assign( unsigned * stride ,
1367  const unsigned & n5 )
1368  {
1369  stride[4] = n5 * (
1370  stride[3] = Tag4::Size * (
1371  stride[2] = Tag3::Size * (
1372  stride[1] = Tag2::Size * (
1373  stride[0] = Tag1::Size ))));
1374  }
1375 
1376  static void assign( unsigned * stride ,
1377  const unsigned & n4 ,
1378  const unsigned & n5 )
1379  {
1380  stride[4] = n5 * (
1381  stride[3] = n4 * (
1382  stride[2] = Tag3::Size * (
1383  stride[1] = Tag2::Size * (
1384  stride[0] = Tag1::Size ))));
1385  }
1386 
1387  static void assign( unsigned * stride ,
1388  const unsigned & n3 ,
1389  const unsigned & n4 ,
1390  const unsigned & n5 )
1391  {
1392  stride[4] = n5 * (
1393  stride[3] = n4 * (
1394  stride[2] = n3 * (
1395  stride[1] = Tag2::Size * (
1396  stride[0] = Tag1::Size ))));
1397  }
1398 
1399  static void assign( unsigned * stride ,
1400  const unsigned & n2 ,
1401  const unsigned & n3 ,
1402  const unsigned & n4 ,
1403  const unsigned & n5 )
1404  {
1405  stride[4] = n5 * (
1406  stride[3] = n4 * (
1407  stride[2] = n3 * (
1408  stride[1] = n2 * (
1409  stride[0] = Tag1::Size ))));
1410  }
1411 
1412  static void assign( unsigned * stride ,
1413  const unsigned & n1 ,
1414  const unsigned & n2 ,
1415  const unsigned & n3 ,
1416  const unsigned & n4 ,
1417  const unsigned & n5 )
1418  {
1419  stride[4] = n5 * (
1420  stride[3] = n4 * (
1421  stride[2] = n3 * (
1422  stride[1] = n2 * (
1423  stride[0] = n1 ))));
1424  }
1425 
1426  static void assign( unsigned * stride ,
1427  const unsigned * const dims )
1428  {
1429  stride[4] = dims[4] * (
1430  stride[3] = dims[3] * (
1431  stride[2] = dims[2] * (
1432  stride[1] = dims[1] * (
1433  stride[0] = dims[0] ))));
1434  }
1435 };
1436 
1437 
1438 template< class Tag1 , class Tag2 , class Tag3 , class Tag4 >
1439 struct Array<void,FortranOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void>
1440 {
1441  enum { Rank = 4 };
1442 
1443  static void assign( unsigned * stride )
1444  {
1445  stride[3] = Tag4::Size * (
1446  stride[2] = Tag3::Size * (
1447  stride[1] = Tag2::Size * (
1448  stride[0] = Tag1::Size )));
1449  }
1450 
1451  static void assign( unsigned * stride ,
1452  const unsigned & n4 )
1453  {
1454  stride[3] = n4 * (
1455  stride[2] = Tag3::Size * (
1456  stride[1] = Tag2::Size * (
1457  stride[0] = Tag1::Size )));
1458  }
1459 
1460  static void assign( unsigned * stride ,
1461  const unsigned & n3 ,
1462  const unsigned & n4 )
1463  {
1464  stride[3] = n4 * (
1465  stride[2] = n3 * (
1466  stride[1] = Tag2::Size * (
1467  stride[0] = Tag1::Size )));
1468  }
1469 
1470  static void assign( unsigned * stride ,
1471  const unsigned & n2 ,
1472  const unsigned & n3 ,
1473  const unsigned & n4 )
1474  {
1475  stride[3] = n4 * (
1476  stride[2] = n3 * (
1477  stride[1] = n2 * (
1478  stride[0] = Tag1::Size )));
1479  }
1480 
1481  static void assign( unsigned * stride ,
1482  const unsigned & n1 ,
1483  const unsigned & n2 ,
1484  const unsigned & n3 ,
1485  const unsigned & n4 )
1486  {
1487  stride[3] = n4 * (
1488  stride[2] = n3 * (
1489  stride[1] = n2 * (
1490  stride[0] = n1 )));
1491  }
1492 
1493  static void assign( unsigned * stride ,
1494  const unsigned * const dims )
1495  {
1496  stride[3] = dims[3] * (
1497  stride[2] = dims[2] * (
1498  stride[1] = dims[1] * (
1499  stride[0] = dims[0] )));
1500  }
1501 };
1502 
1503 template< class Tag1 , class Tag2 , class Tag3 >
1504 struct Array<void,FortranOrder,Tag1,Tag2,Tag3,void,void,void,void,void>
1505 {
1506  enum { Rank = 3 };
1507 
1508  static void assign( unsigned * stride )
1509  {
1510  stride[2] = Tag3::Size * (
1511  stride[1] = Tag2::Size * (
1512  stride[0] = Tag1::Size ));
1513  }
1514 
1515  static void assign( unsigned * stride ,
1516  const unsigned & n3 )
1517  {
1518  stride[2] = n3 * (
1519  stride[1] = Tag2::Size * (
1520  stride[0] = Tag1::Size ));
1521  }
1522 
1523  static void assign( unsigned * stride ,
1524  const unsigned & n2 ,
1525  const unsigned & n3 )
1526  {
1527  stride[2] = n3 * (
1528  stride[1] = n2 * (
1529  stride[0] = Tag1::Size ));
1530  }
1531 
1532  static void assign( unsigned * stride ,
1533  const unsigned & n1 ,
1534  const unsigned & n2 ,
1535  const unsigned & n3 )
1536  {
1537  stride[2] = n3 * (
1538  stride[1] = n2 * (
1539  stride[0] = n1 ));
1540  }
1541 
1542  static void assign( unsigned * stride ,
1543  const unsigned * const dims )
1544  {
1545  stride[2] = dims[2] * (
1546  stride[1] = dims[1] * (
1547  stride[0] = dims[0] ));
1548  }
1549 };
1550 
1551 template< class Tag1 , class Tag2 >
1552 struct Array<void,FortranOrder,Tag1,Tag2,void,void,void,void,void,void>
1553 {
1554  enum { Rank = 2 };
1555 
1556  static void assign( unsigned * stride )
1557  { stride[1] = Tag2::Size * ( stride[0] = Tag1::Size ); }
1558 
1559  static void assign( unsigned * stride ,
1560  const unsigned & n2 )
1561  { stride[1] = n2 * ( stride[0] = Tag1::Size ); }
1562 
1563  static void assign( unsigned * stride ,
1564  const unsigned & n1 ,
1565  const unsigned & n2 )
1566  { stride[1] = n2 * ( stride[0] = n1 ); }
1567 
1568  static void assign( unsigned * stride ,
1569  const unsigned * const dims )
1570  { stride[1] = dims[1] * ( stride[0] = dims[0] ); }
1571 };
1572 
1573 template< class Tag1 >
1574 struct Array<void,FortranOrder,Tag1,void,void,void,void,void,void,void>
1575 {
1576  enum { Rank = 1 };
1577 
1578  static void assign( unsigned * stride ) { stride[0] = Tag1::Size ; }
1579 
1580  static void assign( unsigned * stride ,
1581  const unsigned & n1 ) { stride[0] = n1 ; }
1582 
1583  static void assign( unsigned * stride ,
1584  const unsigned * const dims )
1585  { stride[0] = dims[0] ; }
1586 };
1587 
1588 //----------------------------------------------------------------------
1589 
1590 template< class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
1591  class Tag5 , class Tag6 , class Tag7 , class Tag8 >
1592 struct Array<void,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,Tag8>
1593 {
1594  enum { Rank = 8 };
1595 
1596  static void assign( unsigned * stride )
1597  {
1598  stride[7] = Tag1::Size * (
1599  stride[6] = Tag2::Size * (
1600  stride[5] = Tag3::Size * (
1601  stride[4] = Tag4::Size * (
1602  stride[3] = Tag5::Size * (
1603  stride[2] = Tag6::Size * (
1604  stride[1] = Tag7::Size * (
1605  stride[0] = Tag8::Size )))))));
1606  }
1607 
1608  static void assign( unsigned * stride ,
1609  const unsigned & n1 )
1610  {
1611  stride[7] = n1 * (
1612  stride[6] = Tag2::Size * (
1613  stride[5] = Tag3::Size * (
1614  stride[4] = Tag4::Size * (
1615  stride[3] = Tag5::Size * (
1616  stride[2] = Tag6::Size * (
1617  stride[1] = Tag7::Size * (
1618  stride[0] = Tag8::Size )))))));
1619  }
1620 
1621  static void assign( unsigned * stride ,
1622  const unsigned & n1 ,
1623  const unsigned & n2 )
1624  {
1625  stride[7] = n1 * (
1626  stride[6] = n2 * (
1627  stride[5] = Tag3::Size * (
1628  stride[4] = Tag4::Size * (
1629  stride[3] = Tag5::Size * (
1630  stride[2] = Tag6::Size * (
1631  stride[1] = Tag7::Size * (
1632  stride[0] = Tag8::Size )))))));
1633  }
1634 
1635  static void assign( unsigned * stride ,
1636  const unsigned & n1 ,
1637  const unsigned & n2 ,
1638  const unsigned & n3 )
1639  {
1640  stride[7] = n1 * (
1641  stride[6] = n2 * (
1642  stride[5] = n3 * (
1643  stride[4] = Tag4::Size * (
1644  stride[3] = Tag5::Size * (
1645  stride[2] = Tag6::Size * (
1646  stride[1] = Tag7::Size * (
1647  stride[0] = Tag8::Size )))))));
1648  }
1649 
1650  static void assign( unsigned * stride ,
1651  const unsigned & n1 ,
1652  const unsigned & n2 ,
1653  const unsigned & n3 ,
1654  const unsigned & n4 )
1655  {
1656  stride[7] = n1 * (
1657  stride[6] = n2 * (
1658  stride[5] = n3 * (
1659  stride[4] = n4 * (
1660  stride[3] = Tag5::Size * (
1661  stride[2] = Tag6::Size * (
1662  stride[1] = Tag7::Size * (
1663  stride[0] = Tag8::Size )))))));
1664  }
1665 
1666  static void assign( unsigned * stride ,
1667  const unsigned & n1 ,
1668  const unsigned & n2 ,
1669  const unsigned & n3 ,
1670  const unsigned & n4 ,
1671  const unsigned & n5 )
1672  {
1673  stride[7] = n1 * (
1674  stride[6] = n2 * (
1675  stride[5] = n3 * (
1676  stride[4] = n4 * (
1677  stride[3] = n5 * (
1678  stride[2] = Tag6::Size * (
1679  stride[1] = Tag7::Size * (
1680  stride[0] = Tag8::Size )))))));
1681  }
1682 
1683  static void assign( unsigned * stride ,
1684  const unsigned & n1 ,
1685  const unsigned & n2 ,
1686  const unsigned & n3 ,
1687  const unsigned & n4 ,
1688  const unsigned & n5 ,
1689  const unsigned & n6 )
1690  {
1691  stride[7] = n1 * (
1692  stride[6] = n2 * (
1693  stride[5] = n3 * (
1694  stride[4] = n4 * (
1695  stride[3] = n5 * (
1696  stride[2] = n6 * (
1697  stride[1] = Tag7::Size * (
1698  stride[0] = Tag8::Size )))))));
1699  }
1700 
1701  static void assign( unsigned * stride ,
1702  const unsigned & n1 ,
1703  const unsigned & n2 ,
1704  const unsigned & n3 ,
1705  const unsigned & n4 ,
1706  const unsigned & n5 ,
1707  const unsigned & n6 ,
1708  const unsigned & n7 )
1709  {
1710  stride[7] = n1 * (
1711  stride[6] = n2 * (
1712  stride[5] = n3 * (
1713  stride[4] = n4 * (
1714  stride[3] = n5 * (
1715  stride[2] = n6 * (
1716  stride[1] = n7 * (
1717  stride[0] = Tag8::Size )))))));
1718  }
1719 
1720  static void assign( unsigned * stride ,
1721  const unsigned & n1 ,
1722  const unsigned & n2 ,
1723  const unsigned & n3 ,
1724  const unsigned & n4 ,
1725  const unsigned & n5 ,
1726  const unsigned & n6 ,
1727  const unsigned & n7 ,
1728  const unsigned & n8 )
1729  {
1730  stride[7] = n1 * (
1731  stride[6] = n2 * (
1732  stride[5] = n3 * (
1733  stride[4] = n4 * (
1734  stride[3] = n5 * (
1735  stride[2] = n6 * (
1736  stride[1] = n7 * (
1737  stride[0] = n8 )))))));
1738  }
1739 
1740  static void assign( unsigned * stride ,
1741  const unsigned * const dims )
1742  {
1743  stride[7] = dims[0] * (
1744  stride[6] = dims[1] * (
1745  stride[5] = dims[2] * (
1746  stride[4] = dims[3] * (
1747  stride[3] = dims[4] * (
1748  stride[2] = dims[5] * (
1749  stride[1] = dims[6] * (
1750  stride[0] = dims[7] )))))));
1751  }
1752 };
1753 
1754 template< class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
1755  class Tag5 , class Tag6 , class Tag7 >
1756 struct Array<void,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7,void>
1757 {
1758  enum { Rank = 7 };
1759 
1760  static void assign( unsigned * stride )
1761  {
1762  stride[6] = Tag1::Size * (
1763  stride[5] = Tag2::Size * (
1764  stride[4] = Tag3::Size * (
1765  stride[3] = Tag4::Size * (
1766  stride[2] = Tag5::Size * (
1767  stride[1] = Tag6::Size * (
1768  stride[0] = Tag7::Size ))))));
1769  }
1770 
1771  static void assign( unsigned * stride ,
1772  const unsigned & n1 )
1773  {
1774  stride[6] = n1 * (
1775  stride[5] = Tag2::Size * (
1776  stride[4] = Tag3::Size * (
1777  stride[3] = Tag4::Size * (
1778  stride[2] = Tag5::Size * (
1779  stride[1] = Tag6::Size * (
1780  stride[0] = Tag7::Size ))))));
1781  }
1782 
1783  static void assign( unsigned * stride ,
1784  const unsigned & n1 ,
1785  const unsigned & n2 )
1786  {
1787  stride[6] = n1 * (
1788  stride[5] = n2 * (
1789  stride[4] = Tag3::Size * (
1790  stride[3] = Tag4::Size * (
1791  stride[2] = Tag5::Size * (
1792  stride[1] = Tag6::Size * (
1793  stride[0] = Tag7::Size ))))));
1794  }
1795 
1796  static void assign( unsigned * stride ,
1797  const unsigned & n1 ,
1798  const unsigned & n2 ,
1799  const unsigned & n3 )
1800  {
1801  stride[6] = n1 * (
1802  stride[5] = n2 * (
1803  stride[4] = n3 * (
1804  stride[3] = Tag4::Size * (
1805  stride[2] = Tag5::Size * (
1806  stride[1] = Tag6::Size * (
1807  stride[0] = Tag7::Size ))))));
1808  }
1809 
1810  static void assign( unsigned * stride ,
1811  const unsigned & n1 ,
1812  const unsigned & n2 ,
1813  const unsigned & n3 ,
1814  const unsigned & n4 )
1815  {
1816  stride[6] = n1 * (
1817  stride[5] = n2 * (
1818  stride[4] = n3 * (
1819  stride[3] = n4 * (
1820  stride[2] = Tag5::Size * (
1821  stride[1] = Tag6::Size * (
1822  stride[0] = Tag7::Size ))))));
1823  }
1824 
1825  static void assign( unsigned * stride ,
1826  const unsigned & n1 ,
1827  const unsigned & n2 ,
1828  const unsigned & n3 ,
1829  const unsigned & n4 ,
1830  const unsigned & n5 )
1831  {
1832  stride[6] = n1 * (
1833  stride[5] = n2 * (
1834  stride[4] = n3 * (
1835  stride[3] = n4 * (
1836  stride[2] = n5 * (
1837  stride[1] = Tag6::Size * (
1838  stride[0] = Tag7::Size ))))));
1839  }
1840 
1841  static void assign( unsigned * stride ,
1842  const unsigned & n1 ,
1843  const unsigned & n2 ,
1844  const unsigned & n3 ,
1845  const unsigned & n4 ,
1846  const unsigned & n5 ,
1847  const unsigned & n6 )
1848  {
1849  stride[6] = n1 * (
1850  stride[5] = n2 * (
1851  stride[4] = n3 * (
1852  stride[3] = n4 * (
1853  stride[2] = n5 * (
1854  stride[1] = n6 * (
1855  stride[0] = Tag7::Size ))))));
1856  }
1857 
1858  static void assign( unsigned * stride ,
1859  const unsigned & n1 ,
1860  const unsigned & n2 ,
1861  const unsigned & n3 ,
1862  const unsigned & n4 ,
1863  const unsigned & n5 ,
1864  const unsigned & n6 ,
1865  const unsigned & n7 )
1866  {
1867  stride[6] = n1 * (
1868  stride[5] = n2 * (
1869  stride[4] = n3 * (
1870  stride[3] = n4 * (
1871  stride[2] = n5 * (
1872  stride[1] = n6 * (
1873  stride[0] = n7 ))))));
1874  }
1875 
1876  static void assign( unsigned * stride ,
1877  const unsigned * const dims )
1878  {
1879  stride[6] = dims[0] * (
1880  stride[5] = dims[1] * (
1881  stride[4] = dims[2] * (
1882  stride[3] = dims[3] * (
1883  stride[2] = dims[4] * (
1884  stride[1] = dims[5] * (
1885  stride[0] = dims[6] ))))));
1886  }
1887 };
1888 
1889 template< class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
1890  class Tag5 , class Tag6 >
1891 struct Array<void,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,void,void>
1892 {
1893  enum { Rank = 6 };
1894 
1895  static void assign( unsigned * stride )
1896  {
1897  stride[5] = Tag1::Size * (
1898  stride[4] = Tag2::Size * (
1899  stride[3] = Tag3::Size * (
1900  stride[2] = Tag4::Size * (
1901  stride[1] = Tag5::Size * (
1902  stride[0] = Tag6::Size )))));
1903  }
1904 
1905  static void assign( unsigned * stride ,
1906  const unsigned & n1 )
1907  {
1908  stride[5] = n1 * (
1909  stride[4] = Tag2::Size * (
1910  stride[3] = Tag3::Size * (
1911  stride[2] = Tag4::Size * (
1912  stride[1] = Tag5::Size * (
1913  stride[0] = Tag6::Size )))));
1914  }
1915 
1916  static void assign( unsigned * stride ,
1917  const unsigned & n1 ,
1918  const unsigned & n2 )
1919  {
1920  stride[5] = n1 * (
1921  stride[4] = n2 * (
1922  stride[3] = Tag3::Size * (
1923  stride[2] = Tag4::Size * (
1924  stride[1] = Tag5::Size * (
1925  stride[0] = Tag6::Size )))));
1926  }
1927 
1928  static void assign( unsigned * stride ,
1929  const unsigned & n1 ,
1930  const unsigned & n2 ,
1931  const unsigned & n3 )
1932  {
1933  stride[5] = n1 * (
1934  stride[4] = n2 * (
1935  stride[3] = n3 * (
1936  stride[2] = Tag4::Size * (
1937  stride[1] = Tag5::Size * (
1938  stride[0] = Tag6::Size )))));
1939  }
1940 
1941  static void assign( unsigned * stride ,
1942  const unsigned & n1 ,
1943  const unsigned & n2 ,
1944  const unsigned & n3 ,
1945  const unsigned & n4 )
1946  {
1947  stride[5] = n1 * (
1948  stride[4] = n2 * (
1949  stride[3] = n3 * (
1950  stride[2] = n4 * (
1951  stride[1] = Tag5::Size * (
1952  stride[0] = Tag6::Size )))));
1953  }
1954 
1955  static void assign( unsigned * stride ,
1956  const unsigned & n1 ,
1957  const unsigned & n2 ,
1958  const unsigned & n3 ,
1959  const unsigned & n4 ,
1960  const unsigned & n5 )
1961  {
1962  stride[5] = n1 * (
1963  stride[4] = n2 * (
1964  stride[3] = n3 * (
1965  stride[2] = n4 * (
1966  stride[1] = n5 * (
1967  stride[0] = Tag6::Size )))));
1968  }
1969 
1970  static void assign( unsigned * stride ,
1971  const unsigned & n1 ,
1972  const unsigned & n2 ,
1973  const unsigned & n3 ,
1974  const unsigned & n4 ,
1975  const unsigned & n5 ,
1976  const unsigned & n6 )
1977  {
1978  stride[5] = n1 * (
1979  stride[4] = n2 * (
1980  stride[3] = n3 * (
1981  stride[2] = n4 * (
1982  stride[1] = n5 * (
1983  stride[0] = n6 )))));
1984  }
1985 
1986  static void assign( unsigned * stride ,
1987  const unsigned * const dims )
1988  {
1989  stride[5] = dims[0] * (
1990  stride[4] = dims[1] * (
1991  stride[3] = dims[2] * (
1992  stride[2] = dims[3] * (
1993  stride[1] = dims[4] * (
1994  stride[0] = dims[5] )))));
1995  }
1996 };
1997 
1998 template< class Tag1 , class Tag2 , class Tag3 , class Tag4 ,
1999  class Tag5 >
2000 struct Array<void,NaturalOrder,Tag1,Tag2,Tag3,Tag4,Tag5,void,void,void>
2001 {
2002  enum { Rank = 5 };
2003 
2004  static void assign( unsigned * stride )
2005  {
2006  stride[4] = Tag1::Size * (
2007  stride[3] = Tag2::Size * (
2008  stride[2] = Tag3::Size * (
2009  stride[1] = Tag4::Size * (
2010  stride[0] = Tag5::Size ))));
2011  }
2012 
2013  static void assign( unsigned * stride ,
2014  const unsigned & n1 )
2015  {
2016  stride[4] = n1 * (
2017  stride[3] = Tag2::Size * (
2018  stride[2] = Tag3::Size * (
2019  stride[1] = Tag4::Size * (
2020  stride[0] = Tag5::Size ))));
2021  }
2022 
2023  static void assign( unsigned * stride ,
2024  const unsigned & n1 ,
2025  const unsigned & n2 )
2026  {
2027  stride[4] = n1 * (
2028  stride[3] = n2 * (
2029  stride[2] = Tag3::Size * (
2030  stride[1] = Tag4::Size * (
2031  stride[0] = Tag5::Size ))));
2032  }
2033 
2034  static void assign( unsigned * stride ,
2035  const unsigned & n1 ,
2036  const unsigned & n2 ,
2037  const unsigned & n3 )
2038  {
2039  stride[4] = n1 * (
2040  stride[3] = n2 * (
2041  stride[2] = n3 * (
2042  stride[1] = Tag4::Size * (
2043  stride[0] = Tag5::Size ))));
2044  }
2045 
2046  static void assign( unsigned * stride ,
2047  const unsigned & n1 ,
2048  const unsigned & n2 ,
2049  const unsigned & n3 ,
2050  const unsigned & n4 )
2051  {
2052  stride[4] = n1 * (
2053  stride[3] = n2 * (
2054  stride[2] = n3 * (
2055  stride[1] = n4 * (
2056  stride[0] = Tag5::Size ))));
2057  }
2058 
2059  static void assign( unsigned * stride ,
2060  const unsigned & n1 ,
2061  const unsigned & n2 ,
2062  const unsigned & n3 ,
2063  const unsigned & n4 ,
2064  const unsigned & n5 )
2065  {
2066  stride[4] = n1 * (
2067  stride[3] = n2 * (
2068  stride[2] = n3 * (
2069  stride[1] = n4 * (
2070  stride[0] = n5 ))));
2071  }
2072 
2073  static void assign( unsigned * stride ,
2074  const unsigned * const dims )
2075  {
2076  stride[4] = dims[0] * (
2077  stride[3] = dims[1] * (
2078  stride[2] = dims[2] * (
2079  stride[1] = dims[3] * (
2080  stride[0] = dims[4] ))));
2081  }
2082 };
2083 
2084 
2085 template< class Tag1 , class Tag2 , class Tag3 , class Tag4 >
2086 struct Array<void,NaturalOrder,Tag1,Tag2,Tag3,Tag4,void,void,void,void>
2087 {
2088  enum { Rank = 4 };
2089 
2090  static void assign( unsigned * stride )
2091  {
2092  stride[3] = Tag1::Size * (
2093  stride[2] = Tag2::Size * (
2094  stride[1] = Tag3::Size * (
2095  stride[0] = Tag4::Size )));
2096  }
2097 
2098  static void assign( unsigned * stride ,
2099  const unsigned & n1 )
2100  {
2101  stride[3] = n1 * (
2102  stride[2] = Tag2::Size * (
2103  stride[1] = Tag3::Size * (
2104  stride[0] = Tag4::Size )));
2105  }
2106 
2107  static void assign( unsigned * stride ,
2108  const unsigned & n1 ,
2109  const unsigned & n2 )
2110  {
2111  stride[3] = n1 * (
2112  stride[2] = n2 * (
2113  stride[1] = Tag3::Size * (
2114  stride[0] = Tag4::Size )));
2115  }
2116 
2117  static void assign( unsigned * stride ,
2118  const unsigned & n1 ,
2119  const unsigned & n2 ,
2120  const unsigned & n3 )
2121  {
2122  stride[3] = n1 * (
2123  stride[2] = n2 * (
2124  stride[1] = n3 * (
2125  stride[0] = Tag4::Size )));
2126  }
2127 
2128  static void assign( unsigned * stride ,
2129  const unsigned & n1 ,
2130  const unsigned & n2 ,
2131  const unsigned & n3 ,
2132  const unsigned & n4 )
2133  {
2134  stride[3] = n1 * (
2135  stride[2] = n2 * (
2136  stride[1] = n3 * (
2137  stride[0] = n4 )));
2138  }
2139 
2140  static void assign( unsigned * stride ,
2141  const unsigned * const dims )
2142  {
2143  stride[3] = dims[0] * (
2144  stride[2] = dims[1] * (
2145  stride[1] = dims[2] * (
2146  stride[0] = dims[3] )));
2147  }
2148 };
2149 
2150 template< class Tag1 , class Tag2 , class Tag3 >
2151 struct Array<void,NaturalOrder,Tag1,Tag2,Tag3,void,void,void,void,void>
2152 {
2153  enum { Rank = 3 };
2154 
2155  static void assign( unsigned * stride )
2156  {
2157  stride[2] = Tag1::Size * (
2158  stride[1] = Tag2::Size * (
2159  stride[0] = Tag3::Size ));
2160  }
2161 
2162  static void assign( unsigned * stride ,
2163  const unsigned & n1 )
2164  {
2165  stride[2] = n1 * (
2166  stride[1] = Tag2::Size * (
2167  stride[0] = Tag3::Size ));
2168  }
2169 
2170  static void assign( unsigned * stride ,
2171  const unsigned & n1 ,
2172  const unsigned & n2 )
2173  {
2174  stride[2] = n1 * (
2175  stride[1] = n2 * (
2176  stride[0] = Tag3::Size ));
2177  }
2178 
2179  static void assign( unsigned * stride ,
2180  const unsigned & n1 ,
2181  const unsigned & n2 ,
2182  const unsigned & n3 )
2183  {
2184  stride[2] = n1 * (
2185  stride[1] = n2 * (
2186  stride[0] = n3 ));
2187  }
2188 
2189  static void assign( unsigned * stride ,
2190  const unsigned * const dims )
2191  {
2192  stride[2] = dims[0] * (
2193  stride[1] = dims[1] * (
2194  stride[0] = dims[2] ));
2195  }
2196 };
2197 
2198 template< class Tag1 , class Tag2 >
2199 struct Array<void,NaturalOrder,Tag1,Tag2,void,void,void,void,void,void>
2200 {
2201  enum { Rank = 2 };
2202 
2203  static void assign( unsigned * stride )
2204  { stride[1] = Tag1::Size * ( stride[0] = Tag2::Size ); }
2205 
2206  static void assign( unsigned * stride ,
2207  const unsigned & n1 )
2208  { stride[1] = n1 * ( stride[0] = Tag2::Size ); }
2209 
2210  static void assign( unsigned * stride ,
2211  const unsigned & n1 ,
2212  const unsigned & n2 )
2213  { stride[1] = n1 * ( stride[0] = n2 ); }
2214 
2215  static void assign( unsigned * stride ,
2216  const unsigned * const dims )
2217  {
2218  stride[1] = dims[0] * (
2219  stride[0] = dims[1] );
2220  }
2221 };
2222 
2223 template< class Tag1 >
2224 struct Array<void,NaturalOrder,Tag1,void,void,void,void,void,void,void>
2225 {
2226  enum { Rank = 1 };
2227 
2228  static void assign( unsigned * stride ) { stride[0] = Tag1::Size ; }
2229 
2230  static void assign( unsigned * stride ,
2231  const unsigned & n1 ) { stride[0] = n1 ; }
2232 
2233  static void assign( unsigned * stride ,
2234  const unsigned * const dims )
2235  { stride[0] = dims[0] ; }
2236 };
2237 
2238 //----------------------------------------------------------------------
2239 
2240 template<>
2241 struct Array<void,RankZero,void,void,void,void,void,void,void,void>
2242 {
2243  enum { Rank = 0 };
2244 
2245  static void assign( unsigned * ) {}
2246 };
2247 
2248 //----------------------------------------------------------------------
2249 
2250 #endif /* DOXYGEN_COMPILE */
2251 
2254 } // namespace phdmesh
2255 
2256 #endif
2257 
unsigned array_stride_size(const unsigned rank, const unsigned *const stride)
Return the total number of members from the array stride.
Use the Natural or C-language ordering for multi-dimensions where the right-most dimension is stride-...
Definition: Array.hpp:111
Use the Reverse or Fortran-language ordering for multi-dimensions where the left-most dimension is st...
Definition: Array.hpp:116
void array_stride_to_natural_indices(const unsigned rank, const unsigned *const stride, const unsigned offset, unsigned *const indices)
Generate natural indices from array stride.
ArrayOrder
Define Natural (C-language) or Fortran ordering of array dimensions. A RankZero array does not ha...
Definition: Array.hpp:107
void array_stride_to_natural_dimensions(const unsigned rank, const unsigned *const stride, unsigned *const dim)
Generate natural dimension from array stride.
Special tag to indicate that an array specification has degenerated to rank-zero, i...
Definition: Array.hpp:121