[petsc-users] Calculating the PETSc index of a DMComposite vector

Jed Brown jedbrown at mcs.anl.gov
Wed Nov 13 16:37:38 CST 2013


Anush Krishnan <anush at bu.edu> writes:

>>
>> > [1] Suppose my body moves, and the positions of the body points change,
>> > will I have to completely deallocate C^T and reallocate the new rows on
>> > each process? It's possible that the number of non-zeros on each process
>> > can change. What would you suggest as the best strategy to do this?
>>
>> Just create a new matrix.
>>
>
> Is this done using MatDestroy and MatCreate? I would need to do this at
> every timestep. And suppose C^T was part of a bigger matrix Q = [G C^T],
> and I only needed to change C^T (which has much fewer columns and non-zeros
> compared to G) at every time step, is it possible to handle that separately?

MatCreate is cheap compared to communicating entries, which is usually
cheap compared to a solve or a matrix-matrix multiply.  If I were
writing this and was concerned about performance or memory use, I would
assemble Q in one shot, rather than assembling the pieces like you do.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131113/ad218470/attachment.pgp>


More information about the petsc-users mailing list