{"action":"created","comment":{"url":"https://api.github.com/repos/simphony/simphony-common/pulls/comments/23383731","id":23383731,"diff_hunk":"@@ -0,0 +1,736 @@\n+\"\"\" Mesh File\n+\n+This module contains the implentation to store, acces,\n+and modify a file storing mesh data\n+\n+\"\"\"\n+import tables\n+import uuid\n+\n+from simphony.cuds.mesh import Point\n+from simphony.cuds.mesh import Edge\n+from simphony.cuds.mesh import Face\n+from simphony.cuds.mesh import Cell\n+\n+MAX_POINTS_IN_EDGE = 2\n+MAX_POINTS_IN_FACE = 3\n+MAX_POINTS_IN_CELL = 4\n+\n+\n+class _PointDescriptor(tables.IsDescription):\n+    \"\"\" Descriptor for storing Point information\n+\n+    Provides the column definition to store Point\n+    information (x, y, z).\n+\n+    \"\"\"\n+\n+    uuid = tables.StringCol(32, pos=1)\n+    coordinates = tables.Float64Col(\n+        pos=2, shape=(3,)\n+        )\n+\n+\n+class _EdgeDescriptor(tables.IsDescription):\n+    \"\"\" Descriptor for storing Edge information\n+\n+    Provides the column definition to store Points\n+    forming an edge and its data.\n+\n+    \"\"\"\n+\n+    uuid = tables.StringCol(32, pos=1)\n+    points_uuids = tables.StringCol(\n+        32, pos=2, shape=(MAX_POINTS_IN_EDGE,)\n+        )\n+\n+\n+class _FaceDescriptor(tables.IsDescription):\n+    \"\"\" Descriptor for storing Face information\n+\n+    Provides the column definition to store Points\n+    forming a face and its data.\n+\n+    \"\"\"\n+\n+    uuid = tables.StringCol(32, pos=1)\n+    points_uuids = tables.StringCol(\n+        32, pos=2, shape=(MAX_POINTS_IN_FACE,)\n+        )\n+\n+\n+class _CellDescriptor(tables.IsDescription):\n+    \"\"\" Descriptor for storing Cell information\n+\n+    Provides the column definition to store Points\n+    forming a cell and its data.\n+\n+    \"\"\"\n+\n+    uuid = tables.StringCol(32, pos=1)\n+    points_uuids = tables.StringCol(\n+        32, pos=2, shape=(MAX_POINTS_IN_CELL,)\n+        )\n+\n+\n+class _MeshDescriptor(tables.IsDescription):\n+    \"\"\" Descriptor for storing Mesh information\n+\n+    Provides the column definition to store mesh data.\n+\n+    \"\"\"\n+\n+    uuid = tables.StringCol(32, pos=1)\n+\n+\n+class FileMesh(object):\n+    \"\"\" FileMesh.\n+\n+    Interface of the mesh file driver.\n+    Stores general mesh information Points and Elements\n+    such as Edges, Faces and Cells and provide the\n+    methods to interact with them. The methods are\n+    divided in four diferent blocks:\n+\n+    (1) methods to get the related item with the provided uuid;\n+    (2) methods to add a new item or replace;\n+    (3) generator methods that return iterators\n+        over all or some of the mesh items and;\n+    (4) inspection methods to identify if there are any edges,\n+        faces or cells described in the mesh.\n+\n+    Attributes\n+    ----------\n+    data : Data\n+        The X coordinate.\n+    points : dictionary of Point\n+        Points of the mesh.\n+    edges : dictionary of Edge\n+        Edges of the mesh.\n+    faces : dictionary of Face\n+        Faces of the mesh.\n+    cells : dictionary of Cell\n+        Cells of the mesh.\n+\n+    See Also\n+    --------\n+    get_point, get_edge, get_face, get_cell\n+    add_point, add_edge, add_face, add_cell\n+    update_point, update_edge, update_face, update_cell\n+    iter_points, iter_edges, iter_faces, iter_cells\n+    has_edges, has_faces, has_cells\n+\n+    \"\"\"\n+\n+    def __init__(self, group, meshFile):\n+        self._file = meshFile\n+        self._group = group\n+\n+        if \"points\" not in self._group:\n+            self._create_points_table()\n+\n+        if \"edges\" not in self._group:\n+            self._create_edges_table()\n+\n+        if \"faces\" not in self._group:\n+            self._create_faces_table()\n+\n+        if \"cells\" not in self._group:\n+            self._create_cells_table()\n+\n+    def get_point(self, p_uuid):\n+        \"\"\" Returns a point with a given uuid.\n+\n+        Returns the point stored in the mesh\n+        identified by uuid. If such point do not\n+        exists an exception is raised.\n+\n+        Parameters\n+        ----------\n+        uuid : int\n+            uuid of the desired point.\n+\n+        Returns\n+        -------\n+        Point\n+            Mesh point identified by uuid\n+\n+        Raises\n+        ------\n+        Exception\n+            If the point identified by uuid was not found\n+\n+        \"\"\"\n+\n+        try:","path":"simphony/io/file_mesh.py","position":165,"original_position":165,"commit_id":"0613a16f8c245d46f618255e594a864ffc94000b","original_commit_id":"0613a16f8c245d46f618255e594a864ffc94000b","user":{"login":"itziakos","id":403930,"avatar_url":"https://avatars.githubusercontent.com/u/403930?v=3","gravatar_id":"","url":"https://api.github.com/users/itziakos","html_url":"https://github.com/itziakos","followers_url":"https://api.github.com/users/itziakos/followers","following_url":"https://api.github.com/users/itziakos/following{/other_user}","gists_url":"https://api.github.com/users/itziakos/gists{/gist_id}","starred_url":"https://api.github.com/users/itziakos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itziakos/subscriptions","organizations_url":"https://api.github.com/users/itziakos/orgs","repos_url":"https://api.github.com/users/itziakos/repos","events_url":"https://api.github.com/users/itziakos/events{/privacy}","received_events_url":"https://api.github.com/users/itziakos/received_events","type":"User","site_admin":false},"body":"The try: expect here will not work since there is no exception raised by the `where` method. I will suggest to use the \r\nfor..else construct in this case see https://github.com/simphony/simphony-common/pull/31/files#diff-48635a0984ef717c0fb53f6c3d74e0fcR112 \r\n\r\nalso see http://python-notes.curiousefficiency.org/en/latest/python_concepts/break_else.html for a discussion on how it works ","created_at":"2015-01-22T15:40:25Z","updated_at":"2015-01-22T15:40:25Z","html_url":"https://github.com/simphony/simphony-common/pull/36#discussion_r23383731","pull_request_url":"https://api.github.com/repos/simphony/simphony-common/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/simphony/simphony-common/pulls/comments/23383731"},"html":{"href":"https://github.com/simphony/simphony-common/pull/36#discussion_r23383731"},"pull_request":{"href":"https://api.github.com/repos/simphony/simphony-common/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/simphony/simphony-common/pulls/36","id":27785173,"html_url":"https://github.com/simphony/simphony-common/pull/36","diff_url":"https://github.com/simphony/simphony-common/pull/36.diff","patch_url":"https://github.com/simphony/simphony-common/pull/36.patch","issue_url":"https://api.github.com/repos/simphony/simphony-common/issues/36","number":36,"state":"open","locked":false,"title":"[WIP] Feature mesh io","user":{"login":"roigcarlo","id":1935791,"avatar_url":"https://avatars.githubusercontent.com/u/1935791?v=3","gravatar_id":"","url":"https://api.github.com/users/roigcarlo","html_url":"https://github.com/roigcarlo","followers_url":"https://api.github.com/users/roigcarlo/followers","following_url":"https://api.github.com/users/roigcarlo/following{/other_user}","gists_url":"https://api.github.com/users/roigcarlo/gists{/gist_id}","starred_url":"https://api.github.com/users/roigcarlo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roigcarlo/subscriptions","organizations_url":"https://api.github.com/users/roigcarlo/orgs","repos_url":"https://api.github.com/users/roigcarlo/repos","events_url":"https://api.github.com/users/roigcarlo/events{/privacy}","received_events_url":"https://api.github.com/users/roigcarlo/received_events","type":"User","site_admin":false},"body":"Pull request for the mesh-io feature\r\n\r\nAn early implementation of the Mesh FILE I/O\r\n\r\n**Pending**:\r\n- [ ] Store dataContainers for points and elements\r\n- [ ] Set the correct number of points for elements (see https://github.com/simphony/simphony-common/issues/35)\r\n- [ ] Typos in the comments","created_at":"2015-01-21T19:00:53Z","updated_at":"2015-01-22T15:40:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ebbba5cbc389c8a02fe47ebb877dd10f3e61df5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/simphony/simphony-common/pulls/36/commits","review_comments_url":"https://api.github.com/repos/simphony/simphony-common/pulls/36/comments","review_comment_url":"https://api.github.com/repos/simphony/simphony-common/pulls/comments/{number}","comments_url":"https://api.github.com/repos/simphony/simphony-common/issues/36/comments","statuses_url":"https://api.github.com/repos/simphony/simphony-common/statuses/0613a16f8c245d46f618255e594a864ffc94000b","head":{"label":"simphony:feature-mesh-io","ref":"feature-mesh-io","sha":"0613a16f8c245d46f618255e594a864ffc94000b","user":{"login":"simphony","id":8048249,"avatar_url":"https://avatars.githubusercontent.com/u/8048249?v=3","gravatar_id":"","url":"https://api.github.com/users/simphony","html_url":"https://github.com/simphony","followers_url":"https://api.github.com/users/simphony/followers","following_url":"https://api.github.com/users/simphony/following{/other_user}","gists_url":"https://api.github.com/users/simphony/gists{/gist_id}","starred_url":"https://api.github.com/users/simphony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simphony/subscriptions","organizations_url":"https://api.github.com/users/simphony/orgs","repos_url":"https://api.github.com/users/simphony/repos","events_url":"https://api.github.com/users/simphony/events{/privacy}","received_events_url":"https://api.github.com/users/simphony/received_events","type":"Organization","site_admin":false},"repo":{"id":22651892,"name":"simphony-common","full_name":"simphony/simphony-common","owner":{"login":"simphony","id":8048249,"avatar_url":"https://avatars.githubusercontent.com/u/8048249?v=3","gravatar_id":"","url":"https://api.github.com/users/simphony","html_url":"https://github.com/simphony","followers_url":"https://api.github.com/users/simphony/followers","following_url":"https://api.github.com/users/simphony/following{/other_user}","gists_url":"https://api.github.com/users/simphony/gists{/gist_id}","starred_url":"https://api.github.com/users/simphony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simphony/subscriptions","organizations_url":"https://api.github.com/users/simphony/orgs","repos_url":"https://api.github.com/users/simphony/repos","events_url":"https://api.github.com/users/simphony/events{/privacy}","received_events_url":"https://api.github.com/users/simphony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/simphony/simphony-common","description":"The native implementation of the Simphony cuds objects","fork":false,"url":"https://api.github.com/repos/simphony/simphony-common","forks_url":"https://api.github.com/repos/simphony/simphony-common/forks","keys_url":"https://api.github.com/repos/simphony/simphony-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/simphony/simphony-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/simphony/simphony-common/teams","hooks_url":"https://api.github.com/repos/simphony/simphony-common/hooks","issue_events_url":"https://api.github.com/repos/simphony/simphony-common/issues/events{/number}","events_url":"https://api.github.com/repos/simphony/simphony-common/events","assignees_url":"https://api.github.com/repos/simphony/simphony-common/assignees{/user}","branches_url":"https://api.github.com/repos/simphony/simphony-common/branches{/branch}","tags_url":"https://api.github.com/repos/simphony/simphony-common/tags","blobs_url":"https://api.github.com/repos/simphony/simphony-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/simphony/simphony-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/simphony/simphony-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/simphony/simphony-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/simphony/simphony-common/statuses/{sha}","languages_url":"https://api.github.com/repos/simphony/simphony-common/languages","stargazers_url":"https://api.github.com/repos/simphony/simphony-common/stargazers","contributors_url":"https://api.github.com/repos/simphony/simphony-common/contributors","subscribers_url":"https://api.github.com/repos/simphony/simphony-common/subscribers","subscription_url":"https://api.github.com/repos/simphony/simphony-common/subscription","commits_url":"https://api.github.com/repos/simphony/simphony-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/simphony/simphony-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/simphony/simphony-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/simphony/simphony-common/issues/comments/{number}","contents_url":"https://api.github.com/repos/simphony/simphony-common/contents/{+path}","compare_url":"https://api.github.com/repos/simphony/simphony-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/simphony/simphony-common/merges","archive_url":"https://api.github.com/repos/simphony/simphony-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/simphony/simphony-common/downloads","issues_url":"https://api.github.com/repos/simphony/simphony-common/issues{/number}","pulls_url":"https://api.github.com/repos/simphony/simphony-common/pulls{/number}","milestones_url":"https://api.github.com/repos/simphony/simphony-common/milestones{/number}","notifications_url":"https://api.github.com/repos/simphony/simphony-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/simphony/simphony-common/labels{/name}","releases_url":"https://api.github.com/repos/simphony/simphony-common/releases{/id}","created_at":"2014-08-05T17:05:12Z","updated_at":"2015-01-21T16:27:39Z","pushed_at":"2015-01-22T15:27:40Z","git_url":"git://github.com/simphony/simphony-common.git","ssh_url":"git@github.com:simphony/simphony-common.git","clone_url":"https://github.com/simphony/simphony-common.git","svn_url":"https://github.com/simphony/simphony-common","homepage":null,"size":9238,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":20,"forks":3,"open_issues":20,"watchers":5,"default_branch":"master"}},"base":{"label":"simphony:master","ref":"master","sha":"2007c287ba1259196ab3bc5e9372de6a6b095289","user":{"login":"simphony","id":8048249,"avatar_url":"https://avatars.githubusercontent.com/u/8048249?v=3","gravatar_id":"","url":"https://api.github.com/users/simphony","html_url":"https://github.com/simphony","followers_url":"https://api.github.com/users/simphony/followers","following_url":"https://api.github.com/users/simphony/following{/other_user}","gists_url":"https://api.github.com/users/simphony/gists{/gist_id}","starred_url":"https://api.github.com/users/simphony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simphony/subscriptions","organizations_url":"https://api.github.com/users/simphony/orgs","repos_url":"https://api.github.com/users/simphony/repos","events_url":"https://api.github.com/users/simphony/events{/privacy}","received_events_url":"https://api.github.com/users/simphony/received_events","type":"Organization","site_admin":false},"repo":{"id":22651892,"name":"simphony-common","full_name":"simphony/simphony-common","owner":{"login":"simphony","id":8048249,"avatar_url":"https://avatars.githubusercontent.com/u/8048249?v=3","gravatar_id":"","url":"https://api.github.com/users/simphony","html_url":"https://github.com/simphony","followers_url":"https://api.github.com/users/simphony/followers","following_url":"https://api.github.com/users/simphony/following{/other_user}","gists_url":"https://api.github.com/users/simphony/gists{/gist_id}","starred_url":"https://api.github.com/users/simphony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simphony/subscriptions","organizations_url":"https://api.github.com/users/simphony/orgs","repos_url":"https://api.github.com/users/simphony/repos","events_url":"https://api.github.com/users/simphony/events{/privacy}","received_events_url":"https://api.github.com/users/simphony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/simphony/simphony-common","description":"The native implementation of the Simphony cuds objects","fork":false,"url":"https://api.github.com/repos/simphony/simphony-common","forks_url":"https://api.github.com/repos/simphony/simphony-common/forks","keys_url":"https://api.github.com/repos/simphony/simphony-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/simphony/simphony-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/simphony/simphony-common/teams","hooks_url":"https://api.github.com/repos/simphony/simphony-common/hooks","issue_events_url":"https://api.github.com/repos/simphony/simphony-common/issues/events{/number}","events_url":"https://api.github.com/repos/simphony/simphony-common/events","assignees_url":"https://api.github.com/repos/simphony/simphony-common/assignees{/user}","branches_url":"https://api.github.com/repos/simphony/simphony-common/branches{/branch}","tags_url":"https://api.github.com/repos/simphony/simphony-common/tags","blobs_url":"https://api.github.com/repos/simphony/simphony-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/simphony/simphony-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/simphony/simphony-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/simphony/simphony-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/simphony/simphony-common/statuses/{sha}","languages_url":"https://api.github.com/repos/simphony/simphony-common/languages","stargazers_url":"https://api.github.com/repos/simphony/simphony-common/stargazers","contributors_url":"https://api.github.com/repos/simphony/simphony-common/contributors","subscribers_url":"https://api.github.com/repos/simphony/simphony-common/subscribers","subscription_url":"https://api.github.com/repos/simphony/simphony-common/subscription","commits_url":"https://api.github.com/repos/simphony/simphony-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/simphony/simphony-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/simphony/simphony-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/simphony/simphony-common/issues/comments/{number}","contents_url":"https://api.github.com/repos/simphony/simphony-common/contents/{+path}","compare_url":"https://api.github.com/repos/simphony/simphony-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/simphony/simphony-common/merges","archive_url":"https://api.github.com/repos/simphony/simphony-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/simphony/simphony-common/downloads","issues_url":"https://api.github.com/repos/simphony/simphony-common/issues{/number}","pulls_url":"https://api.github.com/repos/simphony/simphony-common/pulls{/number}","milestones_url":"https://api.github.com/repos/simphony/simphony-common/milestones{/number}","notifications_url":"https://api.github.com/repos/simphony/simphony-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/simphony/simphony-common/labels{/name}","releases_url":"https://api.github.com/repos/simphony/simphony-common/releases{/id}","created_at":"2014-08-05T17:05:12Z","updated_at":"2015-01-21T16:27:39Z","pushed_at":"2015-01-22T15:27:40Z","git_url":"git://github.com/simphony/simphony-common.git","ssh_url":"git@github.com:simphony/simphony-common.git","clone_url":"https://github.com/simphony/simphony-common.git","svn_url":"https://github.com/simphony/simphony-common","homepage":null,"size":9238,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":20,"forks":3,"open_issues":20,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/simphony/simphony-common/pulls/36"},"html":{"href":"https://github.com/simphony/simphony-common/pull/36"},"issue":{"href":"https://api.github.com/repos/simphony/simphony-common/issues/36"},"comments":{"href":"https://api.github.com/repos/simphony/simphony-common/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/simphony/simphony-common/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/simphony/simphony-common/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/simphony/simphony-common/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/simphony/simphony-common/statuses/0613a16f8c245d46f618255e594a864ffc94000b"}}}}