]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Checked FEFaceValues quadrature points.
authorLuca Heltai <luca.heltai@sissa.it>
Mon, 28 Mar 2016 09:23:54 +0000 (11:23 +0200)
committerLuca Heltai <luca.heltai@sissa.it>
Wed, 6 Apr 2016 11:00:14 +0000 (13:00 +0200)
tests/fe/mapping_manifold_07.cc
tests/fe/mapping_manifold_07.output

index ecaef6b656235e7af8fce5312ac3fa25d54cab80..c8bd6af93d10aa28b6bc669b48a2400901b093dd 100644 (file)
@@ -13,8 +13,9 @@
 //
 // ---------------------------------------------------------------------
 
-// Check MappingManifold on faces. Create a sphere around a one cell
-// Triangulation, and make sure all points are on the circle.
+// Check MappingManifold on faces. Create a sphere and make sure all
+// points returned by FEValues.get_quadrature_points are actually on
+// the circle.
 
 #include "../tests.h"
 
 template<int dim, int spacedim>
 void test()
 {
-  deallog << "dim=" << dim << ", spacedim=" << spacedim << std::endl;
+  std::ostream &out = deallog.get_file_stream();
 
-  Triangulation<dim, spacedim>   triangulation;
+  out << "# dim=" << dim << ", spacedim=" << spacedim << std::endl;
 
-  GridGenerator::hyper_cube (triangulation, 2.0, 3.0);
+  Triangulation<dim, spacedim>   triangulation;
 
-  typename Triangulation<dim,spacedim>::active_cell_iterator
-  cell = triangulation.begin_active();
+  Point<spacedim> center;
+  center[0] = 1.5;
+  center[1] = 2.5;
 
-  // Center and radius of the Ball
-  Point<spacedim> center = cell->center();
-  double radius = center.distance(cell->vertex(0));
+  double radius = 1.0;
 
-  static  const SphericalManifold<dim,spacedim> manifold(cell->center());
+  static const SphericalManifold<dim,spacedim> manifold(center);
+  GridGenerator::hyper_ball (triangulation, center, radius);
 
   triangulation.set_all_manifold_ids_on_boundary(0);
   triangulation.set_manifold (0, manifold);
@@ -54,33 +55,35 @@ void test()
   FEFaceValues<dim,spacedim> fe_v(map_manifold, fe, quad,
                                   update_quadrature_points);
 
-
-
-  for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
-    {
-      fe_v.reinit(cell, f);
-      const std::vector<Point<spacedim> > &qps = fe_v.get_quadrature_points();
-      for (unsigned int i=0; i<qps.size(); ++i)
-        if ( std::abs(qps[i].distance(center) - radius) > 1e-10)
-          {
-            deallog << "Expected radius: " << radius << ", got: "
-                    <<  qps[i].distance(center)
-                    << ", on point " << qps[i] << std::endl;
-          }
-    }
-  deallog << "OK" << std::endl;
+  out << "set size ratio -1" << std::endl
+      << "set terminal aqua " << dim+spacedim << std::endl
+      << (spacedim == 3 ? "s" : "") << "plot '-' w l " << std::endl;
+
+  for (typename Triangulation<dim,spacedim>::active_cell_iterator cell =
+         triangulation.begin_active(); cell != triangulation.end(); ++cell)
+    for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+      if (cell->face(f)->at_boundary())
+        {
+          fe_v.reinit(cell, f);
+          const std::vector<Point<spacedim> > &qps = fe_v.get_quadrature_points();
+          for (unsigned int i=0; i<qps.size(); ++i)
+            {
+              out << qps[i] << std::endl;
+              if (std::abs(qps[i].distance(center) -radius) > 1e-10)
+                out << "# Error! This should be on the sphere, but it's not!" << std::endl;
+            }
+          out << std::endl;
+        }
+  out << "e" << std::endl << std::endl;
 }
 
 
 int
 main()
 {
-  std::ofstream logfile ("output");
-  deallog.attach(logfile);
-  deallog.threshold_double(1.e-10);
+  initlog();
 
   test<2,2>();
-  test<2,3>();
 
   test<3,3>();
 
index 72b2a69be5bcb3a6dbf7223272d85b6b5220ea13..97d058a327b9f7068b5c60a0c589764fd924a4c6 100644 (file)
@@ -1,7 +1,193 @@
 
-DEAL::dim=2, spacedim=2
-DEAL::OK
-DEAL::dim=2, spacedim=3
-DEAL::OK
-DEAL::dim=3, spacedim=3
-DEAL::OK
+# dim=2, spacedim=2
+set size ratio -1
+set terminal aqua 4
+plot '-' w l 
+0.846869 1.74276
+1.08958 1.58810
+1.50000 1.50000
+1.91042 1.58810
+2.15313 1.74276
+
+0.742755 1.84687
+0.588103 2.08958
+0.500000 2.50000
+0.588103 2.91042
+0.742755 3.15313
+
+2.25724 1.84687
+2.41190 2.08958
+2.50000 2.50000
+2.41190 2.91042
+2.25724 3.15313
+
+0.846869 3.25724
+1.08958 3.41190
+1.50000 3.50000
+1.91042 3.41190
+2.15313 3.25724
+
+e
+
+# dim=3, spacedim=3
+set size ratio -1
+set terminal aqua 6
+splot '-' w l 
+0.942530 1.94253 -0.615187
+1.12940 1.87632 -0.688247
+1.50000 1.82851 -0.741013
+1.87060 1.87632 -0.688247
+2.05747 1.94253 -0.615187
+0.876324 2.12940 -0.688247
+1.07160 2.07160 -0.795583
+1.50000 2.02589 -0.880468
+1.92840 2.07160 -0.795583
+2.12368 2.12940 -0.688247
+0.828509 2.50000 -0.741013
+1.02589 2.50000 -0.880468
+1.50000 2.50000 -1.00000
+1.97411 2.50000 -0.880468
+2.17149 2.50000 -0.741013
+0.876324 2.87060 -0.688247
+1.07160 2.92840 -0.795583
+1.50000 2.97411 -0.880468
+1.92840 2.92840 -0.795583
+2.12368 2.87060 -0.688247
+0.942530 3.05747 -0.615187
+1.12940 3.12368 -0.688247
+1.50000 3.17149 -0.741013
+1.87060 3.12368 -0.688247
+2.05747 3.05747 -0.615187
+
+2.11519 1.94253 -0.557470
+2.18825 1.87632 -0.370600
+2.24101 1.82851 -8.90587e-18
+2.18825 1.87632 0.370600
+2.11519 1.94253 0.557470
+2.18825 2.12940 -0.623676
+2.29558 2.07160 -0.428397
+2.38047 2.02589 -2.11638e-17
+2.29558 2.07160 0.428397
+2.18825 2.12940 0.623676
+2.24101 2.50000 -0.671491
+2.38047 2.50000 -0.474105
+2.50000 2.50000 0.00000
+2.38047 2.50000 0.474105
+2.24101 2.50000 0.671491
+2.18825 2.87060 -0.623676
+2.29558 2.92840 -0.428397
+2.38047 2.97411 0.00000
+2.29558 2.92840 0.428397
+2.18825 2.87060 0.623676
+2.11519 3.05747 -0.557470
+2.18825 3.12368 -0.370600
+2.24101 3.17149 0.00000
+2.18825 3.12368 0.370600
+2.11519 3.05747 0.557470
+
+0.942530 1.94253 0.615187
+0.876324 2.12940 0.688247
+0.828509 2.50000 0.741013
+0.876324 2.87060 0.688247
+0.942530 3.05747 0.615187
+1.12940 1.87632 0.688247
+1.07160 2.07160 0.795583
+1.02589 2.50000 0.880468
+1.07160 2.92840 0.795583
+1.12940 3.12368 0.688247
+1.50000 1.82851 0.741013
+1.50000 2.02589 0.880468
+1.50000 2.50000 1.00000
+1.50000 2.97411 0.880468
+1.50000 3.17149 0.741013
+1.87060 1.87632 0.688247
+1.92840 2.07160 0.795583
+1.97411 2.50000 0.880468
+1.92840 2.92840 0.795583
+1.87060 3.12368 0.688247
+2.05747 1.94253 0.615187
+2.12368 2.12940 0.688247
+2.17149 2.50000 0.741013
+2.12368 2.87060 0.688247
+2.05747 3.05747 0.615187
+
+0.884813 1.94253 -0.557470
+0.811753 2.12940 -0.623676
+0.758987 2.50000 -0.671491
+0.811753 2.87060 -0.623676
+0.884813 3.05747 -0.557470
+0.811753 1.87632 -0.370600
+0.704417 2.07160 -0.428397
+0.619532 2.50000 -0.474105
+0.704417 2.92840 -0.428397
+0.811753 3.12368 -0.370600
+0.758987 1.82851 -8.90587e-18
+0.619532 2.02589 -2.11638e-17
+0.500000 2.50000 0.00000
+0.619532 2.97411 0.00000
+0.758987 3.17149 0.00000
+0.811753 1.87632 0.370600
+0.704417 2.07160 0.428397
+0.619532 2.50000 0.474105
+0.704417 2.92840 0.428397
+0.811753 3.12368 0.370600
+0.884813 1.94253 0.557470
+0.811753 2.12940 0.623676
+0.758987 2.50000 0.671491
+0.811753 2.87060 0.623676
+0.884813 3.05747 0.557470
+
+0.942530 1.88481 -0.557470
+0.876324 1.81175 -0.370600
+0.828509 1.75899 -8.90587e-18
+0.876324 1.81175 0.370600
+0.942530 1.88481 0.557470
+1.12940 1.81175 -0.623676
+1.07160 1.70442 -0.428397
+1.02589 1.61953 -2.11638e-17
+1.07160 1.70442 0.428397
+1.12940 1.81175 0.623676
+1.50000 1.75899 -0.671491
+1.50000 1.61953 -0.474105
+1.50000 1.50000 0.00000
+1.50000 1.61953 0.474105
+1.50000 1.75899 0.671491
+1.87060 1.81175 -0.623676
+1.92840 1.70442 -0.428397
+1.97411 1.61953 0.00000
+1.92840 1.70442 0.428397
+1.87060 1.81175 0.623676
+2.05747 1.88481 -0.557470
+2.12368 1.81175 -0.370600
+2.17149 1.75899 0.00000
+2.12368 1.81175 0.370600
+2.05747 1.88481 0.557470
+
+0.942530 3.11519 -0.557470
+1.12940 3.18825 -0.623676
+1.50000 3.24101 -0.671491
+1.87060 3.18825 -0.623676
+2.05747 3.11519 -0.557470
+0.876324 3.18825 -0.370600
+1.07160 3.29558 -0.428397
+1.50000 3.38047 -0.474105
+1.92840 3.29558 -0.428397
+2.12368 3.18825 -0.370600
+0.828509 3.24101 -8.90587e-18
+1.02589 3.38047 -2.11638e-17
+1.50000 3.50000 0.00000
+1.97411 3.38047 0.00000
+2.17149 3.24101 0.00000
+0.876324 3.18825 0.370600
+1.07160 3.29558 0.428397
+1.50000 3.38047 0.474105
+1.92840 3.29558 0.428397
+2.12368 3.18825 0.370600
+0.942530 3.11519 0.557470
+1.12940 3.18825 0.623676
+1.50000 3.24101 0.671491
+1.87060 3.18825 0.623676
+2.05747 3.11519 0.557470
+
+e
+

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.