DMDAVecGetArray() works with either a DMDA local or global vector (of course giving ghost point access only with a local vector). To prevent this issue we could have DMDAVecLocalGetArray() and DMDAVecGlobalGetArray() and have each generate useful error messages if the appropriate vector is not passed in. Of course even with this extra level of handholding it won't stop someone from accessing v[j][i] etc with out of bounds array indices.
Barry > On Dec 1, 2014, at 3:00 PM, Jed Brown <[email protected]> wrote: > > Bishesh Khanal <[email protected]> writes: >> Ok, I now see that KSPGetSolution(ksp, &x) gives a GLOBAL vector in x and >> not a local vector; hence the runtime memory error above since I can't >> access ghost values in indices such as [i-1] wth the global vec. >> Was there any reason not to make this information explicit in the docs to >> prevent the confusion I had ? Or should it have been obvious to me and that >> I'm missing something here ? > > Adding to Dave's comment, KSP has no concept of a "local vector". That > is a DM concept.
