Skip to main content
added 3 characters in body
Source Link
Algo
  • 304
  • 1
  • 17

If I have 3 lists: points, faces and cells that represents a mesh, where:

  • points is a list of x,y,z coordinates, for example

     [-0.05, -0.05,  0.  ],
     [-0.05,  0.05,  0.  ],
     [ 0.05, -0.05,  0.  ],
     ...
    
  • faces is a list of list of points, where each row is a list of point indices that represents a face

     [ 1,  4,  8,  7],
     [ 7,  8,  6,  3],
     [ 4,  0,  5,  8],
     ...
    
  • cells is a list of list of points, where each row is a list of point indices that represents a cell

     [ 1,  7,  8,  4, 11, 16, 17, 10],
     [ 7,  3,  6,  8, 16, 15, 14, 17],
     [ 4,  8,  5,  0, 10, 17, 12,  9],
     ...
    

For each face, I need to get the two cells ids that are sharing the face (in case of boundary face, there is only one cell that owns that face).

For a small mesh, I can iterate over cells, and for each cell iterate over all faces and check if a face points are in current cell (two for loops and a face-cells map), which is of course awfully slow.

Is there a smarter way to efficiently get face connectivity of my mesh?

If I have 3 lists: points, faces and cells that represents a mesh, where:

  • points is a list of x,y,z coordinates, for example

     [-0.05, -0.05,  0.  ],
     [-0.05,  0.05,  0.  ],
     [ 0.05, -0.05,  0.  ],
     ...
    
  • faces is a list of list points, where each row is a list of point indices that represents a face

     [ 1,  4,  8,  7],
     [ 7,  8,  6,  3],
     [ 4,  0,  5,  8],
     ...
    
  • cells is a list of list of points, where each row is a list of point indices that represents a cell

     [ 1,  7,  8,  4, 11, 16, 17, 10],
     [ 7,  3,  6,  8, 16, 15, 14, 17],
     [ 4,  8,  5,  0, 10, 17, 12,  9],
     ...
    

For each face, I need to get the two cells ids that are sharing the face (in case of boundary face, there is only one cell that owns that face).

For a small mesh, I can iterate over cells, and for each cell iterate over all faces and check if a face points are in current cell (two for loops and a face-cells map), which is of course awfully slow.

Is there a smarter way to efficiently get face connectivity of my mesh?

If I have 3 lists: points, faces and cells that represents a mesh, where:

  • points is a list of x,y,z coordinates, for example

     [-0.05, -0.05,  0.  ],
     [-0.05,  0.05,  0.  ],
     [ 0.05, -0.05,  0.  ],
     ...
    
  • faces is a list of list of points, where each row is a list of point indices that represents a face

     [ 1,  4,  8,  7],
     [ 7,  8,  6,  3],
     [ 4,  0,  5,  8],
     ...
    
  • cells is a list of list of points, where each row is a list of point indices that represents a cell

     [ 1,  7,  8,  4, 11, 16, 17, 10],
     [ 7,  3,  6,  8, 16, 15, 14, 17],
     [ 4,  8,  5,  0, 10, 17, 12,  9],
     ...
    

For each face, I need to get the two cells ids that are sharing the face (in case of boundary face, there is only one cell that owns that face).

For a small mesh, I can iterate over cells, and for each cell iterate over all faces and check if a face points are in current cell (two for loops and a face-cells map), which is of course awfully slow.

Is there a smarter way to efficiently get face connectivity of my mesh?

Source Link
Algo
  • 304
  • 1
  • 17

How to efficiently get mesh cell/face connectivity?

If I have 3 lists: points, faces and cells that represents a mesh, where:

  • points is a list of x,y,z coordinates, for example

     [-0.05, -0.05,  0.  ],
     [-0.05,  0.05,  0.  ],
     [ 0.05, -0.05,  0.  ],
     ...
    
  • faces is a list of list points, where each row is a list of point indices that represents a face

     [ 1,  4,  8,  7],
     [ 7,  8,  6,  3],
     [ 4,  0,  5,  8],
     ...
    
  • cells is a list of list of points, where each row is a list of point indices that represents a cell

     [ 1,  7,  8,  4, 11, 16, 17, 10],
     [ 7,  3,  6,  8, 16, 15, 14, 17],
     [ 4,  8,  5,  0, 10, 17, 12,  9],
     ...
    

For each face, I need to get the two cells ids that are sharing the face (in case of boundary face, there is only one cell that owns that face).

For a small mesh, I can iterate over cells, and for each cell iterate over all faces and check if a face points are in current cell (two for loops and a face-cells map), which is of course awfully slow.

Is there a smarter way to efficiently get face connectivity of my mesh?