What I have done in several codes (and what is used in ASPECT), is to always 
create block matrices and vectors but to put all DoFs into a single block when 
a direct solver is used. This decision can be made at rintime. Inside the solve 
routine you can just access block_matrix.block(0,0), which is a SparseMatrix. 
Same for the vector. This way, there are no different code paths, different 
types, or copies involved.

--
Timo Heister
http://www.math.clemson.edu/~heister/
________________________________
From: [email protected] <[email protected]> on behalf of Wolfgang 
Bangerth <[email protected]>
Sent: Monday, December 18, 2023 4:37:34 PM
To: [email protected] <[email protected]>
Subject: Re: [deal.II] construct TrilinosWrappers::SparseMatrix from 
TrilinosWrappers::BlockSparseMatrix to use Amesos direct solver

This Message Is From An External Sender: Use caution when opening links or 
attachments if you do not recognize the sender.

On 12/18/23 12:44, Simon wrote:
>
> I use a BlockSolver for the solution and right hand side of the
> linear system to compute the various norms (non-linear solver) of the
> the individual blocks. For a direct solver, I would now use a
> SparseMatrix as matrix type and a BlockVector as vector type. At each
> solve, I convert the BlockVector to a standard Vector, which I guess
> is not too expensive. This mix (SparseMatrix and BlockVector) should
> not cause any undue problems, right? Or would you not recommend
> this?
No. This seems like a reasonable approach to me.
Best
  W.

--
The deal.II project is located at 
https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.dealii.org%2F&data=05%7C02%7Cheister%40clemson.edu%7Cb26c1543ea3f4a770d1a08dc00118fcd%7C0c9bf8f6ccad4b87818d49026938aa97%7C0%7C0%7C638385322953674220%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=FCQhyskq54Y%2B9Uc7oyauIeXMsI5CLzO12RE%2FCDG1w3Y%3D&reserved=0<http://www.dealii.org/>
For mailing list/forum options, see 
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fforum%2Fdealii%3Fhl%3Den&data=05%7C02%7Cheister%40clemson.edu%7Cb26c1543ea3f4a770d1a08dc00118fcd%7C0c9bf8f6ccad4b87818d49026938aa97%7C0%7C0%7C638385322953674220%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=QKshKRkLcezx3WBxZW4FajigvudlynOE6GClmS9nNnY%3D&reserved=0<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 [email protected].
To view this discussion on the web visit 
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fdealii%2F15994792-761a-4899-b7e6-af2fc6ba2932%2540colostate.edu&data=05%7C02%7Cheister%40clemson.edu%7Cb26c1543ea3f4a770d1a08dc00118fcd%7C0c9bf8f6ccad4b87818d49026938aa97%7C0%7C0%7C638385322953674220%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=Lmjub869SyEbNQ5DTAN4RNnzG41%2B2XEWpPs6s97c9OU%3D&reserved=0<https://groups.google.com/d/msgid/dealii/15994792-761a-4899-b7e6-af2fc6ba2932%40colostate.edu>.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/BN7PR06MB52830E6E62C7A6C6AE09546EA197A%40BN7PR06MB5283.namprd06.prod.outlook.com.

Reply via email to