]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fixed test one and two
authorLuca Heltai <luca.heltai@sissa.it>
Thu, 3 Mar 2016 14:43:24 +0000 (15:43 +0100)
committerLuca Heltai <luca.heltai@sissa.it>
Wed, 6 Apr 2016 11:00:14 +0000 (13:00 +0200)
source/fe/mapping_manifold.cc
tests/fe/mapping_manifold_01.cc
tests/fe/mapping_manifold_01.output
tests/fe/mapping_manifold_02.cc
tests/fe/mapping_manifold_02.output

index ba3eff3796a5d7cc60c13243f53b78a56b0849ec..2832ffd07bda9a597a1c1ea53236de52d6b0da8a 100644 (file)
@@ -1073,7 +1073,7 @@ fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
 //       QProjector<dim>::DataSetDescriptor::cell (),
 //       data,
 //       output_data.jacobian_pushed_forward_3rd_derivatives);
-  Assert(false, ExcNotImplemented());
+
   return cell_similarity;
 }
 
@@ -2110,10 +2110,8 @@ namespace
 
 
 //--------------------------- Explicit instantiations -----------------------
-#include "mapping_q_generic.inst"
+#include "mapping_manifold.inst"
 
 
 DEAL_II_NAMESPACE_CLOSE
 
-template class dealii::MappingManifold<2,2>;
-
index 068beaa71dd34208154119302fb4c3d61e704115..9dea26d2b2eb605f11889870a9f42cfa944f9184 100644 (file)
@@ -13,7 +13,7 @@
 //
 // ---------------------------------------------------------------------
 
-
+// Check that MappingManifold and MappingQ1 are the same thing on a FlatManifold
 
 #include "../tests.h"
 
@@ -24,8 +24,6 @@
 #include <deal.II/fe/mapping_manifold.h>
 #include <deal.II/grid/manifold_lib.h>
 
-#include <fstream>
-
 template<int dim, int spacedim>
 void test()
 {
@@ -33,52 +31,33 @@ void test()
 
   Triangulation<dim, spacedim>   triangulation;
 
-  const Point<2> center (7,9);
-  const Point<2> origin (0,0);
-  const double inner_radius = 0.5,
-               outer_radius = 1.0;
-  GridGenerator::hyper_shell (triangulation,
-                              center, inner_radius, outer_radius,
-                              10);
-
-
-  static  const SphericalManifold<dim> manifold(center);
+  GridGenerator::hyper_cube (triangulation, 2.0, 3.0);
 
-  triangulation.set_all_manifold_ids_on_boundary(0);
-  triangulation.set_manifold (0, manifold);
-  typename  Triangulation<dim,spacedim>::active_cell_iterator
-  cell = triangulation.begin_active(),
-  endc = triangulation.end();
-  for (; cell!=endc; ++cell)
-    cell->set_all_manifold_ids (0);
-  triangulation.refine_global (0);
 
-  const QIterated<QTrapez<spacedim> > quadrature(7);
-
-  std::vector<Point<spacedim> > q_points = quadrature.get_points();
+  const QGauss<dim> quadrature(5);
 
+  std::vector<Point<dim> > q_points = quadrature.get_points();
 
   MappingManifold<dim,spacedim> map_manifold;
   MappingQGeneric<dim,spacedim> map_q1(1);
 
-
-  cell = triangulation.begin_active();
-
-  std::ofstream two_be_plotted ("points.txt");
+  typename  Triangulation<dim,spacedim>::active_cell_iterator
+  cell = triangulation.begin_active(),
+  endc = triangulation.end();
   for (; cell!=endc; ++cell)
     {
       for (unsigned int i=0; i<q_points.size(); ++i)
         {
-          // const Point<spacedim> p = map.transform_unit_to_real_cell(cell,q_points[i]);
-          // deallog << "mapping manifold ---> " << p.distance() << std::endl;
-
           const Point<spacedim> pq = map_manifold.transform_unit_to_real_cell(cell,q_points[i]);
-          deallog << "mapping q1       ---> " << pq.distance(origin) << std::endl;
-          for (unsigned int d=0; d<spacedim; ++d)
-            two_be_plotted << pq[d] << "  ";
-          two_be_plotted << std::endl;
+          const Point<spacedim> pq1 = map_q1.transform_unit_to_real_cell(cell, q_points[i]);
+          if (pq.distance(pq1) > 1e-10)
+            {
+              deallog << "Expected: " << pq << ", got: "
+                      << pq1 << std::endl;
+            }
         }
     }
+  deallog << "OK" << std::endl;
 }
 
 
@@ -90,13 +69,13 @@ main()
   deallog.threshold_double(1.e-10);
 
 
-  //  test<1,1>();
+  test<1,1>();
   test<2,2>();
-  // test<3,3>();
+  test<3,3>();
 
