Thank you Peter 在2022年11月5日星期六 UTC+8 15:21:42<peterr...@gmail.com> 写道:
> If it is not too expensive, I would copy the block vector to the normal > distributed vector. For this purpose, I use functions like these: > > ``` > template <typename VectorType, typename BlockVectorType> > void > split_up_components_fast(const VectorType &src, BlockVectorType &dst) > { > for (unsigned int i = 0, j = 0; > i < src.get_partitioner()->locally_owned_size(); > ++j) > for (unsigned int b = 0; b < dst.n_blocks(); ++b) > dst.block(b).local_element(j) = src.local_element(i++); > } > > template <typename VectorType, typename BlockVectorType> > void > merge_components_fast(const BlockVectorType &src, VectorType &dst) > { > for (unsigned int i = 0, j = 0; > i < dst.get_partitioner()->locally_owned_size(); > ++j) > for (unsigned int b = 0; b < src.n_blocks(); ++b) > dst.local_element(i++) = src.block(b).local_element(j); > } > ``` > > However, you have make sure that the DoFs are enumerated consistently for > LinearAlgebra::distributed::Vector. > > Peter > On Saturday, 5 November 2022 at 07:21:40 UTC+1 yy.wayne wrote: > >> Hello, >> >> I assembled a matrix for a multi-component problem. I want to solve it >> with a direct solver, but neither Trilinos solver(SolverDirect amesos_klu) >> nor SparseDirectUMFPACK solver receive a >> LinearAlgebra::distributed::BlockVector as input. The Trilinos direct >> solver receives Vector and BlockVector, while SparseDirectUMFPACK solver >> receives LinearAlgebra::distributed::Vector. What direct solver should I >> use? >> > -- 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/4a658f2c-38b4-4226-8b48-cab11a515aadn%40googlegroups.com.