]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Added failing tests for mapping q eulerian and mapping q1 eulerian.
authorheltai <heltai@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 17 May 2011 16:42:40 +0000 (16:42 +0000)
committerheltai <heltai@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 17 May 2011 16:42:40 +0000 (16:42 +0000)
git-svn-id: https://svn.dealii.org/trunk@23713 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/mapping_q_eulerian_04.cc [new file with mode: 0644]
tests/bits/mapping_q_eulerian_04/cmp/generic [new file with mode: 0644]
tests/bits/mapping_q_eulerian_05.cc [new file with mode: 0644]
tests/bits/mapping_q_eulerian_05/cmp/generic [new file with mode: 0644]

diff --git a/tests/bits/mapping_q_eulerian_04.cc b/tests/bits/mapping_q_eulerian_04.cc
new file mode 100644 (file)
index 0000000..7bc6a2e
--- /dev/null
@@ -0,0 +1,93 @@
+
+//----------------------------  template.cc  ---------------------------
+//    $Id: mapping_q1_eulerian.cc 23710 2011-05-17 04:50:10Z bangerth $
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005, 2009, 2010, 2011 by the deal.II authors 
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  template.cc  ---------------------------
+
+
+// computes points in real space starting from some quadrature points on the unit element
+
+#include "../tests.h"
+#include <fstream>
+#include <deal.II/base/logstream.h>
+
+// all include files you need here
+
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_in.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/fe/mapping.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/mapping_q1_eulerian.h>
+#include <deal.II/base/quadrature_lib.h>
+
+#include <fstream>
+#include <string>
+
+std::ofstream logfile("mapping_q_eulerian_04/output");
+
+template <int dim, int spacedim>
+void test() {
+  Triangulation<dim, spacedim> tria;
+  GridGenerator::hyper_cube(tria);
+  FE_Q<dim, spacedim> base_fe(1);
+  FESystem<dim, spacedim> fe(base_fe, spacedim);
+
+  DoFHandler<dim, spacedim> shift_dh(tria);
+
+  shift_dh.distribute_dofs(fe);
+  
+  Vector<double> shift(shift_dh.n_dofs());
+
+  shift.add(+1);
+
+  GridOut grid_out;
+  grid_out.set_flags (GridOutFlags::Ucd(true));
+  grid_out.write_ucd (tria, logfile);
+
+  QTrapez<dim> quad;
+  MappingQ1Eulerian<dim,Vector<double>,spacedim> mapping(shift, shift_dh);
+  
+  typename Triangulation<dim,spacedim>::active_cell_iterator cell=tria.begin_active(), 
+    endc=tria.end() ;
+  Point<spacedim> real;
+  Point<dim> unit;
+  double eps = 1e-10;
+  for(;cell!=endc;++cell)
+    {
+      deallog<<cell<< std::endl;       
+      for(unsigned int q=0; q<quad.size(); ++q)
+       {
+         real = mapping.transform_unit_to_real_cell(cell, quad.point(q));
+         unit = mapping.transform_real_to_unit_cell(cell, real);
+         deallog<<quad.point(q)<< " -> " << real << std::endl;
+         if( (unit-quad.point(q)).norm()>eps)
+           deallog<<quad.point(q)<< " != " << unit << std::endl;
+       }
+    }     
+    
+}
+
+int main () 
+{
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  
+  test<1,1>();
+  test<2,2>();
+  test<3,3>();
+
+  return 0;
+}
+                  
diff --git a/tests/bits/mapping_q_eulerian_04/cmp/generic b/tests/bits/mapping_q_eulerian_04/cmp/generic
new file mode 100644 (file)
index 0000000..a8278df
--- /dev/null
@@ -0,0 +1,56 @@
+
+# This file was generated by the deal.II library.
+
+
+#
+# For a description of the UCD format see the AVS Developer's guide.
+#
+2 1 0 0 0
+1  0.00000 0 0
+2  1.00000 0 0
+1 0 line    1 2 
+DEAL::0.0
+DEAL::0.00000 -> 1.00000
+DEAL::1.00000 -> 2.00000
+# This file was generated by the deal.II library.
+
+
+#
+# For a description of the UCD format see the AVS Developer's guide.
+#
+4 1 0 0 0
+1  0.00000 0.00000 0
+2  1.00000 0.00000 0
+3  0.00000 1.00000 0
+4  1.00000 1.00000 0
+1 0 quad    1 2 4 3 
+DEAL::0.0
+DEAL::0.00000 0.00000 -> 1.00000 1.00000
+DEAL::1.00000 0.00000 -> 2.00000 1.00000
+DEAL::0.00000 1.00000 -> 1.00000 2.00000
+DEAL::1.00000 1.00000 -> 2.00000 2.00000
+# This file was generated by the deal.II library.
+
+
+#
+# For a description of the UCD format see the AVS Developer's guide.
+#
+8 1 0 0 0
+1  0.00000 0.00000 0.00000
+2  1.00000 0.00000 0.00000
+3  0.00000 1.00000 0.00000
+4  1.00000 1.00000 0.00000
+5  0.00000 0.00000 1.00000
+6  1.00000 0.00000 1.00000
+7  0.00000 1.00000 1.00000
+8  1.00000 1.00000 1.00000
+1 0 hex     1 2 6 5 3 4 8 7 
+DEAL::0.0
+DEAL::0.00000 0.00000 0.00000 -> 1.00000 1.00000 1.00000
+DEAL::1.00000 0.00000 0.00000 -> 2.00000 1.00000 1.00000
+DEAL::0.00000 1.00000 0.00000 -> 1.00000 2.00000 1.00000
+DEAL::1.00000 1.00000 0.00000 -> 2.00000 2.00000 1.00000
+DEAL::0.00000 0.00000 1.00000 -> 1.00000 1.00000 2.00000
+DEAL::1.00000 0.00000 1.00000 -> 2.00000 1.00000 2.00000
+DEAL::0.00000 1.00000 1.00000 -> 1.00000 2.00000 2.00000
+DEAL::1.00000 1.00000 1.00000 -> 2.00000 2.00000 2.00000
diff --git a/tests/bits/mapping_q_eulerian_05.cc b/tests/bits/mapping_q_eulerian_05.cc
new file mode 100644 (file)
index 0000000..34e65a0
--- /dev/null
@@ -0,0 +1,96 @@
+
+//----------------------------  template.cc  ---------------------------
+//    $Id: mapping_q1_eulerian.cc 23710 2011-05-17 04:50:10Z bangerth $
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005, 2009, 2010, 2011 by the deal.II authors 
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  template.cc  ---------------------------
+
+
+// computes points in real space starting from some quadrature points on the unit element
+
+#include "../tests.h"
+#include <fstream>
+#include <deal.II/base/logstream.h>
+
+// all include files you need here
+
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_in.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/fe/mapping.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/mapping_q_eulerian.h>
+#include <deal.II/base/quadrature_lib.h>
+
+#include <fstream>
+#include <string>
+
+std::ofstream logfile("mapping_q_eulerian_05/output");
+
+template <int dim, int spacedim>
+void test(unsigned int degree) {
+  Triangulation<dim, spacedim> tria;
+  GridGenerator::hyper_cube(tria);
+  FE_Q<dim, spacedim> base_fe(degree);
+  FESystem<dim, spacedim> fe(base_fe, spacedim);
+
+  DoFHandler<dim, spacedim> shift_dh(tria);
+
+  shift_dh.distribute_dofs(fe);
+  
+  Vector<double> shift(shift_dh.n_dofs());
+
+  shift.add(+1);
+
+  GridOut grid_out;
+  grid_out.set_flags (GridOutFlags::Ucd(true));
+  grid_out.write_ucd (tria, logfile);
+
+  QTrapez<dim> quad;
+  MappingQEulerian<dim,Vector<double>,spacedim> mapping(degree,shift, shift_dh);
+  
+  typename Triangulation<dim,spacedim>::active_cell_iterator cell=tria.begin_active(), 
+    endc=tria.end() ;
+  Point<spacedim> real;
+  Point<dim> unit;
+  double eps = 1e-10;
+  for(;cell!=endc;++cell)
+    {
+      deallog<<cell<< std::endl;       
+      for(unsigned int q=0; q<quad.size(); ++q)
+       {
+         real = mapping.transform_unit_to_real_cell(cell, quad.point(q));
+         unit = mapping.transform_real_to_unit_cell(cell, real);
+         deallog<<quad.point(q)<< " -> " << real << std::endl;
+         if( (unit-quad.point(q)).norm()>eps)
+           deallog<<quad.point(q)<< " != " << unit << std::endl;
+       }
+    }     
+    
+}
+
+int main () 
+{
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  
+  test<1,1>(1);
+  test<2,2>(1);
+  test<3,3>(1);
+
+  test<1,1>(2);
+  test<2,2>(2);
+  test<3,3>(2);
+  return 0;
+}
+                  
diff --git a/tests/bits/mapping_q_eulerian_05/cmp/generic b/tests/bits/mapping_q_eulerian_05/cmp/generic
new file mode 100644 (file)
index 0000000..e69de29

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.