Re: [deal.II] Hashing / mapping Point locations to material ID

2021-02-08 Thread Wolfgang Bangerth
On 2/6/21 2:30 PM, Corbin Foucart wrote: Thank you for the fast and clear answer, Wolfgang. Just add such a hash function for Point. It's true that two nearby points will have different hash values, but that shouldn't stop you from using hashes if you query the same points over

Re: [deal.II] Hashing / mapping Point locations to material ID

2021-02-07 Thread Jean-Paul Pelteret
Hi Corbin, Just add such a hash function for Point. In case you haven't yet done this, I've dug out an old snippet of code that implements a reliable hash function for the point class. I used this approach successfully when implementing some exotic constraints manager, so hopefully it

Re: [deal.II] Hashing / mapping Point locations to material ID

2021-02-06 Thread Corbin Foucart
Thank you for the fast and clear answer, Wolfgang. Just add such a hash function for Point. It's true that two nearby points > will > have different hash values, but that shouldn't stop you from using hashes > if > you query the same points over and over. This is definitely doable. >

Re: [deal.II] Hashing / mapping Point locations to material ID

2021-02-06 Thread Wolfgang Bangerth
On 2/6/21 1:55 PM, Corbin Foucart wrote: The compiler is rightly complaining that there isn't a hash method for the Point object, and it seems like this could indeed be dangerous, because of floating point comparison later between Point objects during lookup. Just add such a hash function

[deal.II] Hashing / mapping Point locations to material ID

2021-02-06 Thread Corbin Foucart
Hello all, I'm attempting to set material ID based on x-location. I'd like to create std::unordered_map between x-locations of cell centers and material id, and then refer to that map to quickly set material_id later. The compiler is rightly complaining that there isn't a hash method for the