I have a question about how to set the quantities for dealii::Particles that are stored in a dealii::ParticleHandler. I have successfully created a dealii::ParticleHandler and randomly placed particles. I have also successfully solved a PDE, whose solution is stored in the vector solution. Then I (again, successfully) interpolate the solution from the PDE onto the particle locations.
Here is the code: // create the particle handler dealii::Particles::ParticleHandler<dim> particleHandler(triangulation, mapping, ncomponents); // randomly place particles in the domain based on some defined pdf dealii::Particles::Generators::probabilistic_locations(triangulation, pdf, true, nparticles, particleHandler mapping); // map the conserved properties onto the particles dealii::Vector<double> interpolatedParticleQuantities(ncomponents*nparticles); dealii::Particles::Utilities::interpolate_field_on_particles(dofHandler, particleHandler, solution, interpolatedParticleQuantities); The problem that I have now is: how do I attach the correct components of interpolatedParticleQuantities with the property of the corresponding particle? I have tested the implementation by checking: unsigned int part = 0; for( auto iter=particleHandler.begin(); iter!=particleHandler.end(); ++iter, ++part ) { std::cout << "particle " << part << " quantities: "; for( unsigned int i=0; i<ncomponents; ++i ) { std::cout << interpolatedParticleQuantities[part*ncomponents + i] << " "; } std::cout << std::endl; } and I have gotten what I expect. I have also tried attaching the particle properties using: unsigned int npart = 0; for( auto iter=particleHandler.begin(); iter!=particleHandler.end(); ++iter, ++part ) { dealii::ArrayView<double> data(interpolatedParticleQuantities.begin() + part*ncomponents, ncomponents); iter->set_properties(data); } but I get the compiler error: *error: *cannot convert ‘*dealii::ArrayView<double>*’ to ‘*const std::vector<double, std::allocator<double> >&*’ 353 | iter->set_properties(*data*); Does anyone know what I am doing wrong? Or is there is a better way to do this? I'm sure this is a dumb question, but I couldn't find anything in the tutorials/examples. -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/f333e2e2-4382-45f0-8f68-93067a8f3967o%40googlegroups.com.