changing array from ISGetIndices

Barry Smith bsmith at mcs.anl.gov
Fri Sep 12 16:17:13 CDT 2008


On Sep 12, 2008, at 3:09 PM, Andrew T Barker wrote:

>
> The man page for ISGetIndices says "The user should NOT change the  
> indices."  But in this example
>
> http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/dm/ao/examples/tutorials/ex2.c.html
>
> around line 507 you do change indices you get from ISGetIndices.

     This is technically a bug, but since the IS is destroyed  
immediately afterwards, this should not cause a crash.

>  I'm trying to adapt this example to my own needs and am wondering  
> if this may be causing me problems.  In particular I go through this  
> section of code twice (to partition two chunks of data) and the  
> second time the ISCreateBlock makes a segfault.

     Whether this causes the problem or not depends on exactly what  
you are doing, if you are use the same IS etc.

     Recommend simply running in the debugger to see why it is  
crashing. Run the program with -start_in_debugger

    Barry

I will fix petsc-dev so that ISGetIndices() uses a const and so the  
code will automatically detect this illegal use.

>
>
> Thanks,
>
> Andrew
>
> ---
> Andrew T. Barker
> andrew.barker at colorado.edu
> Applied Math Department
> University of Colorado, Boulder
> 526 UCB, Boulder, CO 80309-0526
>
>
>




More information about the petsc-users mailing list