From: bangerth Date: Wed, 13 Aug 2008 03:20:39 +0000 (+0000) Subject: Implement source locations also for 3d. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6643786d291c18a5e51c1616943f8be36ba0f5e6;p=dealii-svn.git Implement source locations also for 3d. git-svn-id: https://svn.dealii.org/trunk@16533 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-31/step-31.cc b/deal.II/examples/step-31/step-31.cc index 7e17aa1e92..da4a0b4943 100644 --- a/deal.II/examples/step-31/step-31.cc +++ b/deal.II/examples/step-31/step-31.cc @@ -566,16 +566,27 @@ double RightHandSide::value (const Point &p, const unsigned int component) const { + // the right hand side only acts on the + // temperature component if (component == dim+1) - return ((p.distance (Point(.3,.1)) < 1./32) - || - (p.distance (Point(.45,.1)) < 1./32) - || - (p.distance (Point(.75,.1)) < 1./32) - ? - 1 - : - 0); + { + static const Point source_centers[3] + = { (dim == 2 ? Point(.3,.1) : Point(.3,.5,.1)), + (dim == 2 ? Point(.45,.1) : Point(.45,.5,.1)), + (dim == 2 ? Point(.75,.1) : Point(.75,.5,.1)) }; + static const double source_radius + = (dim == 2 ? 1./32 : 1./8); + + return ((source_centers[0].distance (p) < source_radius) + || + (source_centers[1].distance (p) < source_radius) + || + (source_centers[2].distance (p) < source_radius) + ? + 1 + : + 0); + } else return 0; }