]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add two new tests.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 6 Aug 2003 14:12:24 +0000 (14:12 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 6 Aug 2003 14:12:24 +0000 (14:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@7902 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/Makefile
tests/bits/cylinder.cc [new file with mode: 0644]
tests/bits/hyper_ball_3d.cc [new file with mode: 0644]

index 634aba7d9bfb64bf0686e7cd025cf99e6ae3febf..b8dab2f59f35c677014f38b66b398029eceb8387 100644 (file)
@@ -94,6 +94,8 @@ parameter_handler_1.exe : parameter_handler_1.g.$(OBJEXT)  $(libraries)
 parameter_handler_2.exe : parameter_handler_2.g.$(OBJEXT)  $(libraries)
 sparse_lu_decomposition_1.exe: sparse_lu_decomposition_1.g.$(OBJEXT) $(libraries)
 block_sparse_matrix_1.exe:block_sparse_matrix_1.g.$(OBJEXT) $(libraries)
+hyper_ball_3d.exe       : hyper_ball_3d.g.$(OBJEXT)        $(libraries)
+cylinder.exe            : cylinder.g.$(OBJEXT)             $(libraries)
 
 
 tests = anna_1 anna_2 anna_3 anna_4 anna_5 anna_6 \
@@ -117,7 +119,8 @@ tests = anna_1 anna_2 anna_3 anna_4 anna_5 anna_6 \
        roy_1 \
         denis_1 \
        unit_support_points parameter_handler_1 parameter_handler_2 \
-       sparse_lu_decomposition_1 block_sparse_matrix_1
+       sparse_lu_decomposition_1 block_sparse_matrix_1 \
+       hyper_ball_3d cylinder
 
 ############################################################
 
diff --git a/tests/bits/cylinder.cc b/tests/bits/cylinder.cc
new file mode 100644 (file)
index 0000000..2cbf52b
--- /dev/null
@@ -0,0 +1,64 @@
+//----------------------------  cylinder.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003 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.
+//
+//----------------------------  cylinder.cc  ---------------------------
+
+// similar to the hyper_ball_3d test, but for the cylinder grid. here,
+// the cause for the failure was different, though: the description of
+// the cells was wrong, and they were not sent through the
+// GridReordering class which would have cured the problem.
+
+
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/tria_iterator.h>
+#include <grid/tria_accessor.h>
+#include <grid/grid_generator.h>
+#include <fstream>
+
+    
+
+int main () 
+{
+  std::ofstream logfile("cylinder.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  logfile.precision (2);
+
+                                   // generate a cylinder
+  Triangulation<3> tria;
+  GridGenerator::cylinder (tria, std::sqrt(2.));
+
+                                   // output all faces. here, we
+                                   // should have 18 (two layers of
+                                   // cells, each with 4 outer faces,
+                                   // plus 5 faces each for the top
+                                   // and bottom of the cylinder)
+  unsigned int external_faces = 0;
+  for (Triangulation<3>::face_iterator face=tria.begin_face();
+       face!=tria.end_face(); ++face)
+    {
+      deallog << face << "   "
+              << (int)face->boundary_indicator() << "  "
+              << '<' << face->vertex(0) << '>' << std::endl
+              << "           <" << face->vertex(1) << '>' << std::endl
+              << "           <" << face->vertex(2) << '>' << std::endl
+              << "           <" << face->vertex(3) << '>' << std::endl;
+      if (face->at_boundary())
+        ++external_faces;
+    }
+
+  deallog << "External faces: " << external_faces << std::endl;
+
+  Assert (external_faces == 18, ExcInternalError());
+  
+  return 0;
+}
diff --git a/tests/bits/hyper_ball_3d.cc b/tests/bits/hyper_ball_3d.cc
new file mode 100644 (file)
index 0000000..6bd4dc1
--- /dev/null
@@ -0,0 +1,77 @@
+//----------------------------  hyper_ball_3d.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003 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.
+//
+//----------------------------  hyper_ball_3d.cc  ---------------------------
+
+// test that the grid generated by GridGenerator::hyper_ball<3> has
+// the right number of external faces. this was not always the case,
+// due to a bug in the 3d grid reordering code that didn't find a
+// valid reordering, though we know that there is one. when not
+// calling the grid reordering, the triangulation can generate a mesh,
+// but it will have internal faces with the "external" 255 marker,
+// leading to more external faces than one originally wanted
+
+
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/tria_iterator.h>
+#include <grid/tria_accessor.h>
+#include <grid/grid_generator.h>
+#include <fstream>
+
+    
+
+int main () 
+{
+  std::ofstream logfile("hyper_ball_3d.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  logfile.precision (2);
+
+                                   // generate a hyperball in 3d
+  Triangulation<3> tria;
+  GridGenerator::hyper_ball (tria, Point<3>(), std::sqrt(3.));
+
+                                   // output all faces. there should
+                                   // be 6 external ones, but there
+                                   // used to be a bug in the
+                                   // triangulation code that
+                                   // generated more than that, with
+                                   // some of them internal to the
+                                   // ball
+  unsigned int external_faces = 0;
+  for (Triangulation<3>::face_iterator face=tria.begin_face();
+       face!=tria.end_face(); ++face)
+    {
+      deallog << face << "   "
+              << (int)face->boundary_indicator() << "  "
+              << face->vertex_index(0)
+              << " <" << face->vertex(0) << '>'
+              << std::endl
+              << "           " << face->vertex_index(1)
+              << "  <" << face->vertex(1) << '>'
+              << std::endl
+              << "           " << face->vertex_index(2)
+              << "  <" << face->vertex(2) << '>'
+              << std::endl
+              << "           " << face->vertex_index(3)
+              << "  <" << face->vertex(3) << '>'
+              << std::endl;
+      if (face->at_boundary())
+        ++external_faces;
+    }
+
+  deallog << "External faces: " << external_faces << std::endl;
+
+  Assert (external_faces == 6, ExcInternalError());
+  
+  return 0;
+}

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.