#include <fstream>
+template <int dim>
void check ()
{
- Triangulation<3> triangulation;
+ Triangulation<dim> triangulation;
GridGenerator::hyper_cube (triangulation);
// Now get the cell
- const Triangulation<3>::cell_iterator cell = triangulation.begin();
+ const Triangulation<dim>::cell_iterator cell = triangulation.begin();
double testcoord[11][3] = {{0.5,0.5,0.5},
{2,0.5,0.5},
{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<dim> 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 <<std::endl;
Assert (res == expected[i], ExcInternalError());
deallog.depth_console(0);
deallog.threshold_double(1.e-10);
- check ();
+ check<2> ();
+ check<3> ();
}