]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
sorry, some small mistakes in the last commit... corrected here!
authorrschulz <rschulz@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 12 May 2006 13:07:37 +0000 (13:07 +0000)
committerrschulz <rschulz@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 12 May 2006 13:07:37 +0000 (13:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@13107 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/grid/grid_tools.cc
tests/bits/find_cell_4.cc
tests/bits/find_cell_4/cmp/generic [new file with mode: 0644]
tests/bits/find_cell_5.cc
tests/bits/find_cell_alt_4.cc
tests/bits/find_cell_alt_4/cmp/generic
tests/bits/find_cell_alt_7.cc
tests/bits/find_cell_alt_7/cmp/generic

index e4e66ba9f3105af8595f46c1b8b630029a01af21..d375a5036ca6402f56150fb80ea6112f584f8599 100644 (file)
@@ -593,8 +593,8 @@ GridTools::find_active_cell_around_point (const Mapping<dim>   &mapping,
                                    // unit cell (or at least not too far
                                    // outside). If it is, it is also checked
                                    // that the cell has a more refined state
-         if(dist <= best_distance
-            && (*cell)->level() > best_level)
+         if(dist < best_distance ||
+            (dist == best_distance && (*cell)->level() > best_level))
             {
                best_distance = dist;
                best_level    = (*cell)->level();
index c07245355b6d15332eec1c74e8876c18e3e13904..7ec0dc326ab27c8de036a40a72f7072da5b057a7 100644 (file)
@@ -37,12 +37,24 @@ void check (Triangulation<3> &tria)
     = GridTools::find_active_cell_around_point (tria, p);
 
   deallog << cell << std::endl;
-  for (unsigned int v=0; v<GeometryInfo<2>::vertices_per_cell; ++v)
+  for (unsigned int v=0; v<GeometryInfo<3>::vertices_per_cell; ++v)
     deallog << "<" << cell->vertex(v) << "> ";
   deallog << std::endl;
 
-  Assert (p.distance (cell->center()) < cell->diameter()/2+1e-10,
-         ExcInternalError());
+  // Transform back and forth
+  Point<3> pp =
+     StaticMappingQ1<3>::mapping.transform_unit_to_real_cell
+     ( cell,
+       GeometryInfo<3>::project_to_unit_cell
+       (
+         StaticMappingQ1<3>::mapping.transform_real_to_unit_cell
+         ( cell,
+           p
+           )
+         )
+       );
+                                                                       
+  Assert (p.distance (pp) < 1e-15,  ExcInternalError());
 }
 
 
diff --git a/tests/bits/find_cell_4/cmp/generic b/tests/bits/find_cell_4/cmp/generic
new file mode 100644 (file)
index 0000000..7bdc5e9
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::3.72
+DEAL::<0.750000 0.00000 0.00000> <0.875000 0.00000 0.00000> <0.750000 0.125000 0.00000> <0.875000 0.125000 0.00000> <0.750000 0.00000 0.125000> <0.875000 0.00000 0.125000> <0.750000 0.125000 0.125000> <0.875000 0.125000 0.125000> 
index 9bc0072b57b16912d22e3f5ee2a72de7f82d45b5..c30ffb873d7cf68bd4da3a0e04a2e6123847114d 100644 (file)
@@ -42,8 +42,21 @@ void check (Triangulation<3> &tria)
     deallog << "<" << cell->vertex(v) << "> ";
   deallog << std::endl;
 
-  Assert (p.distance (cell->center()) < cell->diameter()/2+1e-10,
-         ExcInternalError());
+  // Transform back and forth
+  Point<3> pp =
+     StaticMappingQ1<3>::mapping.transform_unit_to_real_cell
+     ( cell,
+       GeometryInfo<3>::project_to_unit_cell
+       (
+         StaticMappingQ1<3>::mapping.transform_real_to_unit_cell
+         ( cell,
+           p
+           )
+         )
+       );
+                                                                       
+  Assert (p.distance (pp) < 1e-15,  ExcInternalError());
+
 }
 
 
index 3f5ed6451906e093b05549ff3a47c91593eb7dad..67cbcd69281ceb88570c895ca4e94c9f3d3489dd 100644 (file)
@@ -39,13 +39,16 @@ void check (Triangulation<3> &tria)
     = GridTools::find_active_cell_around_point (map, tria, p);
 
   deallog << cell.first << std::endl;
-  for (unsigned int v=0; v<GeometryInfo<2>::vertices_per_cell; ++v)
+  for (unsigned int v=0; v<GeometryInfo<3>::vertices_per_cell; ++v)
     deallog << "<" << cell.first->vertex(v) << "> ";
   deallog << "[ " << cell.second << "] ";
   deallog << std::endl;
 
-  Assert (GeometryInfo<3>::distance_to_unit_cell(cell.second) < 1e-10,
-         ExcInternalError());
+  // Now transform back and check distance
+  Point<3> pp = map.transform_unit_to_real_cell(cell.first, GeometryInfo<3>::project_to_unit_cell(cell.second));
+  deallog << pp.distance(p) << std::endl;
+  Assert (pp.distance(p) < 1e-13,
+          ExcInternalError());
 }
 
 