-  // test<1,2>();
-  // test<1,3>();
-  // test<2,3>();
+  test<1,2>();
+  test<1,3>();
+  test<2,3>();
 
   return 0;
 }
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4367a39484dfb75123fcda0713064667db9ac382 100644 (file)
@@ -0,0 +1,13 @@
+
+DEAL::dim=1, spacedim=1
+DEAL::OK
+DEAL::dim=2, spacedim=2
+DEAL::OK
+DEAL::dim=3, spacedim=3
+DEAL::OK
+DEAL::dim=1, spacedim=2
+DEAL::OK
+DEAL::dim=1, spacedim=3
+DEAL::OK
+DEAL::dim=2, spacedim=3
+DEAL::OK
index 9ef5c321ba36c97d1d6b07286e4483cf947fd8a6..784eba74cf840672fc500a7231ca8240edae0f14 100644 (file)
@@ -30,8 +30,6 @@
 #include <deal.II/fe/fe_q.h>
 #include <deal.II/fe/fe_values.h>
 
-#include <fstream>
-
 template<int dim, int spacedim>
 void test()
 {
@@ -39,58 +37,47 @@ void test()
 
   Triangulation<dim, spacedim>   triangulation;
 
-  const Point<2> center (7,9);
-  const Point<2> origin (0,0);
+  Point<spacedim> center;
+  for (unsigned int i=0; i<spacedim; ++i)
+    center[i] = 5+i;
+
   const double inner_radius = 0.5,
                outer_radius = 1.0;
   GridGenerator::hyper_shell (triangulation,
-                              center, inner_radius, outer_radius,
-                              10);
+                              center, inner_radius, outer_radius);
 
 
   static  const SphericalManifold<dim> manifold(center);
 
-  triangulation.set_all_manifold_ids_on_boundary(0);
+  triangulation.set_all_manifold_ids(0);
   triangulation.set_manifold (0, manifold);
-  typename  Triangulation<dim,spacedim>::active_cell_iterator
-  cell = triangulation.begin_active(),
-  endc = triangulation.end();
-  for (; cell!=endc; ++cell)
-    cell->set_all_manifold_ids (0);
 
-  const QGauss<spacedim> quadrature(1);
-
-  std::vector<Point<spacedim> > q_points_from_quadrature = quadrature.get_points();
+  const QGauss<spacedim> quad(3);
 
   FE_Q<dim,spacedim> fe(1);
 
   DoFHandler<dim,spacedim> dof(triangulation);
   dof.distribute_dofs(fe);
 
+  MappingManifold<dim,spacedim> mapping;
 
-  FEValues<dim,spacedim> fe_values (fe, quadrature,
+  FEValues<dim,spacedim> fe_values (mapping, fe, quad,
                                     update_quadrature_points);
 
-
-  MappingManifold<dim,spacedim> map_manifold;
-
-  cell = triangulation.begin_active();
-
-  std::ofstream two_be_plotted("plot.txt");
-  for (; cell!=endc; ++cell)
+  for (typename Triangulation<dim,spacedim>::active_cell_iterator cell= triangulation.begin_active();
+       cell != triangulation.end(); ++cell)
     {
       fe_values.reinit(cell);
-      std::vector<Point<spacedim> > q_points_from_fe_values = fe_values.get_quadrature_points();
-      for (unsigned int q=0; q<q_points_from_fe_values.size(); ++q)
+      std::vector<Point<spacedim> > fev_qp = fe_values.get_quadrature_points();
+      for (unsigned int q=0; q<fev_qp.size(); ++q)
         {
-          const Point<spacedim> pq = map_manifold.transform_unit_to_real_cell(cell,q_points_from_quadrature[q]);
+          const Point<spacedim> pq = mapping.transform_unit_to_real_cell(cell,quad.point(q));
 
-          if (pq.distance(q_points_from_fe_values[q]) > 1e-10)
+          if (pq.distance(fev_qp[q]) > 1e-10)
             {
               deallog << "Expected: " << pq << ", got: "
-                      << q_points_from_fe_values[q] << std::endl;
+                      << fev_qp[q] << std::endl;
             }
-          two_be_plotted << pq <<  " " << q_points_from_fe_values[q] << std::endl;
         }
     }
   deallog << "OK" << std::endl;
@@ -104,14 +91,8 @@ main()
   deallog.attach(logfile);
   deallog.threshold_double(1.e-10);
 
-
-  //  test<1,1>();
   test<2,2>();
-  //  test<3,3>();
-
-  // test<1,2>();
-  // test<1,3>();
-  // test<2,3>();
+  test<3,3>();
 
   return 0;
 }
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2aae953332df1b4848ec568d3b3cb0da451f2225 100644 (file)
@@ -0,0 +1,5 @@
+
+DEAL::dim=2, spacedim=2
+DEAL::OK
+DEAL::dim=3, spacedim=3
+DEAL::OK

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.