From: Martin Kronbichler Date: Mon, 2 Mar 2020 12:22:55 +0000 (+0100) Subject: Eliminate two places with unsigned long long int X-Git-Tag: v9.2.0-rc1~482^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=447ab17bee60ac332645b4ae42e09d4eed72d03f;p=dealii.git Eliminate two places with unsigned long long int --- diff --git a/include/deal.II/base/table_handler.h b/include/deal.II/base/table_handler.h index 5ac60692bc..9fc847e3c1 100644 --- a/include/deal.II/base/table_handler.h +++ b/include/deal.II/base/table_handler.h @@ -133,8 +133,8 @@ namespace internal /** * Abbreviation for the data type stored by this object. */ - using value_type = boost:: - variant; + using value_type = + boost::variant; /** * Stored value. @@ -829,8 +829,7 @@ namespace internal char c = 's'; ar &c &*p; } - else if (const unsigned long long int *p = - boost::get(&value)) + else if (const std::uint64_t *p = boost::get(&value)) { char c = 'l'; ar &c &*p; @@ -888,8 +887,8 @@ namespace internal case 'l': { - unsigned long long int val; - ar & val; + std::uint64_t val; + ar & val; value = val; break; } diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index 7dbb309b0e..096f93dcab 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -578,16 +578,16 @@ namespace Utilities * $p_i\in [0,N)$ and $p_i\neq p_j$ for $i\neq j$), produce the reverse * permutation $q_i=N-1-p_i$. */ - std::vector - reverse_permutation(const std::vector &permutation); + std::vector + reverse_permutation(const std::vector &permutation); /** * Given a permutation vector (i.e. a vector $p_0\ldots p_{N-1}$ where each * $p_i\in [0,N)$ and $p_i\neq p_j$ for $i\neq j$), produce the inverse * permutation $q_0\ldots q_{N-1}$ so that $q_{p_i}=p_{q_i}=i$. */ - std::vector - invert_permutation(const std::vector &permutation); + std::vector + invert_permutation(const std::vector &permutation); /** * Given an arbitrary object of type T, use boost::serialization utilities diff --git a/source/base/table_handler.cc b/source/base/table_handler.cc index c25053d5da..7d9a7aa95a 100644 --- a/source/base/table_handler.cc +++ b/source/base/table_handler.cc @@ -55,10 +55,10 @@ namespace internal catch (...) {} - // ... then with unsigned long long int... + // ... then with std::uint64_t... try { - return boost::get(value); + return boost::get(value); } catch (...) {} diff --git a/source/base/utilities.cc b/source/base/utilities.cc index e7a1d7009a..1c1019a4e3 100644 --- a/source/base/utilities.cc +++ b/source/base/utilities.cc @@ -904,13 +904,13 @@ namespace Utilities return out; } - std::vector - reverse_permutation(const std::vector &permutation) + std::vector + reverse_permutation(const std::vector &permutation) { - const unsigned long long int n = permutation.size(); + const std::uint64_t n = permutation.size(); - std::vector out(n); - for (unsigned long long int i = 0; i < n; ++i) + std::vector out(n); + for (std::uint64_t i = 0; i < n; ++i) out[i] = n - 1 - permutation[i]; return out; @@ -918,14 +918,14 @@ namespace Utilities - std::vector - invert_permutation(const std::vector &permutation) + std::vector + invert_permutation(const std::vector &permutation) { - const unsigned long long int n = permutation.size(); + const std::uint64_t n = permutation.size(); - std::vector out(n, numbers::invalid_unsigned_int); + std::vector out(n, numbers::invalid_dof_index); - for (unsigned long long int i = 0; i < n; ++i) + for (std::uint64_t i = 0; i < n; ++i) { AssertIndexRange(permutation[i], n); out[permutation[i]] = i; @@ -933,7 +933,7 @@ namespace Utilities // check that we have actually reached // all indices - for (unsigned long long int i = 0; i < n; ++i) + for (std::uint64_t i = 0; i < n; ++i) Assert(out[i] != numbers::invalid_unsigned_int, ExcMessage("The given input permutation had duplicate entries!")); @@ -945,10 +945,10 @@ namespace Utilities std::vector reverse_permutation(const std::vector &permutation) { - const unsigned int n = permutation.size(); + const std::size_t n = permutation.size(); std::vector out(n); - for (unsigned int i = 0; i < n; ++i) + for (std::size_t i = 0; i < n; ++i) out[i] = n - 1 - permutation[i]; return out; @@ -960,11 +960,11 @@ namespace Utilities std::vector invert_permutation(const std::vector &permutation) { - const unsigned int n = permutation.size(); + const std::size_t n = permutation.size(); std::vector out(n, numbers::invalid_unsigned_int); - for (unsigned int i = 0; i < n; ++i) + for (std::size_t i = 0; i < n; ++i) { AssertIndexRange(permutation[i], n); out[permutation[i]] = i; diff --git a/tests/base/convergence_table_05.cc b/tests/base/convergence_table_05.cc index 8744fd5a81..10d273fcf0 100644 --- a/tests/base/convergence_table_05.cc +++ b/tests/base/convergence_table_05.cc @@ -24,7 +24,7 @@ #include "../tests.h" // test the method evaluate_convergence_rates with key column given by -// unsigned long long int +// 64 bit dof indices int main() @@ -33,8 +33,8 @@ main() ConvergenceTable t; - const unsigned long long int t1 = 100; - const unsigned long long int t2 = 400; + const std::uint64_t t1 = 100; + const std::uint64_t t2 = 400; t.add_value("cells", t1); t.add_value("error", 0.1); t.add_value("cells", t2);