From: Matthias Maier Date: Wed, 9 Sep 2015 15:13:06 +0000 (-0500) Subject: Address comments X-Git-Tag: v8.4.0-rc2~451^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf8b44b80992f4b351b334fca62b2246de481ebc;p=dealii.git Address comments --- diff --git a/include/deal.II/base/table_indices.h b/include/deal.II/base/table_indices.h index fd8a41a163..3be3b508a4 100644 --- a/include/deal.II/base/table_indices.h +++ b/include/deal.II/base/table_indices.h @@ -116,7 +116,7 @@ protected: template TableIndices::TableIndices() { - Assert (N != 0, ExcMessage("Cannot create a TableIndices object of size 0")); + Assert (N > 0, ExcMessage("Cannot create a TableIndices object of size 0")); for (unsigned int i=0; i::TableIndices(const unsigned int index0, const unsigned int index7, const unsigned int index8) { - Assert (N != 0, ExcMessage("Cannot create a TableIndices object of size 0")); + Assert (N > 0, ExcMessage("Cannot create a TableIndices object of size 0")); + + switch (N) + { + case 1: // fallthrough + Assert (index1 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); + case 2: // fallthrough + Assert (index2 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); + case 3: // fallthrough + Assert (index3 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); + case 4: // fallthrough + Assert (index4 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); + case 5: // fallthrough + Assert (index5 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); + case 6: // fallthrough + Assert (index6 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); + case 7: // fallthrough + Assert (index7 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); + case 8: // fallthrough + Assert (index8 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); + default: ; + } // Always access "indices" with indices modulo N to avoid bogus compiler // warnings (although such access is always in dead code... switch (N) { - case 9: + default: + // For TableIndices of size 10 or larger als default initialize the + // remaining indices to numbers::invalid_unsigned_int: + for (unsigned int i=0; i::TableIndices(const unsigned int index0, indices[0 % N] = index0; } - // For TableIndices of size 10 or larger als default initialize the - // remaining indices to numbers::invalid_unsigned_int: - if (N > 9) - for (unsigned int i=0; i