From c51740efd3c98dd1641393328606b33bb7d5b3d9 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 28 Jan 2021 10:46:40 -0700 Subject: [PATCH] Revert "Move make_triangulation into ReferenceCell::Type" This reverts commit c14ccdb17608b9bfbcc8db4773b14c28a51a3c8a. --- include/deal.II/fe/fe_tools.templates.h | 4 ++-- include/deal.II/grid/reference_cell.h | 17 +++++++++-------- source/grid/reference_cell.cc | 17 +++++++++-------- source/grid/reference_cell.inst.in | 5 +++-- tests/simplex/orientation_02.cc | 2 +- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/include/deal.II/fe/fe_tools.templates.h b/include/deal.II/fe/fe_tools.templates.h index eb13a193d4..4e3edf8a92 100644 --- a/include/deal.II/fe/fe_tools.templates.h +++ b/include/deal.II/fe/fe_tools.templates.h @@ -1605,7 +1605,7 @@ namespace FETools // First, create a local mass matrix for the unit cell Triangulation tr; - reference_cell_type.make_triangulation(tr); + ReferenceCell::make_triangulation(reference_cell_type, tr); const auto &mapping = reference_cell_type.template get_default_linear_mapping(); @@ -1814,7 +1814,7 @@ namespace FETools // Set up meshes, one with a single // reference cell and refine it once Triangulation tria; - reference_cell_type.make_triangulation(tria); + ReferenceCell::make_triangulation(reference_cell_type, tria); tria.begin_active()->set_refine_flag(RefinementCase(ref_case)); tria.execute_coarsening_and_refinement(); diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index 5266ad1160..d54ed6352d 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -240,14 +240,6 @@ namespace ReferenceCell ArrayView faces_for_given_vertex(const unsigned int vertex) const; - /* - * Create a (coarse) grid with a single cell of the shape of this - * reference cell. - */ - template - void - make_triangulation(Triangulation &tria) const; - private: /** * The variable that stores what this object actually corresponds to. @@ -720,6 +712,15 @@ namespace ReferenceCell return {}; } + /* + * Create a (coarse) grid with a single cell of the shape of the provided + * reference cell. + */ + template + void + make_triangulation(const Type & reference_cell, + Triangulation &tria); + /** * Return a default linear mapping that works for the given triangulation. * Internally, this function calls the function above for the reference diff --git a/source/grid/reference_cell.cc b/source/grid/reference_cell.cc index a5caf7fd59..85c33d5b3f 100644 --- a/source/grid/reference_cell.cc +++ b/source/grid/reference_cell.cc @@ -94,15 +94,16 @@ namespace ReferenceCell template void - Type::make_triangulation(Triangulation &tria) const + make_triangulation(const Type & reference_cell, + Triangulation &tria) { - AssertDimension(dim, this->get_dimension()); + AssertDimension(dim, reference_cell.get_dimension()); - if (this->is_hyper_cube()) + if (reference_cell == Type::get_hypercube()) { GridGenerator::hyper_cube(tria, 0, 1); } - else if ((dim == 2) && (*this == Tri)) + else if ((dim == 2) && (reference_cell == Type::Tri)) { const std::vector> vertices = { Point(), // the origin @@ -115,7 +116,7 @@ namespace ReferenceCell tria.create_triangulation(vertices, cells, {}); } - else if ((dim == 3) && (*this == Tet)) + else if ((dim == 3) && (reference_cell == Type::Tet)) { AssertDimension(spacedim, 3); @@ -127,7 +128,7 @@ namespace ReferenceCell tria.create_triangulation(vertices, cells, {}); } - else if ((dim == 3) && (*this == Pyramid)) + else if ((dim == 3) && (reference_cell == Type::Pyramid)) { AssertDimension(spacedim, 3); @@ -143,7 +144,7 @@ namespace ReferenceCell tria.create_triangulation(vertices, cells, {}); } - else if ((dim == 3) && (*this == Wedge)) + else if ((dim == 3) && (reference_cell == Type::Wedge)) { AssertDimension(spacedim, 3); @@ -284,7 +285,7 @@ namespace ReferenceCell const auto create_quadrature = [](const Type &reference_cell) { Triangulation tria; - reference_cell.make_triangulation(tria); + make_triangulation(reference_cell, tria); return Quadrature(tria.get_vertices()); }; diff --git a/source/grid/reference_cell.inst.in b/source/grid/reference_cell.inst.in index 51149bca8b..b232ba517a 100644 --- a/source/grid/reference_cell.inst.in +++ b/source/grid/reference_cell.inst.in @@ -16,8 +16,9 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { #if deal_II_dimension <= deal_II_space_dimension - template void Type::make_triangulation( - Triangulation & tria) const; + template void make_triangulation( + const Type & reference_cell, + Triangulation &tria); template std::unique_ptr< Mapping> diff --git a/tests/simplex/orientation_02.cc b/tests/simplex/orientation_02.cc index 7916800d7f..c81eb0903f 100644 --- a/tests/simplex/orientation_02.cc +++ b/tests/simplex/orientation_02.cc @@ -29,7 +29,7 @@ test(const unsigned int orientation) Triangulation<3> dummy, tria; - ReferenceCell::Type::Tet.make_triangulation(dummy); + ReferenceCell::make_triangulation(ReferenceCell::Type::Tet, dummy); auto vertices = dummy.get_vertices(); -- 2.39.5