{"action":"created","comment":{"url":"https://api.github.com/repos/odlgroup/odl/pulls/comments/51550168","id":51550168,"diff_hunk":"@@ -164,56 +228,82 @@ def element(self, inp=None):\n                                      '{!r}.'.format(self, inp)), err)\n \n     @property\n-    def grid(self):\n-        \"\"\"Sampling grid of the discretization mappings.\"\"\"\n-        return self.restriction.grid\n-\n-    @property\n-    def shape(self):\n-        \"\"\"Shape of the underlying grid.\"\"\"\n-        return self.grid.shape\n-\n-    @property\n-    def ndim(self):\n-        \"\"\"Number of dimensions.\"\"\"\n-        return self.grid.ndim\n-\n-    @property\n-    def cell_size(self):\n-        \"\"\"Cell size of an underlying regular grid.\"\"\"\n-        if not isinstance(self.grid, RegularGrid):\n-            raise NotImplementedError('cell size not defined for non-uniform '\n-                                      'grids. Use `grid.cell_sizes()` '\n-                                      'instead.')\n-        csize = self.grid.stride\n-        idcs = np.where(csize == 0)\n-        csize[idcs] = self.domain.extent[idcs]\n-        return csize\n-\n-    @property\n-    def cell_volume(self):\n-        \"\"\"Cell volume of an underlying regular grid.\"\"\"\n-        return float(np.prod(self.cell_size))\n-\n-    def points(self):\n-        \"\"\"All points in the sampling grid.\"\"\"\n-        return self.grid.points(order=self.order)\n-\n-    @property\n-    def order(self):\n-        \"\"\"Axis ordering for array flattening.\"\"\"\n-        return self._order\n-\n-    @property\n     def interp(self):\n         \"\"\"Interpolation type of this discretization.\"\"\"\n         return self._interp\n \n+    # Overrides for space functions depending on partition\n+    def _inner(self, x, y):\n+        \"\"\"Return ``self.inner(x, y)``.\"\"\"\n+        if any(bdry[0] or bdry[1]\n+               for bdry in self.partition.nodes_on_boundary()):\n+\n+            # Need to halve the boundary nodes to get correct contributions.\n+            # This requires copies, unfortunately.\n+            # TODO: implement without copy\n+            x_cpy = x.copy()\n+            on_bdry = self.partition.nodes_on_boundary()\n+            apply_on_boundary(\n+                x_cpy.asarray(), func=lambda x: x / 2,\n+                only_once=False, which_boundaries=on_bdry)\n+\n+            return super()._inner(x_cpy, y)\n+        else:\n+            # Standard case\n+            return super()._inner(x, y)\n+\n+    def _norm(self, x):\n+        \"\"\"Return ``self.norm(x)``.\"\"\"\n+        if any(bdry[0] or bdry[1]\n+               for bdry in self.partition.nodes_on_boundary()):\n+\n+            # TODO: implement without copy\n+            x_cpy = x.copy()\n+            on_bdry = self.partition.nodes_on_boundary()\n+            if self.exponent != float('inf'):\n+                # For p != inf we mimic the integral of f(x)**p, i.e. by\n+                # the following scaling we effectively multiply the\n+                # boundary contribution by 1/2.\n+                bdry_fac = 2 ** (1.0 / self.exponent)\n+                apply_on_boundary(\n+                    x_cpy.asarray(), func=lambda x: x / bdry_fac,\n+                    only_once=False, which_boundaries=on_bdry)\n+\n+            return super()._norm(x_cpy)\n+        else:\n+            # Standard case\n+            return super()._norm(x)\n+\n+    def _dist(self, x, y):\n+        \"\"\"Return ``self.dist(x, y)``.\"\"\"\n+        if any(bdry[0] or bdry[1]","path":"odl/discr/lp_discr.py","position":256,"original_position":256,"commit_id":"6dccc1be26111174315335e4fae960cbb735a1da","original_commit_id":"6dccc1be26111174315335e4fae960cbb735a1da","user":{"login":"adler-j","id":2202312,"avatar_url":"https://avatars.githubusercontent.com/u/2202312?v=3","gravatar_id":"","url":"https://api.github.com/users/adler-j","html_url":"https://github.com/adler-j","followers_url":"https://api.github.com/users/adler-j/followers","following_url":"https://api.github.com/users/adler-j/following{/other_user}","gists_url":"https://api.github.com/users/adler-j/gists{/gist_id}","starred_url":"https://api.github.com/users/adler-j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adler-j/subscriptions","organizations_url":"https://api.github.com/users/adler-j/orgs","repos_url":"https://api.github.com/users/adler-j/repos","events_url":"https://api.github.com/users/adler-j/events{/privacy}","received_events_url":"https://api.github.com/users/adler-j/received_events","type":"User","site_admin":false},"body":"See above","created_at":"2016-02-02T10:28:35Z","updated_at":"2016-02-02T10:28:35Z","html_url":"https://github.com/odlgroup/odl/pull/253#discussion_r51550168","pull_request_url":"https://api.github.com/repos/odlgroup/odl/pulls/253","_links":{"self":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/comments/51550168"},"html":{"href":"https://github.com/odlgroup/odl/pull/253#discussion_r51550168"},"pull_request":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/253"}}},"pull_request":{"url":"https://api.github.com/repos/odlgroup/odl/pulls/253","id":57881341,"html_url":"https://github.com/odlgroup/odl/pull/253","diff_url":"https://github.com/odlgroup/odl/pull/253.diff","patch_url":"https://github.com/odlgroup/odl/pull/253.patch","issue_url":"https://api.github.com/repos/odlgroup/odl/issues/253","number":253,"state":"open","locked":false,"title":"Issue 202  partitions","user":{"login":"kohr-h","id":5030250,"avatar_url":"https://avatars.githubusercontent.com/u/5030250?v=3","gravatar_id":"","url":"https://api.github.com/users/kohr-h","html_url":"https://github.com/kohr-h","followers_url":"https://api.github.com/users/kohr-h/followers","following_url":"https://api.github.com/users/kohr-h/following{/other_user}","gists_url":"https://api.github.com/users/kohr-h/gists{/gist_id}","starred_url":"https://api.github.com/users/kohr-h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kohr-h/subscriptions","organizations_url":"https://api.github.com/users/kohr-h/orgs","repos_url":"https://api.github.com/users/kohr-h/repos","events_url":"https://api.github.com/users/kohr-h/events{/privacy}","received_events_url":"https://api.github.com/users/kohr-h/received_events","type":"User","site_admin":false},"body":"Major PR again, but the main changes are really only a few, and the high number of code changes is due to the grid usage being very widespread across the code.\r\n\r\nHere's what happened:\r\n\r\n- A new `RectPartition` class was added which takes over all functionality connected to partition of sets which grids had to handle partly.\r\n- Grids are stripped down to purely handle their points, no extent, no convex hull etc. Much cleaner.\r\n- No more ordering in grids and partitions, this was shifted to `DiscreteLp` and `FunctionSetMapping` since they are the links between grid points and data storage (see also #249).\r\n- Adaption of inner product, norm and dist in `DiscreteLp` where the \"cropped cells\" at the boundaries have to be accounted for. This currently requires a copy, therefore having nodes at the boundary is not the default. (It is in `RectPartition` but not in `uniform_discr`, we could harmonize that.)\r\n- Done away with some of the LaTeX heavy docstrings plus some more cleanup.\r\n\r\nRemaining TODOs:\r\n- [ ] Fix Py2-related error when copying lists\r\n- [ ] Go through the examples and fix them if necessary.\r\n- [ ] Avoid copy in `_inner` etc. when there are boundary nodes. This requires something smarter than purely relying on the underlying `dspace` implementation, though. Probably a new issue.","created_at":"2016-02-01T18:42:54Z","updated_at":"2016-02-02T10:28:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/odlgroup/odl/pulls/253/commits","review_comments_url":"https://api.github.com/repos/odlgroup/odl/pulls/253/comments","review_comment_url":"https://api.github.com/repos/odlgroup/odl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/odlgroup/odl/issues/253/comments","statuses_url":"https://api.github.com/repos/odlgroup/odl/statuses/6dccc1be26111174315335e4fae960cbb735a1da","head":{"label":"odlgroup:issue-202__partitions","ref":"issue-202__partitions","sha":"6dccc1be26111174315335e4fae960cbb735a1da","user":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":45596393,"name":"odl","full_name":"odlgroup/odl","owner":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odlgroup/odl","description":"Operator Discretization Library","fork":false,"url":"https://api.github.com/repos/odlgroup/odl","forks_url":"https://api.github.com/repos/odlgroup/odl/forks","keys_url":"https://api.github.com/repos/odlgroup/odl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odlgroup/odl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odlgroup/odl/teams","hooks_url":"https://api.github.com/repos/odlgroup/odl/hooks","issue_events_url":"https://api.github.com/repos/odlgroup/odl/issues/events{/number}","events_url":"https://api.github.com/repos/odlgroup/odl/events","assignees_url":"https://api.github.com/repos/odlgroup/odl/assignees{/user}","branches_url":"https://api.github.com/repos/odlgroup/odl/branches{/branch}","tags_url":"https://api.github.com/repos/odlgroup/odl/tags","blobs_url":"https://api.github.com/repos/odlgroup/odl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odlgroup/odl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odlgroup/odl/git/refs{/sha}","trees_url":"https://api.github.com/repos/odlgroup/odl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odlgroup/odl/statuses/{sha}","languages_url":"https://api.github.com/repos/odlgroup/odl/languages","stargazers_url":"https://api.github.com/repos/odlgroup/odl/stargazers","contributors_url":"https://api.github.com/repos/odlgroup/odl/contributors","subscribers_url":"https://api.github.com/repos/odlgroup/odl/subscribers","subscription_url":"https://api.github.com/repos/odlgroup/odl/subscription","commits_url":"https://api.github.com/repos/odlgroup/odl/commits{/sha}","git_commits_url":"https://api.github.com/repos/odlgroup/odl/git/commits{/sha}","comments_url":"https://api.github.com/repos/odlgroup/odl/comments{/number}","issue_comment_url":"https://api.github.com/repos/odlgroup/odl/issues/comments{/number}","contents_url":"https://api.github.com/repos/odlgroup/odl/contents/{+path}","compare_url":"https://api.github.com/repos/odlgroup/odl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odlgroup/odl/merges","archive_url":"https://api.github.com/repos/odlgroup/odl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odlgroup/odl/downloads","issues_url":"https://api.github.com/repos/odlgroup/odl/issues{/number}","pulls_url":"https://api.github.com/repos/odlgroup/odl/pulls{/number}","milestones_url":"https://api.github.com/repos/odlgroup/odl/milestones{/number}","notifications_url":"https://api.github.com/repos/odlgroup/odl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odlgroup/odl/labels{/name}","releases_url":"https://api.github.com/repos/odlgroup/odl/releases{/id}","deployments_url":"https://api.github.com/repos/odlgroup/odl/deployments","created_at":"2015-11-05T07:57:55Z","updated_at":"2016-01-11T09:46:56Z","pushed_at":"2016-02-01T18:42:54Z","git_url":"git://github.com/odlgroup/odl.git","ssh_url":"git@github.com:odlgroup/odl.git","clone_url":"https://github.com/odlgroup/odl.git","svn_url":"https://github.com/odlgroup/odl","homepage":null,"size":15002,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":70,"forks":3,"open_issues":70,"watchers":2,"default_branch":"master"}},"base":{"label":"odlgroup:master","ref":"master","sha":"1c5427d4e884e3c2205bed519f9caa4785444e7d","user":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":45596393,"name":"odl","full_name":"odlgroup/odl","owner":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odlgroup/odl","description":"Operator Discretization Library","fork":false,"url":"https://api.github.com/repos/odlgroup/odl","forks_url":"https://api.github.com/repos/odlgroup/odl/forks","keys_url":"https://api.github.com/repos/odlgroup/odl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odlgroup/odl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odlgroup/odl/teams","hooks_url":"https://api.github.com/repos/odlgroup/odl/hooks","issue_events_url":"https://api.github.com/repos/odlgroup/odl/issues/events{/number}","events_url":"https://api.github.com/repos/odlgroup/odl/events","assignees_url":"https://api.github.com/repos/odlgroup/odl/assignees{/user}","branches_url":"https://api.github.com/repos/odlgroup/odl/branches{/branch}","tags_url":"https://api.github.com/repos/odlgroup/odl/tags","blobs_url":"https://api.github.com/repos/odlgroup/odl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odlgroup/odl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odlgroup/odl/git/refs{/sha}","trees_url":"https://api.github.com/repos/odlgroup/odl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odlgroup/odl/statuses/{sha}","languages_url":"https://api.github.com/repos/odlgroup/odl/languages","stargazers_url":"https://api.github.com/repos/odlgroup/odl/stargazers","contributors_url":"https://api.github.com/repos/odlgroup/odl/contributors","subscribers_url":"https://api.github.com/repos/odlgroup/odl/subscribers","subscription_url":"https://api.github.com/repos/odlgroup/odl/subscription","commits_url":"https://api.github.com/repos/odlgroup/odl/commits{/sha}","git_commits_url":"https://api.github.com/repos/odlgroup/odl/git/commits{/sha}","comments_url":"https://api.github.com/repos/odlgroup/odl/comments{/number}","issue_comment_url":"https://api.github.com/repos/odlgroup/odl/issues/comments{/number}","contents_url":"https://api.github.com/repos/odlgroup/odl/contents/{+path}","compare_url":"https://api.github.com/repos/odlgroup/odl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odlgroup/odl/merges","archive_url":"https://api.github.com/repos/odlgroup/odl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odlgroup/odl/downloads","issues_url":"https://api.github.com/repos/odlgroup/odl/issues{/number}","pulls_url":"https://api.github.com/repos/odlgroup/odl/pulls{/number}","milestones_url":"https://api.github.com/repos/odlgroup/odl/milestones{/number}","notifications_url":"https://api.github.com/repos/odlgroup/odl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odlgroup/odl/labels{/name}","releases_url":"https://api.github.com/repos/odlgroup/odl/releases{/id}","deployments_url":"https://api.github.com/repos/odlgroup/odl/deployments","created_at":"2015-11-05T07:57:55Z","updated_at":"2016-01-11T09:46:56Z","pushed_at":"2016-02-01T18:42:54Z","git_url":"git://github.com/odlgroup/odl.git","ssh_url":"git@github.com:odlgroup/odl.git","clone_url":"https://github.com/odlgroup/odl.git","svn_url":"https://github.com/odlgroup/odl","homepage":null,"size":15002,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":70,"forks":3,"open_issues":70,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/253"},"html":{"href":"https://github.com/odlgroup/odl/pull/253"},"issue":{"href":"https://api.github.com/repos/odlgroup/odl/issues/253"},"comments":{"href":"https://api.github.com/repos/odlgroup/odl/issues/253/comments"},"review_comments":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/253/comments"},"review_comment":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/253/commits"},"statuses":{"href":"https://api.github.com/repos/odlgroup/odl/statuses/6dccc1be26111174315335e4fae960cbb735a1da"}}}}