From: blaisb Date: Fri, 29 May 2020 18:59:03 +0000 (-0400) Subject: Working example with properties X-Git-Tag: v9.3.0-rc1~1101^2~14 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ec4c999a5f196e69602aa8b4b2a10fff5d91cb6;p=dealii.git Working example with properties --- diff --git a/examples/step-68/step-68.cc b/examples/step-68/step-68.cc index 1753e0974e..5dfb7afffa 100644 --- a/examples/step-68/step-68.cc +++ b/examples/step-68/step-68.cc @@ -476,9 +476,28 @@ namespace Step68 // 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); + // Particles::Generators::dof_support_points(particles_dof_handler, + // global_bounding_boxes, + // particle_handler); + std::map> 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> 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> properties(particles_dof_handler.n_dofs(), + {0., 0., 0.}); + + 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: " @@ -703,7 +722,7 @@ namespace Step68 pcout << "Repartitioning triangulation after particle generation" << std::endl; - // background_triangulation.repartition(); + background_triangulation.repartition(); setup_background_dofs(); interpolate_function_to_field();