From 6643786d291c18a5e51c1616943f8be36ba0f5e6 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 13 Aug 2008 03:20:39 +0000 Subject: [PATCH] Implement source locations also for 3d. git-svn-id: https://svn.dealii.org/trunk@16533 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-31/step-31.cc | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) 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; } -- 2.39.5