{"action":"created","comment":{"url":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/comments/30125774","id":30125774,"diff_hunk":"@@ -0,0 +1,446 @@\n+\"\"\" Mesh module\n+\n+This module contains the implementation to store, access,\n+and modify a mesh and related data\n+\n+\"\"\"\n+from simphony.cuds.abstractmesh import ABCMesh\n+from simphony.cuds.mesh import Face, Point, Cell\n+from simphony.core.cuba import CUBA\n+\n+from .numerrin_templates import numname, numvariables\n+\n+import numerrin\n+\n+\n+class NumerrinMesh(ABCMesh):\n+    \"\"\" Proxy class to communicate with Numerrin pool mesh data\n+\n+    Parameters\n+    ----------\n+    name : str\n+        name of mesh\n+\n+    mesh : ABCMesh\n+       mesh to store\n+\n+    pool : NumerrinPool\n+       Numerrin variable pool\n+\n+    Attributes\n+    ----------\n+    name : str\n+        name of mesh\n+\n+    mesh : ABCMesh\n+       mesh to store\n+\n+    pool : NumerrinPool\n+       Numerrin variable pool\n+\n+    _uuidToNumLabel : dictionary\n+        Mapping from uuid to Numerrin label number\n+    _numCellLabelToUuid : dictionary\n+        Mapping from Numerrin cell label number to uuid\n+    _numFaceLabelToUuid : dictionary\n+        Mapping from Numerrin face label number to uuid\n+    _numEdgeLabelToUuid : dictionary\n+        Mapping from Numerrin edge label number to uuid\n+    _numPointLabelToUuid : dictionary\n+        Mapping from Numerrin point label number to uuid\n+\n+\n+    \"\"\"\n+\n+    def __init__(self, name, mesh, pool):\n+        super(NumerrinMesh, self).__init__()\n+        self.name = name\n+        self.pool = pool\n+        self._time = str(0)\n+        maps = self.pool.import_mesh(name, mesh)\n+        self._uuidToNumLabel = maps[0]\n+        self._numPointLabelToUuid = maps[1]\n+        self._numEdgeLabelToUuid = maps[2]\n+        self._numFaceLabelToUuid = maps[3]\n+        self._numCellLabelToUuid = maps[4]\n+        # point data\n+        for point in mesh.iter_points():\n+            self.update_point(point)\n+\n+    def get_point(self, 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\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:\n+            coords = numerrin.getnode(self.pool.ph, self.name,\n+                                      self._uuidToNumLabel[uuid])\n+            point = Point(coords, uuid)\n+            for dkey in numvariables:\n+                dataName = numname[dkey]\n+                mDataName = self.name + dataName\n+                try:\n+                    if self.pool.variable_type(mDataName) == \"Function\":\n+                        dataV = self.pool.get_real_function(mDataName)\n+                    else:\n+                        dataV = self.pool.get_variable(mDataName)\n+                    point.data[dkey] = dataV[self._uuidToNumLabel[uuid]]\n+                except RuntimeError:\n+                    pass\n+\n+            return point\n+        except KeyError:\n+            error_str = \"Trying to get an non-existing point with uuid: {}\"\n+            raise ValueError(error_str.format(uuid))\n+\n+    def get_edge(self, uuid):\n+        \"\"\"Returns an edge with a given uuid.\n+\n+        Returns the edge stored in the mesh\n+        identified by uuid. If such edge do not\n+        exists an exception is raised.\n+\n+        Parameters\n+        ----------\n+        uuid\n+            uuid of the desired edge.\n+\n+        Returns\n+        -------\n+        Edge\n+            Edge identified by uuid\n+\n+        Raises\n+        ------\n+        Exception\n+            If the edge identified by uuid was not found\n+\n+        \"\"\"\n+        message = \"Edges are not supported yet in Numerrin engine\"\n+        raise NotImplementedError(message)\n+\n+    def get_face(self, uuid):\n+        \"\"\"Returns a face with a given uuid.\n+\n+        Returns the face stored in the mesh\n+        identified by uuid. If such face do not\n+        exists an exception is raised.\n+\n+        Parameters\n+        ----------\n+        uuid\n+            uuid of the desired face.\n+\n+        Returns\n+        -------\n+        Face\n+            Face identified by uuid\n+\n+        Raises\n+        ------\n+        Exception\n+            If the face identified by uuid was not found\n+\n+        \"\"\"\n+\n+        try:\n+            pointLabels = self.pool.get_face_points(self.name,\n+                                                    self._uuidToNumLabel[uuid])\n+            puids = [self._numPointLabelToUuid[lbl] for lbl in pointLabels]\n+            face = Face(puids, uuid)\n+            try:\n+                blabel = self.pool.get_face_boundary_label(\n+                    self.name, self._uuidToNumLabel[uuid])\n+                face.data[CUBA.LABEL] = blabel\n+            except RuntimeError:\n+                pass\n+            return face\n+        except KeyError:\n+            error_str = \"Trying to get an non-existing edge with uuid: {}\"\n+            raise ValueError(error_str.format(uuid))\n+\n+    def get_cell(self, uuid):\n+        \"\"\"Returns a cell with a given uuid.\n+\n+        Returns the cell stored in the mesh\n+        identified by uuid . If such cell do not\n+        exists an exception is raised.\n+\n+        Parameters\n+        ----------\n+        uuid\n+            uuid of the desired cell.\n+\n+        Returns\n+        -------\n+        Cell\n+            Cell with id identified by uuid\n+\n+        Raises\n+        ------\n+        Exception\n+            If the cell identified by uuid was not found\n+\n+        \"\"\"\n+\n+        try:\n+            pointLabels = numerrin.getelement(self.pool.ph, self.name,\n+                                              3, self._uuidToNumLabel[uuid],\n+                                              0)\n+            puids = [self._numPointLabelToUuid[lbl] for lbl in pointLabels]\n+            cell = Cell(puids, uuid)\n+            return cell\n+\n+        except KeyError:","path":"numerrin_wrapper/numerrin_mesh.py","position":213,"original_position":213,"commit_id":"fdc254f79ebae9ad46388fe91f02447926b4e269","original_commit_id":"fdc254f79ebae9ad46388fe91f02447926b4e269","user":{"login":"kemattil","id":8542601,"avatar_url":"https://avatars.githubusercontent.com/u/8542601?v=3","gravatar_id":"","url":"https://api.github.com/users/kemattil","html_url":"https://github.com/kemattil","followers_url":"https://api.github.com/users/kemattil/followers","following_url":"https://api.github.com/users/kemattil/following{/other_user}","gists_url":"https://api.github.com/users/kemattil/gists{/gist_id}","starred_url":"https://api.github.com/users/kemattil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kemattil/subscriptions","organizations_url":"https://api.github.com/users/kemattil/orgs","repos_url":"https://api.github.com/users/kemattil/repos","events_url":"https://api.github.com/users/kemattil/events{/privacy}","received_events_url":"https://api.github.com/users/kemattil/received_events","type":"User","site_admin":false},"body":"See the above comment on L111.","created_at":"2015-05-12T11:49:14Z","updated_at":"2015-05-12T11:49:14Z","html_url":"https://github.com/simphony/simphony-numerrin/pull/1#discussion_r30125774","pull_request_url":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/comments/30125774"},"html":{"href":"https://github.com/simphony/simphony-numerrin/pull/1#discussion_r30125774"},"pull_request":{"href":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/1","id":33924935,"html_url":"https://github.com/simphony/simphony-numerrin/pull/1","diff_url":"https://github.com/simphony/simphony-numerrin/pull/1.diff","patch_url":"https://github.com/simphony/simphony-numerrin/pull/1.patch","issue_url":"https://api.github.com/repos/simphony/simphony-numerrin/issues/1","number":1,"state":"open","locked":false,"title":"Feature numerrin proxy numerola","user":{"login":"khiltunen","id":8565707,"avatar_url":"https://avatars.githubusercontent.com/u/8565707?v=3","gravatar_id":"","url":"https://api.github.com/users/khiltunen","html_url":"https://github.com/khiltunen","followers_url":"https://api.github.com/users/khiltunen/followers","following_url":"https://api.github.com/users/khiltunen/following{/other_user}","gists_url":"https://api.github.com/users/khiltunen/gists{/gist_id}","starred_url":"https://api.github.com/users/khiltunen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khiltunen/subscriptions","organizations_url":"https://api.github.com/users/khiltunen/orgs","repos_url":"https://api.github.com/users/khiltunen/repos","events_url":"https://api.github.com/users/khiltunen/events{/privacy}","received_events_url":"https://api.github.com/users/khiltunen/received_events","type":"User","site_admin":false},"body":"This version changes Numerrin wrapper work more like a proxy. Numerrin pool is holding the mesh and variable data which can be manipulated through wrapper classes","created_at":"2015-04-23T05:21:01Z","updated_at":"2015-05-12T11:49:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"df2a78b11e53a7c9f201a757bda84b09bc0bcbc0","assignee":{"login":"khiltunen","id":8565707,"avatar_url":"https://avatars.githubusercontent.com/u/8565707?v=3","gravatar_id":"","url":"https://api.github.com/users/khiltunen","html_url":"https://github.com/khiltunen","followers_url":"https://api.github.com/users/khiltunen/followers","following_url":"https://api.github.com/users/khiltunen/following{/other_user}","gists_url":"https://api.github.com/users/khiltunen/gists{/gist_id}","starred_url":"https://api.github.com/users/khiltunen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khiltunen/subscriptions","organizations_url":"https://api.github.com/users/khiltunen/orgs","repos_url":"https://api.github.com/users/khiltunen/repos","events_url":"https://api.github.com/users/khiltunen/events{/privacy}","received_events_url":"https://api.github.com/users/khiltunen/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/1/commits","review_comments_url":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/1/comments","review_comment_url":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/simphony/simphony-numerrin/issues/1/comments","statuses_url":"https://api.github.com/repos/simphony/simphony-numerrin/statuses/fdc254f79ebae9ad46388fe91f02447926b4e269","head":{"label":"simphony:feature-numerrin-proxy-numerola","ref":"feature-numerrin-proxy-numerola","sha":"fdc254f79ebae9ad46388fe91f02447926b4e269","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":28183683,"name":"simphony-numerrin","full_name":"simphony/simphony-numerrin","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-numerrin","description":"","fork":false,"url":"https://api.github.com/repos/simphony/simphony-numerrin","forks_url":"https://api.github.com/repos/simphony/simphony-numerrin/forks","keys_url":"https://api.github.com/repos/simphony/simphony-numerrin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/simphony/simphony-numerrin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/simphony/simphony-numerrin/teams","hooks_url":"https://api.github.com/repos/simphony/simphony-numerrin/hooks","issue_events_url":"https://api.github.com/repos/simphony/simphony-numerrin/issues/events{/number}","events_url":"https://api.github.com/repos/simphony/simphony-numerrin/events","assignees_url":"https://api.github.com/repos/simphony/simphony-numerrin/assignees{/user}","branches_url":"https://api.github.com/repos/simphony/simphony-numerrin/branches{/branch}","tags_url":"https://api.github.com/repos/simphony/simphony-numerrin/tags","blobs_url":"https://api.github.com/repos/simphony/simphony-numerrin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/simphony/simphony-numerrin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/simphony/simphony-numerrin/git/refs{/sha}","trees_url":"https://api.github.com/repos/simphony/simphony-numerrin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/simphony/simphony-numerrin/statuses/{sha}","languages_url":"https://api.github.com/repos/simphony/simphony-numerrin/languages","stargazers_url":"https://api.github.com/repos/simphony/simphony-numerrin/stargazers","contributors_url":"https://api.github.com/repos/simphony/simphony-numerrin/contributors","subscribers_url":"https://api.github.com/repos/simphony/simphony-numerrin/subscribers","subscription_url":"https://api.github.com/repos/simphony/simphony-numerrin/subscription","commits_url":"https://api.github.com/repos/simphony/simphony-numerrin/commits{/sha}","git_commits_url":"https://api.github.com/repos/simphony/simphony-numerrin/git/commits{/sha}","comments_url":"https://api.github.com/repos/simphony/simphony-numerrin/comments{/number}","issue_comment_url":"https://api.github.com/repos/simphony/simphony-numerrin/issues/comments{/number}","contents_url":"https://api.github.com/repos/simphony/simphony-numerrin/contents/{+path}","compare_url":"https://api.github.com/repos/simphony/simphony-numerrin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/simphony/simphony-numerrin/merges","archive_url":"https://api.github.com/repos/simphony/simphony-numerrin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/simphony/simphony-numerrin/downloads","issues_url":"https://api.github.com/repos/simphony/simphony-numerrin/issues{/number}","pulls_url":"https://api.github.com/repos/simphony/simphony-numerrin/pulls{/number}","milestones_url":"https://api.github.com/repos/simphony/simphony-numerrin/milestones{/number}","notifications_url":"https://api.github.com/repos/simphony/simphony-numerrin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/simphony/simphony-numerrin/labels{/name}","releases_url":"https://api.github.com/repos/simphony/simphony-numerrin/releases{/id}","created_at":"2014-12-18T13:01:10Z","updated_at":"2014-12-18T13:01:10Z","pushed_at":"2015-05-12T06:31:03Z","git_url":"git://github.com/simphony/simphony-numerrin.git","ssh_url":"git@github.com:simphony/simphony-numerrin.git","clone_url":"https://github.com/simphony/simphony-numerrin.git","svn_url":"https://github.com/simphony/simphony-numerrin","homepage":null,"size":5852,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"simphony:master","ref":"master","sha":"08cef905ce40fb4523a95aec3ab25640368bfc8c","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":28183683,"name":"simphony-numerrin","full_name":"simphony/simphony-numerrin","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-numerrin","description":"","fork":false,"url":"https://api.github.com/repos/simphony/simphony-numerrin","forks_url":"https://api.github.com/repos/simphony/simphony-numerrin/forks","keys_url":"https://api.github.com/repos/simphony/simphony-numerrin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/simphony/simphony-numerrin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/simphony/simphony-numerrin/teams","hooks_url":"https://api.github.com/repos/simphony/simphony-numerrin/hooks","issue_events_url":"https://api.github.com/repos/simphony/simphony-numerrin/issues/events{/number}","events_url":"https://api.github.com/repos/simphony/simphony-numerrin/events","assignees_url":"https://api.github.com/repos/simphony/simphony-numerrin/assignees{/user}","branches_url":"https://api.github.com/repos/simphony/simphony-numerrin/branches{/branch}","tags_url":"https://api.github.com/repos/simphony/simphony-numerrin/tags","blobs_url":"https://api.github.com/repos/simphony/simphony-numerrin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/simphony/simphony-numerrin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/simphony/simphony-numerrin/git/refs{/sha}","trees_url":"https://api.github.com/repos/simphony/simphony-numerrin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/simphony/simphony-numerrin/statuses/{sha}","languages_url":"https://api.github.com/repos/simphony/simphony-numerrin/languages","stargazers_url":"https://api.github.com/repos/simphony/simphony-numerrin/stargazers","contributors_url":"https://api.github.com/repos/simphony/simphony-numerrin/contributors","subscribers_url":"https://api.github.com/repos/simphony/simphony-numerrin/subscribers","subscription_url":"https://api.github.com/repos/simphony/simphony-numerrin/subscription","commits_url":"https://api.github.com/repos/simphony/simphony-numerrin/commits{/sha}","git_commits_url":"https://api.github.com/repos/simphony/simphony-numerrin/git/commits{/sha}","comments_url":"https://api.github.com/repos/simphony/simphony-numerrin/comments{/number}","issue_comment_url":"https://api.github.com/repos/simphony/simphony-numerrin/issues/comments{/number}","contents_url":"https://api.github.com/repos/simphony/simphony-numerrin/contents/{+path}","compare_url":"https://api.github.com/repos/simphony/simphony-numerrin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/simphony/simphony-numerrin/merges","archive_url":"https://api.github.com/repos/simphony/simphony-numerrin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/simphony/simphony-numerrin/downloads","issues_url":"https://api.github.com/repos/simphony/simphony-numerrin/issues{/number}","pulls_url":"https://api.github.com/repos/simphony/simphony-numerrin/pulls{/number}","milestones_url":"https://api.github.com/repos/simphony/simphony-numerrin/milestones{/number}","notifications_url":"https://api.github.com/repos/simphony/simphony-numerrin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/simphony/simphony-numerrin/labels{/name}","releases_url":"https://api.github.com/repos/simphony/simphony-numerrin/releases{/id}","created_at":"2014-12-18T13:01:10Z","updated_at":"2014-12-18T13:01:10Z","pushed_at":"2015-05-12T06:31:03Z","git_url":"git://github.com/simphony/simphony-numerrin.git","ssh_url":"git@github.com:simphony/simphony-numerrin.git","clone_url":"https://github.com/simphony/simphony-numerrin.git","svn_url":"https://github.com/simphony/simphony-numerrin","homepage":null,"size":5852,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/1"},"html":{"href":"https://github.com/simphony/simphony-numerrin/pull/1"},"issue":{"href":"https://api.github.com/repos/simphony/simphony-numerrin/issues/1"},"comments":{"href":"https://api.github.com/repos/simphony/simphony-numerrin/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/simphony/simphony-numerrin/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/simphony/simphony-numerrin/statuses/fdc254f79ebae9ad46388fe91f02447926b4e269"}}}}