]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Work around a problem where we now got into an if-branch that we
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 29 Jun 2012 07:56:57 +0000 (07:56 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 29 Jun 2012 07:56:57 +0000 (07:56 +0000)
didn't want to get into.

git-svn-id: https://svn.dealii.org/trunk@25659 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/fe/mapping_q.cc

index 4105d61f0289dec7783a68f5c44377326e75cc5f..53a95a97903831f3ab5551f9d0a56b6c0db0f20a 100644 (file)
@@ -1458,20 +1458,36 @@ transform_real_to_unit_cell (const typename Triangulation<dim,spacedim>::cell_it
                                   // the inverse mapping doesn't
                                   // converge. in that case, use the
                                   // center point of the cell as a
-                                  // starting point
+                                  // starting point if we are to go
+                                  // on using the full mapping, or
+                                  // just propagate up the exception
+                                  // if we had no intention of
+                                  // continuing with the full mapping
   Point<dim> initial_p_unit;
-  bool       initial_p_unit_is_valid = false;
   try
     {
       initial_p_unit
        = MappingQ1<dim,spacedim>::transform_real_to_unit_cell(cell, p);
-
-      initial_p_unit_is_valid = true;
     }
   catch (const typename Mapping<dim,spacedim>::ExcTransformationFailed &)
     {
-      for (unsigned int d=0; d<dim; ++d)
-       initial_p_unit[d] = 0.5;
+                                      // mirror the conditions of the
+                                      // code below to determine if
+                                      // we need to use an arbitrary
+                                      // starting point or if we just
+                                      // need to rethrow the
+                                      // exception
+      if (cell->has_boundary_lines()
+         ||
+         use_mapping_q_on_all_cells
+         ||
+         (dim!=spacedim) )
+       {
+         for (unsigned int d=0; d<dim; ++d)
+           initial_p_unit[d] = 0.5;
+       }
+      else
+       throw;
     }
 
                                    // then a Newton iteration based on the
@@ -1480,9 +1496,7 @@ transform_real_to_unit_cell (const typename Triangulation<dim,spacedim>::cell_it
                                    // the mapping used is in fact a Q1
                                    // mapping, so there is nothing we need to
                                    // do unless the iteration above failed
-  if ((initial_p_unit_is_valid == false)
-      ||
-      cell->has_boundary_lines()
+  if (cell->has_boundary_lines()
       ||
       use_mapping_q_on_all_cells
       ||

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.