<div class="gmail_quote">On Fri, Feb 10, 2012 at 19:51, Dmitry Karpeev <span dir="ltr"><<a href="mailto:karpeev@mcs.anl.gov">karpeev@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">
<div>How does this explanation square with the following code from KSPSetUp?</div><div><br></div><div> if (ksp->dmActive && !ksp->setupstage) {</div><div> /* first time in so build matrix and vector data structures using DM */</div>
<div> if (!ksp->vec_rhs) {ierr = DMCreateGlobalVector(ksp->dm,&ksp->vec_rhs);CHKERRQ(ierr);}</div><div> if (!ksp->vec_sol) {ierr = DMCreateGlobalVector(ksp->dm,&ksp->vec_sol);CHKERRQ(ierr);}</div>
<div> ierr = DMCreateMatrix(ksp->dm,MATAIJ,&A);CHKERRQ(ierr);</div><div> ierr = KSPSetOperators(ksp,A,A,stflg);CHKERRQ(ierr); </div><div> ierr = PetscObjectDereference((PetscObject)A);CHKERRQ(ierr); </div>
<div> }</div></blockquote></div><br><div>Look down the page a little, DMComputeJacobian() is what actually assembles.</div><div><br></div><div><div> if (ksp->setupstage != KSP_SETUP_NEWRHS) {</div><div> ierr = KSPGetOperators(ksp,&A,&A,PETSC_NULL);CHKERRQ(ierr);</div>
<div> ierr = DMComputeJacobian(ksp->dm,PETSC_NULL,A,A,&stflg);CHKERRQ(ierr);</div><div> ierr = KSPSetOperators(ksp,A,A,stflg);CHKERRQ(ierr); </div><div> }</div></div><div><br></div>