[petsc-dev] questions on new include organization

Jed Brown jedbrown at mcs.anl.gov
Wed Feb 13 07:41:08 CST 2013


On Wed, Feb 13, 2013 at 7:31 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:

> > 1) ISGetIndices(is,int group_number, &indices) gives the indices for a
> group or
> >
> > So by convention, group 0 is "offset" and group 1 is "size"?
>
>    No, group_number is the number of the clump. and indices are all the
> values in that clump


Then you need to also access the size of the clump, but since the primary
purpose is for indexing into another array, you have to copy out a buffer
(thus requiring a matching Restore). When using (int) -> (offset, size), we
get direct access. It makes this inner loop code a lot simpler and faster.
Consider DMPlexPointLocalRef(), which is effectively

  ierr =
PetscSectionGetOffset(dm->defaultGlobalSection,point,&offset);CHKERRQ(ierr);
  *(PetscScalar**)ptr = (start >= 0) ? array + start - dm->map->rstart :
NULL;

This gives read+write access to that piece of the array. If
PetscSectionGetOffset instead returned discontiguous indices, we'd need a
work buffer and copy-back semantics, or we'd need to push that unstructured
indexing burden onto the user.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130213/26876249/attachment.html>


More information about the petsc-dev mailing list