[petsc-users] Petsc Matrix modifications

Matthew Knepley knepley at gmail.com
Tue Nov 26 09:00:27 CST 2019


On Tue, Nov 26, 2019 at 8:04 AM Brandon Denton <bldenton at buffalo.edu> wrote:

> Good Morning,
>
> Is it possible to expand a matrix in petsc? I current created and loaded a
> matrix (6 x 5) which holds information required later in my program. I
> would like to store additional information in the matrix by expanding its
> size, let's say make it at 10 x 5 matrix. How is this accomplished in
> petsc. When I try to use MatSetSize() or MatSetValue() my code throws
> errors. What is the process for accomplishing this?
>

Normally if you change the size, you just make a new object. If you really
want to retain the same pointer
because it is being held by other objects, you can call MatReset() and
rebuild the matrix completely, but
I normally would not do this.

  Thanks,

    Matt


> Thank you in advance for your time.
> Brandon
>
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20191126/e7c638a2/attachment.html>


More information about the petsc-users mailing list