get Element connectivity (always anticlockwise )


317
views
0
12 months ago by
Hi, I am trying to save element connectivity from FEniCS to txt file, But I need to always save element connectivity in anticlockwsie. The MWC is: 
mesh = UnitCubeMesh(2,2,2)

numelem = mesh.num_cells()
eleNode = mesh.cells()

fileN = 'element' +'.txt'
fileO = open(fileN,'w')

for i in eleNode:
        for j in i:
                fileO.write( '  %d' % j )
        fileO.write('\n')
fileO.close()

​
Thank you for the help
Have you checked the ufc documentation page 57? Also investigate Cell::orientation for the entity ordering.
written 12 months ago by Nate 

1 Answer


0
12 months ago by
pf4d 
Within your cell loop, include some logic that sorts the cells by cell.midpoint() coordinates such that they are in anti-clockwise order.
Please login to add an answer/comment or follow this question.

Similar posts:
Search »