]> https://gitweb.dealii.org/ - dealii.git/commitdiff
simplify test find_cell_10
authorTimo Heister <timo.heister@gmail.com>
Tue, 12 Nov 2013 16:06:11 +0000 (16:06 +0000)
committerTimo Heister <timo.heister@gmail.com>
Tue, 12 Nov 2013 16:06:11 +0000 (16:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@31636 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/find_cell_10a.cc [new file with mode: 0644]
tests/bits/find_cell_10a.debug.output [new file with mode: 0644]

diff --git a/tests/bits/find_cell_10a.cc b/tests/bits/find_cell_10a.cc
new file mode 100644 (file)
index 0000000..4412b59
--- /dev/null
@@ -0,0 +1,122 @@
+// ---------------------------------------------------------------------
+// $Id$
+//
+// Copyright (C) 2003 - 2013 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// transform_real_to_unit_cell works for MappingQ(1) but fails for MappingQ1.
+
+#include "../tests.h"
+
+#include <stdio.h>
+#include <cstdlib>
+
+#include <base/quadrature_lib.h>
+#include <fe/mapping_q.h>
+#include <base/function.h>
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_tools.h>
+#include <dofs/dof_handler.h>
+#include <fe/fe_q.h>
+#include <fe/fe_values.h>
+#include <grid/grid_in.h>
+
+
+#include <iostream>
+#include <fstream>
+#include <list>
+#include <string>
+#include <sstream>
+#include <time.h>
+
+using namespace dealii;
+
+
+void create_coarse_grid(Triangulation<2> &coarse_grid)
+{
+
+  static const Point<2> vertices_1[]
+    = {  Point<2> (9.6982181981258408e-02, 1.1255621492491609e+03),//0
+         Point<2> (6.1219285295807092e-02, 1.1256062663438720e+03),//1
+         Point<2> (0.00000, 1.1255179557007179e+03),//2
+         Point<2> (0.00000, 1.1255994426210491e+03),//3
+      };
+  const unsigned int
+  n_vertices = sizeof(vertices_1) / sizeof(vertices_1[0]);
+
+  const std::vector<Point<2> > vertices (&vertices_1[0],
+                                         &vertices_1[n_vertices]);
+
+  static const int cell_vertices[][GeometryInfo<2>::vertices_per_cell]
+  = {{0, 1, 2, 3}
+  };
+  const unsigned int
+  n_cells = sizeof(cell_vertices) / sizeof(cell_vertices[0]);
+
+  std::vector<CellData<2> > cells (n_cells, CellData<2>());
+  for (unsigned int i=0; i<n_cells; ++i)
+    {
+      for (unsigned int j=0;
+           j<GeometryInfo<2>::vertices_per_cell;
+           ++j)
+        cells[i].vertices[j] = cell_vertices[i][j];
+      cells[i].material_id = 0;
+    }
+
+  coarse_grid.create_triangulation (vertices,
+                                    cells,
+                                    SubCellData());
+}
+
+void test()
+{
+  deallog << std::scientific;
+  deallog.precision(16);
+  
+  Point< 2 > ePos;
+  ePos(0) = 0.0653630060373507487669897386695;
+  ePos(1) = 1125.59175030825804242340382189;
+
+  MappingQ<2> mapping(1);
+  MappingQ1<2> &mapping2 = StaticMappingQ1< 2 >::mapping;
+
+  Triangulation<2>     triangulation;
+  create_coarse_grid(triangulation); // first Tria with just one cell
+
+  Triangulation<2>::active_cell_iterator it = triangulation.begin();
+                                  
+  Point<2> p;
+  p = mapping.transform_real_to_unit_cell(it, ePos);
+  deallog << "A: " << p << std::endl;
+
+                                  // throws:
+  p = mapping2.transform_real_to_unit_cell(it, ePos);
+  deallog << "B: " << p << std::endl;
+
+  deallog << "done" << std::endl;
+}
+
+int main (int argc, char **argv)
+{
+  initlog();
+
+  test();
+
+  return 0;
+}
diff --git a/tests/bits/find_cell_10a.debug.output b/tests/bits/find_cell_10a.debug.output
new file mode 100644 (file)
index 0000000..d6d313c
--- /dev/null
@@ -0,0 +1,16 @@
+
+DEAL::cells 31242
+DEAL::1:
+DEAL::cell 27707
+DEAL::vertex 20297
+DEAL::0.0969822 1125.56
+DEAL::vertex 30988
+DEAL::0.0612193 1125.61
+DEAL::vertex 1298
+DEAL::0.00000 1125.52
+DEAL::vertex 1297
+DEAL::0.00000 1125.60
+DEAL::point 0.706650 0.0885132
+DEAL::1b:
+DEAL::2:
+DEAL::done

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.