<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div>So we can just take the advice out of the manual about setting this, since it's the default behavior?</div><div><a href="https://gitlab.com/petsc/petsc/-/merge_requests/3344" class="">https://gitlab.com/petsc/petsc/-/merge_requests/3344</a></div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">Am 13.10.2020 um 16:41 schrieb Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>>:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div> You only need to provide one of the options. <div class=""><br class=""></div><div class=""> The docs are slightly misleading.The flags only tells the matrix what to do with new nonzero locations, preventing new ones. The Mat actually tracks if new non-zeros locations are actually entered independent of the flags. So, for example even if you did not supply any new flags AND your code did not insert new locations then the structure would be reused.</div><div class=""><br class=""></div><div class=""> Barry<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Oct 13, 2020, at 7:47 AM, Thibaut Appel <<a href="mailto:t.appel17@imperial.ac.uk" class="">t.appel17@imperial.ac.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" class="">
<div class=""><p class="">Hi there, just a quick question:</p><p class="">It seems MAT_NEW_NONZERO_LOCATION_ERR set to PETSC_TRUE has kind
of the same purpose as MAT_NEW_NONZERO_LOCATIONS set to
PETSC_FALSE, the difference being if an additional entry is there,
the former produces an error whereas in the latter it is simply
ignored.</p><p class="">However the manual states:</p><p class="">'If one wishes to repeatedly assemble matrices that retain the
same nonzero pattern (such as within a nonlinear
or time-dependent problem), the option
MatSetOption(MatA,<b class="">MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE</b>);
should be specified after the first matrix has been fully
assembled. This option ensures that certain data
structures and communication information will be reused (instead
of regenerated) during successive steps,
thereby increasing efficiency'</p><p class="">If I only declare:</p><p class=""> CALL
MatSetOption(MatA,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE,ierr)</p><p class="">Would the data structures still be reused in later matrix
assemblies?<br class="">
</p><p class="">Or does it rather make sense to use conjointly:</p><p class=""> CALL
MatSetOption(MatA,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE,ierr)<br class="">
CALL
MatSetOption(MatA,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE,ierr)<br class="">
</p><p class="">Thank you,<br class="">
</p><p class=""><br class="">
</p><p class="">Thibaut<br class="">
</p>
</div>
</div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></body></html>