Assert (Td[i][j].end() - Td[i][j].begin() ==
static_cast<signed int>(K),
ExcInternalError());
+ };
+
+ // fifth check: a 4d-table
+ if (true)
+ {
+ const unsigned int I=5, J=4, K=3, L=2;
+ Table<4,double> Td(I,J,K,L);
+ Table<4,int> Ti(I,J,K,L);
+
+ unsigned int index=0;
+ for (unsigned int i=0; i<I; ++i)
+ for (unsigned int j=0; j<J; ++j)
+ for (unsigned int k=0; k<K; ++k)
+ for (unsigned int l=0; l<L; ++l, ++index)
+ {
+ // Take a simple
+ // number generator
+ // rather than
+ // dreaming up lots
+ // of `arbitrary'
+ // numbers in the
+ // entries array
+ Td(i,j,k,l) = 2*index+1;
+ Ti(i,j,k,l) = 2*index+1;
+ };
+
+ for (unsigned int i=0; i<I; ++i)
+ for (unsigned int j=0; j<J; ++j)
+ for (unsigned int k=0; k<K; ++k)
+ for (unsigned int l=0; l<L; ++l)
+ {
+ Assert (Td[i][j][k][l] == Td(i,j,k,l), ExcInternalError());
+ Assert (Ti[i][j][k][l] == Ti(i,j,k,l), ExcInternalError());
+ Assert (Ti[i][j][k][l] == Td(i,j,k,l), ExcInternalError());
+
+ Assert (*(Td[i][j][k].begin()+l) == Td(i,j,k,l), ExcInternalError());
+ Assert (*(Ti[i][j][k].begin()+l) == Ti(i,j,k,l), ExcInternalError());
+ Assert (*(Ti[i][j][k].begin()+l) == Td(i,j,k,l), ExcInternalError());
+
+ Assert (Td[i][j][k].begin()+l == &Td(i,j,k,l), ExcInternalError());
+ Assert (Ti[i][j][k].begin()+l == &Ti(i,j,k,l), ExcInternalError());
+
+ logfile << i << " " << j << " " << k << " " << l << " "
+ << Td[i][j][k][l] << " ok" << std::endl;
+ };
+
+ for (unsigned int i=0; i<I; ++i)
+ for (unsigned int j=0; j<J; ++j)
+ for (unsigned int k=0; k<K; ++k)
+ Assert (Td[i][j][k].end() - Td[i][j][k].begin() ==
+ static_cast<signed int>(L),
+ ExcDimensionMismatch(Td[i][j][k].end() - Td[i][j][k].begin(),
+ static_cast<signed int>(L)));
+ };
+
+ // sixth check: a 5d-table
+ if (true)
+ {
+ const unsigned int I=6, J=2, K=3, L=4, M=5;
+ Table<5,double> Td(I,J,K,L,M);
+ Table<5,int> Ti(I,J,K,L,M);
+
+ unsigned int index=0;
+ for (unsigned int i=0; i<I; ++i)
+ for (unsigned int j=0; j<J; ++j)
+ for (unsigned int k=0; k<K; ++k)
+ for (unsigned int l=0; l<L; ++l)
+ for (unsigned int m=0; m<M; ++m, ++index)
+ {
+ Td(i,j,k,l,m) = 2*index+1;
+ Ti(i,j,k,l,m) = 2*index+1;
+ };
+
+ for (unsigned int i=0; i<I; ++i)
+ for (unsigned int j=0; j<J; ++j)
+ for (unsigned int k=0; k<K; ++k)
+ for (unsigned int l=0; l<L; ++l)
+ for (unsigned int m=0; m<M; ++m)
+ {
+ Assert (Td[i][j][k][l][m] == Td(i,j,k,l,m), ExcInternalError());
+ Assert (Ti[i][j][k][l][m] == Ti(i,j,k,l,m), ExcInternalError());
+ Assert (Ti[i][j][k][l][m] == Td(i,j,k,l,m), ExcInternalError());
+
+ Assert (*(Td[i][j][k][l].begin()+m) == Td(i,j,k,l,m), ExcInternalError());
+ Assert (*(Ti[i][j][k][l].begin()+m) == Ti(i,j,k,l,m), ExcInternalError());
+ Assert (*(Ti[i][j][k][l].begin()+m) == Td(i,j,k,l,m), ExcInternalError());
+
+ Assert (Td[i][j][k][l].begin()+m == &Td(i,j,k,l,m), ExcInternalError());
+ Assert (Ti[i][j][k][l].begin()+m == &Ti(i,j,k,l,m), ExcInternalError());
+
+ logfile << i << " " << j << " " << k << " " << l << " " << m << " "
+ << Td[i][j][k][l][m] << " ok" << std::endl;
+ };
+
+ for (unsigned int i=0; i<I; ++i)
+ for (unsigned int j=0; j<J; ++j)
+ for (unsigned int k=0; k<K; ++k)
+ for (unsigned int l=0; l<L; ++l)
+ Assert (Td[i][j][k][l].end() - Td[i][j][k][l].begin() ==
+ static_cast<signed int>(M),
+ ExcDimensionMismatch(Td[i][j][k][l].end() - Td[i][j][k][l].begin(),
+ static_cast<signed int>(M)));
+ };
+
+ // seventh check: a 6d-table
+ if (true)
+ {
+ const unsigned int I=6, J=2, K=4, L=3, M=5, N=7;
+ Table<6,double> Td(I,J,K,L,M,N);
+ Table<6,int> Ti(I,J,K,L,M,N);
+
+ unsigned int index=0;
+ for (unsigned int i=0; i<I; ++i)
+ for (unsigned int j=0; j<J; ++j)
+ for (unsigned int k=0; k<K; ++k)
+ for (unsigned int l=0; l<L; ++l)
+ for (unsigned int m=0; m<M; ++m)
+ for (unsigned int n=0; n<N; ++n, ++index)
+ {
+ Td(i,j,k,l,m,n) = 2*index+1;
+ Ti(i,j,k,l,m,n) = 2*index+1;
+ };
+
+ for (unsigned int i=0; i<I; ++i)
+ for (unsigned int j=0; j<J; ++j)
+ for (unsigned int k=0; k<K; ++k)
+ for (unsigned int l=0; l<L; ++l)
+ for (unsigned int m=0; m<M; ++m)
+ for (unsigned int n=0; n<N; ++n)
+ {
+ Assert (Td[i][j][k][l][m][n] == Td(i,j,k,l,m,n), ExcInternalError());
+ Assert (Ti[i][j][k][l][m][n] == Ti(i,j,k,l,m,n), ExcInternalError());
+ Assert (Ti[i][j][k][l][m][n] == Td(i,j,k,l,m,n), ExcInternalError());
+
+ Assert (*(Td[i][j][k][l][m].begin()+n) == Td(i,j,k,l,m,n), ExcInternalError());
+ Assert (*(Ti[i][j][k][l][m].begin()+n) == Ti(i,j,k,l,m,n), ExcInternalError());
+ Assert (*(Ti[i][j][k][l][m].begin()+n) == Td(i,j,k,l,m,n), ExcInternalError());
+
+ Assert (Td[i][j][k][l][m].begin()+n == &Td(i,j,k,l,m,n), ExcInternalError());
+ Assert (Ti[i][j][k][l][m].begin()+n == &Ti(i,j,k,l,m,n), ExcInternalError());
+
+ logfile << i << " " << j << " " << k << " " << l << " " << m << " " << n << " "
+ << Td[i][j][k][l][m][n] << " ok" << std::endl;
+ };
+
+ for (unsigned int i=0; i<I; ++i)
+ for (unsigned int j=0; j<J; ++j)
+ for (unsigned int k=0; k<K; ++k)
+ for (unsigned int l=0; l<L; ++l)
+ for (unsigned int m=0; m<M; ++m)
+ Assert (Td[i][j][k][l][m].end() - Td[i][j][k][l][m].begin() ==
+ static_cast<signed int>(N),
+ ExcDimensionMismatch(Td[i][j][k][l][m].end() - Td[i][j][k][l][m].begin(),
+ static_cast<signed int>(N)));
};
};