On Tue, Apr 19, 2011 at 6:19 PM, Jed Brown <jed at 59a2.org> wrote: > On Wed, Apr 20, 2011 at 00:35, Ethan Coon <ecoon at lanl.gov> wrote: > >> Ok, here's a patch that does the very very special case of: >> >> p=P=1, s > p, DMDA_BOUNDARY_PERIODIC in the z-direction. >> >> Note this is really only possible in the z-direction... >> > > That is the case that you usually want, otherwise DMDAVecGetArray has > rather inefficient indexing. > > >> when in the >> z-direction, we can just check if the global index < 0 or > x*y*z and >> adjust appropriately. So this can't generalize to x- or y- directions >> (though it could do the y-direction in the 2D case, allowing one to do >> 1D problems in a 2D algorithm?) >> >> Compared to the rest of the cruft in da3.c and how non-general the >> global index generation is overall, it's not actually that ugly... >> > > We should all go unstructured for everything. Then we would have already > paid the storage cost of heavier data structures so many of the special > cases go away. :-) > > I did this already in src/dm/impls/cartesian, but we don't want to depend on Boost for the data structure. I will rewrite this with a simple multiindex container in PETSc when I get a chance. Once this is done, the code is very very simple to construct the scatter.
Matt > >> I've tested with s=2 and 3, BOX and STAR, and the indices look right >> (i.e. they are identical in the z-dimension). But it's ugly, so please >> test with your stuff too Jed. >> > > It seems to be working with Andrew's MHD code so I've pushed your > patch. Thank you Ethan. > > Andrew, your code is running now with NZ=1. Your function evaluation still > evaluates to zero so SNESSolve is not doing any iterations. I assume there > is some other step to turn on your source terms. > -- 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110419/4ecfd6c0/attachment.html>