{"action":"created","comment":{"url":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/comments/44458341","id":44458341,"diff_hunk":"@@ -360,6 +360,67 @@ class PointDataLeafNode : public tree::LeafNode<T, Log2Dim> {\n         mAttributeSet->reorderAttributes(replacement);\n     }\n \n+    /// @brief Swap the underlying attribute set with the given @a attributeSet.\n+    /// This leaf will assume ownership of the given attribute set. The new\n+    /// attributes must have an equal descriptor. Additionally, if the new\n+    /// attributes have different topology, then the voxel offset values must\n+    /// be updated to reflect this new topology after a call to this method.\n+    void swap(AttributeSet* attributeSet)\n+    {\n+        if (!attributeSet) {\n+            OPENVDB_THROW(ValueError, \"Cannot swap with a null attribute set\");\n+        }\n+\n+        if (mAttributeSet->descriptor() != attributeSet->descriptor()) {\n+            OPENVDB_THROW(ValueError, \"Attribute set descriptors are not equal.\");\n+        }\n+\n+        mAttributeSet.reset(attributeSet);\n+    }\n+\n+    /// @brief Sets all of the voxel offset values on this leaf, from the given vector\n+    /// of @a offsets. If @a updateValueMask is true, then the active value mask will\n+    /// also be updated such that voxels with points are marked as active, and empty voxels\n+    /// are marked as inactive.\n+    void setOffsets(const std::vector<ValueType>& offsets, const bool updateValueMask = true)\n+    {\n+        if (offsets.size() != LeafNodeType::NUM_VALUES) {\n+            OPENVDB_THROW(ValueError, \"Offset vector size doesn't match number of voxels.\")\n+        }\n+\n+        for (size_t index = 0; index < offsets.size(); ++index) {\n+            setOffsetOnly(index, offsets[index]);\n+        }\n+\n+        if (updateValueMask)\n+            this->updateValueMask();\n+    }\n+\n+    /// @brief Validates the voxel offset values on this leaf to ensure that they are both\n+    /// monotonically increasing, and that they are within the bounds of the attribute\n+    /// arrays on this leaf node. Throws an exception if any of these checks fail.\n+    void validateOffsets() const\n+    {\n+        // Ensure all of the offset values are monotonically increasing\n+        for (size_t prevIndex = 0, index = 0; index < BaseLeaf::SIZE; prevIndex = index++) {\n+            if (this->getValue(prevIndex) > this->getValue(index)) {","path":"openvdb_points/tools/PointDataGrid.h","position":47,"original_position":47,"commit_id":"aa73a9a1058907a230a2a7259593888ee19d46b0","original_commit_id":"aa73a9a1058907a230a2a7259593888ee19d46b0","user":{"login":"danrbailey","id":5251654,"avatar_url":"https://avatars.githubusercontent.com/u/5251654?v=3","gravatar_id":"","url":"https://api.github.com/users/danrbailey","html_url":"https://github.com/danrbailey","followers_url":"https://api.github.com/users/danrbailey/followers","following_url":"https://api.github.com/users/danrbailey/following{/other_user}","gists_url":"https://api.github.com/users/danrbailey/gists{/gist_id}","starred_url":"https://api.github.com/users/danrbailey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danrbailey/subscriptions","organizations_url":"https://api.github.com/users/danrbailey/orgs","repos_url":"https://api.github.com/users/danrbailey/repos","events_url":"https://api.github.com/users/danrbailey/events{/privacy}","received_events_url":"https://api.github.com/users/danrbailey/received_events","type":"User","site_admin":false},"body":"Perhaps could be simpler?\r\n\r\n```\r\nfor (size_t index = 1; index < BaseLeaf::SIZE; index++) {\r\n    if (this->getValue(index - 1) > this->getValue(index))     ...\r\n}\r\n```","created_at":"2015-11-10T20:12:35Z","updated_at":"2015-11-10T20:12:35Z","html_url":"https://github.com/dneg/openvdb_points_dev/pull/16#discussion_r44458341","pull_request_url":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/comments/44458341"},"html":{"href":"https://github.com/dneg/openvdb_points_dev/pull/16#discussion_r44458341"},"pull_request":{"href":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/16","id":49580689,"html_url":"https://github.com/dneg/openvdb_points_dev/pull/16","diff_url":"https://github.com/dneg/openvdb_points_dev/pull/16.diff","patch_url":"https://github.com/dneg/openvdb_points_dev/pull/16.patch","issue_url":"https://api.github.com/repos/dneg/openvdb_points_dev/issues/16","number":16,"state":"open","locked":false,"title":"Adding swapAttributes and setOffsets on PointDataLeafNode","user":{"login":"jbrd","id":3728063,"avatar_url":"https://avatars.githubusercontent.com/u/3728063?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrd","html_url":"https://github.com/jbrd","followers_url":"https://api.github.com/users/jbrd/followers","following_url":"https://api.github.com/users/jbrd/following{/other_user}","gists_url":"https://api.github.com/users/jbrd/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrd/subscriptions","organizations_url":"https://api.github.com/users/jbrd/orgs","repos_url":"https://api.github.com/users/jbrd/repos","events_url":"https://api.github.com/users/jbrd/events{/privacy}","received_events_url":"https://api.github.com/users/jbrd/received_events","type":"User","site_admin":false},"body":"Note - no unit tests yet, opening the pull request so we can iterate on API first...","created_at":"2015-11-03T16:51:44Z","updated_at":"2015-11-10T20:12:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5bb098e4233c0e3bbf40f9cfb5147310a4ac4b8b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/16/commits","review_comments_url":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/16/comments","review_comment_url":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dneg/openvdb_points_dev/issues/16/comments","statuses_url":"https://api.github.com/repos/dneg/openvdb_points_dev/statuses/aa73a9a1058907a230a2a7259593888ee19d46b0","head":{"label":"jbrd:swapAttributes","ref":"swapAttributes","sha":"aa73a9a1058907a230a2a7259593888ee19d46b0","user":{"login":"jbrd","id":3728063,"avatar_url":"https://avatars.githubusercontent.com/u/3728063?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrd","html_url":"https://github.com/jbrd","followers_url":"https://api.github.com/users/jbrd/followers","following_url":"https://api.github.com/users/jbrd/following{/other_user}","gists_url":"https://api.github.com/users/jbrd/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrd/subscriptions","organizations_url":"https://api.github.com/users/jbrd/orgs","repos_url":"https://api.github.com/users/jbrd/repos","events_url":"https://api.github.com/users/jbrd/events{/privacy}","received_events_url":"https://api.github.com/users/jbrd/received_events","type":"User","site_admin":false},"repo":{"id":42353102,"name":"openvdb_points_dev","full_name":"jbrd/openvdb_points_dev","owner":{"login":"jbrd","id":3728063,"avatar_url":"https://avatars.githubusercontent.com/u/3728063?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrd","html_url":"https://github.com/jbrd","followers_url":"https://api.github.com/users/jbrd/followers","following_url":"https://api.github.com/users/jbrd/following{/other_user}","gists_url":"https://api.github.com/users/jbrd/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrd/subscriptions","organizations_url":"https://api.github.com/users/jbrd/orgs","repos_url":"https://api.github.com/users/jbrd/repos","events_url":"https://api.github.com/users/jbrd/events{/privacy}","received_events_url":"https://api.github.com/users/jbrd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jbrd/openvdb_points_dev","description":"OpenVDB Points Development Repository","fork":true,"url":"https://api.github.com/repos/jbrd/openvdb_points_dev","forks_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/forks","keys_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/teams","hooks_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/hooks","issue_events_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/issues/events{/number}","events_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/events","assignees_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/assignees{/user}","branches_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/branches{/branch}","tags_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/tags","blobs_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/statuses/{sha}","languages_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/languages","stargazers_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/stargazers","contributors_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/contributors","subscribers_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/subscribers","subscription_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/subscription","commits_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/contents/{+path}","compare_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/merges","archive_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/downloads","issues_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/issues{/number}","pulls_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/pulls{/number}","milestones_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/milestones{/number}","notifications_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/labels{/name}","releases_url":"https://api.github.com/repos/jbrd/openvdb_points_dev/releases{/id}","created_at":"2015-09-12T10:25:32Z","updated_at":"2015-09-12T10:25:33Z","pushed_at":"2015-11-10T19:31:03Z","git_url":"git://github.com/jbrd/openvdb_points_dev.git","ssh_url":"git@github.com:jbrd/openvdb_points_dev.git","clone_url":"https://github.com/jbrd/openvdb_points_dev.git","svn_url":"https://github.com/jbrd/openvdb_points_dev","homepage":"","size":692,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dneg:master","ref":"master","sha":"448202330f483ee8febe0b8c75e7e45049d8a4d3","user":{"login":"dneg","id":5524887,"avatar_url":"https://avatars.githubusercontent.com/u/5524887?v=3","gravatar_id":"","url":"https://api.github.com/users/dneg","html_url":"https://github.com/dneg","followers_url":"https://api.github.com/users/dneg/followers","following_url":"https://api.github.com/users/dneg/following{/other_user}","gists_url":"https://api.github.com/users/dneg/gists{/gist_id}","starred_url":"https://api.github.com/users/dneg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dneg/subscriptions","organizations_url":"https://api.github.com/users/dneg/orgs","repos_url":"https://api.github.com/users/dneg/repos","events_url":"https://api.github.com/users/dneg/events{/privacy}","received_events_url":"https://api.github.com/users/dneg/received_events","type":"Organization","site_admin":false},"repo":{"id":35619792,"name":"openvdb_points_dev","full_name":"dneg/openvdb_points_dev","owner":{"login":"dneg","id":5524887,"avatar_url":"https://avatars.githubusercontent.com/u/5524887?v=3","gravatar_id":"","url":"https://api.github.com/users/dneg","html_url":"https://github.com/dneg","followers_url":"https://api.github.com/users/dneg/followers","following_url":"https://api.github.com/users/dneg/following{/other_user}","gists_url":"https://api.github.com/users/dneg/gists{/gist_id}","starred_url":"https://api.github.com/users/dneg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dneg/subscriptions","organizations_url":"https://api.github.com/users/dneg/orgs","repos_url":"https://api.github.com/users/dneg/repos","events_url":"https://api.github.com/users/dneg/events{/privacy}","received_events_url":"https://api.github.com/users/dneg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dneg/openvdb_points_dev","description":"OpenVDB Points Development Repository","fork":false,"url":"https://api.github.com/repos/dneg/openvdb_points_dev","forks_url":"https://api.github.com/repos/dneg/openvdb_points_dev/forks","keys_url":"https://api.github.com/repos/dneg/openvdb_points_dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dneg/openvdb_points_dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dneg/openvdb_points_dev/teams","hooks_url":"https://api.github.com/repos/dneg/openvdb_points_dev/hooks","issue_events_url":"https://api.github.com/repos/dneg/openvdb_points_dev/issues/events{/number}","events_url":"https://api.github.com/repos/dneg/openvdb_points_dev/events","assignees_url":"https://api.github.com/repos/dneg/openvdb_points_dev/assignees{/user}","branches_url":"https://api.github.com/repos/dneg/openvdb_points_dev/branches{/branch}","tags_url":"https://api.github.com/repos/dneg/openvdb_points_dev/tags","blobs_url":"https://api.github.com/repos/dneg/openvdb_points_dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dneg/openvdb_points_dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dneg/openvdb_points_dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/dneg/openvdb_points_dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dneg/openvdb_points_dev/statuses/{sha}","languages_url":"https://api.github.com/repos/dneg/openvdb_points_dev/languages","stargazers_url":"https://api.github.com/repos/dneg/openvdb_points_dev/stargazers","contributors_url":"https://api.github.com/repos/dneg/openvdb_points_dev/contributors","subscribers_url":"https://api.github.com/repos/dneg/openvdb_points_dev/subscribers","subscription_url":"https://api.github.com/repos/dneg/openvdb_points_dev/subscription","commits_url":"https://api.github.com/repos/dneg/openvdb_points_dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/dneg/openvdb_points_dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/dneg/openvdb_points_dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/dneg/openvdb_points_dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/dneg/openvdb_points_dev/contents/{+path}","compare_url":"https://api.github.com/repos/dneg/openvdb_points_dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dneg/openvdb_points_dev/merges","archive_url":"https://api.github.com/repos/dneg/openvdb_points_dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dneg/openvdb_points_dev/downloads","issues_url":"https://api.github.com/repos/dneg/openvdb_points_dev/issues{/number}","pulls_url":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls{/number}","milestones_url":"https://api.github.com/repos/dneg/openvdb_points_dev/milestones{/number}","notifications_url":"https://api.github.com/repos/dneg/openvdb_points_dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dneg/openvdb_points_dev/labels{/name}","releases_url":"https://api.github.com/repos/dneg/openvdb_points_dev/releases{/id}","created_at":"2015-05-14T15:38:43Z","updated_at":"2015-11-06T10:01:41Z","pushed_at":"2015-11-10T19:31:03Z","git_url":"git://github.com/dneg/openvdb_points_dev.git","ssh_url":"git@github.com:dneg/openvdb_points_dev.git","clone_url":"https://github.com/dneg/openvdb_points_dev.git","svn_url":"https://github.com/dneg/openvdb_points_dev","homepage":"","size":1476,"stargazers_count":15,"watchers_count":15,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":1,"forks":9,"open_issues":1,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/16"},"html":{"href":"https://github.com/dneg/openvdb_points_dev/pull/16"},"issue":{"href":"https://api.github.com/repos/dneg/openvdb_points_dev/issues/16"},"comments":{"href":"https://api.github.com/repos/dneg/openvdb_points_dev/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dneg/openvdb_points_dev/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/dneg/openvdb_points_dev/statuses/aa73a9a1058907a230a2a7259593888ee19d46b0"}}}}