In Finite element method, for making sparse matrix of tangent stiffness matrix we should know the number of nonzero terms because, I am using language : C.
I could not find an optimal algorithm to find the number of nonzero terms using "element connectivity".
Can someone tell me which algorithm to get the number of nonzero terms by using element connectivity, or a library built for this purpose?
For example full index of global tangent matrix is {1, 2, 3, 4}. the element connectivity is like below 1st element - 1 2, 2nd element - 2 3, 3rd element - 3 4. so I just got the element connectivity and then I should make sparse matrix of global tangent matrix in that case How can I get the number of nonzero terms efficiently??