]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Test on order of construction, and signals.
authorLuca Heltai <luca.heltai@sissa.it>
Thu, 14 Sep 2017 18:00:36 +0000 (20:00 +0200)
committerLuca Heltai <luca.heltai@sissa.it>
Thu, 14 Sep 2017 21:40:26 +0000 (23:40 +0200)
source/grid/tria_info_cache.cc
tests/grid/tria_info_cache_02.cc [new file with mode: 0644]
tests/grid/tria_info_cache_02.output [new file with mode: 0644]

index 8a150a861ad11f1a5c857e9b90bf072111dd2962..e9c89139f0fa108cacb5e2defe73eac27000417b 100644 (file)
@@ -55,7 +55,9 @@ void TriangulationInfoCache<dim,spacedim>::update(bool topology_is_unchanged)
     {
       vertex_to_cells.clear();
       vertex_to_cell_centers.clear();
+#ifdef DEAL_II_WITH_NANOFLANN
       vertex_kdtree.set_points(tria->get_vertices());
+#endif
       return;
     }
 
diff --git a/tests/grid/tria_info_cache_02.cc b/tests/grid/tria_info_cache_02.cc
new file mode 100644 (file)
index 0000000..4280b6c
--- /dev/null
@@ -0,0 +1,70 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2001 - 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+// Validate tria_info_cache. Different construction order. Check signal.
+
+#include "../tests.h"
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria_info_cache.h>
+
+
+template <int dim, int spacedim>
+void test ()
+{
+  deallog << "dim = " << dim
+          << ", spacedim = " << spacedim << std::endl;
+
+  Triangulation<dim> tria;
+  TriangulationInfoCache<dim> cache(tria, cache_vertex_to_cell_map);
+
+  GridGenerator::hyper_cube(tria);
+
+  {
+    auto m = cache.get_vertex_to_cell_map();
+
+    unsigned int i=0;
+    for (auto &v : m)
+      {
+        for (auto &c : v)
+          deallog << "Vertex " << i << ", cell " << c << std::endl;
+        ++i;
+      }
+  }
+  deallog << "After one refinement. " << std::endl;
+
+  tria.refine_global(1);
+  {
+    auto m = cache.get_vertex_to_cell_map();
+
+    unsigned int i=0;
+    for (auto &v : m)
+      {
+        for (auto &c : v)
+          deallog << "Vertex " << i << ", cell " << c << std::endl;
+        ++i;
+      }
+  }
+}
+
+
+int main ()
+{
+  initlog();
+
+  test<2,2> ();
+
+  return 0;
+}
diff --git a/tests/grid/tria_info_cache_02.output b/tests/grid/tria_info_cache_02.output
new file mode 100644 (file)
index 0000000..f5e83bd
--- /dev/null
@@ -0,0 +1,23 @@
+
+DEAL::dim = 2, spacedim = 2
+DEAL::Vertex 0, cell 0.0
+DEAL::Vertex 1, cell 0.0
+DEAL::Vertex 2, cell 0.0
+DEAL::Vertex 3, cell 0.0
+DEAL::After one refinement. 
+DEAL::Vertex 0, cell 1.0
+DEAL::Vertex 1, cell 1.1
+DEAL::Vertex 2, cell 1.2
+DEAL::Vertex 3, cell 1.3
+DEAL::Vertex 4, cell 1.0
+DEAL::Vertex 4, cell 1.1
+DEAL::Vertex 5, cell 1.0
+DEAL::Vertex 5, cell 1.2
+DEAL::Vertex 6, cell 1.1
+DEAL::Vertex 6, cell 1.3
+DEAL::Vertex 7, cell 1.2
+DEAL::Vertex 7, cell 1.3
+DEAL::Vertex 8, cell 1.0
+DEAL::Vertex 8, cell 1.1
+DEAL::Vertex 8, cell 1.2
+DEAL::Vertex 8, cell 1.3

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.