]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Address some comments
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Thu, 28 May 2020 21:22:43 +0000 (14:22 -0700)
committerBruno Blais <blais.bruno@gmail.com>
Tue, 15 Sep 2020 19:47:34 +0000 (15:47 -0400)
examples/step-68/doc/results.dox
examples/step-68/step-68.cc

index afb776f795fe1d29c73b121a9526f15dc7abbc15..0eb5b337b4dfdcd6c97eeaa7002d0d6c223d5052 100644 (file)
@@ -6,7 +6,7 @@ line, the program will try to read the file "`parameters.prm`" by default, and
 will execute the two dimensional version of the code.
 
 Regardless of the specific parameter file name, if the specified file does not
-exist, when you execute the program you will get an exception that no such file
+exist when you execute the program you will get an exception that no such file
 can be found:
 
 @code
@@ -63,9 +63,9 @@ Writing particle output file: interpolated-particles-2000
 Writing background field file: background-2000
 @endcode
 
-We notice that, by default, the simulation runs the particle tracking with
+We note that, by default, the simulation runs the particle tracking with
 an analytical velocity for 2000 iterations, then runs the particle tracking with
-velocity interpolationn for the same duration. The results are written every
+velocity interpolation for the same duration. The results are written every
 10 iterations.
 
 <h3> Motion of the particles </h3>
index d870baed3693b19387df2e1566cd502b01b4c5c3..7eb3943a7ab548463c6b2774532070687bf50883 100644 (file)
@@ -218,11 +218,6 @@ namespace Step68
   // @sect3{The <code>PatricleTracking</code> class declaration}
 
   // We are now ready to introduce the main class of our tutorial program.
-  // Contrarily to some other steps, there is an additional function that is
-  // left public other than the constructor and the `run()` method, which is the
-  // cell_weight() function. This function is connected to the triangulation and
-  // must be callable from outside of the scope of this class. Everything else
-  // is left `private`, and accessed through the run method itself.
   template <int dim>
   class ParticleTracking
   {
@@ -231,16 +226,6 @@ namespace Step68
                      const bool                        interpolated_velocity);
     void run();
 
-    // The cell_weight() function indicates to the triangulation how much
-    // computational work is expected to happen on this cell, and consequently
-    // how the domain needs to be partitioned so that every MPI rank receives a
-    // roughly equal amount of work (potentially not an equal number of cells).
-    unsigned int cell_weight(
-      const typename parallel::distributed::Triangulation<dim>::cell_iterator
-        &cell,
-      const typename parallel::distributed::Triangulation<dim>::CellStatus
-        status);
-
   private:
     // The particles_generation function is responsible for the initial
     // generation of the particles on top of the background grid
@@ -261,6 +246,18 @@ namespace Step68
     void euler_interpolated(double dt);
     void euler_analytical(double dt);
 
+    // The cell_weight() function indicates to the triangulation how much
+    // computational work is expected to happen on this cell, and consequently
+    // how the domain needs to be partitioned so that every MPI rank receives a
+    // roughly equal amount of work (potentially not an equal number of cells).
+    // While the function is called from the outside, it is connected to the
+    // corresponding signal from inside this class, therefore it can be private.
+    unsigned int cell_weight(
+      const typename parallel::distributed::Triangulation<dim>::cell_iterator
+        &cell,
+      const typename parallel::distributed::Triangulation<dim>::CellStatus
+        status) const;
+
     // The following two functions are responsible for outputting the simulation
     // results for the particles and for the velocity profile on the background
     // mesh, respectively.
@@ -333,9 +330,10 @@ namespace Step68
   unsigned int ParticleTracking<dim>::cell_weight(
     const typename parallel::distributed::Triangulation<dim>::cell_iterator
       &                                                                  cell,
-    const typename parallel::distributed::Triangulation<dim>::CellStatus status)
+    const typename parallel::distributed::Triangulation<dim>::CellStatus status) const
   {
-    if (cell->is_active() && !cell->is_locally_owned())
+    // Assign no weight to cells we do not own.
+    if (!cell->is_locally_owned())
       return 0;
 
     // This determines how important particle work is compared to cell
@@ -390,10 +388,12 @@ namespace Step68
 
     // In order to consider the particles when repartitioning the triangulation
     // the algorithm needs to know three things:
+    //
     // 1. How much weight to assign to each cell (how many particles are in
     // there)
     // 2. How to pack the particles before shipping data around
     // 3. How to unpack the particles after repartitioning
+    //
     // Attach the correct functions to the signals inside
     // parallel::distributed::Triangulation, which will be called every time the
     // repartition() function is called.

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.