Hello, thanks for looking at this,
I have a peculiar matrix that I would like to order and sort. The matrix itself is imported form a geometry file exported from Ansys, and it looks like:
18f 1b6 368 1 db3 18f 252 1b6 1 e60 1b6 252 368 1 da7 18f 368 252 1 e3e 53 194 3e 2 1d0 53 29c 194 2 1100 194 29c 3e 2 884 53 3e 29c 2 71d 26f 2fa 2d1 3 426 26f 2ba 2fa 3 1b0 2fa 2ba 2d1 3 847 26f 2d1 2ba 3 10fd 34f 1e7 27b 4 925 34f 31d 1e7 4 5bc 1e7 31d 27b 4 92c 34f 27b 31d 4 2a8 222 21e 2b3 5 4ce 222 3a7 21e 5 1127
Now, here is a bit of information on this matrix. The first three column entries are hexadecimal point indices, and they form a triangle. Meaning, in the first row: point 18f is connected to 1b6 and is connected to 368 (all hex), and this forms a triangle.
The last two column entries are tetrahedra indexes, and are important in the fact that for each tetrahedra, there are at least 3 rows. The reason there are at least three is there are four triangles for each tetrahedra, however, some of the triangles are surface elements (which I don't need). There are at least three of each tetrahedra index, but the cumulative 3 indexes exist in the thid and forth column, index 1 is special because all four indexes exist in column four. This doesn't always happen, this is especially evident as you progress through the face matrix, since Ansys doesn't want to export duplicate entries.
Now, what I think I can do in order to have a single tetradedra index column that is ordered by 1 to N, and has at least 3 of each index (i.e. 1 1 1, 2 2 2, etc) is concatanate the fourth and fifth columns, as that would make a single column where every tetrahedra index is listed at least three times, and then I can check the first three columns and see if any of the rows exist for the given ordered tetrahedra index, and then re-create a longer row-wise but shorter column-wise (by 1 row) face matrix where its ordered by the last tetrahedra index column.
Any advice on how I can do this/is this even the best method to use you can give me would be appreciated! Thanks!
No products are associated with this question.
Well first, you'll have to use hex2dec to get the hexadecimals to decimals.
Second, can you make a smaller example of what you expect for outputs. E.g.:
18f 1b6 368 1 db3
Should become what?
doc hex2dec doc sort
to get you started