From becfc53cdb8f9c7a186b03c8796519dbfb320e3d Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 5 Jan 2011 14:15:12 +0000 Subject: [PATCH] Adjust code to current style in the tutorial program. git-svn-id: https://svn.dealii.org/trunk@23125 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-38/doc/results.dox | 82 +++++++++++++----------- 1 file changed, 43 insertions(+), 39 deletions(-) diff --git a/deal.II/examples/step-38/doc/results.dox b/deal.II/examples/step-38/doc/results.dox index efd057d8ac..b0b7cdb7bd 100644 --- a/deal.II/examples/step-38/doc/results.dox +++ b/deal.II/examples/step-38/doc/results.dox @@ -77,16 +77,16 @@ different position. Let us here use the following, rather simple function (remember: stretch in one direction, jumble in the other two): @code -template -Point warp (const Point &p) +template +Point warp (const Point &p) { - Point q = p; - q[dim-1] *= 10; + Point q = p; + q[spacedim-1] *= 10; - if (dim >= 2) - q[0] += 2*std::sin(q[dim-1]); - if (dim >= 3) - q[1] += 2*std::cos(q[dim-1]); + if (spacedim >= 2) + q[0] += 2*std::sin(q[spacedim-1]); + if (spacedim >= 3) + q[1] += 2*std::cos(q[spacedim-1]); return q; } @@ -108,45 +108,49 @@ now no longer need it, and then finally warp the mesh. With the function above, this would look as follows: @code -template -void LaplaceBeltrami::make_grid_and_dofs () +template +void LaplaceBeltrami::make_grid_and_dofs () { - HyperBallBoundary boundary_description; - Triangulation volume_mesh; - GridGenerator::half_hyper_ball(volume_mesh); - - volume_mesh.set_boundary (1, boundary_description); - volume_mesh.set_boundary (0, boundary_description); - volume_mesh.refine_global (6); - - static HyperBallBoundary surface_description; - triangulation.set_boundary (1, surface_description); + static HyperBallBoundary surface_description; triangulation.set_boundary (0, surface_description); - - std::set boundary_ids; - boundary_ids.insert(0); - - GridTools::extract_boundary_mesh (volume_mesh, triangulation, - boundary_ids); - triangulation.set_boundary (1); /* ** */ - triangulation.set_boundary (0); /* ** */ - GridTools::transform (&warp, triangulation); /* ** */ + + { + HyperBallBoundary boundary_description; + Triangulation volume_mesh; + GridGenerator::half_hyper_ball(volume_mesh); + + volume_mesh.set_boundary (0, boundary_description); + volume_mesh.refine_global (4); + + std::set boundary_ids; + boundary_ids.insert (0); + + GridTools::extract_boundary_mesh (volume_mesh, triangulation, + boundary_ids); + triangulation.set_boundary (1); /* ** */ + triangulation.set_boundary (0); /* ** */ + GridTools::transform (&warp, triangulation); /* ** */ + std::ofstream x("x"), y("y"); + GridOut().write_gnuplot (volume_mesh, x); + GridOut().write_gnuplot (triangulation, y); + } std::cout << "Surface mesh has " << triangulation.n_active_cells() << " cells." << std::endl; -} + + ... @endcode -Note that the only addition has been the three lines marked with asterisks. It -is worth pointing out one other thing here, though: because we un-attach the -manifold description from the surface mesh, whenever we use a mapping object -in the rest of the program, it has no curves boundary description to go on any -more. Rather, it will have to use the implicit, StraightBoundary class that is -used on all parts of the boundary not explicitly assigned a different -mannifold object. Consequently, whether we use MappingQ(2), MappingQ(15) or -MappingQ1, each cell of our mesh will be mapped using a bilinear -approximation. +Note that the only essential addition has been the three lines marked with +asterisks. It is worth pointing out one other thing here, though: because we +un-attach the manifold description from the surface mesh, whenever we use a +mapping object in the rest of the program, it has no curves boundary +description to go on any more. Rather, it will have to use the implicit, +StraightBoundary class that is used on all parts of the boundary not +explicitly assigned a different mannifold object. Consequently, whether we use +MappingQ(2), MappingQ(15) or MappingQ1, each cell of our mesh will be mapped +using a bilinear approximation. All these drawbacks aside, the resulting pictures are still pretty. The only other differences to what's in step-38 is that we changed the right hand side -- 2.39.5