index 509909a6c9833a743bcdc97592f46823f073da19..51492c821e0dd73631b85eb4d6c49e14fece74eb 100644 (file)
@@ -1,3 +1,4 @@
 
-DEAL::3.65
-DEAL::<0.625000 0.00000 0.00000> <0.750000 0.00000 0.00000> <0.625000 0.125000 0.00000> <0.750000 0.125000 0.00000> [ 1.00000 0.00000 5.55112e-17] 
+DEAL::3.72
+DEAL::<0.750000 0.00000 0.00000> <0.875000 0.00000 0.00000> <0.750000 0.125000 0.00000> <0.875000 0.125000 0.00000> <0.750000 0.00000 0.125000> <0.875000 0.00000 0.125000> <0.750000 0.125000 0.125000> <0.875000 0.125000 0.125000> [ -3.33067e-16 0.00000 5.55112e-17] 
+DEAL::0
index 3ed761dc1e6cbb43b21f9cce5f0ccfaa89e8c1ee..095ce86abc88c7f8dcd5f1e9f4292170241127b5 100644 (file)
@@ -29,8 +29,6 @@
 #include <fstream>
 
 
-
-
 void check (Triangulation<2> &tria)
 {
    MappingQ<2> map(5);
@@ -51,9 +49,8 @@ void check (Triangulation<2> &tria)
 
          // Now transform back and check distance
          Point<2> pp = map.transform_unit_to_real_cell(cell.first, GeometryInfo<2>::project_to_unit_cell(cell.second));
-         deallog << (pp-p).square() << std::endl;
-
-         Assert (GeometryInfo<2>::distance_to_unit_cell(cell.second) < 1e-10,
+         deallog << pp.distance(p) << std::endl;
+         Assert (pp.distance(p) < 1e-13,
                  ExcInternalError());
       }
   
index 49f3613be4f37bc963307a1af61535c54e927dfd..eb5c5e83364eace916713dbeca1d5099f8534624 100644 (file)
@@ -1,6 +1,6 @@
 
-DEAL::2.66
-DEAL::<-0.382683 0.923880> <-0.305418 0.694720> <0.00000 1.00000> <0.00000 0.768306> [ 4.31605e-08 1.00000] 0
+DEAL::2.72
+DEAL::<0.00000 1.00000> <0.00000 0.768306> <0.382683 0.923880> <0.305418 0.694720> [ 4.31603e-08 1.26953e-19] 0
 DEAL::2.72
 DEAL::<0.00000 1.00000> <0.00000 0.768306> <0.382683 0.923880> <0.305418 0.694720> [ 1.84097e-08 0.0800000] 0
 DEAL::2.72
@@ -99,8 +99,8 @@ DEAL::2.52
 DEAL::<1.00000 0.00000> <0.923880 0.382683> <0.768306 0.00000> <0.694720 0.305418> [ 0.160000 3.03924e-08] 0
 DEAL::2.52
 DEAL::<1.00000 0.00000> <0.923880 0.382683> <0.768306 0.00000> <0.694720 0.305418> [ 0.0800000 1.84097e-08] 0
-DEAL::2.49
-DEAL::<0.923880 -0.382683> <1.00000 0.00000> <0.694720 -0.305418> <0.768306 0.00000> [ 1.00000 4.31605e-08] 0
+DEAL::2.52
+DEAL::<1.00000 0.00000> <0.923880 0.382683> <0.768306 0.00000> <0.694720 0.305418> [ 1.60129e-16 4.31603e-08] 0
 DEAL::2.49
 DEAL::<0.923880 -0.382683> <1.00000 0.00000> <0.694720 -0.305418> <0.768306 0.00000> [ 0.920000 1.84097e-08] 0
 DEAL::2.49
@@ -149,8 +149,8 @@ DEAL::2.48
 DEAL::<0.707107 -0.707107> <0.923880 -0.382683> <0.603553 -0.603553> <0.694720 -0.305418> [ 0.160000 4.17686e-08] 0
 DEAL::2.48
 DEAL::<0.707107 -0.707107> <0.923880 -0.382683> <0.603553 -0.603553> <0.694720 -0.305418> [ 0.0800000 2.67832e-08] 0
-DEAL::2.5
-DEAL::<0.382683 -0.923880> <0.707107 -0.707107> <0.305418 -0.694720> <0.603553 -0.603553> [ 1.00000 6.82846e-08] 0
+DEAL::2.48
+DEAL::<0.707107 -0.707107> <0.923880 -0.382683> <0.603553 -0.603553> <0.694720 -0.305418> [ 2.71333e-16 6.82843e-08] 0
 DEAL::2.5
 DEAL::<0.382683 -0.923880> <0.707107 -0.707107> <0.305418 -0.694720> <0.603553 -0.603553> [ 0.920000 2.67832e-08] 0
 DEAL::2.5
@@ -199,8 +199,8 @@ DEAL::2.4
 DEAL::<0.00000 -1.00000> <0.382683 -0.923880> <0.00000 -0.768306> <0.305418 -0.694720> [ 0.160000 3.03924e-08] 0
 DEAL::2.4
 DEAL::<0.00000 -1.00000> <0.382683 -0.923880> <0.00000 -0.768306> <0.305418 -0.694720> [ 0.0800000 1.84097e-08] 0
-DEAL::2.1
-DEAL::<-0.382683 -0.923880> <0.00000 -1.00000> <-0.305418 -0.694720> <0.00000 -0.768306> [ 1.00000 4.31605e-08] 0
+DEAL::2.4
+DEAL::<0.00000 -1.00000> <0.382683 -0.923880> <0.00000 -0.768306> <0.305418 -0.694720> [ 3.20132e-16 4.31603e-08] 0
 DEAL::2.1
 DEAL::<-0.382683 -0.923880> <0.00000 -1.00000> <-0.305418 -0.694720> <0.00000 -0.768306> [ 0.920000 1.84098e-08] 0
 DEAL::2.1
@@ -299,8 +299,8 @@ DEAL::2.18
 DEAL::<-0.923880 -0.382683> <-0.694720 -0.305418> <-1.00000 0.00000> <-0.768306 0.00000> [ 3.03924e-08 0.840000] 0
 DEAL::2.18
 DEAL::<-0.923880 -0.382683> <-0.694720 -0.305418> <-1.00000 0.00000> <-0.768306 0.00000> [ 1.84097e-08 0.920000] 0
-DEAL::2.18
-DEAL::<-0.923880 -0.382683> <-0.694720 -0.305418> <-1.00000 0.00000> <-0.768306 0.00000> [ 4.31605e-08 1.00000] 0
+DEAL::2.24
+DEAL::<-1.00000 0.00000> <-0.768306 0.00000> <-0.923880 0.382683> <-0.694720 0.305418> [ 4.31603e-08 -4.79881e-16] 0
 DEAL::2.24
 DEAL::<-1.00000 0.00000> <-0.768306 0.00000> <-0.923880 0.382683> <-0.694720 0.305418> [ 1.84097e-08 0.0800000] 0
 DEAL::2.24
@@ -349,8 +349,8 @@ DEAL::2.26
 DEAL::<-0.923880 0.382683> <-0.694720 0.305418> <-0.707107 0.707107> <-0.603553 0.603553> [ 4.17687e-08 0.840000] 0
 DEAL::2.26
 DEAL::<-0.923880 0.382683> <-0.694720 0.305418> <-0.707107 0.707107> <-0.603553 0.603553> [ 2.67835e-08 0.920000] 0
-DEAL::2.26
-DEAL::<-0.923880 0.382683> <-0.694720 0.305418> <-0.707107 0.707107> <-0.603553 0.603553> [ 6.82845e-08 1.00000] 0
+DEAL::2.64
+DEAL::<-0.707107 0.707107> <-0.603553 0.603553> <-0.382683 0.923880> <-0.305418 0.694720> [ 6.82843e-08 -5.24473e-16] 0
 DEAL::2.64
 DEAL::<-0.707107 0.707107> <-0.603553 0.603553> <-0.382683 0.923880> <-0.305418 0.694720> [ 2.67832e-08 0.0800000] 0
 DEAL::2.64

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.