From: frohne Date: Sat, 28 Sep 2013 23:20:10 +0000 (+0000) Subject: fix sphere obstacle function X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34381fbc6109f8effaf50ffd54caebf564dd2695;p=dealii-svn.git fix sphere obstacle function git-svn-id: https://svn.dealii.org/trunk@31009 0785d39b-7218-0410-832d-ea1e28bc413d --- 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