Mesh element numbering
Mesh element numberingPosted by Janis Klavins at June 25. 2012
I am new to using Salome. I have a problem that I need to create a cylinder with hexahedral mesh - that is not a problem. The example script helped out and it is ok for me. Then need to convert it to Openfoam and then for calculations I have to add nonuniform value field for the outside of the cylinder. The thing is that I have to put my values at exact element on the cylinder. So I have to know where each of the elements are located. How can I do that?
Re: Mesh element numberingPosted by ppeetteerr at June 26. 2012
Do you want to know the xyz position and element number of all the elements or specific elements?
Re: Mesh element numberingPosted by Janis Klavins at June 26. 2012
Well actually I need to know xyz position for specific elements... but it is ok if I can get xyz for all the elements also
Re: Mesh element numberingPosted by Saint Michael at June 26. 2012
The following code iterates over all 2D elements of the mesh and then over nodes of each element that allows you knowing element position and ID (== f)
faces = mesh.GetElementsByType( smesh.SMESH.FACE )
for f in faces:
nodes = mesh.GetElemNodes( f )
for n in nodes:
x,y,z = mesh.GetNodeXYZ( n )