[petsc-dev] [petsc-users] About MAT_NEW_NONZERO_LOCATION[]

Patrick Sanan patrick.sanan at gmail.com
Tue Oct 13 11:36:15 CDT 2020


So we can just take the advice out of the manual about setting this, since it's the default behavior?
https://gitlab.com/petsc/petsc/-/merge_requests/3344


> Am 13.10.2020 um 16:41 schrieb Barry Smith <bsmith at petsc.dev>:
> 
> 
>   You only need to provide one of the options. 
> 
>    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.
> 
>    Barry
> 
>> On Oct 13, 2020, at 7:47 AM, Thibaut Appel <t.appel17 at imperial.ac.uk <mailto:t.appel17 at imperial.ac.uk>> wrote:
>> 
>> Hi there, just a quick question:
>> 
>> 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.
>> 
>> However the manual states:
>> 
>> '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,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE); 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'
>> 
>> If I only declare:
>> 
>>     CALL MatSetOption(MatA,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE,ierr)
>> 
>> Would the data structures still be reused in later matrix assemblies?
>> 
>> Or does it rather make sense to use conjointly:
>> 
>>     CALL MatSetOption(MatA,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE,ierr)
>>     CALL MatSetOption(MatA,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE,ierr)
>> 
>> Thank you,
>> 
>> 
>> 
>> Thibaut
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20201013/947e40d1/attachment.html>


More information about the petsc-dev mailing list