From: Peter Munch Date: Mon, 14 Dec 2020 11:42:14 +0000 (+0100) Subject: Use function from simplex_grids.h X-Git-Tag: v9.3.0-rc1~755^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46db15031d5dc688b91888be8597cccf51f56fba;p=dealii.git Use function from simplex_grids.h --- diff --git a/tests/simplex/matrix_free_02.cc b/tests/simplex/matrix_free_02.cc index b510772772..1532bca33b 100644 --- a/tests/simplex/matrix_free_02.cc +++ b/tests/simplex/matrix_free_02.cc @@ -47,115 +47,9 @@ #include "../tests.h" -using namespace dealii; +#include "./simplex_grids.h" -namespace dealii -{ - namespace GridGenerator - { - template - void - subdivided_hyper_rectangle_with_simplices_mix( - Triangulation & tria, - const std::vector &repetitions, - const Point & p1, - const Point & p2, - const bool colorize = false) - { - AssertDimension(dim, spacedim); - - AssertThrow(colorize == false, ExcNotImplemented()); - - std::vector> vertices; - std::vector> cells; - - if (dim == 2) - { - // determine cell sizes - const Point dx((p2[0] - p1[0]) / repetitions[0], - (p2[1] - p1[1]) / repetitions[1]); - - // create vertices - for (unsigned int j = 0; j <= repetitions[1]; ++j) - for (unsigned int i = 0; i <= repetitions[0]; ++i) - vertices.push_back( - Point(p1[0] + dx[0] * i, p1[1] + dx[1] * j)); - - // create cells - for (unsigned int j = 0; j < repetitions[1]; ++j) - for (unsigned int i = 0; i < repetitions[0]; ++i) - { - // create reference QUAD cell - std::array quad{{ - (j + 0) * (repetitions[0] + 1) + i + 0, // - (j + 0) * (repetitions[0] + 1) + i + 1, // - (j + 1) * (repetitions[0] + 1) + i + 0, // - (j + 1) * (repetitions[0] + 1) + i + 1 // - }}; // - - if (j < repetitions[1] / 2 && i < repetitions[0] / 2) - { - CellData quad_; - quad_.vertices = {quad[0], quad[1], quad[2], quad[3]}; - cells.push_back(quad_); - - continue; - } - - // TRI cell 0 - { - CellData tri; - tri.vertices = {quad[0], quad[1], quad[2]}; - cells.push_back(tri); - } - - // TRI cell 1 - { - CellData tri; - tri.vertices = {quad[3], quad[2], quad[1]}; - cells.push_back(tri); - } - } - } - else - { - AssertThrow(colorize == false, ExcNotImplemented()); - } - - // actually create triangulation - tria.create_triangulation(vertices, cells, SubCellData()); - } - - - template - void - subdivided_hyper_cube_with_simplices_mix(Triangulation &tria, - const unsigned int repetitions, - const double p1 = 0.0, - const double p2 = 1.0, - const bool colorize = false) - { - if (dim == 2) - { - subdivided_hyper_rectangle_with_simplices_mix( - tria, {{repetitions, repetitions}}, {p1, p1}, {p2, p2}, colorize); - } - else if (dim == 3) - { - subdivided_hyper_rectangle_with_simplices_mix( - tria, - {{repetitions, repetitions, repetitions}}, - {p1, p1, p1}, - {p2, p2, p2}, - colorize); - } - else - { - AssertThrow(false, ExcNotImplemented()) - } - } - } // namespace GridGenerator -} // namespace dealii +using namespace dealii; template class PoissonOperator