From: Bruno Turcksin Date: Wed, 30 Sep 2015 23:28:05 +0000 (-0500) Subject: Add 3D test for vertex_to_cell_map function. X-Git-Tag: v8.4.0-rc2~354^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=288d643a04255609f40aefa31880f98ab9a15d7f;p=dealii.git Add 3D test for vertex_to_cell_map function. --- diff --git a/tests/grid/grid_tools_vertex_to_cell_map.cc b/tests/grid/grid_tools_vertex_to_cell_map_01.cc similarity index 97% rename from tests/grid/grid_tools_vertex_to_cell_map.cc rename to tests/grid/grid_tools_vertex_to_cell_map_01.cc index 3e66bf9902..6eb8dfe385 100644 --- a/tests/grid/grid_tools_vertex_to_cell_map.cc +++ b/tests/grid/grid_tools_vertex_to_cell_map_01.cc @@ -12,7 +12,7 @@ // // --------------------------------------------------------------------- - +// Test vertex_to_cell_map for 2D problem with mpi and hanging nodes. #include "../tests.h" #include diff --git a/tests/grid/grid_tools_vertex_to_cell_map.mpirun=2.output b/tests/grid/grid_tools_vertex_to_cell_map_01.mpirun=2.output similarity index 100% rename from tests/grid/grid_tools_vertex_to_cell_map.mpirun=2.output rename to tests/grid/grid_tools_vertex_to_cell_map_01.mpirun=2.output diff --git a/tests/grid/grid_tools_vertex_to_cell_map_02.cc b/tests/grid/grid_tools_vertex_to_cell_map_02.cc new file mode 100644 index 0000000000..fdef4600b3 --- /dev/null +++ b/tests/grid/grid_tools_vertex_to_cell_map_02.cc @@ -0,0 +1,81 @@ + +// +// Copyright (C) 2015 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. +// +// --------------------------------------------------------------------- + + +// Test vertex_to_cell_map for 3D problem with hanging nodes. + +#include "../tests.h" +#include +#include +#include +#include +#include + +#include + +std::ofstream logfile("output"); + +void test() +{ + Triangulation<3> tria; + Point<3> a(0.,0.,0.); + Point<3> b(1.,1.,1.); + std::vector repetitions(3); + repetitions[0] = 2; + repetitions[1] = 2; + repetitions[2] = 1; + GridGenerator::subdivided_hyper_rectangle(tria,repetitions,a,b); + typename Triangulation<3>::active_cell_iterator cell = tria.begin_active(); + cell->set_refine_flag(); + tria.execute_coarsening_and_refinement(); + + std::vector::active_cell_iterator> > + vertex_to_cell = GridTools::vertex_to_cell_map(tria); + + AssertThrow(tria.n_vertices()==vertex_to_cell.size(), + ExcMessage("Wrong number of vertices")); + + std::vector n_cells; + for (unsigned int i=0; i histogram(9,0); + for (unsigned int i=0; i