]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added the capacity to add properties to the particles that are generated using the...
authorblaisb <blais.bruno@gmail.com>
Sat, 30 May 2020 01:48:12 +0000 (21:48 -0400)
committerblaisb <blais.bruno@gmail.com>
Sat, 30 May 2020 01:48:12 +0000 (21:48 -0400)
that generates particles at support points or at gauss quadrature points.
Note that we do not check for the size of the properties and the number of particles
as this is done within insert global particles.

include/deal.II/particles/generators.h
source/particles/generators.cc
source/particles/generators.inst.in

index 18b7c959b41a99e4b6fa90eb47aa3c948a828472..11cb6f56bcb033ad8fa4a6c05c2a94c905864226 100644 (file)
@@ -194,6 +194,9 @@ namespace Particles
      * @param[in] mapping An optional mapping object that is used to map
      * the DOF locations. If no mapping is provided a MappingQ1 is assumed.
      *
+     * @param[in] properties An optional vector of vector of properties
+     * for each particles to be inserted.
+     *
      * @param[in] components Component mask that decides which subset of the
      * support points of the dof_handler are used to generate the particles.
      *
@@ -207,6 +210,8 @@ namespace Particles
                        ParticleHandler<dim, spacedim> &particle_handler,
                        const Mapping<dim, spacedim> &  mapping =
                          StaticMappingQ1<dim, spacedim>::mapping,
+                       const std::vector<std::vector<double>> &properties =
+                         std::vector<std::vector<double>>(),
                        const ComponentMask &components = ComponentMask());
 
     /**
@@ -237,6 +242,9 @@ namespace Particles
      * the quadrature locations. If no mapping is provided a MappingQ1 is
      * assumed.
      *
+     * @param[in] properties An optional vector of vector of properties
+     * for each particles to be inserted.
+     *
      * @author Bruno Blais, Luca Heltai, 2019
      */
     template <int dim, int spacedim = dim>
@@ -247,7 +255,9 @@ namespace Particles
                         &                             global_bounding_boxes,
                       ParticleHandler<dim, spacedim> &particle_handler,
                       const Mapping<dim, spacedim> &  mapping =
-                        StaticMappingQ1<dim, spacedim>::mapping);
+                        StaticMappingQ1<dim, spacedim>::mapping,
+                      const std::vector<std::vector<double>> &properties =
+                        std::vector<std::vector<double>>());
   } // namespace Generators
 } // namespace Particles
 
index 5b5961480c5e52de2e2f25d1c8c46bf43132ddff..da677b75529069ce35ed31fb0788abb00612f39a 100644 (file)
@@ -409,7 +409,8 @@ namespace Particles
                          &                             global_bounding_boxes,
                        ParticleHandler<dim, spacedim> &particle_handler,
                        const Mapping<dim, spacedim> &  mapping,
-                       const ComponentMask &           components)
+                       const std::vector<std::vector<double>> &properties,
+                       const ComponentMask &                   components)
     {
       const auto &fe = dof_handler.get_fe();
 
@@ -433,7 +434,8 @@ namespace Particles
         support_points_vec.push_back(element.second);
 
       particle_handler.insert_global_particles(support_points_vec,
-                                               global_bounding_boxes);
+                                               global_bounding_boxes,
+                                               properties);
     }
 
 
@@ -444,9 +446,10 @@ namespace Particles
       const Quadrature<dim> &             quadrature,
       // const std::vector<Point<dim>> &     particle_reference_locations,
       const std::vector<std::vector<BoundingBox<spacedim>>>
-        &                             global_bounding_boxes,
-      ParticleHandler<dim, spacedim> &particle_handler,
-      const Mapping<dim, spacedim> &  mapping)
+        &                                     global_bounding_boxes,
+      ParticleHandler<dim, spacedim> &        particle_handler,
+      const Mapping<dim, spacedim> &          mapping,
+      const std::vector<std::vector<double>> &properties)
     {
       const std::vector<Point<dim>> &particle_reference_locations =
         quadrature.get_points();
index c00c41abddd0b3656faa6c65c6e1039602ccd60d..51d92313c5068a50db1211e382991ec13875d6dc 100644 (file)
@@ -61,6 +61,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
           ParticleHandler<deal_II_dimension, deal_II_space_dimension>
             &particle_handler,
           const Mapping<deal_II_dimension, deal_II_space_dimension> &mapping,
+          const std::vector<std::vector<double>> &                   properties,
           const ComponentMask &components);
 
         template void
@@ -72,7 +73,8 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
             &global_bounding_boxes,
           ParticleHandler<deal_II_dimension, deal_II_space_dimension>
             &particle_handler,
-          const Mapping<deal_II_dimension, deal_II_space_dimension> &mapping);
+          const Mapping<deal_II_dimension, deal_II_space_dimension> &mapping,
+          const std::vector<std::vector<double>> &properties);
 
       \}
     \}

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.