On Fri, Feb 17, 2012 at 1:46 PM, Blaise Bourdin <span dir="ltr">&lt;<a href="mailto:bourdin@lsu.edu">bourdin@lsu.edu</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
Is there an easy way to gather all values of an IS across all processes in a communicator while removing duplicates?<br>
<br>
Basically, I want to go from<br>
[0] Number of indices in set 2<br>
[0] 0 1<br>
[0] 1 2<br>
[1] Number of indices in set 2<br>
[1] 0 2<br>
[1] 1 3<br>
<br>
to<br>
[0] Number of indices in set 3<br>
[0] 0 1<br>
[0] 1 2<br>
[0] 2 3<br>
[1] Number of indices in set 3<br>
[1] 0 1<br>
[1] 1 2<br>
[1] 2 3<br>
<br>
The way I do it right now is<br>
  ierr = ISGetTotalIndices(csIS,&amp;labels);CHKERRQ(ierr);<br>
  ierr = ISGetSize(csIS,&amp;num_cs_global);CHKERRQ(ierr);<br></blockquote><div><br></div><div>I would violate PETSc semantics here since you are going to destroy csIS anyway:</div><div><br></div><div>  PetscSortRemoveDupsInt(&amp;num_cs_global, labels);</div>
<div>  ISCreateGeneral(comm, num_cs_global, labels, PETSC_COPY_VALUES, &amp;csIS_global);</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  ierr = ISRestoreTotalIndices(csIS,&amp;labels);CHKERRQ(ierr);<br></blockquote><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888">
<br>
Blaise<br>
--<br>
Department of Mathematics and Center for Computation &amp; Technology<br>
Louisiana State University, Baton Rouge, LA 70803, USA<br>
Tel. <a href="tel:%2B1%20%28225%29%20578%201612" value="+12255781612">+1 (225) 578 1612</a>, Fax  <a href="tel:%2B1%20%28225%29%20578%204276" value="+12255784276">+1 (225) 578 4276</a> <a href="http://www.math.lsu.edu/~bourdin" target="_blank">http://www.math.lsu.edu/~bourdin</a><br>

<br>
<br>
<br>
<br>
<br>
<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>