{"action":"created","issue":{"url":"https://api.github.com/repos/SteveDoyle2/pyNastran/issues/203","labels_url":"https://api.github.com/repos/SteveDoyle2/pyNastran/issues/203/labels{/name}","comments_url":"https://api.github.com/repos/SteveDoyle2/pyNastran/issues/203/comments","events_url":"https://api.github.com/repos/SteveDoyle2/pyNastran/issues/203/events","html_url":"https://github.com/SteveDoyle2/pyNastran/pull/203","id":86914854,"number":203,"title":"ENH: get_edges for LineElements and RodElement","user":{"login":"saullocastro","id":3889819,"avatar_url":"https://avatars.githubusercontent.com/u/3889819?v=3","gravatar_id":"","url":"https://api.github.com/users/saullocastro","html_url":"https://github.com/saullocastro","followers_url":"https://api.github.com/users/saullocastro/followers","following_url":"https://api.github.com/users/saullocastro/following{/other_user}","gists_url":"https://api.github.com/users/saullocastro/gists{/gist_id}","starred_url":"https://api.github.com/users/saullocastro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saullocastro/subscriptions","organizations_url":"https://api.github.com/users/saullocastro/orgs","repos_url":"https://api.github.com/users/saullocastro/repos","events_url":"https://api.github.com/users/saullocastro/events{/privacy}","received_events_url":"https://api.github.com/users/saullocastro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-06-10T10:16:19Z","updated_at":"2015-06-18T18:47:01Z","closed_at":"2015-06-10T16:58:12Z","pull_request":{"url":"https://api.github.com/repos/SteveDoyle2/pyNastran/pulls/203","html_url":"https://github.com/SteveDoyle2/pyNastran/pull/203","diff_url":"https://github.com/SteveDoyle2/pyNastran/pull/203.diff","patch_url":"https://github.com/SteveDoyle2/pyNastran/pull/203.patch"},"body":"I've seen the importance of an Edge object such as:\r\n\r\n    class Edge(object):\r\n        def __init__(self):\r\n            self.nodes = set()\r\n            self.elements = set()\r\n\r\nto check the connectivity among elements in an algorithm like:\r\n\r\n    # Finding edges\r\n    mesh.edges = []\r\n    for element in mesh.elements.values():\r\n        el_edges = element.get_edges()\r\n        for nodes in el_edges:\r\n            nodes = set(nodes)\r\n            is_new_edge = True\r\n            for edge in mesh.edges:\r\n                if nodes == edge.nodes:\r\n                    is_new_edge = False\r\n                    break\r\n            if is_new_edge:\r\n                new_edge = Edge()\r\n                new_edge.nodes = set(nodes)\r\n                new_edge.elements.add(element)\r\n                mesh.edges.append(new_edge)\r\n            else:\r\n                edge.elements.add(element)\r\n\r\nBut for this approach to work the `LineElement` and `RodElement` should also have the method `get_edges` implemented, which is conceptually correct.\r\n\r\nIn this pull request I'm suggesting to add such methods.\r\n\r\nIf there is interest we could think of making this algorithm for edge detection shown above a new pull request."},"comment":{"url":"https://api.github.com/repos/SteveDoyle2/pyNastran/issues/comments/113254981","html_url":"https://github.com/SteveDoyle2/pyNastran/pull/203#issuecomment-113254981","issue_url":"https://api.github.com/repos/SteveDoyle2/pyNastran/issues/203","id":113254981,"user":{"login":"SteveDoyle2","id":1059417,"avatar_url":"https://avatars.githubusercontent.com/u/1059417?v=3","gravatar_id":"","url":"https://api.github.com/users/SteveDoyle2","html_url":"https://github.com/SteveDoyle2","followers_url":"https://api.github.com/users/SteveDoyle2/followers","following_url":"https://api.github.com/users/SteveDoyle2/following{/other_user}","gists_url":"https://api.github.com/users/SteveDoyle2/gists{/gist_id}","starred_url":"https://api.github.com/users/SteveDoyle2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SteveDoyle2/subscriptions","organizations_url":"https://api.github.com/users/SteveDoyle2/orgs","repos_url":"https://api.github.com/users/SteveDoyle2/repos","events_url":"https://api.github.com/users/SteveDoyle2/events{/privacy}","received_events_url":"https://api.github.com/users/SteveDoyle2/received_events","type":"User","site_admin":false},"created_at":"2015-06-18T18:47:00Z","updated_at":"2015-06-18T18:47:00Z","body":"For a CTRIA3, the get_edges method is:\n\n    def get_edges(self):\n        \"\"\"\n        Returns the edges\n        \"\"\"\n        return [(self.nodes[0], self.nodes[1]),\n                (self.nodes[1], self.nodes[2]),\n                (self.nodes[2], self.nodes[0])]\n\nFor xref=False, self.nodes[0] is an integer.  For xref=True, self.nodes[0]\nis a GRID object.  Using this method...\n\n    def get_edge_ids(self):\n        \"\"\"\n        Return the edge IDs\n        \"\"\"\n        node_ids = self.node_ids\n        return [(node_ids[0], node_ids[1]),\n                (node_ids[1], node_ids[2]),\n                (node_ids[2], node_ids[0])]\n\nnode_ids[0] is always an integer.\n\nThe data will not be stored on the element.  It's just a get method.\n\nMy question was did you think the \"get_edges\" method is valuable given the\nlimitation?  It's technically faster for xref=False at least to get the\nedges (maybe not when using them given the additional overhead), but more\nerror prone.\n\nOn Thu, Jun 18, 2015 at 11:35 AM, saullocastro <notifications@github.com>\nwrote:\n\n> I'm afraid I didn't understand... are you going to build the method to\n> detect and store the edges for each node/element? Or just the method to get\n> the node_ids?\n>\n> 2015-06-18 14:57 GMT-03:00 SteveDoyle2 <notifications@github.com>:\n>\n> > Alright. I'll add a get_edge_ids method. Thanks for the feedback.\n> >\n> > —\n> > Reply to this email directly or view it on GitHub\n> > <\n> https://github.com/SteveDoyle2/pyNastran/pull/203#issuecomment-113238661>\n>\n> > .\n> >\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/SteveDoyle2/pyNastran/pull/203#issuecomment-113252485>\n> .\n>\n"}}