On Tue, Jun 8, 2010 at 6:17 AM, Robert Cimrman cimr...@ntc.zcu.cz wrote:
On 06/07/10 16:57, Logan Sorenson wrote:
On Mon, Jun 7, 2010 at 6:50 AM, Robert Cimrmancimr...@ntc.zcu.cz wrote:
mat_id in Mesh is declared as int, so it can be, in principle, negative. However I am not sure, whether there are some silent implicit assumptions that on its sign in the code... Anyway, the reader can change the mat_id sign so that it is positive, no?
Ok, that was my thought as well, I assumed that the mat_id most likely should be positive. As far as I have seen, the MED numbers are all negative, so there should be no harm in running nm.abs over the mat_id array before passing it of to SfePy. But I wanted to make sure I'm not missing any silent assumptions... :)
I made a small patch for this and sent you a pull request on github or the code is available at .
It's in (github for the moment). I have also added verification of the negative id assumptions.
Ok, cool, it looks good. I like the use of assert and testing the entire set of group numbers. Actually, it turns out the numbering on the node groups is in fact positive (while element groups are negative), so I just switched the sign for the node group assertion.
Could you put a small MED mesh to meshes/various_formats, and add it to tests/test_meshio.py, so that the reader is tested?
This is done, I sent you a pull request, or it's on the branch "med_mesh_test" on my github , along with the patch for positive node groups above.
The test file could be enhanced to test mesh writing too - another EasyToFix issue? :)
Sounds good, I'll see if I have more free time this weekend to work on it...some other things are demanding my attention now. :( Maybe someone else will beat me to it? ;) I'll add an issue to the issue tracker so we don't forget.
Quoting Logan Sorensonlogan.s...@gmail.com:
I was playing a bit with the grouping functionality in Salome which allows one to group similar elements and nodes into families. AFAIK, this more or less corresponds to the mat_id associated with the elements in SfePy. However, I couldn't find a way to explicitly specify the numbering, and the implicit numbering by Salome appears to write meshes with negative integers for the mat_id.
Are negative mat_ids allowed in SfePy? If not, I'll submit a patch for the MED format read code. Otherwise, we should correct the mat_ids in the comsol format write code, since negative domain numbers do not seem to be allowed there.