Closed jtoumey closed 5 years ago
This may not be possible during edge generation. Currently, each edge for a cell is created and then tested for uniqueness. If it is already on the edge list, the edge is discarded. There is no way to look back through the edge list and identify the ID of the already-added edge.
Creating this mapping after the edge generation may be possible by searching for appropriate vertices.
For generating association after edge_list generation:
for each cell in cell_list:
for each edge // based on four cardinal directions
start_vertex = ...
end_vertex = ...
for each edge in edge_list:
slow search for matching first and then second vertex
For generating association during edge_list generation, findUniqueFaceNeighbors
could, if the edge is determined not unique, return the cell which already possesses the edge in the UniqueCellStatus
struct. From there, the code could retrieve this edge ID from the previous cell and then store it in the current cell.
I implemented the first method. It uses a slow lookup of every edge until the start and end vertices match (or vice versa). This brings up the issues of 1) Standardizing edge vertex ordering and 2) Developing a faster method for finding the appropriate edge. I think I could store the edges in a kd-tree with the start and end vertices as the dimensions and the edge ID as the salient piece of data. This modification is extra though.
Also, I need to store adjacent cells for each edge. This is more pertinent information for a fluid mesh.
Did so in a very messy brute force fashion. I think the best way would be to work it into the findUniqueFaceNeighbors
routine but then that function is doing too much. Also, it would be wise to make edge_list
its own class.
Closing for now. Further improvements discussed above represent a significant investment of work for minimal speed-up.
Either during the edge generation step or after, map the edges composing each cell to the cell itself.
Likewise, extend the edge item s.t. it may know the cell indices of its two neighbors.