From 8b94029791c890326f965de1e7f8795aa2538ab7 Mon Sep 17 00:00:00 2001 From: heister Date: Tue, 19 Feb 2013 15:58:33 +0000 Subject: [PATCH] step-49: small fixes git-svn-id: https://svn.dealii.org/trunk@28465 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-49/step-49.cc | 50 ++++++++++++++++------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/deal.II/examples/step-49/step-49.cc b/deal.II/examples/step-49/step-49.cc index 41150a9eb0..e8b9937687 100644 --- a/deal.II/examples/step-49/step-49.cc +++ b/deal.II/examples/step-49/step-49.cc @@ -127,6 +127,8 @@ void grid_3 () } + // here we are going to set a boundary descriptor for the round hole + // and refine the mesh twice. const HyperBallBoundary<2> boundary_description(Point<2>(0,0),0.25); triangulation.set_boundary (1, boundary_description); triangulation.refine_global(2); @@ -149,6 +151,15 @@ void grid_4() } +struct Grid5Func +{ + Point<2> operator() (const Point<2> & in) const + { + return Point<2>(in(0), in(1)+sin(in(0)/5.0*3.14159)); + } +}; + + // demonstrate GridTools::transform void grid_5() { @@ -159,18 +170,25 @@ void grid_5() GridGenerator::subdivided_hyper_rectangle (tria, repetitions, Point<2>(0.0,0.0), Point<2>(10.0,1.0)); - struct Func - { - Point<2> operator() (const Point<2> & in) const - { - return Point<2>(in(0), in(1)+sin(in(0)/5.0*3.14159)); - } - }; - GridTools::transform(Func(), tria); + GridTools::transform(Grid5Func(), tria); mesh_info(tria, "grid-5.eps"); } +struct Grid6Func +{ + double trans(double x) const + { + return tanh(2*x)/tanh(2); + } + + Point<2> operator() (const Point<2> & in) const + { + return Point<2>((in(0)), trans(in(1))); + } +}; + + // demonstrate GridTools::transform void grid_6() { @@ -181,21 +199,7 @@ void grid_6() GridGenerator::subdivided_hyper_rectangle (tria, repetitions, Point<2>(0.0,0.0), Point<2>(1.0,1.0)); - struct Func - { - double trans(double x) const - { - //return atan((x-0.5)*3.14159); - return tanh(2*x)/tanh(2);//(x-0.5)*3.14159); - } - - Point<2> operator() (const Point<2> & in) const - { - return Point<2>((in(0)), trans(in(1))); - } - }; - - GridTools::transform(Func(), tria); + GridTools::transform(Grid6Func(), tria); mesh_info(tria, "grid-6.eps"); } -- 2.39.5