]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Change particle generation
authorblaisb <blais.bruno@gmail.com>
Tue, 2 Jun 2020 13:11:02 +0000 (09:11 -0400)
committerBruno Blais <blais.bruno@gmail.com>
Tue, 15 Sep 2020 19:47:34 +0000 (15:47 -0400)
examples/step-68/step-68.cc

index 5dfb7afffaab1a52a1e4ec1ff1806de3065b0941..e7c2ef60c57e0b6c83d95bb5b06b8e0322932d67 100644 (file)
@@ -474,30 +474,38 @@ namespace Step68
     const auto global_bounding_boxes =
       Utilities::MPI::all_gather(MPI_COMM_WORLD, my_bounding_box);
 
+    // We generate an empty vector of properties. We will fix the properties
+    // of the particles once they are generated.
+    std::vector<std::vector<double>> properties(particles_dof_handler.n_dofs(),
+                                                std::vector<double>(dim + 1,
+                                                                    0.));
+
     // We generate the particles at the position of the degree of
     // freedom of the dummy particle triangulation
-    // Particles::Generators::dof_support_points(particles_dof_handler,
-    //                                          global_bounding_boxes,
-    //                                          particle_handler);
-    std::map<types::global_dof_index, Point<dim>> support_points_map;
-
-    DoFTools::map_dofs_to_support_points(mapping,
-                                         particles_dof_handler,
-                                         support_points_map);
-
-    // Generate the vector of points from the map
-    // Memory is reserved for efficiency reasons
-    std::vector<Point<dim>> support_points_vec;
-    support_points_vec.reserve(support_points_map.size());
-    for (auto const &element : support_points_map)
-      support_points_vec.push_back(element.second);
+    Particles::Generators::dof_support_points(particles_dof_handler,
+                                              global_bounding_boxes,
+                                              particle_handler,
+                                              mapping,
+                                              properties);
+
+    //    std::map<types::global_dof_index, Point<dim>> support_points_map;
+
+    //    DoFTools::map_dofs_to_support_points(mapping,
+    //                                         particles_dof_handler,
+    //                                         support_points_map);
+
+    //    // Generate the vector of points from the map
+    //    // Memory is reserved for efficiency reasons
+    //    std::vector<Point<dim>> support_points_vec;
+    //    support_points_vec.reserve(support_points_map.size());
+    //    for (auto const &element : support_points_map)
+    //      support_points_vec.push_back(element.second);
+
 
-    std::vector<std::vector<double>> properties(particles_dof_handler.n_dofs(),
-                                                {0., 0., 0.});
 
-    particle_handler.insert_global_particles(support_points_vec,
-                                             global_bounding_boxes,
-                                             properties);
+    //    particle_handler.insert_global_particles(support_points_vec,
+    //                                             global_bounding_boxes,
+    //                                             properties);
 
     // Displaying the total number of generated particles in the domain
     pcout << "Number of particles inserted: "

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.