From 87df59e5e29129936d456387f24ae0ca2f0c6453 Mon Sep 17 00:00:00 2001 From: Joerg Frohne Date: Sat, 28 Sep 2013 23:20:10 +0000 Subject: [PATCH] fix sphere obstacle function git-svn-id: https://svn.dealii.org/trunk@31009 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-42/step-42.cc | 37 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/deal.II/examples/step-42/step-42.cc b/deal.II/examples/step-42/step-42.cc index 04cdd6195b..b58953756a 100644 --- a/deal.II/examples/step-42/step-42.cc +++ b/deal.II/examples/step-42/step-42.cc @@ -385,23 +385,28 @@ namespace Step42 template - double - SphereObstacle::value (const Point &p, - const unsigned int component) const - { - if (component == 0) - return p(0); - else if (component == 1) - return p(1); - else if (component == 2) - return (-std::sqrt(0.36 - - (p(0) - 0.5) * (p(0) - 0.5) - - (p(1) - 0.5) * (p(1) - 0.5)) - + z_surface + 0.59); + double + SphereObstacle::value ( + const Point &p, const unsigned int component) const + { + if (component == 0) + return p(0); + else if (component == 1) + return p(1); + else if (component == 2) + { + double return_value = 1000.0; + if ((p(0) - 0.5) * (p(0) - 0.5) + (p(1) - 0.5) * (p(1) - 0.5) + < 0.36) + return_value = (-std::sqrt( + 0.36 - (p(0) - 0.5) * (p(0) - 0.5) + - (p(1) - 0.5) * (p(1) - 0.5)) + z_surface + 0.59); + return return_value; + } - Assert (false, ExcNotImplemented()); - return 1e9; // an unreasonable value; ignored in debug mode because of the preceding Assert - } + Assert(false, ExcNotImplemented()); + return 1e9; // an unreasonable value; ignored in debug mode because of the preceding Assert + } template -- 2.39.5