From: pauletti Date: Mon, 20 Dec 2010 01:14:59 +0000 (+0000) Subject: Added a curve test to step 38 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87d5110a1be5e650b102299ceaea0e9a10847262;p=dealii-svn.git Added a curve test to step 38 git-svn-id: https://svn.dealii.org/trunk@23013 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-38/doc/step-38.solution-2d.png b/deal.II/examples/step-38/doc/step-38.solution-2d.png new file mode 100644 index 0000000000..732fcac38c Binary files /dev/null and b/deal.II/examples/step-38/doc/step-38.solution-2d.png differ diff --git a/deal.II/examples/step-38/doc/step-38.solution.png b/deal.II/examples/step-38/doc/step-38.solution-3d.png similarity index 100% rename from deal.II/examples/step-38/doc/step-38.solution.png rename to deal.II/examples/step-38/doc/step-38.solution-3d.png diff --git a/deal.II/examples/step-38/step-38.cc b/deal.II/examples/step-38/step-38.cc index efa7d178ed..8cc31786f2 100644 --- a/deal.II/examples/step-38/step-38.cc +++ b/deal.II/examples/step-38/step-38.cc @@ -102,7 +102,31 @@ class Solution : public Function const unsigned int component = 0) const; }; - + + +template <> +double +Solution<2>::value (const Point<2> &p, + const unsigned int) const +{ + return ( -2. * p(0) * p(1) ); +} + + +template <> +Tensor<1,2> +Solution<2>::gradient (const Point<2> &p, + const unsigned int) const +{ + + Tensor<1,2> return_value; + return_value[0] = -2. * p(1) * (1 - 2. * p(0) * p(0)); + return_value[1] = -2. * p(0) * (1 - 2. * p(1) * p(1)); + + return return_value; +} + + template <> double Solution<3>::value (const Point<3> &p, @@ -179,7 +203,13 @@ RightHandSide<3>::value (const Point<3> &p, } - +template <> +double +RightHandSide<2>::value (const Point<2> &p, + const unsigned int comp) const +{ + return ( -8. * p(0) * p(1) ); +} template @@ -294,11 +324,9 @@ void LaplaceBeltramiProblem::assemble_system () std::map boundary_values; - VectorTools::interpolate_boundary_values (mapping, - dof_handler, - 0, - Solution(), + VectorTools::interpolate_boundary_values (mapping,dof_handler,0,Solution(), boundary_values); + MatrixTools::apply_boundary_values (boundary_values, system_matrix, solution, @@ -331,7 +359,9 @@ void LaplaceBeltramiProblem::output_results () const data_out.build_patches (mapping, mapping.get_degree()); - std::ofstream output ("solution.vtk"); + std::string filename ("solution-"); + filename += ('0'+spacedim);filename += "d.vtk"; + std::ofstream output (filename.c_str()); data_out.write_vtk (output); } @@ -369,8 +399,14 @@ void LaplaceBeltramiProblem::run () int main ( int argc, char **argv ) { deallog.depth_console (0); + + { + LaplaceBeltramiProblem<3> laplace_beltrami_3d; + laplace_beltrami_3d.run(); + } + { - LaplaceBeltramiProblem<3> laplace_beltrami_2d; + LaplaceBeltramiProblem<2> laplace_beltrami_2d; laplace_beltrami_2d.run(); }