I have some experience with the direct solvers of Trilinos and it requires 
very few modifications to change the assembly to a SparseMatrix instead of 
a BlockSparseMatrix for vector valued problems.
Especially the assembly with distribute_local_to_global does not actually 
care apart from the matrix type provided to the method. 

So you could try to work with some form of pointer, e.g. shared_ptr (which 
allows for checking initialization etc.) together with a switch for direct 
vs. iterative.
Then give both pointers to the assembly class and depending on the switch 
call distribute_local_to_global on one or the other. 
This way only one matrix would actually need memory. Same would go for the 
vector classes.

The main difference is that you don't extract the views of the local and 
relevant dof index sets into a vector of sets 
but just keep it as is in the sparsity pattern etc. 

If you have any further questions on this don't hesitate to ask! 
Best 
Philipp

On Monday, December 18, 2023 at 10:37:41 PM UTC+1 Wolfgang Bangerth wrote:

>
> 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 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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/4bf0654b-c84a-4592-a852-35a9e0fc52a5n%40googlegroups.com.

Reply via email to