I don't think you want to hash floating point values, but I've had a number of reasons to want spatial hashing for near-neighbor queries in PETSc and that would be a great contribution. (Spatial hashes have a length scale and compute integer bins.)
Brandon Denton via petsc-users <[email protected]> writes: > Good Afternoon, > > Is there a structure within PETSc that allows storage of a value using a > triple similar to PetscHMapIJSet with the key using a struct{PetscScalar i, > j, k;}? > > I'm trying to access mesh information (the shape function coefficients I will > calculate prior to their use) who's values I want to store in the auxiliary > array available in the Residual Functions of PETSc's FEM infrastructure. > After some trial and error work, I've come to the realization that the > coordinates (x[]) available in the auxiliary functions is the centroid of the > cell/element currently being evaluated. This triplet is unique for each > cell/element for a valid mesh so I think it's reasonable to use this triplet > as a key for looking up stored values unique to each cell/element. My plan is > to attached the map to the Application Context, also available to Auxiliary > Functions, to enable these calculations. > > Does such a map infrastructure exist within PETSc? If so, could you point me > to a reference for it? If not, does anyone have any suggestions on how to > solve this problem? > > Thank you in advance for your time. > Brandon Denton
