recently I got involved with memory optimization of our in house FE program. I decided to use csr format storage with dss solver, which worked fine so far. However in our implementation, we have so called special elements, which require special treatment. To give you one example: you can define a special node in the mesh, where the program creates an additional node in the same location. Then we couple certain dofs between these nodes and allow them to move only in a certain direction wrt each other. Anyway, without going any further detail, the implementation of this coupling etc. requires some significant manipulation in global stiffness matrix, such as exchanging rows/columns, setting a whole row/column to zero, etc. As a result, the csr storage arrays (rowindex, columns, values) populated during the assembly of global matrix gets totally messed up and book keeping becomes a nightmare.
I was wondering if anyone faced a similar problem and could give me any feedback on how to tackle this issue. I have tried various things, such as converting the csr into dense format, do the manipulations and then convert back to csr again. However it really killed the efficiency, which was my main goal in the first place.
Looking forward to your replies and thank you in advance!