]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Implement source locations also for 3d.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Aug 2008 03:20:39 +0000 (03:20 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Aug 2008 03:20:39 +0000 (03:20 +0000)
git-svn-id: https://svn.dealii.org/trunk@16533 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-31/step-31.cc

index 7e17aa1e92b28260acd9999704cd8331c8cd07bf..da4a0b49433171855602d5e60ab1d463e89cf25c 100644 (file)
@@ -566,16 +566,27 @@ double
 RightHandSide<dim>::value (const Point<dim>  &p,
                            const unsigned int component) const
 {
+                                  // the right hand side only acts on the
+                                  // temperature component
   if (component == dim+1)
-    return ((p.distance (Point<dim>(.3,.1)) < 1./32)
-           ||
-           (p.distance (Point<dim>(.45,.1)) < 1./32)
-           ||
-           (p.distance (Point<dim>(.75,.1)) < 1./32)
-           ?
-           1
-           :
-           0);
+    {
+      static const Point<dim> source_centers[3]
+       = { (dim == 2 ? Point<dim>(.3,.1) : Point<dim>(.3,.5,.1)),
+           (dim == 2 ? Point<dim>(.45,.1) : Point<dim>(.45,.5,.1)),
+           (dim == 2 ? Point<dim>(.75,.1) : Point<dim>(.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;
 }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.