[petsc-users] Storing Values using a Triplet for using later

Brandon Denton bldenton at buffalo.edu
Thu Nov 9 07:08:23 CST 2023


Good Morning,

Thank you Matt, Jed, and Barry. I will looking into each of these suggestions a report back.

-Brandon
________________________________
From: Matthew Knepley <knepley at gmail.com>
Sent: Wednesday, November 8, 2023 4:18 PM
To: Brandon Denton <bldenton at buffalo.edu>
Cc: petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] Storing Values using a Triplet for using later

On Wed, Nov 8, 2023 at 2:40 PM Brandon Denton via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:
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?

As Jed says, this is a spatial hash. I have a primitive spatial hash now. You can use DMLocatePoints() to find the cell containing a point (like the centroid). Let me know if this does not work or if I misunderstand the problem.

  Thanks!

    Matt

Thank you in advance for your time.
Brandon Denton



--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/<http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20231109/4527c8ee/attachment-0001.html>


More information about the petsc-users mailing list