- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am working with FEM sparse matrices and would like to create a non-rectangular array. I am trying to store a linked node connectivity for each node in order toinitiallystore the sparse stiffness matrix. However, each node (representing first index, or rows) will contain a different number of nodes connected to themselves, therefore requiring different "second index" sizes.
Let's say node 1 is connected to nodes 2 and 3, so position 1, would contain 2 and 3, or 2 spaces. Node 2, may be connected to nodes 1, 3 and 4. Therefore requiring 3 spaces.
Is this even possible? Otherwise, any suggestions?
Thanks,
Roberto
Intel Fortran 11, MKL user, Windows XP 32 bits.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An array of derived type, where the type contains an ALLOCATABLE (or POINTER) array component, is the only thing that comes to mind.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could simply mimic one of the sparse matrix storage schemes that you will probably use when your FEM global matrix is assembled. One way that is venerable, simple but not elegant, and works even with Fortran 77, is as follows.
Have two arrays, say NODES and FIRST, with the following contents for the example that you gave:
NODES: || 2 | 3 || 1 | 3 | 4 || ...
FIRST: | 1 | 3 | 6 | ...
The size of NODES should be at least the number of non-zero entries in the adjacency matrix, and FIRST should be of size = number of nodes + 1.
The list of nodes connected to node I is read off from NODES, starting with index FIRST(I) and ending with index FIRST(I+1)-1.
Have two arrays, say NODES and FIRST, with the following contents for the example that you gave:
NODES: || 2 | 3 || 1 | 3 | 4 || ...
FIRST: | 1 | 3 | 6 | ...
The size of NODES should be at least the number of non-zero entries in the adjacency matrix, and FIRST should be of size = number of nodes + 1.
The list of nodes connected to node I is read off from NODES, starting with index FIRST(I) and ending with index FIRST(I+1)-1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply. I actually thought of something like this, however I don't know the final size of each row until the end. It would have to be something to be incremented as the loop was progressing.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page