From: blaisb Date: Sat, 30 May 2020 01:48:12 +0000 (-0400) Subject: Added the capacity to add properties to the particles that are generated using the... X-Git-Tag: v9.3.0-rc1~1505^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b912a3456da1c9f0b57fc75ec2040aabbeda77c0;p=dealii.git Added the capacity to add properties to the particles that are generated using the particle generator 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. --- diff --git a/include/deal.II/particles/generators.h b/include/deal.II/particles/generators.h index 18b7c959b4..11cb6f56bc 100644 --- a/include/deal.II/particles/generators.h +++ b/include/deal.II/particles/generators.h @@ -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 &particle_handler, const Mapping & mapping = StaticMappingQ1::mapping, + const std::vector> &properties = + std::vector>(), 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 @@ -247,7 +255,9 @@ namespace Particles & global_bounding_boxes, ParticleHandler &particle_handler, const Mapping & mapping = - StaticMappingQ1::mapping); + StaticMappingQ1::mapping, + const std::vector> &properties = + std::vector>()); } // namespace Generators } // namespace Particles diff --git a/source/particles/generators.cc b/source/particles/generators.cc index 5b5961480c..da677b7552 100644 --- a/source/particles/generators.cc +++ b/source/particles/generators.cc @@ -409,7 +409,8 @@ namespace Particles & global_bounding_boxes, ParticleHandler &particle_handler, const Mapping & mapping, - const ComponentMask & components) + const std::vector> &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 & quadrature, // const std::vector> & particle_reference_locations, const std::vector>> - & global_bounding_boxes, - ParticleHandler &particle_handler, - const Mapping & mapping) + & global_bounding_boxes, + ParticleHandler & particle_handler, + const Mapping & mapping, + const std::vector> &properties) { const std::vector> &particle_reference_locations = quadrature.get_points(); diff --git a/source/particles/generators.inst.in b/source/particles/generators.inst.in index c00c41abdd..51d92313c5 100644 --- a/source/particles/generators.inst.in +++ b/source/particles/generators.inst.in @@ -61,6 +61,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) ParticleHandler &particle_handler, const Mapping &mapping, + const std::vector> & 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 &particle_handler, - const Mapping &mapping); + const Mapping &mapping, + const std::vector> &properties); \} \}