Hi Daniel, thanks for your kind reply. I apologize for not giving more details about my code.
In the file where the global matrix (m33) and its sparsity pattern is created, I also include the declaration and initialization of the new matrix (m22). After that, the new matrix is of size 2x2 blocks. Then, I simply copy the sparsity pattern of each block of matrix m33 to the blocks of matrix m22 as: for (int i = 0; i < dim; i++) { for (int j = 0; j < dim; j++) { m22.block(i,j).reinit(m33.block(i+1,j+1).get_sparsity_pattern()); m22.block(i,j).copy_from(m33.block(i+1,j+1)); } } The error appears on the next step, when I try to initialize the preconditioner with matrix m22: SparseDirectUMFPACK preconditioner; preconditioner.initialize (A_mat, SparseDirectUMFPACK::AdditionalData()); The exact error message that I get in debug mode is the following: -------------------------------------------------------- An error occurred in line <272> of file </home/alex/Git/openfcst/openfcst/Build/contrib/deal.II/src/source/lac/sparse_direct.cc> in function void dealii::SparseDirectUMFPACK::factorize(const Matrix&) [with Matrix = dealii::BlockSparseMatrix<double>] The violated condition was: row_pointers[i] == Ap[i+1] The name and call sequence of the exception was: ExcInternalError() Additional Information: This exception -- which is used in many places in the library -- usually indicates that some condition which the author of the code thought must be satisfied at a certain point in an algorithm, is not fulfilled. An example would be that the first part of an algorithm sorts elements of an array in ascending order, and a second part of the algorithm later encounters an an element that is not larger than the previous one. There is usually not very much you can do if you encounter such an exception since it indicates an error in deal.II, not in your own program. Try to come up with the smallest possible program that still demonstrates the error and contact the deal.II mailing lists with it to obtain help. -------------------------------------------------------- I cannot understand why the initialization of the blocks of matrix m22 is not working properly.. Thanks for your help. Cheers, Alex On Monday, October 16, 2017 at 9:03:05 AM UTC-6, Daniel Arndt wrote: > > Alex, > > Hi all, >> >> I am having a similar problem. I want to take a 3x3 BlockSparseMatrix m33 >> and copy four of its blocks into a 2x2 BlockSparseMatrix m22. For instance: >> >> m33 = [ A B C >> D E F >> G H I ] >> >> From this matrix, I would like to obtain the following: >> >> m22 = [ E F >> H I ] >> >> Timo, I have tried the solutions that you suggest, but none of them work, >> I keep getting a segmentation fault error. Could you please give me an >> alternative option? >> > What exactly are you doing and what is the exact error message you are > getting in debug mode? > Do the sparsity patterns already match before copying? > > 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.