On 10/19/20 9:03 AM, blais...@gmail.com wrote:
I am not sur if I fully understand the memory structure of the Property Pool (or at least I am still confused by it). If I understand correctly, the properties of all the particles are stored in a single Handle array and the get_properties of a single particle returns an array view pointing to this large array. However, the n_properties_per_slot() returns the number of properties associated with a single particle. Is there a way to know from within the property pool the size of the handle array?

Maybe
  https://github.com/dealii/dealii/pull/11057
clarifies the intent of the PropertyPool? The idea is that the property pool is responsible for all of the memory allocated for particle properties.

I've come to realize that what you want to do wasn't possible in the current design (because we don't keep track of which memory we have allocated), so wrote
  https://github.com/dealii/dealii/pull/11059

Once that is merged, I think what you want to do is maybe something along the lines of the following addition to the PropertyPool class:

  /**
   * Return the first of all of the memory pool handles that are managed
   * by this class. Iterating from begin() to end() then returns the handles
   * associated with all particles in the ParticleHandler class that owns
   * this property pool; using the get_properties() function, these handles
   * can be converted to ArrayView objects that then allow access to the
   * actual properties.
   *
   * This function can be used to access and modify the properties of all
   * particles, though possibly in a different order than if one accessed
   * them using ParticleHandler::begin() and ParticleHandler::end().
   *
   * @note PropertyPools also store the properties of ghost particles,
   *   and consequently iterating over all handles also reaches the
   *   properties of ghost particles.
   */
  std::set<Handle>::iterator begin ()
  { return currently_open_handler.begin() }

+ same for the corresponding end() function.


If the properties are stored in a continuous block, one could easily write a function that takes into argument a vector of property index, the value to set and the number of particles for example. This function would then be called from the particle handler which in turn would have an interface to this function with the vector of property index and the value to set.
Would that be the right approach? If so, I can work on a PR.

PropertyPool doesn't advertise how it stores properties. Currently, it's not in one large block, though that's something we might want to change at some future point. The interface above avoids exposing how exactly they are stored.

Best
 W.


--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 bange...@colostate.edu
                           www: http://www.math.colostate.edu/~bangerth/

--
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/f8c034bf-621b-bc23-3c93-6c35be1d346b%40colostate.edu.

Reply via email to