HOW TO OUTPUT SYSTEM MATRIX IN A FILE

17 views
Skip to first unread message

孙翔

unread,
Jul 28, 2020, 2:11:20 PM7/28/20
to deal.II User Group
Hi, I followed step-17 and build a system matrix of which type is PETScWrappers::MPI::SparseMatrix. I want to output it after assembling. How should I do it? Thank you very much. 

Best,

Xiang

Wolfgang Bangerth

unread,
Jul 29, 2020, 12:59:43 PM7/29/20
to dea...@googlegroups.com
If performance doesn't matter, just loop over all indices i and j and output
the value of the matrix. If you're running in parallel, you need to restrict
the loop over i to the locally owned range.

Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Daniel Arndt

unread,
Jul 29, 2020, 3:31:30 PM7/29/20
to dea...@googlegroups.com
Of course, there is also PETScWrappers::MatrixBase::print(https://www.dealii.org/current/doxygen/deal.II/classPETScWrappers_1_1MatrixBase.html#a7515e640202d1ad50bd9baa13c404cb1) that should work.

Best,
Daniel
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/879a7ef3-7c13-8142-d970-773e3a57e470%40colostate.edu.

Wolfgang Bangerth

unread,
Jul 29, 2020, 3:37:33 PM7/29/20
to dea...@googlegroups.com

孙翔

unread,
Aug 2, 2020, 2:24:47 AM8/2/20
to deal.II User Group
Thank you very much. 

孙翔

unread,
Aug 2, 2020, 2:25:35 AM8/2/20
to deal.II User Group
Thank you very much. 


On Wednesday, 29 July 2020 12:31:30 UTC-7, Daniel Arndt wrote:
Of course, there is also PETScWrappers::MatrixBase::print(https://www.dealii.org/current/doxygen/deal.II/classPETScWrappers_1_1MatrixBase.html#a7515e640202d1ad50bd9baa13c404cb1) that should work.

Best,
Daniel

Am Mi., 29. Juli 2020 um 12:59 Uhr schrieb Wolfgang Bangerth <bang...@colostate.edu>:
On 7/28/20 12:11 PM, 孙翔 wrote:
> Hi, I followed step-17 and build a system matrix of which type
> is PETScWrappers::MPI::SparseMatrix. I want to output it after assembling. How
> should I do it? Thank you very much.

If performance doesn't matter, just loop over all indices i and j and output
the value of the matrix. If you're running in parallel, you need to restrict
the loop over i to the locally owned range.

Best
  W.


--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 bang...@colostate.edu
                            www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dea...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages