<div class="gmail_quote">On Wed, Dec 21, 2011 at 19:16, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
You could do this. Sounds reasonable.</blockquote></div><div><br></div>Done:<div><br></div><div><a href="http://petsc.cs.iit.edu/petsc/petsc-dev/rev/918daef122af">http://petsc.cs.iit.edu/petsc/petsc-dev/rev/918daef122af</a></div>
<div><br></div><div><br></div><div>Now what is going on with this (apparent) debugging code virs.c:424 and virsaug.c:1183 (<a href="http://petsc.cs.iit.edu/petsc/petsc-dev/rev/31c8ce">http://petsc.cs.iit.edu/petsc/petsc-dev/rev/31c8ce</a>):</div>
<div><br></div><div><div> ierr = MatFindNonzeroRows(jac_inact_inact,&keptrows);CHKERRQ(ierr);</div><div> if (0 && keptrows) {</div><div> PetscInt cnt,*nrows,k;</div><div> const PetscInt *krows,*inact;</div>
<div> PetscInt rstart=jac_inact_inact->rmap->rstart;</div><div><br></div><div> ierr = MatDestroy(&jac_inact_inact);CHKERRQ(ierr);</div><div> ierr = ISDestroy(&IS_act);CHKERRQ(ierr);</div>
<div><br></div><div> ierr = ISGetLocalSize(keptrows,&cnt);CHKERRQ(ierr);</div><div> ierr = ISGetIndices(keptrows,&krows);CHKERRQ(ierr);</div><div> ierr = ISGetIndices(IS_inact,&inact);CHKERRQ(ierr);</div>
<div> ierr = PetscMalloc(cnt*sizeof(PetscInt),&nrows);CHKERRQ(ierr);</div><div> for (k=0; k<cnt; k++) {</div><div> nrows[k] = inact[krows[k]-rstart];</div><div> }</div><div> ierr = ISRestoreIndices(keptrows,&krows);CHKERRQ(ierr);</div>
<div> ierr = ISRestoreIndices(IS_inact,&inact);CHKERRQ(ierr);</div><div> ierr = ISDestroy(&keptrows);CHKERRQ(ierr);</div><div> ierr = ISDestroy(&IS_inact);CHKERRQ(ierr);</div><div> </div><div>
ierr = ISCreateGeneral(PETSC_COMM_WORLD,cnt,nrows,PETSC_OWN_POINTER,&IS_inact);CHKERRQ(ierr);</div><div> ierr = ISComplement(IS_inact,F->map->rstart,F->map->rend,&IS_act);CHKERRQ(ierr);</div>
<div> ierr = MatGetSubMatrix(snes->jacobian,IS_inact,IS_inact,MAT_INITIAL_MATRIX,&jac_inact_inact);CHKERRQ(ierr);</div><div> }</div><div> ierr = DMSetVI(snes->dm,IS_inact);CHKERRQ(ierr);</div><div> /* remove later */</div>
</div><div><br></div><div><br></div><div>This (a) leaks keptrows and (b) doesn't do anything useful because of the if (0 && ...). What's the idea here?</div>