]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New test.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Dec 2010 23:45:10 +0000 (23:45 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Dec 2010 23:45:10 +0000 (23:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@22988 0785d39b-7218-0410-832d-ea1e28bc413d

tests/codim_one/mapping_01.cc [new file with mode: 0644]
tests/codim_one/mapping_01/cmp/generic [new file with mode: 0644]

diff --git a/tests/codim_one/mapping_01.cc b/tests/codim_one/mapping_01.cc
new file mode 100644 (file)
index 0000000..1468a54
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  mapping_01.cc  ---------------------------
+//    $Id: bem.cc 22693 2010-11-11 20:11:47Z kanschat $
+//    Version: $Name$
+//
+//    Copyright (C) 2010 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.
+//
+//----------------------------  mapping_01.cc  ---------------------------
+
+
+// test mapping surfaces in higher dimensions. when we use the MappingQ1
+// class, each 1d cell in 2d space is mapped to a straight line and so all
+// cell normals should be parallel. likewise, if the four vertices of a 2d
+// cell in 3d space are in a plane, then the cell normal vectors at all
+// quadrature points of the same cell should be parallel, even though the true
+// surface is curved
+
+#include "../tests.h"
+
+#include <base/quadrature_lib.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_boundary_lib.h>
+#include <grid/grid_out.h>
+#include <grid/grid_tools.h>
+#include <fe/fe_values.h>
+#include <fe/fe_q.h>
+#include <fe/mapping_q1.h>
+
+
+template <int dim>
+void test ()
+{
+  deallog << "Testing hyper_ball in dim: " << dim << "..."<< std::endl;
+
+  Triangulation<dim> volume_mesh;
+  GridGenerator::hyper_ball(volume_mesh);
+
+  const HyperBallBoundary<dim-1,dim> surface_description;
+  Triangulation<dim-1,dim> boundary_mesh;
+  boundary_mesh.set_boundary (0, surface_description);
+
+  GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh);
+
+  QGauss<dim-1> quadrature(2);
+  MappingQ1<dim-1,dim> mapping;
+  FE_Q<dim-1,dim> fe (1);
+  
+  FEValues<dim-1,dim> fe_values (mapping, fe, quadrature, update_cell_normal_vectors);
+  
+  for (typename Triangulation<dim-1,dim>::active_cell_iterator
+        cell = boundary_mesh.begin_active(); cell != boundary_mesh.end();
+       ++cell)
+    {
+      deallog << "Cell = " << cell
+             << ", with center at " << cell->center()
+             << std::endl;
+      fe_values.reinit (cell);
+
+      for (unsigned int q=0; q<quadrature.size(); ++q)
+       deallog << "  cell_normal[" << q << "] = "
+               << fe_values.cell_normal_vector(q)
+               << std::endl;
+    }
+}
+
+  
+
+int main ()
+{
+  std::ofstream logfile("mapping_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  test<2> ();
+  test<3> ();
+
+  return 0;
+}
diff --git a/tests/codim_one/mapping_01/cmp/generic b/tests/codim_one/mapping_01/cmp/generic
new file mode 100644 (file)
index 0000000..50e0115
--- /dev/null
@@ -0,0 +1,45 @@
+
+DEAL::Testing hyper_ball in dim: 2...
+DEAL::Cell = 0.0, with center at 0.00000 -0.707107
+DEAL::  cell_normal[0] = 0.00000 1.00000
+DEAL::  cell_normal[1] = 0.00000 1.00000
+DEAL::Cell = 0.1, with center at -0.707107 0.00000
+DEAL::  cell_normal[0] = 1.00000 0.00000
+DEAL::  cell_normal[1] = 1.00000 0.00000
+DEAL::Cell = 0.2, with center at 0.707107 0.00000
+DEAL::  cell_normal[0] = -1.00000 0.00000
+DEAL::  cell_normal[1] = -1.00000 0.00000
+DEAL::Cell = 0.3, with center at 0.00000 0.707107
+DEAL::  cell_normal[0] = 0.00000 -1.00000
+DEAL::  cell_normal[1] = 0.00000 -1.00000
+DEAL::Testing hyper_ball in dim: 3...
+DEAL::Cell = 0.0, with center at 0.00000 0.00000 -0.577350
+DEAL::  cell_normal[0] = 0.00000 0.00000 1.00000
+DEAL::  cell_normal[1] = 0.00000 0.00000 1.00000
+DEAL::  cell_normal[2] = 0.00000 0.00000 1.00000
+DEAL::  cell_normal[3] = 0.00000 0.00000 1.00000
+DEAL::Cell = 0.1, with center at 0.577350 0.00000 0.00000
+DEAL::  cell_normal[0] = -1.00000 0.00000 0.00000
+DEAL::  cell_normal[1] = -1.00000 0.00000 0.00000
+DEAL::  cell_normal[2] = -1.00000 0.00000 0.00000
+DEAL::  cell_normal[3] = -1.00000 0.00000 0.00000
+DEAL::Cell = 0.2, with center at 0.00000 0.00000 0.577350
+DEAL::  cell_normal[0] = 0.00000 0.00000 -1.00000
+DEAL::  cell_normal[1] = 0.00000 0.00000 -1.00000
+DEAL::  cell_normal[2] = 0.00000 0.00000 -1.00000
+DEAL::  cell_normal[3] = 0.00000 0.00000 -1.00000
+DEAL::Cell = 0.3, with center at -0.577350 0.00000 0.00000
+DEAL::  cell_normal[0] = 1.00000 0.00000 0.00000
+DEAL::  cell_normal[1] = 1.00000 0.00000 0.00000
+DEAL::  cell_normal[2] = 1.00000 0.00000 0.00000
+DEAL::  cell_normal[3] = 1.00000 0.00000 0.00000
+DEAL::Cell = 0.4, with center at 0.00000 -0.577350 0.00000
+DEAL::  cell_normal[0] = 0.00000 1.00000 0.00000
+DEAL::  cell_normal[1] = 0.00000 1.00000 0.00000
+DEAL::  cell_normal[2] = 0.00000 1.00000 0.00000
+DEAL::  cell_normal[3] = 0.00000 1.00000 0.00000
+DEAL::Cell = 0.5, with center at 0.00000 0.577350 0.00000
+DEAL::  cell_normal[0] = 0.00000 -1.00000 0.00000
+DEAL::  cell_normal[1] = 0.00000 -1.00000 0.00000
+DEAL::  cell_normal[2] = 0.00000 -1.00000 0.00000
+DEAL::  cell_normal[3] = 0.00000 -1.00000 0.00000

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.