[petsc-dev] What should MatReset() do?

Jed Brown jed at jedbrown.org
Fri Mar 6 16:41:20 CST 2015

Dmitry Karpeyev <karpeev at mcs.anl.gov> writes:
> This is trickier than it might appear: nonzerostate effectively counts the
> global number of nonzeros. The PC will rebuild if its state is stale, but
> it will reuse matrices (e.g., subdomain matrices in PCASM) if nonzerostate
> is up to date.  This works if the sparsity pattern never drops nonzeros,
> but that's no longer true if reset is allowed. I can reset a matrix,
> preallocate and assemble it so that the global number of nonzeros will be
> the same as before the resetting, but local sparsity patterns will change.
> This could happen, for example, when I have moving particles or, less
> exotically, when I have elastic contact and nodes move past each other.
> That will break PCASM.

On pretty simple and reliable solution would be to take a cryptographic
hash of the row/col arrays.  I assume BG is really atrocious at hashing,
but is it so bad that this is not viable?  (There are several places
where we use kinda fragile state counters or trust the user, but hashes
would make rebuilding more reliable and transparent.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150306/49e1edbe/attachment.sig>

More information about the petsc-dev mailing list