]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove 'if (true)' statements. 7248/head
authorDavid Wells <drwells@email.unc.edu>
Fri, 28 Sep 2018 18:58:11 +0000 (14:58 -0400)
committerDavid Wells <drwells@email.unc.edu>
Fri, 28 Sep 2018 19:37:19 +0000 (15:37 -0400)
include/deal.II/lac/sparse_vanka.templates.h
source/base/function_lib.cc
source/dofs/dof_tools_constraints.cc
source/grid/grid_out.cc
source/grid/tria.cc

index 6f5f9cfdd1efd16052795616213f17ccb5965d14..e10bdd9cd1ae2de19fc7b5111e5dc1cbd064e800 100644 (file)
@@ -474,27 +474,26 @@ SparseBlockVanka<number>::compute_dof_masks(
   // consecutive, with other
   // consecutive regions where we do
   // not have to do something
-  if (true)
-    {
-      unsigned int c     = 0;
-      unsigned int block = 0;
-      intervals[0].first = 0;
+  {
+    unsigned int c     = 0;
+    unsigned int block = 0;
+    intervals[0].first = 0;
 
-      for (size_type i = 0; (i < M.m()) && (block + 1 < n_blocks); ++i)
-        {
-          if (selected[i] == true)
-            ++c;
-          if (c == n_inverses_per_block)
-            {
-              intervals[block].second    = i;
-              intervals[block + 1].first = i;
-              ++block;
-
-              c = 0;
-            }
-        }
-      intervals[n_blocks - 1].second = M.m();
-    }
+    for (size_type i = 0; (i < M.m()) && (block + 1 < n_blocks); ++i)
+      {
+        if (selected[i] == true)
+          ++c;
+        if (c == n_inverses_per_block)
+          {
+            intervals[block].second    = i;
+            intervals[block + 1].first = i;
+            ++block;
+
+            c = 0;
+          }
+      }
+    intervals[n_blocks - 1].second = M.m();
+  }
 
   // now transfer the knowledge on
   // the splitting points into the
index 663714a71c4be83fe66b8f779e6aba9ec78e28e7..996822ff1b00052b0e5456c78ef9bd523f3c6dc4 100644 (file)
@@ -606,42 +606,40 @@ namespace Functions
           result[0][0] = -pi2 * std::cos(numbers::PI_2 * p(0));
           break;
         case 2:
-          if (true)
-            {
-              const double coco = -pi2 * std::cos(numbers::PI_2 * p(0)) *
-                                  std::cos(numbers::PI_2 * p(1));
-              const double sisi = pi2 * std::sin(numbers::PI_2 * p(0)) *
-                                  std::sin(numbers::PI_2 * p(1));
-              result[0][0] = coco;
-              result[1][1] = coco;
-              // for SymmetricTensor we assign [ij] and [ji] simultaneously:
-              result[0][1] = sisi;
-            }
+          {
+            const double coco = -pi2 * std::cos(numbers::PI_2 * p(0)) *
+                                std::cos(numbers::PI_2 * p(1));
+            const double sisi = pi2 * std::sin(numbers::PI_2 * p(0)) *
+                                std::sin(numbers::PI_2 * p(1));
+            result[0][0] = coco;
+            result[1][1] = coco;
+            // for SymmetricTensor we assign [ij] and [ji] simultaneously:
+            result[0][1] = sisi;
+          }
           break;
         case 3:
-          if (true)
-            {
-              const double cococo = -pi2 * std::cos(numbers::PI_2 * p(0)) *
-                                    std::cos(numbers::PI_2 * p(1)) *
-                                    std::cos(numbers::PI_2 * p(2));
-              const double sisico = pi2 * std::sin(numbers::PI_2 * p(0)) *
-                                    std::sin(numbers::PI_2 * p(1)) *
-                                    std::cos(numbers::PI_2 * p(2));
-              const double sicosi = pi2 * std::sin(numbers::PI_2 * p(0)) *
-                                    std::cos(numbers::PI_2 * p(1)) *
-                                    std::sin(numbers::PI_2 * p(2));
-              const double cosisi = pi2 * std::cos(numbers::PI_2 * p(0)) *
-                                    std::sin(numbers::PI_2 * p(1)) *
-                                    std::sin(numbers::PI_2 * p(2));
-
-              result[0][0] = cococo;
-              result[1][1] = cococo;
-              result[2][2] = cococo;
-              // for SymmetricTensor we assign [ij] and [ji] simultaneously:
-              result[0][1] = sisico;
-              result[0][2] = sicosi;
-              result[1][2] = cosisi;
-            }
+          {
+            const double cococo = -pi2 * std::cos(numbers::PI_2 * p(0)) *
+                                  std::cos(numbers::PI_2 * p(1)) *
+                                  std::cos(numbers::PI_2 * p(2));
+            const double sisico = pi2 * std::sin(numbers::PI_2 * p(0)) *
+                                  std::sin(numbers::PI_2 * p(1)) *
+                                  std::cos(numbers::PI_2 * p(2));
+            const double sicosi = pi2 * std::sin(numbers::PI_2 * p(0)) *
+                                  std::cos(numbers::PI_2 * p(1)) *
+                                  std::sin(numbers::PI_2 * p(2));
+            const double cosisi = pi2 * std::cos(numbers::PI_2 * p(0)) *
+                                  std::sin(numbers::PI_2 * p(1)) *
+                                  std::sin(numbers::PI_2 * p(2));
+
+            result[0][0] = cococo;
+            result[1][1] = cococo;
+            result[2][2] = cococo;
+            // for SymmetricTensor we assign [ij] and [ji] simultaneously:
+            result[0][1] = sisico;
+            result[0][2] = sicosi;
+            result[1][2] = cosisi;
+          }
           break;
         default:
           Assert(false, ExcNotImplemented());
@@ -670,42 +668,40 @@ namespace Functions
               hessians[i][0][0] = -pi2 * std::cos(numbers::PI_2 * p(0));
               break;
             case 2:
-              if (true)
-                {
-                  const double coco = -pi2 * std::cos(numbers::PI_2 * p(0)) *
-                                      std::cos(numbers::PI_2 * p(1));
-                  const double sisi = pi2 * std::sin(numbers::PI_2 * p(0)) *
-                                      std::sin(numbers::PI_2 * p(1));
-                  hessians[i][0][0] = coco;
-                  hessians[i][1][1] = coco;
-                  // for SymmetricTensor we assign [ij] and [ji] simultaneously:
-                  hessians[i][0][1] = sisi;
-                }
+              {
+                const double coco = -pi2 * std::cos(numbers::PI_2 * p(0)) *
+                                    std::cos(numbers::PI_2 * p(1));
+                const double sisi = pi2 * std::sin(numbers::PI_2 * p(0)) *
+                                    std::sin(numbers::PI_2 * p(1));
+                hessians[i][0][0] = coco;
+                hessians[i][1][1] = coco;
+                // for SymmetricTensor we assign [ij] and [ji] simultaneously:
+                hessians[i][0][1] = sisi;
+              }
               break;
             case 3:
-              if (true)
-                {
-                  const double cococo = -pi2 * std::cos(numbers::PI_2 * p(0)) *
-                                        std::cos(numbers::PI_2 * p(1)) *
-                                        std::cos(numbers::PI_2 * p(2));
-                  const double sisico = pi2 * std::sin(numbers::PI_2 * p(0)) *
-                                        std::sin(numbers::PI_2 * p(1)) *
-                                        std::cos(numbers::PI_2 * p(2));
-                  const double sicosi = pi2 * std::sin(numbers::PI_2 * p(0)) *
-                                        std::cos(numbers::PI_2 * p(1)) *
-                                        std::sin(numbers::PI_2 * p(2));
-                  const double cosisi = pi2 * std::cos(numbers::PI_2 * p(0)) *
-                                        std::sin(numbers::PI_2 * p(1)) *
-                                        std::sin(numbers::PI_2 * p(2));
-
-                  hessians[i][0][0] = cococo;
-                  hessians[i][1][1] = cococo;
-                  hessians[i][2][2] = cococo;
-                  // for SymmetricTensor we assign [ij] and [ji] simultaneously:
-                  hessians[i][0][1] = sisico;
-                  hessians[i][0][2] = sicosi;
-                  hessians[i][1][2] = cosisi;
-                }
+              {
+                const double cococo = -pi2 * std::cos(numbers::PI_2 * p(0)) *
+                                      std::cos(numbers::PI_2 * p(1)) *
+                                      std::cos(numbers::PI_2 * p(2));
+                const double sisico = pi2 * std::sin(numbers::PI_2 * p(0)) *
+                                      std::sin(numbers::PI_2 * p(1)) *
+                                      std::cos(numbers::PI_2 * p(2));
+                const double sicosi = pi2 * std::sin(numbers::PI_2 * p(0)) *
+                                      std::cos(numbers::PI_2 * p(1)) *
+                                      std::sin(numbers::PI_2 * p(2));
+                const double cosisi = pi2 * std::cos(numbers::PI_2 * p(0)) *
+                                      std::sin(numbers::PI_2 * p(1)) *
+                                      std::sin(numbers::PI_2 * p(2));
+
+                hessians[i][0][0] = cococo;
+                hessians[i][1][1] = cococo;
+                hessians[i][2][2] = cococo;
+                // for SymmetricTensor we assign [ij] and [ji] simultaneously:
+                hessians[i][0][1] = sisico;
+                hessians[i][0][2] = sicosi;
+                hessians[i][1][2] = cosisi;
+              }
               break;
             default:
               Assert(false, ExcNotImplemented());
@@ -972,44 +968,42 @@ namespace Functions
               gradients[i][0][0] = -pi2 * std::cos(numbers::PI_2 * p(0));
               break;
             case 2:
-              if (true)
-                {
-                  const double coco = -pi2 * std::cos(numbers::PI_2 * p(0)) *
-                                      std::cos(numbers::PI_2 * p(1));
-                  const double sisi = pi2 * std::sin(numbers::PI_2 * p(0)) *
-                                      std::sin(numbers::PI_2 * p(1));
-                  gradients[i][0][0] = coco;
-                  gradients[i][1][1] = coco;
-                  gradients[i][0][1] = sisi;
-                  gradients[i][1][0] = sisi;
-                }
+              {
+                const double coco = -pi2 * std::cos(numbers::PI_2 * p(0)) *
+                                    std::cos(numbers::PI_2 * p(1));
+                const double sisi = pi2 * std::sin(numbers::PI_2 * p(0)) *
+                                    std::sin(numbers::PI_2 * p(1));
+                gradients[i][0][0] = coco;
+                gradients[i][1][1] = coco;
+                gradients[i][0][1] = sisi;
+                gradients[i][1][0] = sisi;
+              }
               break;
             case 3:
-              if (true)
-                {
-                  const double cococo = -pi2 * std::cos(numbers::PI_2 * p(0)) *
-                                        std::cos(numbers::PI_2 * p(1)) *
-                                        std::cos(numbers::PI_2 * p(2));
-                  const double sisico = pi2 * std::sin(numbers::PI_2 * p(0)) *
-                                        std::sin(numbers::PI_2 * p(1)) *
-                                        std::cos(numbers::PI_2 * p(2));
-                  const double sicosi = pi2 * std::sin(numbers::PI_2 * p(0)) *
-                                        std::cos(numbers::PI_2 * p(1)) *
-                                        std::sin(numbers::PI_2 * p(2));
-                  const double cosisi = pi2 * std::cos(numbers::PI_2 * p(0)) *
-                                        std::sin(numbers::PI_2 * p(1)) *
-                                        std::sin(numbers::PI_2 * p(2));
-
-                  gradients[i][0][0] = cococo;
-                  gradients[i][1][1] = cococo;
-                  gradients[i][2][2] = cococo;
-                  gradients[i][0][1] = sisico;
-                  gradients[i][1][0] = sisico;
-                  gradients[i][0][2] = sicosi;
-                  gradients[i][2][0] = sicosi;
-                  gradients[i][1][2] = cosisi;
-                  gradients[i][2][1] = cosisi;
-                }
+              {
+                const double cococo = -pi2 * std::cos(numbers::PI_2 * p(0)) *
+                                      std::cos(numbers::PI_2 * p(1)) *
+                                      std::cos(numbers::PI_2 * p(2));
+                const double sisico = pi2 * std::sin(numbers::PI_2 * p(0)) *
+                                      std::sin(numbers::PI_2 * p(1)) *
+                                      std::cos(numbers::PI_2 * p(2));
+                const double sicosi = pi2 * std::sin(numbers::PI_2 * p(0)) *
+                                      std::cos(numbers::PI_2 * p(1)) *
+                                      std::sin(numbers::PI_2 * p(2));
+                const double cosisi = pi2 * std::cos(numbers::PI_2 * p(0)) *
+                                      std::sin(numbers::PI_2 * p(1)) *
+                                      std::sin(numbers::PI_2 * p(2));
+
+                gradients[i][0][0] = cococo;
+                gradients[i][1][1] = cococo;
+                gradients[i][2][2] = cococo;
+                gradients[i][0][1] = sisico;
+                gradients[i][1][0] = sisico;
+                gradients[i][0][2] = sicosi;
+                gradients[i][2][0] = sicosi;
+                gradients[i][1][2] = cosisi;
+                gradients[i][2][1] = cosisi;
+              }
               break;
             default:
               Assert(false, ExcNotImplemented());
index 8f5a2af38f3998dbdd5e5175fbfe137b78666b2a..93c7132fbc959efcce613bfc6fff2fab21a4b327 100644 (file)
@@ -3054,32 +3054,30 @@ namespace DoFTools
         // find out how many DoFs there are on the grids belonging to the
         // components we want to match
         unsigned int n_parameters_on_fine_grid = 0;
-        if (true)
-          {
-            // have a flag for each dof on the fine grid and set it to true if
-            // this is an interesting dof. finally count how many true's there
-            std::vector<bool> dof_is_interesting(fine_grid.n_dofs(), false);
-            std::vector<types::global_dof_index> local_dof_indices(
-              fine_fe.dofs_per_cell);
-
-            for (typename dealii::DoFHandler<dim,
-                                             spacedim>::active_cell_iterator
-                   cell = fine_grid.begin_active();
-                 cell != fine_grid.end();
-                 ++cell)
-              if (cell->is_locally_owned())
-                {
-                  cell->get_dof_indices(local_dof_indices);
-                  for (unsigned int i = 0; i < fine_fe.dofs_per_cell; ++i)
-                    if (fine_fe.system_to_component_index(i).first ==
-                        fine_component)
-                      dof_is_interesting[local_dof_indices[i]] = true;
-                }
+        {
+          // have a flag for each dof on the fine grid and set it to true if
+          // this is an interesting dof. finally count how many true's there
+          std::vector<bool> dof_is_interesting(fine_grid.n_dofs(), false);
+          std::vector<types::global_dof_index> local_dof_indices(
+            fine_fe.dofs_per_cell);
+
+          for (typename dealii::DoFHandler<dim, spacedim>::active_cell_iterator
+                 cell = fine_grid.begin_active();
+               cell != fine_grid.end();
+               ++cell)
+            if (cell->is_locally_owned())
+              {
+                cell->get_dof_indices(local_dof_indices);
+                for (unsigned int i = 0; i < fine_fe.dofs_per_cell; ++i)
+                  if (fine_fe.system_to_component_index(i).first ==
+                      fine_component)
+                    dof_is_interesting[local_dof_indices[i]] = true;
+              }
 
-            n_parameters_on_fine_grid = std::count(dof_is_interesting.begin(),
-                                                   dof_is_interesting.end(),
-                                                   true);
-          }
+          n_parameters_on_fine_grid = std::count(dof_is_interesting.begin(),
+                                                 dof_is_interesting.end(),
+                                                 true);
+        }
 
 
         // set up the weights mapping
@@ -3089,35 +3087,33 @@ namespace DoFTools
         weight_mapping.clear();
         weight_mapping.resize(n_fine_dofs, numbers::invalid_dof_index);
 
-        if (true)
-          {
-            std::vector<types::global_dof_index> local_dof_indices(
-              fine_fe.dofs_per_cell);
-            unsigned int next_free_index = 0;
-            for (typename dealii::DoFHandler<dim,
-                                             spacedim>::active_cell_iterator
-                   cell = fine_grid.begin_active();
-                 cell != fine_grid.end();
-                 ++cell)
-              if (cell->is_locally_owned())
-                {
-                  cell->get_dof_indices(local_dof_indices);
-                  for (unsigned int i = 0; i < fine_fe.dofs_per_cell; ++i)
-                    // if this DoF is a parameter dof and has not yet been
-                    // numbered, then do so
-                    if ((fine_fe.system_to_component_index(i).first ==
-                         fine_component) &&
-                        (weight_mapping[local_dof_indices[i]] ==
-                         numbers::invalid_dof_index))
-                      {
-                        weight_mapping[local_dof_indices[i]] = next_free_index;
-                        ++next_free_index;
-                      }
-                }
+        {
+          std::vector<types::global_dof_index> local_dof_indices(
+            fine_fe.dofs_per_cell);
+          unsigned int next_free_index = 0;
+          for (typename dealii::DoFHandler<dim, spacedim>::active_cell_iterator
+                 cell = fine_grid.begin_active();
+               cell != fine_grid.end();
+               ++cell)
+            if (cell->is_locally_owned())
+              {
+                cell->get_dof_indices(local_dof_indices);
+                for (unsigned int i = 0; i < fine_fe.dofs_per_cell; ++i)
+                  // if this DoF is a parameter dof and has not yet been
+                  // numbered, then do so
+                  if ((fine_fe.system_to_component_index(i).first ==
+                       fine_component) &&
+                      (weight_mapping[local_dof_indices[i]] ==
+                       numbers::invalid_dof_index))
+                    {
+                      weight_mapping[local_dof_indices[i]] = next_free_index;
+                      ++next_free_index;
+                    }
+              }
 
-            Assert(next_free_index == n_parameters_on_fine_grid,
-                   ExcInternalError());
-          }
+          Assert(next_free_index == n_parameters_on_fine_grid,
+                 ExcInternalError());
+        }
 
 
         // for each cell on the parameter grid: find out which degrees of
index eca272afef77730a683414b0bd5f47a58bb30d84..b536dbd01adfbf8e93a34f559e1770c8a5eb9e27 100644 (file)
@@ -2747,29 +2747,27 @@ GridOut::write_mathgl(const Triangulation<dim, spacedim> &tria,
   AssertThrow(out, ExcIO());
 
   // (i) write header
-  if (true)
-    {
-      // block this to have local variables destroyed after use
-      const std::time_t time1 = std::time(nullptr);
-      const std::tm *   time  = std::localtime(&time1);
+  {
+    // block this to have local variables destroyed after use
+    const std::time_t time1 = std::time(nullptr);
+    const std::tm *   time  = std::localtime(&time1);
 
-      out
-        << "\n#"
-        << "\n# This file was generated by the deal.II library."
-        << "\n#   Date =  " << time->tm_year + 1900 << "/" << std::setfill('0')
-        << std::setw(2) << time->tm_mon + 1 << "/" << std::setfill('0')
-        << std::setw(2) << time->tm_mday
-        << "\n#   Time =  " << std::setfill('0') << std::setw(2)
-        << time->tm_hour << ":" << std::setfill('0') << std::setw(2)
-        << time->tm_min << ":" << std::setfill('0') << std::setw(2)
-        << time->tm_sec << "\n#"
-        << "\n# For a description of the MathGL script format see the MathGL manual.  "
-        << "\n#"
-        << "\n# Note: This file is understood by MathGL v2.1 and higher only, and can "
-        << "\n#       be quickly viewed in a graphical environment using \'mglview\'. "
-        << "\n#"
-        << "\n";
-    }
+    out
+      << "\n#"
+      << "\n# This file was generated by the deal.II library."
+      << "\n#   Date =  " << time->tm_year + 1900 << "/" << std::setfill('0')
+      << std::setw(2) << time->tm_mon + 1 << "/" << std::setfill('0')
+      << std::setw(2) << time->tm_mday << "\n#   Time =  " << std::setfill('0')
+      << std::setw(2) << time->tm_hour << ":" << std::setfill('0')
+      << std::setw(2) << time->tm_min << ":" << std::setfill('0')
+      << std::setw(2) << time->tm_sec << "\n#"
+      << "\n# For a description of the MathGL script format see the MathGL manual.  "
+      << "\n#"
+      << "\n# Note: This file is understood by MathGL v2.1 and higher only, and can "
+      << "\n#       be quickly viewed in a graphical environment using \'mglview\'. "
+      << "\n#"
+      << "\n";
+  }
 
   // define a helper to keep loops approximately dim-independent
   // since MathGL labels axes as x, y, z
@@ -4403,84 +4401,83 @@ namespace internal
 
 
       // now write preamble
-      if (true)
-        {
-          // block this to have local
-          // variables destroyed after
-          // use
-          std::time_t time1 = std::time(nullptr);
-          std::tm *   time  = std::localtime(&time1);
-          out << "%!PS-Adobe-2.0 EPSF-1.2" << '\n'
-              << "%%Title: deal.II Output" << '\n'
-              << "%%Creator: the deal.II library" << '\n'
-              << "%%Creation Date: " << time->tm_year + 1900 << "/"
-              << time->tm_mon + 1 << "/" << time->tm_mday << " - "
-              << time->tm_hour << ":" << std::setw(2) << time->tm_min << ":"
-              << std::setw(2) << time->tm_sec << '\n'
-              << "%%BoundingBox: "
-              // lower left corner
-              << "0 0 "
-              // upper right corner
-              << static_cast<unsigned int>(
-                   std::floor(((x_max - x_min) * scale) + 1))
-              << ' '
-              << static_cast<unsigned int>(
-                   std::floor(((y_max - y_min) * scale) + 1))
+      {
+        // block this to have local
+        // variables destroyed after
+        // use
+        std::time_t time1 = std::time(nullptr);
+        std::tm *   time  = std::localtime(&time1);
+        out << "%!PS-Adobe-2.0 EPSF-1.2" << '\n'
+            << "%%Title: deal.II Output" << '\n'
+            << "%%Creator: the deal.II library" << '\n'
+            << "%%Creation Date: " << time->tm_year + 1900 << "/"
+            << time->tm_mon + 1 << "/" << time->tm_mday << " - "
+            << time->tm_hour << ":" << std::setw(2) << time->tm_min << ":"
+            << std::setw(2) << time->tm_sec << '\n'
+            << "%%BoundingBox: "
+            // lower left corner
+            << "0 0 "
+            // upper right corner
+            << static_cast<unsigned int>(
+                 std::floor(((x_max - x_min) * scale) + 1))
+            << ' '
+            << static_cast<unsigned int>(
+                 std::floor(((y_max - y_min) * scale) + 1))
+            << '\n';
+
+        // define some abbreviations to keep
+        // the output small:
+        // m=move turtle to
+        // x=execute line stroke
+        // b=black pen
+        // r=red pen
+        out << "/m {moveto} bind def" << '\n'
+            << "/x {lineto stroke} bind def" << '\n'
+            << "/b {0 0 0 setrgbcolor} def" << '\n'
+            << "/r {1 0 0 setrgbcolor} def" << '\n';
+
+        // calculate colors for level
+        // coloring; level 0 is black,
+        // other levels are blue
+        // ... red
+        if (eps_flags_base.color_lines_level)
+          out << "/l  { neg " << (max_level) << " add "
+              << (0.66666 / std::max(1U, (max_level - 1)))
+              << " mul 1 0.8 sethsbcolor} def" << '\n';
+
+        // in 2d, we can also plot cell
+        // and vertex numbers, but this
+        // requires a somewhat more
+        // lengthy preamble. please
+        // don't ask me what most of
+        // this means, it is reverse
+        // engineered from what GNUPLOT
+        // uses in its output
+        if ((dim == 2) && (eps_flags_2.write_cell_numbers ||
+                           eps_flags_2.write_vertex_numbers))
+          {
+            out
+              << ("/R {rmoveto} bind def\n"
+                  "/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont\n"
+                  "dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall\n"
+                  "currentdict end definefont\n"
+                  "/MFshow {{dup dup 0 get findfont exch 1 get scalefont setfont\n"
+                  "[ currentpoint ] exch dup 2 get 0 exch rmoveto dup dup 5 get exch 4 get\n"
+                  "{show} {stringwidth pop 0 rmoveto}ifelse dup 3 get\n"
+                  "{2 get neg 0 exch rmoveto pop} {pop aload pop moveto}ifelse} forall} bind def\n"
+                  "/MFwidth {0 exch {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont\n"
+                  "5 get stringwidth pop add}\n"
+                  "{pop} ifelse} forall} bind def\n"
+                  "/MCshow { currentpoint stroke m\n"
+                  "exch dup MFwidth -2 div 3 -1 roll R MFshow } def\n")
               << '\n';
+          }
 
-          // define some abbreviations to keep
-          // the output small:
-          // m=move turtle to
-          // x=execute line stroke
-          // b=black pen
-          // r=red pen
-          out << "/m {moveto} bind def" << '\n'
-              << "/x {lineto stroke} bind def" << '\n'
-              << "/b {0 0 0 setrgbcolor} def" << '\n'
-              << "/r {1 0 0 setrgbcolor} def" << '\n';
-
-          // calculate colors for level
-          // coloring; level 0 is black,
-          // other levels are blue
-          // ... red
-          if (eps_flags_base.color_lines_level)
-            out << "/l  { neg " << (max_level) << " add "
-                << (0.66666 / std::max(1U, (max_level - 1)))
-                << " mul 1 0.8 sethsbcolor} def" << '\n';
-
-          // in 2d, we can also plot cell
-          // and vertex numbers, but this
-          // requires a somewhat more
-          // lengthy preamble. please
-          // don't ask me what most of
-          // this means, it is reverse
-          // engineered from what GNUPLOT
-          // uses in its output
-          if ((dim == 2) && (eps_flags_2.write_cell_numbers ||
-                             eps_flags_2.write_vertex_numbers))
-            {
-              out
-                << ("/R {rmoveto} bind def\n"
-                    "/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont\n"
-                    "dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall\n"
-                    "currentdict end definefont\n"
-                    "/MFshow {{dup dup 0 get findfont exch 1 get scalefont setfont\n"
-                    "[ currentpoint ] exch dup 2 get 0 exch rmoveto dup dup 5 get exch 4 get\n"
-                    "{show} {stringwidth pop 0 rmoveto}ifelse dup 3 get\n"
-                    "{2 get neg 0 exch rmoveto pop} {pop aload pop moveto}ifelse} forall} bind def\n"
-                    "/MFwidth {0 exch {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont\n"
-                    "5 get stringwidth pop add}\n"
-                    "{pop} ifelse} forall} bind def\n"
-                    "/MCshow { currentpoint stroke m\n"
-                    "exch dup MFwidth -2 div 3 -1 roll R MFshow } def\n")
-                << '\n';
-            }
-
-          out << "%%EndProlog" << '\n' << '\n';
+        out << "%%EndProlog" << '\n' << '\n';
 
-          // set fine lines
-          out << eps_flags_base.line_width << " setlinewidth" << '\n';
-        }
+        // set fine lines
+        out << eps_flags_base.line_width << " setlinewidth" << '\n';
+      }
 
       // now write the lines
       const Point<2> offset(x_min, y_min);
index f0e6233c325a273dff20e8449cfe218dd137b08f..8fcab065a21361df05ba132632c501f70a035c8a 100644 (file)
@@ -4896,23 +4896,20 @@ namespace internal
         // check whether a new level is needed we have to check for
         // this on the highest level only (on this, all used cells are
         // also active, so we only have to check for this)
-        if (true)
-          {
-            typename Triangulation<dim, spacedim>::raw_cell_iterator
-              cell =
-                triangulation.begin_active(triangulation.levels.size() - 1),
-              endc = triangulation.end();
-            for (; cell != endc; ++cell)
-              if (cell->used())
-                if (cell->refine_flag_set())
-                  {
-                    triangulation.levels.push_back(
-                      std_cxx14::make_unique<
-                        internal::TriangulationImplementation::TriaLevel<
-                          dim>>());
-                    break;
-                  }
-          }
+        {
+          typename Triangulation<dim, spacedim>::raw_cell_iterator
+            cell = triangulation.begin_active(triangulation.levels.size() - 1),
+            endc = triangulation.end();
+          for (; cell != endc; ++cell)
+            if (cell->used())
+              if (cell->refine_flag_set())
+                {
+                  triangulation.levels.push_back(
+                    std_cxx14::make_unique<
+                      internal::TriangulationImplementation::TriaLevel<dim>>());
+                  break;
+                }
+        }
 
 
         // first clear user flags and pointers of lines; we're going
@@ -5082,119 +5079,117 @@ namespace internal
 
         // first the refinement of lines.  children are stored
         // pairwise
-        if (true)
-          {
-            // only active objects can be refined further
-            typename Triangulation<dim, spacedim>::active_line_iterator
-              line = triangulation.begin_active_line(),
-              endl = triangulation.end_line();
-            typename Triangulation<dim, spacedim>::raw_line_iterator
-              next_unused_line = triangulation.begin_raw_line();
-
-            for (; line != endl; ++line)
-              if (line->user_flag_set())
-                {
-                  // this line needs to be refined
-
-                  // find the next unused vertex and set it
-                  // appropriately
-                  while (triangulation.vertices_used[next_unused_vertex] ==
-                         true)
-                    ++next_unused_vertex;
-                  Assert(
-                    next_unused_vertex < triangulation.vertices.size(),
-                    ExcMessage(
-                      "Internal error: During refinement, the triangulation wants to access an element of the 'vertices' array but it turns out that the array is not large enough."));
-                  triangulation.vertices_used[next_unused_vertex] = true;
-
-                  if (spacedim == dim)
-                    {
-                      // for the case of a domain in an
-                      // equal-dimensional space we only have to treat
-                      // boundary lines differently; for interior
-                      // lines we can compute the midpoint as the mean
-                      // of the two vertices: if (line->at_boundary())
-                      triangulation.vertices[next_unused_vertex] =
-                        line->center(true);
-                    }
-                  else
-                    // however, if spacedim>dim, we always have to ask
-                    // the boundary object for its answer. We use the
-                    // same object of the cell (which was stored in
-                    // line->user_index() before) unless a manifold_id
-                    // has been set on this very line.
-                    if (line->manifold_id() == numbers::flat_manifold_id)
-                    triangulation.vertices[next_unused_vertex] =
-                      triangulation.get_manifold(line->user_index())
-                        .get_new_point_on_line(line);
-                  else
+        {
+          // only active objects can be refined further
+          typename Triangulation<dim, spacedim>::active_line_iterator
+            line = triangulation.begin_active_line(),
+            endl = triangulation.end_line();
+          typename Triangulation<dim, spacedim>::raw_line_iterator
+            next_unused_line = triangulation.begin_raw_line();
+
+          for (; line != endl; ++line)
+            if (line->user_flag_set())
+              {
+                // this line needs to be refined
+
+                // find the next unused vertex and set it
+                // appropriately
+                while (triangulation.vertices_used[next_unused_vertex] == true)
+                  ++next_unused_vertex;
+                Assert(
+                  next_unused_vertex < triangulation.vertices.size(),
+                  ExcMessage(
+                    "Internal error: During refinement, the triangulation wants to access an element of the 'vertices' array but it turns out that the array is not large enough."));
+                triangulation.vertices_used[next_unused_vertex] = true;
+
+                if (spacedim == dim)
+                  {
+                    // for the case of a domain in an
+                    // equal-dimensional space we only have to treat
+                    // boundary lines differently; for interior
+                    // lines we can compute the midpoint as the mean
+                    // of the two vertices: if (line->at_boundary())
                     triangulation.vertices[next_unused_vertex] =
                       line->center(true);
+                  }
+                else
+                  // however, if spacedim>dim, we always have to ask
+                  // the boundary object for its answer. We use the
+                  // same object of the cell (which was stored in
+                  // line->user_index() before) unless a manifold_id
+                  // has been set on this very line.
+                  if (line->manifold_id() == numbers::flat_manifold_id)
+                  triangulation.vertices[next_unused_vertex] =
+                    triangulation.get_manifold(line->user_index())
+                      .get_new_point_on_line(line);
+                else
+                  triangulation.vertices[next_unused_vertex] =
+                    line->center(true);
 
-                  // now that we created the right point, make up the
-                  // two child lines.  To this end, find a pair of
-                  // unused lines
-                  bool pair_found = false;
-                  (void)pair_found;
-                  for (; next_unused_line != endl; ++next_unused_line)
-                    if (!next_unused_line->used() &&
-                        !(++next_unused_line)->used())
-                      {
-                        // go back to the first of the two unused
-                        // lines
-                        --next_unused_line;
-                        pair_found = true;
-                        break;
-                      }
-                  Assert(pair_found, ExcInternalError());
-
-                  // there are now two consecutive unused lines, such
-                  // that the children of a line will be consecutive.
-                  // then set the child pointer of the present line
-                  line->set_children(0, next_unused_line->index());
-
-                  // set the two new lines
-                  const typename Triangulation<dim, spacedim>::raw_line_iterator
-                    children[2] = {next_unused_line, ++next_unused_line};
-                  // some tests; if any of the iterators should be
-                  // invalid, then already dereferencing will fail
-                  Assert(
-                    children[0]->used() == false,
-                    ExcMessage(
-                      "Internal error: We want to use a cell during refinement that should be unused, but turns out not to be."));
-                  Assert(
-                    children[1]->used() == false,
-                    ExcMessage(
-                      "Internal error: We want to use a cell during refinement that should be unused, but turns out not to be."));
-
-                  children[0]->set(
-                    internal::TriangulationImplementation ::TriaObject<1>(
-                      line->vertex_index(0), next_unused_vertex));
-                  children[1]->set(
-                    internal::TriangulationImplementation ::TriaObject<1>(
-                      next_unused_vertex, line->vertex_index(1)));
-
-                  children[0]->set_used_flag();
-                  children[1]->set_used_flag();
-                  children[0]->clear_children();
-                  children[1]->clear_children();
-                  children[0]->clear_user_data();
-                  children[1]->clear_user_data();
-                  children[0]->clear_user_flag();
-                  children[1]->clear_user_flag();
-
-
-                  children[0]->set_boundary_id_internal(line->boundary_id());
-                  children[1]->set_boundary_id_internal(line->boundary_id());
-
-                  children[0]->set_manifold_id(line->manifold_id());
-                  children[1]->set_manifold_id(line->manifold_id());
-
-                  // finally clear flag indicating the need for
-                  // refinement
-                  line->clear_user_flag();
-                }
-          }
+                // now that we created the right point, make up the
+                // two child lines.  To this end, find a pair of
+                // unused lines
+                bool pair_found = false;
+                (void)pair_found;
+                for (; next_unused_line != endl; ++next_unused_line)
+                  if (!next_unused_line->used() &&
+                      !(++next_unused_line)->used())
+                    {
+                      // go back to the first of the two unused
+                      // lines
+                      --next_unused_line;
+                      pair_found = true;
+                      break;
+                    }
+                Assert(pair_found, ExcInternalError());
+
+                // there are now two consecutive unused lines, such
+                // that the children of a line will be consecutive.
+                // then set the child pointer of the present line
+                line->set_children(0, next_unused_line->index());
+
+                // set the two new lines
+                const typename Triangulation<dim, spacedim>::raw_line_iterator
+                  children[2] = {next_unused_line, ++next_unused_line};
+                // some tests; if any of the iterators should be
+                // invalid, then already dereferencing will fail
+                Assert(
+                  children[0]->used() == false,
+                  ExcMessage(
+                    "Internal error: We want to use a cell during refinement that should be unused, but turns out not to be."));
+                Assert(
+                  children[1]->used() == false,
+                  ExcMessage(
+                    "Internal error: We want to use a cell during refinement that should be unused, but turns out not to be."));
+
+                children[0]->set(
+                  internal::TriangulationImplementation ::TriaObject<1>(
+                    line->vertex_index(0), next_unused_vertex));
+                children[1]->set(
+                  internal::TriangulationImplementation ::TriaObject<1>(
+                    next_unused_vertex, line->vertex_index(1)));
+
+                children[0]->set_used_flag();
+                children[1]->set_used_flag();
+                children[0]->clear_children();
+                children[1]->clear_children();
+                children[0]->clear_user_data();
+                children[1]->clear_user_data();
+                children[0]->clear_user_flag();
+                children[1]->clear_user_flag();
+
+
+                children[0]->set_boundary_id_internal(line->boundary_id());
+                children[1]->set_boundary_id_internal(line->boundary_id());
+
+                children[0]->set_manifold_id(line->manifold_id());
+                children[1]->set_manifold_id(line->manifold_id());
+
+                // finally clear flag indicating the need for
+                // refinement
+                line->clear_user_flag();
+              }
+        }
 
 
         // Now set up the new cells
@@ -5280,23 +5275,20 @@ namespace internal
         // check whether a new level is needed we have to check for
         // this on the highest level only (on this, all used cells are
         // also active, so we only have to check for this)
-        if (true)
-          {
-            typename Triangulation<dim, spacedim>::raw_cell_iterator
-              cell =
-                triangulation.begin_active(triangulation.levels.size() - 1),
-              endc = triangulation.end();
-            for (; cell != endc; ++cell)
-              if (cell->used())
-                if (cell->refine_flag_set())
-                  {
-                    triangulation.levels.push_back(
-                      std_cxx14::make_unique<
-                        internal::TriangulationImplementation::TriaLevel<
-                          dim>>());
-                    break;
-                  }
-          }
+        {
+          typename Triangulation<dim, spacedim>::raw_cell_iterator
+            cell = triangulation.begin_active(triangulation.levels.size() - 1),
+            endc = triangulation.end();
+          for (; cell != endc; ++cell)
+            if (cell->used())
+              if (cell->refine_flag_set())
+                {
+                  triangulation.levels.push_back(
+                    std_cxx14::make_unique<
+                      internal::TriangulationImplementation::TriaLevel<dim>>());
+                  break;
+                }
+        }
 
 
         // first clear user flags for quads and lines; we're going to
@@ -5591,91 +5583,88 @@ namespace internal
         unsigned int next_unused_vertex = 0;
 
         // first for lines
-        if (true)
-          {
-            // only active objects can be refined further
-            typename Triangulation<dim, spacedim>::active_line_iterator
-              line = triangulation.begin_active_line(),
-              endl = triangulation.end_line();
-            typename Triangulation<dim, spacedim>::raw_line_iterator
-              next_unused_line = triangulation.begin_raw_line();
-
-            for (; line != endl; ++line)
-              if (line->user_flag_set())
-                {
-                  // this line needs to be refined
-
-                  // find the next unused vertex and set it
-                  // appropriately
-                  while (triangulation.vertices_used[next_unused_vertex] ==
-                         true)
-                    ++next_unused_vertex;
-                  Assert(
-                    next_unused_vertex < triangulation.vertices.size(),
-                    ExcMessage(
-                      "Internal error: During refinement, the triangulation wants to access an element of the 'vertices' array but it turns out that the array is not large enough."));
-                  triangulation.vertices_used[next_unused_vertex] = true;
-
-                  triangulation.vertices[next_unused_vertex] =
-                    line->center(true);
-
-                  // now that we created the right point, make up the
-                  // two child lines (++ takes care of the end of the
-                  // vector)
-                  next_unused_line =
-                    triangulation.faces->lines.next_free_pair_object(
-                      triangulation);
-                  Assert(next_unused_line.state() == IteratorState::valid,
-                         ExcInternalError());
-
-                  // now we found two consecutive unused lines, such
-                  // that the children of a line will be consecutive.
-                  // then set the child pointer of the present line
-                  line->set_children(0, next_unused_line->index());
-
-                  // set the two new lines
-                  const typename Triangulation<dim, spacedim>::raw_line_iterator
-                    children[2] = {next_unused_line, ++next_unused_line};
-
-                  // some tests; if any of the iterators should be
-                  // invalid, then already dereferencing will fail
-                  Assert(
-                    children[0]->used() == false,
-                    ExcMessage(
-                      "Internal error: We want to use a cell during refinement that should be unused, but turns out not to be."));
-                  Assert(
-                    children[1]->used() == false,
-                    ExcMessage(
-                      "Internal error: We want to use a cell during refinement that should be unused, but turns out not to be."));
+        {
+          // only active objects can be refined further
+          typename Triangulation<dim, spacedim>::active_line_iterator
+            line = triangulation.begin_active_line(),
+            endl = triangulation.end_line();
+          typename Triangulation<dim, spacedim>::raw_line_iterator
+            next_unused_line = triangulation.begin_raw_line();
+
+          for (; line != endl; ++line)
+            if (line->user_flag_set())
+              {
+                // this line needs to be refined
+
+                // find the next unused vertex and set it
+                // appropriately
+                while (triangulation.vertices_used[next_unused_vertex] == true)
+                  ++next_unused_vertex;
+                Assert(
+                  next_unused_vertex < triangulation.vertices.size(),
+                  ExcMessage(
+                    "Internal error: During refinement, the triangulation wants to access an element of the 'vertices' array but it turns out that the array is not large enough."));
+                triangulation.vertices_used[next_unused_vertex] = true;
+
+                triangulation.vertices[next_unused_vertex] = line->center(true);
+
+                // now that we created the right point, make up the
+                // two child lines (++ takes care of the end of the
+                // vector)
+                next_unused_line =
+                  triangulation.faces->lines.next_free_pair_object(
+                    triangulation);
+                Assert(next_unused_line.state() == IteratorState::valid,
+                       ExcInternalError());
 
-                  children[0]->set(
-                    internal::TriangulationImplementation ::TriaObject<1>(
-                      line->vertex_index(0), next_unused_vertex));
-                  children[1]->set(
-                    internal::TriangulationImplementation ::TriaObject<1>(
-                      next_unused_vertex, line->vertex_index(1)));
-
-                  children[0]->set_used_flag();
-                  children[1]->set_used_flag();
-                  children[0]->clear_children();
-                  children[1]->clear_children();
-                  children[0]->clear_user_data();
-                  children[1]->clear_user_data();
-                  children[0]->clear_user_flag();
-                  children[1]->clear_user_flag();
-
-                  children[0]->set_boundary_id_internal(line->boundary_id());
-                  children[1]->set_boundary_id_internal(line->boundary_id());
-
-                  children[0]->set_manifold_id(line->manifold_id());
-                  children[1]->set_manifold_id(line->manifold_id());
-
-                  // finally clear flag
-                  // indicating the need
-                  // for refinement
-                  line->clear_user_flag();
-                }
-          }
+                // now we found two consecutive unused lines, such
+                // that the children of a line will be consecutive.
+                // then set the child pointer of the present line
+                line->set_children(0, next_unused_line->index());
+
+                // set the two new lines
+                const typename Triangulation<dim, spacedim>::raw_line_iterator
+                  children[2] = {next_unused_line, ++next_unused_line};
+
+                // some tests; if any of the iterators should be
+                // invalid, then already dereferencing will fail
+                Assert(
+                  children[0]->used() == false,
+                  ExcMessage(
+                    "Internal error: We want to use a cell during refinement that should be unused, but turns out not to be."));
+                Assert(
+                  children[1]->used() == false,
+                  ExcMessage(
+                    "Internal error: We want to use a cell during refinement that should be unused, but turns out not to be."));
+
+                children[0]->set(
+                  internal::TriangulationImplementation ::TriaObject<1>(
+                    line->vertex_index(0), next_unused_vertex));
+                children[1]->set(
+                  internal::TriangulationImplementation ::TriaObject<1>(
+                    next_unused_vertex, line->vertex_index(1)));
+
+                children[0]->set_used_flag();
+                children[1]->set_used_flag();
+                children[0]->clear_children();
+                children[1]->clear_children();
+                children[0]->clear_user_data();
+                children[1]->clear_user_data();
+                children[0]->clear_user_flag();
+                children[1]->clear_user_flag();
+
+                children[0]->set_boundary_id_internal(line->boundary_id());
+                children[1]->set_boundary_id_internal(line->boundary_id());
+
+                children[0]->set_manifold_id(line->manifold_id());
+                children[1]->set_manifold_id(line->manifold_id());
+
+                // finally clear flag
+                // indicating the need
+                // for refinement
+                line->clear_user_flag();
+              }
+        }
 
 
         ///////////////////////////////////////

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.