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 <bsm...@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.appe...@imperial.ac.uk 
>> <mailto:t.appe...@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
>> 
> 

Reply via email to