]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Slightly simplify some code. 10972/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 25 Sep 2020 21:19:37 +0000 (15:19 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 25 Sep 2020 21:19:37 +0000 (15:19 -0600)
source/lac/sparsity_pattern.cc

index 608392f9fcbf4a5191aaf530fa86718d1eb2c96e..94437de1df63fdde4406847d0a4d5f1e9745ddfc 100644 (file)
@@ -913,8 +913,8 @@ SparsityPatternBase::print_gnuplot(std::ostream &out) const
 void
 SparsityPatternBase::print_svg(std::ostream &out) const
 {
-  unsigned int m = this->n_rows();
-  unsigned int n = this->n_cols();
+  const unsigned int m = this->n_rows();
+  const unsigned int n = this->n_cols();
   out
     << "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 "
     << n + 2 << " " << m + 2
@@ -933,11 +933,10 @@ SparsityPatternBase::print_svg(std::ostream &out) const
     << n + 0.1 << "\" height=\"" << m + 0.1
     << "\" fill=\"rgb(255, 255, 255)\"/>\n\n";
 
-  SparsityPattern::iterator it = this->begin(), end = this->end();
-  for (; it != end; ++it)
+  for (const auto &entry : *this)
     {
-      out << "  <rect class=\"pixel\" x=\"" << it->column() + 1 << "\" y=\""
-          << it->row() + 1 << "\" width=\".9\" height=\".9\"/>\n";
+      out << "  <rect class=\"pixel\" x=\"" << entry.column() + 1 << "\" y=\""
+          << entry.row() + 1 << "\" width=\".9\" height=\".9\"/>\n";
     }
   out << "</svg>" << std::endl;
 }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.