From: Wolfgang Bangerth Date: Tue, 2 Jan 2024 21:44:57 +0000 (-0700) Subject: Simplify some locations. X-Git-Tag: relicensing~206^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16408%2Fhead;p=dealii.git Simplify some locations. In particular, avoid doing too many type casts by hand in the Trilinos wrappers given that this is so fragile with regard to what Trilinos actually uses internally. --- diff --git a/source/lac/trilinos_sparsity_pattern.cc b/source/lac/trilinos_sparsity_pattern.cc index ccf17e785f..9834a35fa4 100644 --- a/source/lac/trilinos_sparsity_pattern.cc +++ b/source/lac/trilinos_sparsity_pattern.cc @@ -921,9 +921,7 @@ namespace TrilinosWrappers unsigned int SparsityPattern::local_size() const { - int n_rows = graph->NumMyRows(); - - return n_rows; + return graph->NumMyRows(); } @@ -931,11 +929,10 @@ namespace TrilinosWrappers std::pair SparsityPattern::local_range() const { - size_type begin, end; - begin = TrilinosWrappers::min_my_gid(graph->RowMap()); - end = TrilinosWrappers::max_my_gid(graph->RowMap()) + 1; + const size_type begin = TrilinosWrappers::min_my_gid(graph->RowMap()); + const size_type end = TrilinosWrappers::max_my_gid(graph->RowMap()) + 1; - return std::make_pair(begin, end); + return {begin, end}; } @@ -943,9 +940,7 @@ namespace TrilinosWrappers std::uint64_t SparsityPattern::n_nonzero_elements() const { - TrilinosWrappers::types::int64_type nnz = n_global_entries(*graph); - - return static_cast(nnz); + return n_global_entries(*graph); } @@ -953,9 +948,7 @@ namespace TrilinosWrappers unsigned int SparsityPattern::max_entries_per_row() const { - int nnz = graph->MaxNumIndices(); - - return static_cast(nnz); + return graph->MaxNumIndices(); }