{"action":"created","comment":{"url":"https://api.github.com/repos/OP2/PyOP2/pulls/comments/130349686","pull_request_review_id":53214093,"id":130349686,"diff_hunk":"@@ -2737,6 +2737,84 @@ def halo_exchange_end(self):\n         part of a :class:`MixedDat`.\"\"\"\n         pass\n \n+    def _op(self, other, op):\n+        ret = type(self)(self.dim, dtype=self.dtype, name=self.name)\n+        if isinstance(other, Global):\n+            ret.data[:] = op(self.data_ro, other.data_ro)\n+        else:\n+            ret.data[:] = op(self.data_ro, other)\n+        return ret\n+\n+    def _iop(self, other, op):\n+        if isinstance(other, Global):\n+            op(self.data[:], other.data_ro)\n+        else:\n+            op(self.data[:], other)\n+        return self\n+\n+    def __pos__(self):\n+        return self.duplicate()\n+\n+    def __add__(self, other):\n+        \"\"\"Pointwise addition of fields.\"\"\"\n+        return self._op(other, operator.add)\n+\n+    def __radd__(self, other):\n+        \"\"\"Pointwise addition of fields.\n+\n+        self.__radd__(other) <==> other + self.\"\"\"\n+        return self + other\n+\n+    def __neg__(self):\n+        return type(self)(self.dim, data=-np.copy(self.data_ro),\n+                          dtype=self.dtype, name=self.name)\n+\n+    def __sub__(self, other):\n+        \"\"\"Pointwise subtraction of fields.\"\"\"\n+        return self._op(other, operator.sub)\n+\n+    def __rsub__(self, other):\n+        \"\"\"Pointwise subtraction of fields.\n+\n+        self.__rsub__(other) <==> other - self.\"\"\"\n+        ret = -self\n+        ret += other\n+        return ret\n+\n+    def __mul__(self, other):\n+        \"\"\"Pointwise multiplication or scaling of fields.\"\"\"\n+        return self._op(other, operator.mul)\n+\n+    def __rmul__(self, other):\n+        \"\"\"Pointwise multiplication or scaling of fields.\n+\n+        self.__rmul__(other) <==> other * self.\"\"\"\n+        return self.__mul__(other)\n+\n+    def __truediv__(self, other):\n+        \"\"\"Pointwise division or scaling of fields.\"\"\"\n+        return self._op(other, operator.truediv)\n+\n+    __div__ = __truediv__  # Python 2 compatibility\n+\n+    def __iadd__(self, other):\n+        \"\"\"Pointwise addition of fields.\"\"\"\n+        return self._iop(other, operator.iadd)\n+\n+    def __isub__(self, other):\n+        \"\"\"Pointwise subtraction of fields.\"\"\"\n+        return self._iop(other, operator.isub)\n+\n+    def __imul__(self, other):\n+        \"\"\"Pointwise multiplication or scaling of fields.\"\"\"\n+        return self._iop(other, operator.imul)\n+\n+    def __itruediv__(self, other):\n+        \"\"\"Pointwise division or scaling of fields.\"\"\"\n+        return self._iop(other, operator.itruediv)\n+\n+    __idiv__ = __itruediv__  # Python 2 compatibility","path":"pyop2/base.py","position":80,"original_position":80,"commit_id":"86f9344b5220f6d6b7f5665917d40279b84c2639","original_commit_id":"86f9344b5220f6d6b7f5665917d40279b84c2639","user":{"login":"dham","id":848103,"avatar_url":"https://avatars2.githubusercontent.com/u/848103?v=4","gravatar_id":"","url":"https://api.github.com/users/dham","html_url":"https://github.com/dham","followers_url":"https://api.github.com/users/dham/followers","following_url":"https://api.github.com/users/dham/following{/other_user}","gists_url":"https://api.github.com/users/dham/gists{/gist_id}","starred_url":"https://api.github.com/users/dham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dham/subscriptions","organizations_url":"https://api.github.com/users/dham/orgs","repos_url":"https://api.github.com/users/dham/repos","events_url":"https://api.github.com/users/dham/events{/privacy}","received_events_url":"https://api.github.com/users/dham/received_events","type":"User","site_admin":false},"body":"Well we haven't disabled it elsewhere, so not putting it in at this point would create an undocumented breakage. However I agree, we should drop Python 2.7 support (but do it in one fell swoop).","created_at":"2017-07-31T13:20:04Z","updated_at":"2017-07-31T13:20:04Z","html_url":"https://github.com/OP2/PyOP2/pull/531#discussion_r130349686","pull_request_url":"https://api.github.com/repos/OP2/PyOP2/pulls/531","_links":{"self":{"href":"https://api.github.com/repos/OP2/PyOP2/pulls/comments/130349686"},"html":{"href":"https://github.com/OP2/PyOP2/pull/531#discussion_r130349686"},"pull_request":{"href":"https://api.github.com/repos/OP2/PyOP2/pulls/531"}}},"pull_request":{"url":"https://api.github.com/repos/OP2/PyOP2/pulls/531","id":133242187,"html_url":"https://github.com/OP2/PyOP2/pull/531","diff_url":"https://github.com/OP2/PyOP2/pull/531.diff","patch_url":"https://github.com/OP2/PyOP2/pull/531.patch","issue_url":"https://api.github.com/repos/OP2/PyOP2/issues/531","number":531,"state":"open","locked":false,"title":"Define infix operators on Globals","user":{"login":"dham","id":848103,"avatar_url":"https://avatars2.githubusercontent.com/u/848103?v=4","gravatar_id":"","url":"https://api.github.com/users/dham","html_url":"https://github.com/dham","followers_url":"https://api.github.com/users/dham/followers","following_url":"https://api.github.com/users/dham/following{/other_user}","gists_url":"https://api.github.com/users/dham/gists{/gist_id}","starred_url":"https://api.github.com/users/dham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dham/subscriptions","organizations_url":"https://api.github.com/users/dham/orgs","repos_url":"https://api.github.com/users/dham/repos","events_url":"https://api.github.com/users/dham/events{/privacy}","received_events_url":"https://api.github.com/users/dham/received_events","type":"User","site_admin":false},"body":"This fixes issues where operations on Firedrake Functions in the R space assume that the usual operators are defined for Globals.","created_at":"2017-07-31T13:14:36Z","updated_at":"2017-07-31T13:20:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e411f598def37cbdf905ec97a2a45cd8250fe480","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/OP2/PyOP2/pulls/531/commits","review_comments_url":"https://api.github.com/repos/OP2/PyOP2/pulls/531/comments","review_comment_url":"https://api.github.com/repos/OP2/PyOP2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OP2/PyOP2/issues/531/comments","statuses_url":"https://api.github.com/repos/OP2/PyOP2/statuses/86f9344b5220f6d6b7f5665917d40279b84c2639","head":{"label":"OP2:globals_operators","ref":"globals_operators","sha":"86f9344b5220f6d6b7f5665917d40279b84c2639","user":{"login":"OP2","id":1544411,"avatar_url":"https://avatars3.githubusercontent.com/u/1544411?v=4","gravatar_id":"","url":"https://api.github.com/users/OP2","html_url":"https://github.com/OP2","followers_url":"https://api.github.com/users/OP2/followers","following_url":"https://api.github.com/users/OP2/following{/other_user}","gists_url":"https://api.github.com/users/OP2/gists{/gist_id}","starred_url":"https://api.github.com/users/OP2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OP2/subscriptions","organizations_url":"https://api.github.com/users/OP2/orgs","repos_url":"https://api.github.com/users/OP2/repos","events_url":"https://api.github.com/users/OP2/events{/privacy}","received_events_url":"https://api.github.com/users/OP2/received_events","type":"Organization","site_admin":false},"repo":{"id":4648505,"name":"PyOP2","full_name":"OP2/PyOP2","owner":{"login":"OP2","id":1544411,"avatar_url":"https://avatars3.githubusercontent.com/u/1544411?v=4","gravatar_id":"","url":"https://api.github.com/users/OP2","html_url":"https://github.com/OP2","followers_url":"https://api.github.com/users/OP2/followers","following_url":"https://api.github.com/users/OP2/following{/other_user}","gists_url":"https://api.github.com/users/OP2/gists{/gist_id}","starred_url":"https://api.github.com/users/OP2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OP2/subscriptions","organizations_url":"https://api.github.com/users/OP2/orgs","repos_url":"https://api.github.com/users/OP2/repos","events_url":"https://api.github.com/users/OP2/events{/privacy}","received_events_url":"https://api.github.com/users/OP2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OP2/PyOP2","description":"Framework for performance-portable parallel computations on unstructured meshes","fork":false,"url":"https://api.github.com/repos/OP2/PyOP2","forks_url":"https://api.github.com/repos/OP2/PyOP2/forks","keys_url":"https://api.github.com/repos/OP2/PyOP2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OP2/PyOP2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OP2/PyOP2/teams","hooks_url":"https://api.github.com/repos/OP2/PyOP2/hooks","issue_events_url":"https://api.github.com/repos/OP2/PyOP2/issues/events{/number}","events_url":"https://api.github.com/repos/OP2/PyOP2/events","assignees_url":"https://api.github.com/repos/OP2/PyOP2/assignees{/user}","branches_url":"https://api.github.com/repos/OP2/PyOP2/branches{/branch}","tags_url":"https://api.github.com/repos/OP2/PyOP2/tags","blobs_url":"https://api.github.com/repos/OP2/PyOP2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OP2/PyOP2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OP2/PyOP2/git/refs{/sha}","trees_url":"https://api.github.com/repos/OP2/PyOP2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OP2/PyOP2/statuses/{sha}","languages_url":"https://api.github.com/repos/OP2/PyOP2/languages","stargazers_url":"https://api.github.com/repos/OP2/PyOP2/stargazers","contributors_url":"https://api.github.com/repos/OP2/PyOP2/contributors","subscribers_url":"https://api.github.com/repos/OP2/PyOP2/subscribers","subscription_url":"https://api.github.com/repos/OP2/PyOP2/subscription","commits_url":"https://api.github.com/repos/OP2/PyOP2/commits{/sha}","git_commits_url":"https://api.github.com/repos/OP2/PyOP2/git/commits{/sha}","comments_url":"https://api.github.com/repos/OP2/PyOP2/comments{/number}","issue_comment_url":"https://api.github.com/repos/OP2/PyOP2/issues/comments{/number}","contents_url":"https://api.github.com/repos/OP2/PyOP2/contents/{+path}","compare_url":"https://api.github.com/repos/OP2/PyOP2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OP2/PyOP2/merges","archive_url":"https://api.github.com/repos/OP2/PyOP2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OP2/PyOP2/downloads","issues_url":"https://api.github.com/repos/OP2/PyOP2/issues{/number}","pulls_url":"https://api.github.com/repos/OP2/PyOP2/pulls{/number}","milestones_url":"https://api.github.com/repos/OP2/PyOP2/milestones{/number}","notifications_url":"https://api.github.com/repos/OP2/PyOP2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OP2/PyOP2/labels{/name}","releases_url":"https://api.github.com/repos/OP2/PyOP2/releases{/id}","deployments_url":"https://api.github.com/repos/OP2/PyOP2/deployments","created_at":"2012-06-13T08:28:09Z","updated_at":"2017-07-14T11:44:30Z","pushed_at":"2017-07-31T13:16:39Z","git_url":"git://github.com/OP2/PyOP2.git","ssh_url":"git@github.com:OP2/PyOP2.git","clone_url":"https://github.com/OP2/PyOP2.git","svn_url":"https://github.com/OP2/PyOP2","homepage":"op2.github.com/PyOP2","size":11800,"stargazers_count":33,"watchers_count":33,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":17,"mirror_url":null,"open_issues_count":17,"forks":17,"open_issues":17,"watchers":33,"default_branch":"master"}},"base":{"label":"OP2:master","ref":"master","sha":"5862a37a8129a6230c272415c62b4f8a0600d644","user":{"login":"OP2","id":1544411,"avatar_url":"https://avatars3.githubusercontent.com/u/1544411?v=4","gravatar_id":"","url":"https://api.github.com/users/OP2","html_url":"https://github.com/OP2","followers_url":"https://api.github.com/users/OP2/followers","following_url":"https://api.github.com/users/OP2/following{/other_user}","gists_url":"https://api.github.com/users/OP2/gists{/gist_id}","starred_url":"https://api.github.com/users/OP2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OP2/subscriptions","organizations_url":"https://api.github.com/users/OP2/orgs","repos_url":"https://api.github.com/users/OP2/repos","events_url":"https://api.github.com/users/OP2/events{/privacy}","received_events_url":"https://api.github.com/users/OP2/received_events","type":"Organization","site_admin":false},"repo":{"id":4648505,"name":"PyOP2","full_name":"OP2/PyOP2","owner":{"login":"OP2","id":1544411,"avatar_url":"https://avatars3.githubusercontent.com/u/1544411?v=4","gravatar_id":"","url":"https://api.github.com/users/OP2","html_url":"https://github.com/OP2","followers_url":"https://api.github.com/users/OP2/followers","following_url":"https://api.github.com/users/OP2/following{/other_user}","gists_url":"https://api.github.com/users/OP2/gists{/gist_id}","starred_url":"https://api.github.com/users/OP2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OP2/subscriptions","organizations_url":"https://api.github.com/users/OP2/orgs","repos_url":"https://api.github.com/users/OP2/repos","events_url":"https://api.github.com/users/OP2/events{/privacy}","received_events_url":"https://api.github.com/users/OP2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OP2/PyOP2","description":"Framework for performance-portable parallel computations on unstructured meshes","fork":false,"url":"https://api.github.com/repos/OP2/PyOP2","forks_url":"https://api.github.com/repos/OP2/PyOP2/forks","keys_url":"https://api.github.com/repos/OP2/PyOP2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OP2/PyOP2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OP2/PyOP2/teams","hooks_url":"https://api.github.com/repos/OP2/PyOP2/hooks","issue_events_url":"https://api.github.com/repos/OP2/PyOP2/issues/events{/number}","events_url":"https://api.github.com/repos/OP2/PyOP2/events","assignees_url":"https://api.github.com/repos/OP2/PyOP2/assignees{/user}","branches_url":"https://api.github.com/repos/OP2/PyOP2/branches{/branch}","tags_url":"https://api.github.com/repos/OP2/PyOP2/tags","blobs_url":"https://api.github.com/repos/OP2/PyOP2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OP2/PyOP2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OP2/PyOP2/git/refs{/sha}","trees_url":"https://api.github.com/repos/OP2/PyOP2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OP2/PyOP2/statuses/{sha}","languages_url":"https://api.github.com/repos/OP2/PyOP2/languages","stargazers_url":"https://api.github.com/repos/OP2/PyOP2/stargazers","contributors_url":"https://api.github.com/repos/OP2/PyOP2/contributors","subscribers_url":"https://api.github.com/repos/OP2/PyOP2/subscribers","subscription_url":"https://api.github.com/repos/OP2/PyOP2/subscription","commits_url":"https://api.github.com/repos/OP2/PyOP2/commits{/sha}","git_commits_url":"https://api.github.com/repos/OP2/PyOP2/git/commits{/sha}","comments_url":"https://api.github.com/repos/OP2/PyOP2/comments{/number}","issue_comment_url":"https://api.github.com/repos/OP2/PyOP2/issues/comments{/number}","contents_url":"https://api.github.com/repos/OP2/PyOP2/contents/{+path}","compare_url":"https://api.github.com/repos/OP2/PyOP2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OP2/PyOP2/merges","archive_url":"https://api.github.com/repos/OP2/PyOP2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OP2/PyOP2/downloads","issues_url":"https://api.github.com/repos/OP2/PyOP2/issues{/number}","pulls_url":"https://api.github.com/repos/OP2/PyOP2/pulls{/number}","milestones_url":"https://api.github.com/repos/OP2/PyOP2/milestones{/number}","notifications_url":"https://api.github.com/repos/OP2/PyOP2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OP2/PyOP2/labels{/name}","releases_url":"https://api.github.com/repos/OP2/PyOP2/releases{/id}","deployments_url":"https://api.github.com/repos/OP2/PyOP2/deployments","created_at":"2012-06-13T08:28:09Z","updated_at":"2017-07-14T11:44:30Z","pushed_at":"2017-07-31T13:16:39Z","git_url":"git://github.com/OP2/PyOP2.git","ssh_url":"git@github.com:OP2/PyOP2.git","clone_url":"https://github.com/OP2/PyOP2.git","svn_url":"https://github.com/OP2/PyOP2","homepage":"op2.github.com/PyOP2","size":11800,"stargazers_count":33,"watchers_count":33,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":17,"mirror_url":null,"open_issues_count":17,"forks":17,"open_issues":17,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OP2/PyOP2/pulls/531"},"html":{"href":"https://github.com/OP2/PyOP2/pull/531"},"issue":{"href":"https://api.github.com/repos/OP2/PyOP2/issues/531"},"comments":{"href":"https://api.github.com/repos/OP2/PyOP2/issues/531/comments"},"review_comments":{"href":"https://api.github.com/repos/OP2/PyOP2/pulls/531/comments"},"review_comment":{"href":"https://api.github.com/repos/OP2/PyOP2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OP2/PyOP2/pulls/531/commits"},"statuses":{"href":"https://api.github.com/repos/OP2/PyOP2/statuses/86f9344b5220f6d6b7f5665917d40279b84c2639"}}}}
{"actor":{"display_login":"dham"}}