"This. I don't see a different way of doing things. Though I might just always create both objects and then call distribute_local_to_global() with one or the other matrix object, depending on your run-time flags. "
Your approach sounds more reasonable than copying data back and forth at every Newton step for a possibly large linear system. 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? Best Simon Wolfgang Bangerth schrieb am Montag, 18. Dezember 2023 um 18:03:13 UTC+1: > On 12/18/23 04:47, Simon wrote: > > > > Can you think of an elegant solution or must the non-zero values be > copied via > > a loop > > over the individual blocks? > > This. I don't see a different way of doing things. Though I might just > always > create both objects and then call distribute_local_to_global() with one or > the > other matrix object, depending on your run-time flags. > > 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 dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/9b61d0e7-6ea3-4db9-aa6a-578304bee319n%40googlegroups.com.