{"action":"created","comment":{"url":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/comments/46659524","id":46659524,"diff_hunk":"@@ -200,21 +206,40 @@ def from_dataset(cls, name, data_set, data=None):\n \n     # Particle operations ####################################################\n \n-    def add_particle(self, particle):\n+    def add_particles(self, particles):\n         data_set = self.data_set\n         points = data_set.points\n         particle2index = self.particle2index\n-        with self._add_item(particle, particle2index) as item:\n-            if self.initialized:\n-                # We remove the dummy point\n-                self.data_set.points = tvtk.Points()\n-                points = data_set.points\n-                self.initialized = False\n-            index = points.insert_next_point(item.coordinates)\n-            particle2index[item.uid] = index\n-            self.index2particle[index] = item.uid\n-            self.point_data.append(item.data)\n-        return item.uid\n+        item_uids = []\n+        for particle in particles:\n+            with self._add_item(particle, particle2index) as item:\n+                if self.initialized:\n+                    # We remove the dummy point\n+                    self.data_set.points = tvtk.Points()\n+                    points = data_set.points\n+                    self.initialized = False\n+                index = points.insert_next_point(item.coordinates)\n+                particle2index[item.uid] = index\n+                self.index2particle[index] = item.uid\n+                self.point_data.append(item.data)\n+                item_uids.append(item.uid)\n+\n+        # adding new points causes the cached array under\n+        # tvtk.array_handler to be inconsistent with the\n+        # points FloatArray, therefore we need to remove\n+        # the reference in the tvtk.array_handler._array_cache\n+        # for points.to_array() to work properly\n+        _array_cache = None\n+        for name in ['array_handler', 'tvtk.array_handler']:\n+            if name in sys.modules:\n+                mod = sys.modules[name]\n+                if hasattr(mod, '_array_cache'):\n+                    _array_cache = mod._array_cache\n+                break\n+        if _array_cache:\n+            _array_cache._remove_array(tvtk.to_vtk(points.data).__this__)","path":"simphony_mayavi/cuds/vtk_particles.py","position":72,"original_position":72,"commit_id":"5ec9178c69b53d7d54670d176ba2e620207e3b1e","original_commit_id":"5ec9178c69b53d7d54670d176ba2e620207e3b1e","user":{"login":"kitchoi","id":3673984,"avatar_url":"https://avatars.githubusercontent.com/u/3673984?v=3","gravatar_id":"","url":"https://api.github.com/users/kitchoi","html_url":"https://github.com/kitchoi","followers_url":"https://api.github.com/users/kitchoi/followers","following_url":"https://api.github.com/users/kitchoi/following{/other_user}","gists_url":"https://api.github.com/users/kitchoi/gists{/gist_id}","starred_url":"https://api.github.com/users/kitchoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitchoi/subscriptions","organizations_url":"https://api.github.com/users/kitchoi/orgs","repos_url":"https://api.github.com/users/kitchoi/repos","events_url":"https://api.github.com/users/kitchoi/events{/privacy}","received_events_url":"https://api.github.com/users/kitchoi/received_events","type":"User","site_admin":false},"body":"This block looks like a hack for me.  What do you think? @dpinte ","created_at":"2015-12-04T08:39:08Z","updated_at":"2015-12-04T08:39:08Z","html_url":"https://github.com/simphony/simphony-mayavi/pull/96#discussion_r46659524","pull_request_url":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/96","_links":{"self":{"href":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/comments/46659524"},"html":{"href":"https://github.com/simphony/simphony-mayavi/pull/96#discussion_r46659524"},"pull_request":{"href":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/96"}}},"pull_request":{"url":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/96","id":52422766,"html_url":"https://github.com/simphony/simphony-mayavi/pull/96","diff_url":"https://github.com/simphony/simphony-mayavi/pull/96.diff","patch_url":"https://github.com/simphony/simphony-mayavi/pull/96.patch","issue_url":"https://api.github.com/repos/simphony/simphony-mayavi/issues/96","number":96,"state":"open","locked":false,"title":"Upgrade particle support","user":{"login":"kitchoi","id":3673984,"avatar_url":"https://avatars.githubusercontent.com/u/3673984?v=3","gravatar_id":"","url":"https://api.github.com/users/kitchoi","html_url":"https://github.com/kitchoi","followers_url":"https://api.github.com/users/kitchoi/followers","following_url":"https://api.github.com/users/kitchoi/following{/other_user}","gists_url":"https://api.github.com/users/kitchoi/gists{/gist_id}","starred_url":"https://api.github.com/users/kitchoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitchoi/subscriptions","organizations_url":"https://api.github.com/users/kitchoi/orgs","repos_url":"https://api.github.com/users/kitchoi/repos","events_url":"https://api.github.com/users/kitchoi/events{/privacy}","received_events_url":"https://api.github.com/users/kitchoi/received_events","type":"User","site_admin":false},"body":"I have fixed support for vtk-particle.  Please take a look @dpinte, @itziakos.\r\nNow the failed tests are the ones that have to do with H5CUDS.\r\n\r\nNote:\r\nI have implemented the [proposal regarding adding/updating bonds that contain particles outside of the particles container](https://publicwiki-01.fraunhofer.de/SimPhoNy-Project/index.php/Operations_on_Bonds_and_other_connectivity_objects) in `vtk_particle`.  ValueError would be raised if the user tries to do so.  Since the simphony-common has not implemented this proposal, I have overloaded and added tests in `simphony_mayavi.cuds.tests.test_vtk_particles`\r\n","created_at":"2015-12-02T16:55:39Z","updated_at":"2015-12-04T08:39:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5549e55372a8ca715ffc6fd8621d411cb7145ab2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/96/commits","review_comments_url":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/96/comments","review_comment_url":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/simphony/simphony-mayavi/issues/96/comments","statuses_url":"https://api.github.com/repos/simphony/simphony-mayavi/statuses/5ec9178c69b53d7d54670d176ba2e620207e3b1e","head":{"label":"simphony:upgrade-particle-support","ref":"upgrade-particle-support","sha":"5ec9178c69b53d7d54670d176ba2e620207e3b1e","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":22652254,"name":"simphony-mayavi","full_name":"simphony/simphony-mayavi","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-mayavi","description":"The mayavi adapters to the simphony framework","fork":false,"url":"https://api.github.com/repos/simphony/simphony-mayavi","forks_url":"https://api.github.com/repos/simphony/simphony-mayavi/forks","keys_url":"https://api.github.com/repos/simphony/simphony-mayavi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/simphony/simphony-mayavi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/simphony/simphony-mayavi/teams","hooks_url":"https://api.github.com/repos/simphony/simphony-mayavi/hooks","issue_events_url":"https://api.github.com/repos/simphony/simphony-mayavi/issues/events{/number}","events_url":"https://api.github.com/repos/simphony/simphony-mayavi/events","assignees_url":"https://api.github.com/repos/simphony/simphony-mayavi/assignees{/user}","branches_url":"https://api.github.com/repos/simphony/simphony-mayavi/branches{/branch}","tags_url":"https://api.github.com/repos/simphony/simphony-mayavi/tags","blobs_url":"https://api.github.com/repos/simphony/simphony-mayavi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/simphony/simphony-mayavi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/simphony/simphony-mayavi/git/refs{/sha}","trees_url":"https://api.github.com/repos/simphony/simphony-mayavi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/simphony/simphony-mayavi/statuses/{sha}","languages_url":"https://api.github.com/repos/simphony/simphony-mayavi/languages","stargazers_url":"https://api.github.com/repos/simphony/simphony-mayavi/stargazers","contributors_url":"https://api.github.com/repos/simphony/simphony-mayavi/contributors","subscribers_url":"https://api.github.com/repos/simphony/simphony-mayavi/subscribers","subscription_url":"https://api.github.com/repos/simphony/simphony-mayavi/subscription","commits_url":"https://api.github.com/repos/simphony/simphony-mayavi/commits{/sha}","git_commits_url":"https://api.github.com/repos/simphony/simphony-mayavi/git/commits{/sha}","comments_url":"https://api.github.com/repos/simphony/simphony-mayavi/comments{/number}","issue_comment_url":"https://api.github.com/repos/simphony/simphony-mayavi/issues/comments{/number}","contents_url":"https://api.github.com/repos/simphony/simphony-mayavi/contents/{+path}","compare_url":"https://api.github.com/repos/simphony/simphony-mayavi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/simphony/simphony-mayavi/merges","archive_url":"https://api.github.com/repos/simphony/simphony-mayavi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/simphony/simphony-mayavi/downloads","issues_url":"https://api.github.com/repos/simphony/simphony-mayavi/issues{/number}","pulls_url":"https://api.github.com/repos/simphony/simphony-mayavi/pulls{/number}","milestones_url":"https://api.github.com/repos/simphony/simphony-mayavi/milestones{/number}","notifications_url":"https://api.github.com/repos/simphony/simphony-mayavi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/simphony/simphony-mayavi/labels{/name}","releases_url":"https://api.github.com/repos/simphony/simphony-mayavi/releases{/id}","created_at":"2014-08-05T17:15:12Z","updated_at":"2015-05-08T16:49:09Z","pushed_at":"2015-12-03T09:44:58Z","git_url":"git://github.com/simphony/simphony-mayavi.git","ssh_url":"git@github.com:simphony/simphony-mayavi.git","clone_url":"https://github.com/simphony/simphony-mayavi.git","svn_url":"https://github.com/simphony/simphony-mayavi","homepage":null,"size":1813,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":0,"default_branch":"master"}},"base":{"label":"simphony:master","ref":"master","sha":"f0a34b956aadc7c3b2e95569688b6dc372a9c85a","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":22652254,"name":"simphony-mayavi","full_name":"simphony/simphony-mayavi","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-mayavi","description":"The mayavi adapters to the simphony framework","fork":false,"url":"https://api.github.com/repos/simphony/simphony-mayavi","forks_url":"https://api.github.com/repos/simphony/simphony-mayavi/forks","keys_url":"https://api.github.com/repos/simphony/simphony-mayavi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/simphony/simphony-mayavi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/simphony/simphony-mayavi/teams","hooks_url":"https://api.github.com/repos/simphony/simphony-mayavi/hooks","issue_events_url":"https://api.github.com/repos/simphony/simphony-mayavi/issues/events{/number}","events_url":"https://api.github.com/repos/simphony/simphony-mayavi/events","assignees_url":"https://api.github.com/repos/simphony/simphony-mayavi/assignees{/user}","branches_url":"https://api.github.com/repos/simphony/simphony-mayavi/branches{/branch}","tags_url":"https://api.github.com/repos/simphony/simphony-mayavi/tags","blobs_url":"https://api.github.com/repos/simphony/simphony-mayavi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/simphony/simphony-mayavi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/simphony/simphony-mayavi/git/refs{/sha}","trees_url":"https://api.github.com/repos/simphony/simphony-mayavi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/simphony/simphony-mayavi/statuses/{sha}","languages_url":"https://api.github.com/repos/simphony/simphony-mayavi/languages","stargazers_url":"https://api.github.com/repos/simphony/simphony-mayavi/stargazers","contributors_url":"https://api.github.com/repos/simphony/simphony-mayavi/contributors","subscribers_url":"https://api.github.com/repos/simphony/simphony-mayavi/subscribers","subscription_url":"https://api.github.com/repos/simphony/simphony-mayavi/subscription","commits_url":"https://api.github.com/repos/simphony/simphony-mayavi/commits{/sha}","git_commits_url":"https://api.github.com/repos/simphony/simphony-mayavi/git/commits{/sha}","comments_url":"https://api.github.com/repos/simphony/simphony-mayavi/comments{/number}","issue_comment_url":"https://api.github.com/repos/simphony/simphony-mayavi/issues/comments{/number}","contents_url":"https://api.github.com/repos/simphony/simphony-mayavi/contents/{+path}","compare_url":"https://api.github.com/repos/simphony/simphony-mayavi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/simphony/simphony-mayavi/merges","archive_url":"https://api.github.com/repos/simphony/simphony-mayavi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/simphony/simphony-mayavi/downloads","issues_url":"https://api.github.com/repos/simphony/simphony-mayavi/issues{/number}","pulls_url":"https://api.github.com/repos/simphony/simphony-mayavi/pulls{/number}","milestones_url":"https://api.github.com/repos/simphony/simphony-mayavi/milestones{/number}","notifications_url":"https://api.github.com/repos/simphony/simphony-mayavi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/simphony/simphony-mayavi/labels{/name}","releases_url":"https://api.github.com/repos/simphony/simphony-mayavi/releases{/id}","created_at":"2014-08-05T17:15:12Z","updated_at":"2015-05-08T16:49:09Z","pushed_at":"2015-12-03T09:44:58Z","git_url":"git://github.com/simphony/simphony-mayavi.git","ssh_url":"git@github.com:simphony/simphony-mayavi.git","clone_url":"https://github.com/simphony/simphony-mayavi.git","svn_url":"https://github.com/simphony/simphony-mayavi","homepage":null,"size":1813,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/96"},"html":{"href":"https://github.com/simphony/simphony-mayavi/pull/96"},"issue":{"href":"https://api.github.com/repos/simphony/simphony-mayavi/issues/96"},"comments":{"href":"https://api.github.com/repos/simphony/simphony-mayavi/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/simphony/simphony-mayavi/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/simphony/simphony-mayavi/statuses/5ec9178c69b53d7d54670d176ba2e620207e3b1e"}}}}