From: Daniel Arndt Date: Fri, 29 Dec 2017 15:17:49 +0000 (+0100) Subject: Replace CylinderManifold by CylindricalManifold in tests X-Git-Tag: v9.0.0-rc1~594^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5682%2Fhead;p=dealii.git Replace CylinderManifold by CylindricalManifold in tests --- diff --git a/include/deal.II/grid/tria_boundary_lib.h b/include/deal.II/grid/tria_boundary_lib.h index a10e5cfc76..4a73cbd945 100644 --- a/include/deal.II/grid/tria_boundary_lib.h +++ b/include/deal.II/grid/tria_boundary_lib.h @@ -44,6 +44,7 @@ DEAL_II_NAMESPACE_OPEN * @deprecated The boundary classes have been deprecated in favor of the more * general Manifold classes. For this class CylindricalManifold is an appropriate * replacement which is expected to produce better results under mesh refinement. + * For a two-dimensional cylinder use FlatManifold instead. * * @ingroup boundary * diff --git a/tests/bits/cylinder_01.cc b/tests/bits/cylinder_01.cc index 37c756ed69..c173cc5f1d 100644 --- a/tests/bits/cylinder_01.cc +++ b/tests/bits/cylinder_01.cc @@ -15,13 +15,13 @@ -// check the cells generated by the CylinderBoundary the default +// check the cells generated by the CylindricalManifold for the default // axiparallel cylinder #include "../tests.h" #include #include -#include +#include #include #include #include @@ -31,15 +31,37 @@ #include - - template void check () { + AssertThrow(false, ExcInternalError()); +} + + +template<> +void check<2> () +{ + constexpr int dim = 2; + Triangulation triangulation; + GridGenerator::cylinder (triangulation); + triangulation.refine_global (2); + + for (typename Triangulation::active_cell_iterator + cell = triangulation.begin_active(); + cell!=triangulation.end(); ++cell) + for (unsigned int i=0; i::vertices_per_cell; ++i) + deallog << cell->vertex(i) << std::endl; +} + + +template<> +void check<3> () +{ + constexpr int dim = 3; + const CylindricalManifold boundary; Triangulation triangulation; GridGenerator::cylinder (triangulation); - static const CylinderBoundary boundary (1,0); - triangulation.set_boundary (0, boundary); + triangulation.set_manifold(0, boundary); triangulation.refine_global (2); for (typename Triangulation::active_cell_iterator diff --git a/tests/bits/cylinder_02.cc b/tests/bits/cylinder_02.cc index 799c43a826..4515a52d6b 100644 --- a/tests/bits/cylinder_02.cc +++ b/tests/bits/cylinder_02.cc @@ -15,13 +15,13 @@ -// check the cells generated by the CylinderBoundary the +// check the cells generated by the CylindricalManifold for an // axiparallel cylinder parallel to the y-axis #include "../tests.h" #include #include -#include +#include #include #include #include @@ -42,6 +42,15 @@ Point rotate_to_y (const Point &p) return Point (-p[1], p[0], p[2]); } +void set_manifold(Triangulation<2> &triangulation) +{ +} + +void set_manifold(Triangulation<3> &triangulation) +{ + static const CylindricalManifold<3> boundary (1); + triangulation.set_manifold (0, boundary); +} template void check () @@ -51,8 +60,7 @@ void check () GridTools::transform ((Point ( *)(const Point &))&rotate_to_y, triangulation); - static const CylinderBoundary boundary (1,1); - triangulation.set_boundary (0, boundary); + set_manifold(triangulation); triangulation.refine_global (2); for (typename Triangulation::active_cell_iterator diff --git a/tests/bits/cylinder_03.cc b/tests/bits/cylinder_03.cc index b25c5ea5f0..a5fded568c 100644 --- a/tests/bits/cylinder_03.cc +++ b/tests/bits/cylinder_03.cc @@ -15,13 +15,13 @@ -// check the cells generated by the CylinderBoundary the axiparallel +// check the cells generated by the CylindricalManifold the axiparallel // cylinder parallel to the z-axis. this of course only works for 3d #include "../tests.h" #include #include -#include +#include #include #include #include @@ -34,11 +34,16 @@ template -Point rotate_to_y (const Point &p) +Point rotate_to_z (const Point &p) { return Point (-p[2], p[1], p[0]); } +void set_manifold(Triangulation<3> &triangulation) +{ + static const CylindricalManifold<3> boundary (2); + triangulation.set_manifold (0, boundary); +} template void check () @@ -46,10 +51,9 @@ void check () Triangulation triangulation; GridGenerator::cylinder (triangulation); - GridTools::transform ((Point ( *)(const Point &))&rotate_to_y, triangulation); + GridTools::transform ((Point ( *)(const Point &))&rotate_to_z, triangulation); - static const CylinderBoundary boundary (1,2); - triangulation.set_boundary (0, boundary); + set_manifold(triangulation); triangulation.refine_global (2); for (typename Triangulation::active_cell_iterator @@ -59,7 +63,6 @@ void check () deallog << cell->vertex(i) << std::endl; } - int main () { initlog(); diff --git a/tests/bits/cylinder_04.cc b/tests/bits/cylinder_04.cc index 7ddfbe8120..d67962c12d 100644 --- a/tests/bits/cylinder_04.cc +++ b/tests/bits/cylinder_04.cc @@ -15,13 +15,13 @@ -// check the cells generated by the CylinderBoundary for an arbitrary +// check the cells generated by the CylindricalManifold for an arbitrary // orientation #include "../tests.h" #include #include -#include +#include #include #include #include @@ -36,7 +36,7 @@ const double xy_angle = numbers::PI/6; template -Point rotate_to_y (const Point &p) +Point rotate_by_xy_angle (const Point &p) { return Point (p[0]*std::cos(xy_angle) - p[1]*std::sin(xy_angle), p[0]*std::sin(xy_angle) + p[1]*std::cos(xy_angle), @@ -50,12 +50,11 @@ void check () Triangulation triangulation; GridGenerator::cylinder (triangulation); - GridTools::transform ((Point ( *)(const Point &))&rotate_to_y, triangulation); + GridTools::transform ((Point ( *)(const Point &))&rotate_by_xy_angle, triangulation); - static const CylinderBoundary boundary (1, - Point(std::cos(xy_angle), std::sin(xy_angle), 0), - Point()); - triangulation.set_boundary (0, boundary); + static const CylindricalManifold boundary (Point(std::cos(xy_angle), std::sin(xy_angle), 0), + Point()); + triangulation.set_manifold (0, boundary); triangulation.refine_global (2); for (typename Triangulation::active_cell_iterator diff --git a/tests/codim_one/extract_boundary_mesh_10.cc b/tests/codim_one/extract_boundary_mesh_10.cc index 159b0344e5..c25c2139c1 100644 --- a/tests/codim_one/extract_boundary_mesh_10.cc +++ b/tests/codim_one/extract_boundary_mesh_10.cc @@ -25,6 +25,9 @@ // resorting to manifold_ids. this testcase in essence just ensures // that we continue to get this "undesirable" behavior until someone // comes up with a better idea +// +// In particular, it doesn't make sense to replace CylinderBoundary +// by CylindricalManifold here as the problem then doesn't appear anymore. #include "../tests.h" diff --git a/tests/codim_one/extract_boundary_mesh_11.cc b/tests/codim_one/extract_boundary_mesh_11.cc index a850b9024d..920afa0dab 100644 --- a/tests/codim_one/extract_boundary_mesh_11.cc +++ b/tests/codim_one/extract_boundary_mesh_11.cc @@ -23,7 +23,7 @@ #include #include #include -#include +#include @@ -43,18 +43,20 @@ void test() cell != triangulation.end(); ++cell) for (unsigned int f=0; f::faces_per_cell; ++f) if (cell->face(f)->at_boundary()) - if (cell->face(f)->boundary_id() == 0) - cell->face(f)->set_all_manifold_ids(0); - else - cell->face(f)->set_manifold_id(cell->face(f)->boundary_id()); - - static const CylinderBoundary outer_cylinder (100,0); + { + if (cell->face(f)->boundary_id() == 0) + cell->face(f)->set_all_manifold_ids(0); + else + cell->face(f)->set_manifold_id(cell->face(f)->boundary_id()); + } + + static const CylindricalManifold outer_cylinder (0); triangulation.set_manifold(0,outer_cylinder); // now extract the surface mesh Triangulation triangulation_surface; - static const CylinderBoundary surface_cyl(100,0); + static const CylindricalManifold surface_cyl(0); triangulation_surface.set_manifold(0,surface_cyl); GridGenerator::extract_boundary_mesh(triangulation,triangulation_surface); diff --git a/tests/codim_one/extract_boundary_mesh_12.cc b/tests/codim_one/extract_boundary_mesh_12.cc index 7ad69aa08c..4f8b8e5672 100644 --- a/tests/codim_one/extract_boundary_mesh_12.cc +++ b/tests/codim_one/extract_boundary_mesh_12.cc @@ -22,7 +22,7 @@ #include #include #include -#include +#include @@ -37,13 +37,13 @@ void test() // faces GridTools::copy_boundary_to_manifold_id (triangulation); - static const CylinderBoundary outer_cylinder (100,0); + static const CylindricalManifold outer_cylinder (0); triangulation.set_manifold(0,outer_cylinder); // now extract the surface mesh Triangulation triangulation_surface; - static const CylinderBoundary surface_cyl(100,0); + static const CylindricalManifold surface_cyl(0); triangulation_surface.set_manifold(0,surface_cyl); GridGenerator::extract_boundary_mesh(triangulation,triangulation_surface); diff --git a/tests/codim_one/extract_boundary_mesh_13.cc b/tests/codim_one/extract_boundary_mesh_13.cc index cc62ef8ac9..363ec09bda 100644 --- a/tests/codim_one/extract_boundary_mesh_13.cc +++ b/tests/codim_one/extract_boundary_mesh_13.cc @@ -23,7 +23,7 @@ #include #include #include -#include +#include @@ -43,12 +43,14 @@ void test() cell != triangulation.end(); ++cell) for (unsigned int f=0; f::faces_per_cell; ++f) if (cell->face(f)->at_boundary()) - if (cell->face(f)->boundary_id() == 0) - cell->face(f)->set_all_manifold_ids(0); - else - cell->face(f)->set_manifold_id(cell->face(f)->boundary_id()); - - static const CylinderBoundary outer_cylinder (100,0); + { + if (cell->face(f)->boundary_id() == 0) + cell->face(f)->set_all_manifold_ids(0); + else + cell->face(f)->set_manifold_id(cell->face(f)->boundary_id()); + } + + static const CylindricalManifold outer_cylinder (0); triangulation.set_manifold(0,outer_cylinder); // refine the surface mesh to see the effect of boundary/manifold @@ -58,7 +60,7 @@ void test() // now extract the surface mesh Triangulation triangulation_surface; - static const CylinderBoundary surface_cyl(100,0); + static const CylindricalManifold surface_cyl(0); triangulation_surface.set_manifold(0,surface_cyl); GridGenerator::extract_boundary_mesh(triangulation,triangulation_surface); diff --git a/tests/grid/grid_output_input.cc b/tests/grid/grid_output_input.cc index 32369b6051..08e3389ba1 100644 --- a/tests/grid/grid_output_input.cc +++ b/tests/grid/grid_output_input.cc @@ -21,7 +21,7 @@ #include "../tests.h" #include #include -#include +#include #include #include @@ -36,8 +36,8 @@ void test(std::ostream &out) Triangulation tr; GridGenerator::hyper_cube_with_cylindrical_hole(tr, .3, .4, 1, 1, false); - CylinderBoundary boundary(.3, 2); - tr.set_boundary(1, boundary); + CylindricalManifold boundary(2); + tr.set_manifold(1, boundary); { std::ofstream grid_file("coarse_grid.inp"); go.write_ucd(tr, grid_file); @@ -47,7 +47,7 @@ void test(std::ostream &out) deallog << "Writing refined from constructor" << std::endl; go.write_ucd(tr, out); - tr.set_boundary(1); + tr.set_manifold(1); tr.clear(); GridIn gi; @@ -59,7 +59,7 @@ void test(std::ostream &out) grid_file.close(); } - tr.set_boundary(1, boundary); + tr.set_manifold(1, boundary); tr.refine_global(1); deallog << "Writing refined from file" << std::endl; go.write_ucd(tr, out); @@ -70,7 +70,7 @@ void test(std::ostream &out) grid_file.close(); } - tr.set_boundary(1); + tr.set_manifold(1); tr.clear(); } diff --git a/tests/grid/grid_transform_3d.cc b/tests/grid/grid_transform_3d.cc index 0a9adc1b71..5fe501e643 100644 --- a/tests/grid/grid_transform_3d.cc +++ b/tests/grid/grid_transform_3d.cc @@ -21,7 +21,7 @@ #include "../tests.h" #include #include -#include +#include #include #include #include @@ -32,10 +32,10 @@ int main () { const unsigned int dim=3; Point origin; - CylinderBoundary boundary; + CylindricalManifold boundary; Triangulation tria; - tria.set_boundary(0, boundary); GridGenerator::cylinder(tria, 1, .7); + tria.set_manifold(0, boundary); tria.refine_global(2); // build up a map of vertex indices diff --git a/tests/grid/manifold_ids_on_boundary_01.cc b/tests/grid/manifold_ids_on_boundary_01.cc index 1249e74cad..67cfd37f90 100644 --- a/tests/grid/manifold_ids_on_boundary_01.cc +++ b/tests/grid/manifold_ids_on_boundary_01.cc @@ -56,7 +56,7 @@ void dim_3(std::ostream &os) Triangulation tr; GridGenerator::hyper_cube_with_cylindrical_hole(tr,inner,outer,outer,true); - static CylinderBoundary boundary(inner,2); + static CylindricalManifold boundary(2); tr.set_all_manifold_ids_on_boundary(1,1); tr.set_manifold(1,boundary);