From 97963261ee6ad91d38a5f940bea5a6bc96f7b089 Mon Sep 17 00:00:00 2001 From: hartmann Date: Thu, 30 Jun 2005 09:11:03 +0000 Subject: [PATCH] Test point_inside function also in 2d. git-svn-id: https://svn.dealii.org/trunk@10977 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/point_inside_1.cc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/bits/point_inside_1.cc b/tests/bits/point_inside_1.cc index 405d35b22d..4e6024fb09 100644 --- a/tests/bits/point_inside_1.cc +++ b/tests/bits/point_inside_1.cc @@ -27,14 +27,15 @@ #include +template void check () { - Triangulation<3> triangulation; + Triangulation triangulation; GridGenerator::hyper_cube (triangulation); // Now get the cell - const Triangulation<3>::cell_iterator cell = triangulation.begin(); + const Triangulation::cell_iterator cell = triangulation.begin(); double testcoord[11][3] = {{0.5,0.5,0.5}, {2,0.5,0.5}, @@ -48,13 +49,17 @@ void check () {0.9999999,0.5,0.5}, {1.0000001,0.5,0.5} }; - int expected[] = {1,0,0,0,0,0,0,1,1,1,0}; - + const bool expected2d[] = {1,0,0,1,0,0,1,1,1,1,0}; + const bool expected3d[] = {1,0,0,0,0,0,0,1,1,1,0}; + const bool *expected=dim==2 ? expected2d : expected3d; for (int i=0; i<11; i++) { - const Point<3> testpoint(testcoord[i][0], - testcoord[i][1], - testcoord[i][2]); + Point testpoint; + testpoint(0)=testcoord[i][0]; + testpoint(1)=testcoord[i][1]; + if (dim==3) + testpoint(2)=testcoord[i][2]; + bool res = cell->point_inside(testpoint); deallog << testpoint << " inside " << res < (); + check<3> (); } -- 2.39.5