From ad9e2c5852e1e3a746d93e5e94e015e9efc5be08 Mon Sep 17 00:00:00 2001 From: David Wells Date: Tue, 8 May 2018 10:48:51 -0400 Subject: [PATCH] Attach a TorusManifold to a Torus. --- include/deal.II/grid/grid_generator.h | 15 +++++++-------- source/grid/grid_generator.cc | 2 ++ tests/codim_one/torus_01.cc | 4 ---- tests/distributed_grids/codim_01.cc | 1 + tests/grid/torus_01.cc | 7 ++----- tests/mpi/codim_01.cc | 1 + 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/include/deal.II/grid/grid_generator.h b/include/deal.II/grid/grid_generator.h index 6b4e611067..a31e3abf8b 100644 --- a/include/deal.II/grid/grid_generator.h +++ b/include/deal.II/grid/grid_generator.h @@ -835,14 +835,13 @@ namespace GridGenerator * Produce the volume or surface mesh of a torus. The axis of the torus is * the $y$-axis while the plane of the torus is the $x$-$z$ plane. * - * If @p dim is 3, the mesh will be the volume of the torus. By default, - * the boundary faces will have manifold id 0 and you should attach a - * TorusManifold to it. The cells will have manifold id 1 and you should - * attach a SphericalManifold to it. - * - * If @p dim is 2, the mesh will describe the surface of the torus. All - * cells and faces will have manifold id 0 and you should attach a - * TorusManifold to it. + * If @p dim is 3, the mesh will be the volume of the torus and this + * function attaches a TorusManifold to all boundary cells and faces (which + * are marked with a manifold id of 0). + * + * If @p dim is 2, the mesh will describe the surface of the torus and this + * function attaches a TorusManifold to all cells and faces (which are + * marked with a manifold id of 0). * * @param tria The triangulation to be filled. * diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 1ea4cbeea5..00476bc5d0 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -720,6 +720,7 @@ namespace GridGenerator tria.create_triangulation_compatibility (vertices, cells, SubCellData()); tria.set_all_manifold_ids(0); + tria.set_manifold(0, TorusManifold<2>(R, r)); } template <> @@ -747,6 +748,7 @@ namespace GridGenerator // set manifolds as documented tria.set_all_manifold_ids(1); tria.set_all_manifold_ids_on_boundary(0); + tria.set_manifold(0, TorusManifold<3>(R, r)); } diff --git a/tests/codim_one/torus_01.cc b/tests/codim_one/torus_01.cc index a01d6e6827..5ff75199fb 100644 --- a/tests/codim_one/torus_01.cc +++ b/tests/codim_one/torus_01.cc @@ -35,10 +35,7 @@ int main () initlog(); - TorusManifold boundary (1.5, .5); Triangulation tria; - tria.set_manifold (0, boundary); - GridGenerator::torus (tria, 1.5, .5); tria.refine_global(2); @@ -47,4 +44,3 @@ int main () return 0; } - diff --git a/tests/distributed_grids/codim_01.cc b/tests/distributed_grids/codim_01.cc index 591e2c33bf..d817f486bf 100644 --- a/tests/distributed_grids/codim_01.cc +++ b/tests/distributed_grids/codim_01.cc @@ -35,6 +35,7 @@ void test(std::ostream & /*out*/) parallel::distributed::Triangulation tr(MPI_COMM_WORLD); GridGenerator::torus(tr, 1, 0.2); + tr.reset_all_manifolds(); tr.begin_active()->set_refine_flag(); tr.execute_coarsening_and_refinement (); diff --git a/tests/grid/torus_01.cc b/tests/grid/torus_01.cc index a39c231b6c..47c6415d42 100644 --- a/tests/grid/torus_01.cc +++ b/tests/grid/torus_01.cc @@ -35,15 +35,12 @@ void test<3,3> () Triangulation triangulation; GridGenerator::torus(triangulation, 1.0, 0.4); - - static const SphericalManifold<3> desc_sphere; - static const TorusManifold<3> desc_torus(1.0, 0.4); - triangulation.set_manifold (0, desc_torus); - triangulation.set_manifold (1, desc_sphere); + triangulation.set_manifold (1, SphericalManifold<3>()); triangulation.begin_active()->set_refine_flag(); triangulation.execute_coarsening_and_refinement (); + const TorusManifold<3> desc_torus(1.0, 0.4); unsigned int c = 0; for (Triangulation::active_vertex_iterator v = triangulation.begin_active_vertex(); v != triangulation.end_vertex(); diff --git a/tests/mpi/codim_01.cc b/tests/mpi/codim_01.cc index 1bbc5ec29b..939ab9e70d 100644 --- a/tests/mpi/codim_01.cc +++ b/tests/mpi/codim_01.cc @@ -62,6 +62,7 @@ void test(std::ostream & /*out*/) parallel::distributed::Triangulation tr(MPI_COMM_WORLD); GridGenerator::torus(tr, 1, 0.2); + tr.reset_all_manifolds(); tr.refine_global(); tr.begin_active()->set_refine_flag(); -- 2.39.5