]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
new test for the GridReordering::invert_all_cells_of_negative_grid() function
authorleicht <leicht@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 14 Dec 2006 10:18:27 +0000 (10:18 +0000)
committerleicht <leicht@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 14 Dec 2006 10:18:27 +0000 (10:18 +0000)
git-svn-id: https://svn.dealii.org/trunk@14237 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/Makefile
tests/deal.II/grid_invert.cc [new file with mode: 0644]
tests/deal.II/grid_invert/cmp/generic [new file with mode: 0644]

index 46a7bbb6c118c7542484d8e446a2985fd5779190..dd4e51b92f4cfa3e073a2ce8b989b42944300d6b 100644 (file)
@@ -29,6 +29,7 @@ tests_x = block_matrices \
        dof_test \
        dof_renumbering \
        error_estimator \
+       grid_invert \
        grid_out \
        grid_test \
        grid_transform \
diff --git a/tests/deal.II/grid_invert.cc b/tests/deal.II/grid_invert.cc
new file mode 100644 (file)
index 0000000..daeaf44
--- /dev/null
@@ -0,0 +1,76 @@
+//----------------------------  grid_invert.cc  ---------------------------
+//    $Id: grid_in.cc 11749 2005-11-09 19:11:20Z wolf $
+//    Version: $Name$ 
+//
+//    Copyright (C) 2002, 2003, 2004, 2005 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.
+//
+//----------------------------  grid_invert.cc  ---------------------------
+
+
+#include "../tests.h"
+#include <dofs/dof_handler.h>
+#include <grid/grid_out.h>
+#include <grid/grid_reordering.h>
+#include <base/logstream.h>
+
+#include <fstream>
+#include <string>
+
+std::ofstream logfile("grid_invert/output");
+
+template <int dim>
+void test (bool second_case=false)
+{
+  std::vector<Point<dim> > vertices(GeometryInfo<dim>::vertices_per_cell);
+  vertices[1](1)=1;
+  vertices[2](0)=1;
+  vertices[2](1)=1;
+  vertices[3](0)=1;
+  if (dim==3)
+    {
+      for (unsigned int i=4; i<GeometryInfo<dim>::vertices_per_cell; ++i)
+       vertices[i](2)=-1;
+      vertices[5](1)=1;
+      vertices[6](0)=1;
+      vertices[6](1)=1;
+      vertices[7](0)=1;
+    }
+  std::vector<CellData<dim> > cells(1);
+  for (unsigned int i=0;i<GeometryInfo<dim>::vertices_per_cell; ++i)
+    cells[0].vertices[i]=i;
+
+  if (dim==3 && second_case)
+    {
+      std::swap(cells[0].vertices[1],cells[0].vertices[3]);
+      std::swap(cells[0].vertices[5],cells[0].vertices[7]);
+      for (unsigned int i=4; i<GeometryInfo<dim>::vertices_per_cell; ++i)
+       vertices[i](2)=1;
+    }
+
+  SubCellData subcelldata;
+  GridReordering<dim>::invert_all_cells_of_negative_grid(vertices,cells);
+
+  Triangulation<dim> tria;
+  tria.create_triangulation_compatibility(vertices,cells,subcelldata);
+
+  logfile<<"---------------------------------------------"
+        <<std::endl<<"dim="<<dim
+        <<(second_case ? ", second case" : ", first case")
+        <<std::endl<<std::endl;
+
+  GridOut grid_out;
+  grid_out.write_ucd (tria, logfile);
+}
+
+int main ()
+{
+  test<2> ();
+  test<3> (false);
+  test<3> (true);
+}
+
diff --git a/tests/deal.II/grid_invert/cmp/generic b/tests/deal.II/grid_invert/cmp/generic
new file mode 100644 (file)
index 0000000..47f4a40
--- /dev/null
@@ -0,0 +1,53 @@
+---------------------------------------------
+dim=2, first case
+
+# 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 0 0
+2  0 1 0
+3  1 1 0
+4  1 0 0
+1 0 quad    1 4 3 2 
+---------------------------------------------
+dim=3, first case
+
+# 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 0 0
+2  0 1 0
+3  1 1 0
+4  1 0 0
+5  0 0 -1
+6  0 1 -1
+7  1 1 -1
+8  1 0 -1
+1 0 hex     5 6 7 8 1 2 3 4 
+---------------------------------------------
+dim=3, second case
+
+# 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 0 0
+2  0 1 0
+3  1 1 0
+4  1 0 0
+5  0 0 1
+6  0 1 1
+7  1 1 1
+8  1 0 1
+1 0 hex     5 8 7 6 1 4 3 2 

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.