]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added tetst for persistent triangulation
authorLuca Heltai <luca.heltai@sissa.it>
Mon, 16 May 2011 10:50:02 +0000 (10:50 +0000)
committerLuca Heltai <luca.heltai@sissa.it>
Mon, 16 May 2011 10:50:02 +0000 (10:50 +0000)
git-svn-id: https://svn.dealii.org/trunk@23697 0785d39b-7218-0410-832d-ea1e28bc413d

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

diff --git a/tests/codim_one/grid_in_out_03.cc b/tests/codim_one/grid_in_out_03.cc
new file mode 100644 (file)
index 0000000..373ea64
--- /dev/null
@@ -0,0 +1,66 @@
+
+//----------------------------  template.cc  ---------------------------
+//    $Id: grid_in_out_02.cc 22595 2010-11-03 11:30:11Z bangerth $
+//    Version: $Name$
+//
+//    Copyright (C) 2005, 2008, 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  ---------------------------
+
+
+// like grid_in_out but test persistent triangulation 
+
+#include "../tests.h"
+#include <fstream>
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/tria_accessor.h>
+#include <grid/persistent_tria.h>
+#include <grid/grid_in.h>
+#include <grid/grid_out.h>
+
+#include <string>
+
+std::ofstream logfile("grid_in_out_03/output");
+
+template <int dim, int spacedim>
+void test(std::string filename) {
+  logfile << " Tria<" << dim << "," << spacedim << ">: "
+         << filename << std::endl;
+  Triangulation<dim, spacedim> tria;
+  GridIn<dim, spacedim> gi;
+  gi.attach_triangulation (tria);
+  std::ifstream in (filename.c_str());
+  gi.read_ucd (in);
+  
+  PersistentTriangulation<dim, spacedim> ptria(tria);
+  typename Triangulation<dim,spacedim>::active_cell_iterator cell;
+
+  ptria.restore();
+  for(unsigned int i=0; i<2; ++i) 
+    {
+      for(cell=ptria.begin_active(); cell != ptria.end(); ++cell)
+       if(cell->center()[0]<.5)
+         cell->set_refine_flag();
+      ptria.execute_coarsening_and_refinement();
+    }
+  
+  ptria.write_flags(logfile);
+}
+
+int main ()
+{
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  test<2,3>("grids/square.inp");
+  test<2,3>("grids/sphere_1.inp");
+
+  return 0;
+}
+
diff --git a/tests/codim_one/grid_in_out_03/cmp/generic b/tests/codim_one/grid_in_out_03/cmp/generic
new file mode 100644 (file)
index 0000000..47e91aa
--- /dev/null
@@ -0,0 +1,31 @@
+
+ Tria<2,3>: grids/square.inp
+41472 2
+40960 8
+0 0 
+40961
+40976 4
+0 
+40977
+40960 8
+0 0 
+40961
+40976 4
+0 
+40977
+41473
+ Tria<2,3>: grids/sphere_1.inp
+41472 2
+40960 212
+255 255 255 255 255 255 255 252 255 15 255 255 255 0 240 255 0 252 3 12 240 240 255 255 243 255 15 
+40961
+40976 106
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+40977
+40960 698
+0 0 0 0 0 0 252 255 255 255 255 255 255 255 255 255 255 255 255 207 204 204 252 255 255 255 255 255 255 255 255 255 63 204 252 255 255 255 255 255 255 255 255 63 252 255 255 255 255 255 255 255 255 255 63 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 3 
+40961
+40976 349
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+40977
+41473

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.