<div class="gmail_quote">On Tue, Jan 10, 2012 at 03:45, Thomas Witkowski <span dir="ltr">&lt;<a href="mailto:Thomas.Witkowski@tu-dresden.de">Thomas.Witkowski@tu-dresden.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;m about to implement the multigrid preconditioner for my FEM code for the case of regulare 2D triangular meshes. My meshes have a union jack pattern, thus the nodes are equidistributed in both directions but the stencil varies between a 9-point and a 5-point stencil. Is it possible to fit this into the DMDA framework?</blockquote>
</div><br><div>It&#39;s not easy to make DMCreateMatrix() preallocate for this arrangement, but you can overallocate (all 9-point), useĀ </div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMSetMatrixPreallocateOnly.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMSetMatrixPreallocateOnly.html</a></div>
<div><br></div><div>and then assemble what you have. The resulting matrix will be compacted so that the used part is contiguous, so the run-time performance will be the same as with perfect preallocation (but needed to allocate slightly more memory).</div>