<div dir="ltr"><div dir="ltr"><div>this refinement seems to work pretty well for what I was looking for. </div><div>still testing... but tetgen seems to load these  background mesh files at the higher resolution to guide the refinement?</div><div><br></div><div><div>$ tetgen -Vrmqk coarse.1.node</div><div>Opening coarse.1.node.</div><div>Opening coarse.1.ele.</div><div>Opening coarse.1.face.</div><div>Opening coarse.1.b.node.</div><div>Opening coarse.1.b.ele.</div><div>Opening coarse.1.b.mtr.</div></div><div>.</div><div>.</div><div><br></div><div>do you think a reasonable approach would be for me work with two meshes in petsc? a coarse and fine mesh. and load a uniformly refined fine dmplex mesh as the background mesh?</div><div><br></div><div><a href="https://bitbucket.org/petsc/ctetgen/src/8ca66eb7de95b82f7969984bab6aacada6626b1d/ctetgen.c?at=master&fileviewer=file-view-default#ctetgen.c-22245">https://bitbucket.org/petsc/ctetgen/src/8ca66eb7de95b82f7969984bab6aacada6626b1d/ctetgen.c?at=master&fileviewer=file-view-default#ctetgen.c-22245</a><br></div><div><br></div><div><img src="cid:ii_jufbqqfx0" alt="Screen Shot 2019-04-13 at 4.50.06 AM.png" width="562" height="484"><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 8, 2019 at 11:29 AM David Fuentes <<a href="mailto:fuentesdt@gmail.com">fuentesdt@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">sounds great! i've been working out of this guy - <a href="https://github.com/fuentesdt/thermoembo" target="_blank">https://github.com/fuentesdt/thermoembo</a></div><div dir="ltr"><br></div><div dir="ltr">and loading vtk data for the segmentation:  <a href="https://github.com/fuentesdt/thermoembo/blob/master/tutorials/exac.c#L50" target="_blank">https://github.com/fuentesdt/thermoembo/blob/master/tutorials/exac.c#L50</a><br></div><div><br></div><div>I can clean this up and separate into relevant directories ? or start an new repo? which ever you prefer. </div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jan 8, 2019 at 11:20 AM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Jan 7, 2019 at 4:27 PM David Fuentes <<a href="mailto:fuentesdt@gmail.com" target="_blank">fuentesdt@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">ha! thanks for you time on this Matt. I'm trying to generate a mesh from image segmentation data.<div>I would like to use an image segmentation to guide the refinement. Figure 25 of this paper - <a href="https://www.ices.utexas.edu/media/reports/2017/1707.pdf" target="_blank">https://www.ices.utexas.edu/media/reports/2017/1707.pdf</a></div></div></div></blockquote><div><br></div><div>Very cool. We can do that. Lets make an example and iterate. Want to make a repo you control? I will</div><div>stick in a PETSc example that refines meshes (maybe Plex ex19), and we can experiment with both p4est</div><div>and Pragmatic (installation of those is hardest part :) This sounds great.</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><div dir="ltr">On Mon, Jan 7, 2019 at 2:53 PM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Jan 7, 2019 at 11:41 AM David Fuentes <<a href="mailto:fuentesdt@gmail.com" target="_blank">fuentesdt@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>thanks Matt,</div><div><br></div><div>I posted a slightly modified example</div><div><br></div><div><a href="https://github.com/fuentesdt/dmplexrefinement/blob/master/ex45.c" target="_blank">https://github.com/fuentesdt/dmplexrefinement/blob/master/ex45.c</a></div><div><br></div><div>and changes from the orginal</div><div><br></div><div><a href="https://github.com/fuentesdt/dmplexrefinement/blob/master/refinement.diff" target="_blank">https://github.com/fuentesdt/dmplexrefinement/blob/master/refinement.diff</a></div><div><br></div><div><br></div><div>This is what I'm seeing</div><div><br></div><div><a href="https://github.com/fuentesdt/dmplexrefinement/blob/master/paraview.png" target="_blank">https://github.com/fuentesdt/dmplexrefinement/blob/master/paraview.png</a></div><div><br></div><div><br></div><div>I'm refining based on this element centroid:</div><div><br></div><div><a href="https://github.com/fuentesdt/dmplexrefinement/blob/master/testcentroid.stl" target="_blank">https://github.com/fuentesdt/dmplexrefinement/blob/master/testcentroid.stl</a></div><div><br></div><div>unrefined - <a href="https://github.com/fuentesdt/dmplexrefinement/blob/master/unrefined.vtu" target="_blank">https://github.com/fuentesdt/dmplexrefinement/blob/master/unrefined.vtu</a></div><div><br></div><div>refined - <a href="https://github.com/fuentesdt/dmplexrefinement/blob/master/refined.vtu" target="_blank">https://github.com/fuentesdt/dmplexrefinement/blob/master/refined.vtu</a></div><div><br></div><div><br></div><div>Maybe I don't understand the refinement algorithm, but the refinement is a little offset from what I was expecting.</div></div></div></blockquote><div><br></div><div>Okay, I have that working. I will make a branch and put this in it. For right now, I attach ex45.c (but it will not run since I put in stuff to take lower/upper from the command line). 3D refinement just sucks, but you can see it is refining cell 7, not 8. Its just that refinement</div><div>propagates a long, long way.</div><div><br></div><div>I have pretty much abandoned this type of refinement since it will not work in parallel, and the mesh generator</div><div>interface is poor. I am transitioning everything to</div><div><br></div><div>  - uniform refinement (ha!)</div><div>  - cell marking (p4est likes this)</div><div>  - metric tensor (Pragmatic likes this)</div><div><br></div><div>I have some routines to convert marking <--> metric but they are not perfect I think. I can try and help do what you want with</div><div>AMR if I have a better idea what it is.</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><br></div><div>Also, can you pass an application context to the user refinement function ?</div><div><br></div><div><a href="https://github.com/fuentesdt/dmplexrefinement/blob/master/ex45.c#L119" target="_blank">https://github.com/fuentesdt/dmplexrefinement/blob/master/ex45.c#L119</a></div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 3, 2019 at 7:49 AM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Jan 2, 2019 at 7:28 PM David Fuentes via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi,<br></div><div><div><br></div><div>Starting with TS example 45</div><div><br></div><div>$ pwd</div><div>/opt/apps/PETSc/petsc-3.10.2</div><div>$ ls src/ts/examples/tutorials/ex45.c</div><div>src/ts/examples/tutorials/ex45.c</div><div><br></div><div>petsc configured with: ./config/configure.py --with-shared-libraries --with-clanguage=c++ --CFLAGS='-g -O0' --CXXFLAGS='-g -O0'  --with-c2html=0 --download-ctetgen  --download-triangle --with-debugging=yes --download-netcdf  --download-zlib  --download-exodusii --download-hdf5 --download-pnetcdf</div><div><br></div><div>I'm trying to refine the DMPlexCreateBoxMesh  with the DMPlexSetRefinementFunction.</div><div>It generally seems to be working, except that the refined element is slightly offset from what I was expecting.</div><div>Based on my application specific criteria, element id number 7 is flagged to be refined by the DMPlexSetRefinementFunction but when I open in paraview, it looks like element id number 8 is being refined. See attached pic.</div><div><br></div><div><div><img alt="Screen Shot 2019-01-02 at 6.02.02 PM.png" width="224" height="68" style="margin-right: 0px;"><br></div><div><img alt="Screen Shot 2019-01-02 at 6.02.11 PM.png" width="224" height="75" style="margin-right: 0px;"><br></div></div><div><br></div><div>Is it possible that the maxVolumes array is 'off by one' when transfering to tetgen data structures somehow ?</div></div></div></div></blockquote><div><br></div><div>I looked through and cannot see it by eye. Could you send me your modified example and I will walk through it with the</div><div>debugger?</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><div><a href="https://bitbucket.org/petsc/petsc/src/bd27d3f284687498e4c4678d234c0e308a5bc236/src/dm/impls/plex/plexadapt.c?at=master&fileviewer=file-view-default#plexadapt.c-252" target="_blank">https://bitbucket.org/petsc/petsc/src/bd27d3f284687498e4c4678d234c0e308a5bc236/src/dm/impls/plex/plexadapt.c?at=master&fileviewer=file-view-default#plexadapt.c-252</a></div><div><br></div><div><br></div><div><br></div><div>(gdb) bt</div><div>#0  DMPlexRefine_CTetgen (dm=0x932180, maxVolumes=0x919710, dmRefined=0x7fffffffb938) at /opt/apps/PETSc/petsc-3.10.2/src/dm/impls/plex/generators/ctetgen/ctetgenerate.c:182</div><div>#1  0x00007ffff6b76401 in DMPlexRefine_Internal (dm=0x932180, adaptLabel=0x0, dmRefined=0x7fffffffb938) at /opt/apps/PETSc/petsc-3.10.2/src/dm/impls/plex/plexadapt.c:252</div><div>#2  0x00007ffff6b72720 in DMRefine_Plex (dm=0x932180, comm=0x6b, dmRefined=0x7fffffffb938) at /opt/apps/PETSc/petsc-3.10.2/src/dm/impls/plex/plexrefine.c:10361</div><div>#3  0x00007ffff6dad8ff in DMRefine (dm=0x932180, comm=0x6b, dmf=0x7fffffffb938) at /opt/apps/PETSc/petsc-3.10.2/src/dm/interface/dm.c:1808</div><div>#4  0x0000000000405274 in CreateMesh (comm=0x7ffff5891680 <ompi_mpi_comm_world>, dm=0x7fffffffb9d0, ctx=0x7fffffffba00) at /rsrch1/ip/dtfuentes/github/thermoembo/tutorials/exac.c:253</div><div>#5  0x00000000004063c4 in main (argc=32, argv=0x7fffffffdb68) at /rsrch1/ip/dtfuentes/github/thermoembo/tutorials/exac.c:336</div></div><div><br></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-5461759504175364436gmail-m_2899274837606623965gmail-m_7580473505488073867gmail-m_6917394882812334095gmail-m_705927680672223488gmail-m_-3547449316338932709gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-5461759504175364436gmail-m_2899274837606623965gmail-m_7580473505488073867gmail-m_6917394882812334095gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-5461759504175364436gmail-m_2899274837606623965gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div>