]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix an assumption that might be violated in very rare cases: that 1e308 is not greate...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 17 Nov 1999 18:45:53 +0000 (18:45 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 17 Nov 1999 18:45:53 +0000 (18:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@1884 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/Todo
deal.II/deal.II/source/grid/tria.cc

index cb8631eb2876b9d2765473ba2aaa7dfff0eb1287..b58badfbc0c6c5ce0a6bdb9c45de2e44f819c467 100644 (file)
@@ -159,7 +159,3 @@ Remove the hack in Make_forward_declarations when using gcc2.95. See
 
 Move the TriaNumberCache into the Triangulation class once the
   compiler supports this (gcc2.95 does not allow this at present)
-
-
-In Tria::distort_random: replace the initial value 1e308 by the
-  diameter of the domain (sum of diameters of coarse level cells).
index 7816b93655493d2e1ac0e264a738b2f8df611943..8346f2bc8d7a39f84aeac6636bf94b92be46e947 100644 (file)
@@ -1143,9 +1143,20 @@ void Triangulation<1>::distort_random (const double factor,
 
   const unsigned int dim = 1;
   
-                                  // find the smallest length of the lines
-                                  // adjacent to the vertex
-  vector<double>             minimal_length (vertices.size(), 1e308);
+                                  // find the smallest length of the
+                                  // lines adjacent to the
+                                  // vertex. take the initial value
+                                  // to be larger than anything that
+                                  // might be found: the diameter of
+                                  // the triangulation, here computed
+                                  // by adding up the diameters of
+                                  // the coarse grid cells.
+  double almost_infinite_length = 0;
+  for (cell_iterator cell=begin(0); cell!=end(0); ++cell)
+    almost_infinite_length += cell->diameter();
+  
+  vector<double>             minimal_length (vertices.size(),
+                                            almost_infinite_length);
                                   // also note if a vertex is at
                                   // the boundary
   vector<bool>               at_boundary (vertices.size(), false);
@@ -1205,9 +1216,21 @@ void Triangulation<dim>::distort_random (const double factor,
                                   // if you change something here, don't
                                   // forget to do so there as well
   
-                                  // find the smallest length of the lines
-                                  // adjecent to the vertex
-  vector<double>             minimal_length (vertices.size(), 1e308);
+                                  // find the smallest length of the
+                                  // lines adjacent to the
+                                  // vertex. take the initial value
+                                  // to be larger than anything that
+                                  // might be found: the diameter of
+                                  // the triangulation, here estimated
+                                  // by adding up the diameters of
+                                  // the coarse grid cells.
+  double almost_infinite_length = 0;
+  for (cell_iterator cell=begin(0); cell!=end(0); ++cell)
+    almost_infinite_length += cell->diameter();
+  
+  vector<double>             minimal_length (vertices.size(),
+                                            almost_infinite_length);
+
                                   // also note if a vertex is at
                                   // the boundary
   vector<bool>               at_boundary (vertices.size(), false);

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.