1 #ifndef INTREPID_RANK_HPP
2 #define INTREPID_RANK_HPP
5 struct CheckType{
static const bool value =
false; };
9 struct Rank{
static const int value = -1;};
11 template<
class A,
class Scalar>
13 typedef Scalar& return_type;
14 typedef Scalar const_return_type;
20 template<
class DataT,
int leftrank>
26 static int returnvalue(DataT& leftvalues){
27 int dataRank = leftvalues.rank();
34 static int returnvalue(DataT& leftvalues){
41 static int returnvalue(DataT& leftvalues){
48 static int returnvalue(DataT& leftvalues){
55 static int returnvalue(DataT& leftvalues){
62 static int returnvalue(DataT& leftvalues){
69 static int returnvalue(DataT& leftvalues){
76 static int returnvalue(DataT& leftvalues){
83 static int returnvalue(DataT& leftvalues){
89 inline size_t getrank(DataT& leftvalue){
98 template<
class Scalar,
class ArrayType,
int ArrayRank,
bool isconstant>
103 template<
class Scalar,
class ArrayType>
106 typedef typename Return_Type<ArrayType, Scalar>::return_type rtype;
116 runtimewrapper1(view_),
117 runtimewrapper2(view_),
118 runtimewrapper3(view_),
119 runtimewrapper4(view_),
120 runtimewrapper5(view_) {};
122 int dimension(
int i)
const{
123 return view.dimension(i);
129 rtype operator() (
const int i0)
const{
133 rtype operator() (
const int i0,
const int i1)
const{
137 rtype operator() (
const int i0,
const int i1,
const int i2)
const{
138 return view(i0,i1,i2);
141 rtype operator() (
const int i0,
const int i1,
const int i2,
143 return view(i0,i1,i2,i3);
146 rtype operator() (
const int i0,
const int i1,
const int i2,
147 const int i3,
const int i4)
const{
148 return view(i0,i1,i2,i3,i4);
153 template<
class Scalar,
class ArrayType>
157 typedef typename Return_Type<ArrayType, Scalar>::return_type rtype;
161 int dimension(
int i)
const{
162 return view.dimension(i);
168 rtype operator() (
const int i0,
const int i1 = 0,
const int i2 = 0,
169 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
170 const int i6 = 0,
const int i7 = 0)
const{
175 template<
class Scalar,
class ArrayType>
179 typedef typename Return_Type<ArrayType, Scalar>::return_type rtype;
183 int dimension(
int i)
const{
184 return view.dimension(i);
190 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
191 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
192 const int i6 = 0,
const int i7 = 0)
const{
197 template<
class Scalar,
class ArrayType>
201 typedef typename Return_Type<ArrayType, Scalar>::return_type rtype;
205 int dimension(
int i)
const{
206 return view.dimension(i);
211 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
212 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
213 const int i6 = 0,
const int i7 = 0)
const{
214 return view(i0,i1,i2);
217 template<
class Scalar,
class ArrayType>
221 typedef typename Return_Type<ArrayType, Scalar>::return_type rtype;
225 int dimension(
int i)
const{
226 return view.dimension(i);
231 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
232 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
233 const int i6 = 0,
const int i7 = 0)
const {
234 return view(i0,i1,i2,i3);
237 template<
class Scalar,
class ArrayType>
241 typedef typename Return_Type<ArrayType, Scalar>::return_type rtype;
245 int dimension(
int i)
const{
246 return view.dimension(i);
251 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
252 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
253 const int i6 = 0,
const int i7 = 0)
const {
254 return view(i0,i1,i2,i3,i4);
257 template<
class Scalar,
class ArrayType>
261 typedef typename Return_Type<ArrayType, Scalar>::return_type rtype;
265 int dimension(
int i)
const{
266 return view.dimension(i);
271 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
272 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
273 const int i6 = 0,
const int i7 = 0)
const{
274 return view(i0,i1,i2,i3,i4,i5);
277 template<
class Scalar,
class ArrayType>
281 typedef typename Return_Type<ArrayType, Scalar>::return_type rtype;
285 int dimension(
int i)
const{
286 return view.dimension(i);
291 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
292 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
293 const int i6 = 0,
const int i7 = 0)
const{
294 return view(i0,i1,i2,i3,i4,i5,i6);
297 template<
class Scalar,
class ArrayType>
301 typedef typename Return_Type<ArrayType, Scalar>::return_type rtype;
305 int dimension(
int i)
const{
306 return view.dimension(i);
311 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
312 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
313 const int i6 = 0,
const int i7 = 0)
const{
314 return view(i0,i1,i2,i3,i4,i5,i6,i7);
317 template<
class Scalar,
class ArrayType>
319 const ArrayType& view;
320 typedef typename Return_Type<ArrayType, Scalar>::const_return_type rtype;
330 runtimewrapper1(view_),
331 runtimewrapper2(view_),
332 runtimewrapper3(view_),
333 runtimewrapper4(view_),
334 runtimewrapper5(view_) {};
336 int dimension(
int i)
const{
337 return view.dimension(i);
342 rtype operator() (
const int i0)
const{
345 rtype operator() (
const int i0,
const int i1)
const{
348 rtype operator() (
const int i0,
const int i1,
const int i2)
const{
349 return view(i0,i1,i2);
351 rtype operator() (
const int i0,
const int i1,
const int i2,
352 const int i3 )
const{
353 return view(i0,i1,i2,i3);
355 rtype operator() (
const int i0,
const int i1,
const int i2,
356 const int i3,
const int i4)
const{
357 return view(i0,i1,i2,i3,i4);
363 template<
class Scalar,
class ArrayType>
365 const ArrayType& view;
367 typedef typename Return_Type<ArrayType, Scalar>::const_return_type rtype;
371 int dimension(
int i)
const{
372 return view.dimension(i);
377 rtype operator() (
const int i0,
const int i1 = 0,
const int i2 = 0,
378 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
379 const int i6 = 0,
const int i7 = 0)
const {
384 template<
class Scalar,
class ArrayType>
386 const ArrayType& view;
388 typedef typename Return_Type<ArrayType, Scalar>::const_return_type rtype;
392 int dimension(
int i)
const{
393 return view.dimension(i);
399 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
400 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
401 const int i6 = 0,
const int i7 = 0)
const {
406 template<
class Scalar,
class ArrayType>
408 const ArrayType& view;
410 typedef typename Return_Type<ArrayType, Scalar>::const_return_type rtype;
414 int dimension(
int i)
const{
415 return view.dimension(i);
421 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
422 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
423 const int i6 = 0,
const int i7 = 0)
const {
424 return view(i0,i1,i2);
427 template<
class Scalar,
class ArrayType>
429 const ArrayType& view;
431 typedef typename Return_Type<ArrayType, Scalar>::const_return_type rtype;
434 int dimension(
int i)
const{
435 return view.dimension(i);
440 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
441 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
442 const int i6 = 0,
const int i7 = 0)
const {
443 return view(i0,i1,i2,i3);
446 template<
class Scalar,
class ArrayType>
448 const ArrayType& view;
450 typedef typename Return_Type<ArrayType, Scalar>::const_return_type rtype;
452 int dimension(
int i)
const{
453 return view.dimension(i);
458 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
459 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
460 const int i6 = 0,
const int i7 = 0)
const{
461 return view(i0,i1,i2,i3,i4);
464 template<
class Scalar,
class ArrayType>
466 const ArrayType& view;
468 typedef typename Return_Type<ArrayType, Scalar>::const_return_type rtype;
470 int dimension(
int i)
const{
471 return view.dimension(i);
476 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
477 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
478 const int i6 = 0,
const int i7 = 0)
const {
479 return view(i0,i1,i2,i3,i4,i5);
482 template<
class Scalar,
class ArrayType>
484 const ArrayType& view;
486 typedef typename Return_Type<ArrayType, Scalar>::const_return_type rtype;
488 int dimension(
int i)
const{
489 return view.dimension(i);
495 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
496 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
497 const int i6 = 0,
const int i7 = 0)
const {
498 return view(i0,i1,i2,i3,i4,i5,i6);
503 template<
class Scalar,
class ArrayType>
505 const ArrayType& view;
507 typedef typename Return_Type<ArrayType, Scalar>::const_return_type rtype;
509 int dimension(
int i)
const{
510 return view.dimension(i);
515 rtype operator() (
const int i0,
const int i1=0,
const int i2 = 0,
516 const int i3 = 0,
const int i4 = 0,
const int i5 = 0,
517 const int i6 = 0,
const int i7 = 0)
const {
518 return view(i0,i1,i2,i3,i4,i5,i6,i7);