Skip to content

Construct Mesh2_edge_face Connectivity  #512

Closed

Description

@philipc2

Represents the neighboring faces of each edge.

From the UGRID conventions

edge_face_connectivity pointing to an index variable identifying all faces that share the same edge, i. e. are neighbors to an edge. This connectivity array is thus a matrix of size nEdges x 2. It is intended to be used in combination with data defined on edges. The start_index attribute should be used to specify the indexing convention and 0-based indexing is the default. Attribute _FillValue must be present.

Activity

  1. added
    new feature
    on Oct 16, 2023
  2. self-assigned this
    on Oct 16, 2023
  3. added this to the Grid Topology milestone on Oct 16, 2023
  4. philipc2 commented on Oct 16, 2023

    @philipc2
    MemberAuthor

    @hongyuchen1030

    Do you have any algorithmic suggestions on implementing this connectivity?

    I was planning on using the face_edge connectivity to obtain the edges that make up each face. Each edge will be assigned a unique index.

    Any two faces that then share an edge ($face_{a}$, $face_{b}$) will become the indices stored in that row for the edge_face connectivity

    Example

    image

    The values in red represent a unique identifier into each face, with the values in green being a unique identifier for each edge

    Face Edges with Unique Identifier Applied

    [2, 1, 3] (a)
    [3, 5, 4] (b)
    [5, 7, 6] (c)
    [7, 8, 9] (d)

    Corresponding Edge Face Connectivity

    [a, None] (1)
    [a, None] (2)
    [a, b] (3)
    [b, None] (4)
    [b, c] (5)
    [c, None] (6)
    [c, d] (7)
    [d, None] (8)
    [d, None] (9)

    Implementation / Algorithm

    For each unique edge identifier [0, n_edge), find one or both faces that contain that edge identifier. I'm not certain on what the best implementation would be, but I was thinking of constructing a dictionary where each key is the edge identifier, and as we iterate over each face edge, populating the dictionary with which face index contains that edge

    Algorithm using the example

    Dictionary (start)
    {}
    Dictionary (After Face a)
    {"2": [a], 
     "3": [a],
     "1": [a]}
    Dictionary (After Face b)
    {"2": [a], 
     "3": [a, b],
     "1": [a],
     "4": [b],
     "5": [b],}

    We would continue this until we've iterated over each face. Any thoughts?

  5. moved this from 📚 Backlog to 📝 To-Do in UXarray Developmenton Oct 16, 2023
  6. hongyuchen1030 commented on Oct 16, 2023

    @hongyuchen1030
    Contributor

    Thank you for sharing your approach to handling the connectivity issue. Your method resonates with certain concepts from computational geometry, specifically the idea of mesh arrangements.

    This approach is actually quite similar to the strategies we employed in computational geometry, a field where handling such geometric information is routine. Incorporating this kind of mesh arrangement in our codes would undoubtedly be beneficial. In fact, mesh arrangement does more than just solve the connectivity problem you mentioned. It can also determine if an arbitrary point is located inside a given polygon, a topic that I plan to delve into in my upcoming research.

    One primary concern here is the direction of the edges. According to the UGRID convention, the edge should be counter-clockwise directed. This raises a challenge: for instance, edge "3" runs from vertex 1 --> 0 in face 'b' but from vertex 0 --> 1 in face 'a'. This discrepancy calls for the introduction of a concept known as the "half-edge". As you can infer, each half-edge relates to its adjacent face, providing a solution to the edge directionality issue. This is precisely how mesh arrangements address such problems.

    For a deeper dive into these concepts, I recommend looking into the following papers:

    Let me know if you need more clarification or if you have any other thoughts on this. Looking forward to working closely on this!

  7. philipc2 commented on Oct 16, 2023

    @philipc2
    MemberAuthor

    Thank you for sharing your approach to handling the connectivity issue. Your method resonates with certain concepts from computational geometry, specifically the idea of mesh arrangements.

    This approach is actually quite similar to the strategies we employed in computational geometry, a field where handling such geometric information is routine. Incorporating this kind of mesh arrangement in our codes would undoubtedly be beneficial. In fact, mesh arrangement does more than just solve the connectivity problem you mentioned. It can also determine if an arbitrary point is located inside a given polygon, a topic that I plan to delve into in my upcoming research.

    One primary concern here is the direction of the edges. According to the UGRID convention, the edge should be counter-clockwise directed. This raises a challenge: for instance, edge "3" runs from vertex 1 --> 0 in face 'b' but from vertex 0 --> 1 in face 'a'. This discrepancy calls for the introduction of a concept known as the "half-edge". As you can infer, each half-edge relates to its adjacent face, providing a solution to the edge directionality issue. This is precisely how mesh arrangements address such problems.

    For a deeper dive into these concepts, I recommend looking into the following papers:

    Let me know if you need more clarification or if you have any other thoughts on this. Looking forward to working closely on this!

    Thank you for the detailed response! Is the direction of the edge important if we are only interested in computing which faces saddle a given edge?

    image

    In the case here, for the yellow edge (3), we want to know which two faces (a, b) saddle a give edge. Does the direction here matter?

  8. philipc2 commented on Oct 16, 2023

    @philipc2
    MemberAuthor

    Here's a quick implementation I put together in a notebook.

    image

    These values line up with what is provided in MPAS datasets.
    image

  9. hongyuchen1030 commented on Oct 17, 2023

    @hongyuchen1030
    Contributor

    Thank you for the detailed response! Is the direction of the edge important if we are only interested in computing which faces saddle a given edge?

    The mesh arrangement concept captures this precisely:

    During the input construction, the mesh arrangement notes that the descending yellow half-edge (3) is linked to face 'b', whereas the ascending half-edge (3) corresponds to face 'a'.

    So, when inquiring about the faces adjacent to edge (3), the mesh arrangement can promptly indicate faces 'a' and 'b' as the answer. It can also answer the problem "Which edge is adjacent to face a"

    While it's entirely feasible to identify faces adjacent to an edge without emphasizing edge direction, it's essential to recognize the inherent subtleties. These nuances might become significant in advanced use cases or as our project progresses.

    I advocate for the mesh arrangement for several reasons:

    1. For creating a fast and reliable algorithm on a spherical surface, the mesh arrangement is nearly indispensable. Not only does it offer solutions to your adjacency concerns, but it also robustly addresses whether a specific point lies within a given polygon. Furthermore, it can shed light on other topological issues, such as identifying mesh "holes" and their locations. As previously mentioned, this direction aligns with my upcoming research focus.

    2. The solution presented in Is pole point inside #510 just aims to accelerate our present trajectory, enabling the integral function's swift availability. However, I anticipate utilizing the mesh arrangement to refine the algorithm down the line.

    Incorporating mesh arrangement into our workflow will preempt the need to keep re-building the wheel repeatedly. It also helps us steer clear of extensive code refactoring in the future.

    But I also understand your concern about bringing out a working solution as soon as possible. And I am just sharing my thoughts about the mesh arrangement here. I am always open to any suitable solutions or suggestions related to our project

  10. philipc2 commented on Oct 17, 2023

    @philipc2
    MemberAuthor

    Thank you for the detailed response! Is the direction of the edge important if we are only interested in computing which faces saddle a given edge?

    The mesh arrangement concept captures this precisely:

    During the input construction, the mesh arrangement notes that the descending yellow half-edge (3) is linked to face 'b', whereas the ascending half-edge (3) corresponds to face 'a'.

    So, when inquiring about the faces adjacent to edge (3), the mesh arrangement can promptly indicate faces 'a' and 'b' as the answer. It can also answer the problem "Which edge is adjacent to face a"

    While it's entirely feasible to identify faces adjacent to an edge without emphasizing edge direction, it's essential to recognize the inherent subtleties. These nuances might become significant in advanced use cases or as our project progresses.

    I advocate for the mesh arrangement for several reasons:

    1. For creating a fast and reliable algorithm on a spherical surface, the mesh arrangement is nearly indispensable. Not only does it offer solutions to your adjacency concerns, but it also robustly addresses whether a specific point lies within a given polygon. Furthermore, it can shed light on other topological issues, such as identifying mesh "holes" and their locations. As previously mentioned, this direction aligns with my upcoming research focus.
    2. The solution presented in Is pole point inside #510 just aims to accelerate our present trajectory, enabling the integral function's swift availability. However, I anticipate utilizing the mesh arrangement to refine the algorithm down the line.

    Incorporating mesh arrangement into our workflow will preempt the need to keep re-building the wheel repeatedly. It also helps us steer clear of extensive code refactoring in the future.

    But I also understand your concern about bringing out a working solution as soon as possible. And I am just sharing my thoughts about the mesh arrangement here. I am always open to any suitable solutions or suggestions related to our project

    This is a fantastic response! I'll give those two papers above a read through. Thank you!

  11. moved this from 📝 To-Do to 🏗 In progress in UXarray Developmenton Oct 24, 2023
  12. moved this from 🏗 In progress to ✅ Done in UXarray Developmenton Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

new feature

Type

No type

Fields

Priority

None yet

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions