This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How to set all non-zero values in a CG1 mass-matrix equal to 1?

0 votes

Hi!

I have a general CG1 mass matrix which needs to be altered such that all non-zero values are set equal to 1. Any idea on the fastest way to do this?

I have tried fenicstools' SetMatrixValue method, but it does not work in parallell and is in general too slow for larger systems. The method needs to be fast, and work in parallell. I need such a matrix since I'm averaging over neighbouring nodes in a CG1-space, the CG1 mass matrix has the correct sparsity pattern for this purpose..

Thanks!

asked Apr 17, 2015 by joakibo FEniCS User (1,140 points)

1 Answer

+1 vote
 
Best answer

fenicstools' SetMatrixValue is now fixed to work in parallel as well. Consider creating an issue on https://github.com/mikaem/fenicstools next time:-).

answered Apr 21, 2015 by mikael-mortensen FEniCS Expert (29,340 points)
selected Apr 21, 2015 by joakibo

Thanks Mikael, I'll give it a shot. Will report as an issue next time :-)

Have you tested the performance of SetMatrixValue for larger systems?

Should be better now as well.

That's excellent!

...