[petsc-users] How to automatically create many Petsc matrices with similar names(A1, A2, A3....)?
Matthew Knepley
knepley at gmail.com
Wed Dec 21 14:33:33 CST 2016
On Wed, Dec 21, 2016 at 2:30 PM, Fangbo Wang <fangbowa at buffalo.edu> wrote:
> Hi,
>
> *Background:*
> I have a global matrix (sparse) which is very large (2 million by
> million), it is generated from local block matrix with size around 30,000
> by 30,000 (also sparse) using stochastic galerkin projection method.
>
> In the global matrix, I have 700 local block matrices which most of them
> are similar. At the end of the day, I only need to save 45 different local
> block matrices which can save a lot of memory than saving the global matrix.
>
> *my problem:*
> I don't want to mannually create 45 petsc matrices with similar names, for
> example, A1, A2, A3, A4, etc. I want to automatically create these
> matrices and be able to call these matrices according to its name.
>
> Any one have experiences on this? Thank you very much.
>
Try using
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateNest.html#MatCreateNest
although its usually intended for s smaller number of block matrices.
Matt
Fangbo Wang
>
> --
> Fangbo Wang, PhD student
> Stochastic Geomechanics Research Group
> Department of Civil, Structural and Environmental Engineering
> University at Buffalo
> Email: *fangbowa at buffalo.edu <fangbowa at buffalo.edu>*
>
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20161221/c93befd5/attachment.html>
More information about the petsc-users
mailing list