<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
There is also DMPlexFindVertices() which finds the nearest vertex to the given coords in the given radius.
<div class=""><br class="">
</div>
<div class="">You can then get support or its transitive closure for that vertex.<br class="">
<div class=""><br class="">
</div>
<div class="">I wrote it some time ago mainly for debug purposes. It <span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">uses just brute force.</span> I'm not sure it deserves to exist :-) Maybe we should somehow merge these functionalities.</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class=""><br class="">
</div>
<div class="">Vaclav<br class="">
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 16 Sep 2020, at 01:44, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<div dir="ltr" class="">On Tue, Sep 15, 2020 at 6:18 PM Jeremy Theler <<a href="mailto:jeremy@seamplex.com" class="">jeremy@seamplex.com</a>> wrote:<br class="">
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
On Mon, 2020-09-14 at 20:28 -0400, Matthew Knepley wrote:<br class="">
> On Mon, Sep 14, 2020 at 6:15 PM Jeremy Theler <<a href="mailto:jeremy@seamplex.com" target="_blank" class="">jeremy@seamplex.com</a>><br class="">
> wrote:<br class="">
> > Hello all<br class="">
> ><span class="Apple-converted-space"> </span><br class="">
> > Say I have a fully-interpolated 3D DMPlex and a point with<br class="">
> > arbitrary<br class="">
> > coordinates x,y,z. What's the most efficient way to know which cell<br class="">
> > this point belongs to in parallel? Cells can be either tets or<br class="">
> > hexes.<br class="">
><span class="Apple-converted-space"> </span><br class="">
> I should make a tutorial on this, but have not had time so far.<br class="">
<br class="">
Thank you very much for this mini-tutorial.<br class="">
<br class="">
><span class="Apple-converted-space"> </span><br class="">
> The intention is that you use<br class="">
><span class="Apple-converted-space"> </span><br class="">
>   <br class="">
><span class="Apple-converted-space"> </span><a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMLocatePoints.html" rel="noreferrer" target="_blank" class="">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMLocatePoints.html</a><br class="">
><span class="Apple-converted-space"> </span><br class="">
> This will just brute force search unless you also give<br class="">
><span class="Apple-converted-space"> </span><br class="">
>   -dm_plex_hash_location<br class="">
<br class="">
Well, for a 3D DMplex PETSc (and git blame) tells me that you "have<br class="">
only coded this for 2D." :-)<br class="">
</blockquote>
<div class=""><br class="">
</div>
<div class="">Crap. I need to do 3D. It's not hard, just work.</div>
<div class=""> </div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
> which builds a grid hash to accelerate it. I should probably expose<br class="">
><span class="Apple-converted-space"> </span><br class="">
>   DMPlexLocatePoint_Internal()<br class="">
><span class="Apple-converted-space"> </span><br class="">
> which handles the single cell queries. If you just had one point,<br class="">
> that might make it simpler,<br class="">
> although you would still write your own loop.<br class="">
<br class="">
I see that DMLocatePoints() loops over all the cells until it finds the<br class="">
right one. I was thinking about finding first the nearest vertex to the<br class="">
point and then sweeping over all the cells that share this vertex<br class="">
testing for DMPlexLocatePoint_Internal(). The nearest node ought to be<br class="">
found using an octree or similar. Any direction regarding this idea?<br class="">
</blockquote>
<div class=""><br class="">
</div>
<div class="">So you can imagine both a topological search and a geometric search. Generally, people want geometric.</div>
<div class="">The geometric hash we use is just to bin elements on a regular grid.</div>
<div class=""> </div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
>  If your intention is to interpolate a field at these<br class="">
> locations, I created<br class="">
><span class="Apple-converted-space"> </span><br class="">
>   <br class="">
><span class="Apple-converted-space"> </span><a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/DMInterpolationCreate.html" rel="noreferrer" target="_blank" class="">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/DMInterpolationCreate.html</a><br class="">
><span class="Apple-converted-space"> </span><br class="">
> which no one but me uses so far, but I think it is convenient.<br class="">
<br class="">
Any other example apart from src/snes/tutorials/ex63.c?<br class="">
</blockquote>
<div class=""><br class="">
</div>
<div class="">That is the only one in PETSc. The PyLith code uses this to interpolate to seismic stations.</div>
<div class=""><br class="">
</div>
<div class="">  Thanks,</div>
<div class=""><br class="">
</div>
<div class="">     Matt</div>
<div class=""> </div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
Thank you.<br class="">
<br class="">
><span class="Apple-converted-space"> </span><br class="">
>   Thanks,<br class="">
><span class="Apple-converted-space"> </span><br class="">
>     Matt<br class="">
> <span class="Apple-converted-space"> </span><br class="">
> > Regards<br class="">
> > --<br class="">
> > jeremy theler<br class="">
> ><span class="Apple-converted-space"> </span><a href="http://www.seamplex.com/" rel="noreferrer" target="_blank" class="">www.seamplex.com</a><br class="">
> ><span class="Apple-converted-space"> </span><br class="">
> ><span class="Apple-converted-space"> </span><br class="">
><span class="Apple-converted-space"> </span><br class="">
><span class="Apple-converted-space"> </span><br class="">
><span class="Apple-converted-space"> </span><br class="">
<br class="">
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
--<span class="Apple-converted-space"> </span><br class="">
<div dir="ltr" class="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener</div>
<div class=""><br class="">
</div>
<div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</body>
</html>