[petsc-users] ISAllGather withoutduplicates
Matthew Knepley
knepley at gmail.com
Fri Feb 17 13:54:29 CST 2012
On Fri, Feb 17, 2012 at 1:46 PM, Blaise Bourdin <bourdin at lsu.edu> wrote:
> Hi,
>
> Is there an easy way to gather all values of an IS across all processes in
> a communicator while removing duplicates?
>
> Basically, I want to go from
> [0] Number of indices in set 2
> [0] 0 1
> [0] 1 2
> [1] Number of indices in set 2
> [1] 0 2
> [1] 1 3
>
> to
> [0] Number of indices in set 3
> [0] 0 1
> [0] 1 2
> [0] 2 3
> [1] Number of indices in set 3
> [1] 0 1
> [1] 1 2
> [1] 2 3
>
> The way I do it right now is
> ierr = ISGetTotalIndices(csIS,&labels);CHKERRQ(ierr);
> ierr = ISGetSize(csIS,&num_cs_global);CHKERRQ(ierr);
>
I would violate PETSc semantics here since you are going to destroy csIS
anyway:
PetscSortRemoveDupsInt(&num_cs_global, labels);
ISCreateGeneral(comm, num_cs_global, labels, PETSC_COPY_VALUES,
&csIS_global);
> ierr = ISRestoreTotalIndices(csIS,&labels);CHKERRQ(ierr);
>
Matt
>
> Blaise
> --
> Department of Mathematics and Center for Computation & Technology
> Louisiana State University, Baton Rouge, LA 70803, USA
> Tel. +1 (225) 578 1612, Fax +1 (225) 578 4276
> http://www.math.lsu.edu/~bourdin
>
>
>
>
>
>
>
>
--
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-users/attachments/20120217/a2587f90/attachment-0001.htm>
More information about the petsc-users
mailing list