{"action":"created","comment":{"url":"https://api.github.com/repos/mantidproject/mantid/pulls/comments/70620223","id":70620223,"diff_hunk":"@@ -0,0 +1,111 @@\n+#ifndef MANTID_INDEXING_INDEXSET_H_\n+#define MANTID_INDEXING_INDEXSET_H_\n+\n+#include \"MantidIndexing/DllConfig.h\"\n+\n+#include <set>\n+#include <stdexcept>\n+#include <vector>\n+\n+namespace Mantid {\n+namespace Indexing {\n+namespace detail {\n+\n+/** IndexSet : TODO: DESCRIPTION\n+  CRTP\n+  We want DetectorIndexSet and SpectrumIndexSet, with the same functionality,\n+  but the types should be incompatible. Thus, we use IndexSet<DetectorIndexSet>\n+  and IndexSet<SpectrumIndexSet>.\n+\n+  @author Simon Heybrock\n+  @date 2016\n+\n+  Copyright &copy; 2016 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge\n+  National Laboratory & European Spallation Source\n+\n+  This file is part of Mantid.\n+\n+  Mantid is free software; you can redistribute it and/or modify\n+  it under the terms of the GNU General Public License as published by\n+  the Free Software Foundation; either version 3 of the License, or\n+  (at your option) any later version.\n+\n+  Mantid is distributed in the hope that it will be useful,\n+  but WITHOUT ANY WARRANTY; without even the implied warranty of\n+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+  GNU General Public License for more details.\n+\n+  You should have received a copy of the GNU General Public License\n+  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+\n+  File change history is stored at: <https://github.com/mantidproject/mantid>\n+  Code Documentation is available at: <http://doxygen.mantidproject.org>\n+*/\n+template <class T> class IndexSet {\n+public:\n+  IndexSet(size_t fullRange);\n+  IndexSet(int64_t min, int64_t max, size_t fullRange);\n+  IndexSet(const std::vector<size_t> indices, size_t fullRange);\n+\n+  /// Returns the size of the set.\n+  size_t size() const { return m_size; }\n+\n+  /// Returns the element at given index (range 0...size()-1).\n+  size_t operator[](size_t index) const {\n+    // This is accessed frequently in loops and thus inlined.\n+    if (m_isRange)\n+      return m_min + index;\n+    return m_indices[index];\n+  }\n+\n+protected:\n+  ~IndexSet() = default;\n+\n+private:\n+  bool m_isRange = true;\n+  // Default here to avoid uninitialized warning for m_isRange = false.\n+  size_t m_min = 0;\n+  size_t m_size;\n+  std::vector<size_t> m_indices;\n+};\n+\n+/// Constructor for a set covering the full range from 0 to fullRange-1.\n+template <class T>\n+IndexSet<T>::IndexSet(size_t fullRange)\n+    : m_size(fullRange) {}\n+\n+/// Constructor for a set covering the range from min to max. Range is verified\n+/// at construction time.\n+template <class T>\n+IndexSet<T>::IndexSet(int64_t min, int64_t max, size_t fullRange) {\n+  if (min < 0 || min > max)\n+    throw std::logic_error(\"IndexSet: specified min or max values are invalid\");\n+  if (max >= static_cast<int64_t>(fullRange))\n+    throw std::out_of_range(\"IndexSet: specified max value is out of range\");\n+\n+  // Bounds checked, cast should be fine in all cases.\n+  m_min = static_cast<size_t>(min);\n+  m_size = static_cast<size_t>(max - min + 1);\n+}\n+\n+/// Constructor for a set containing all specified indices. Range is verified at\n+/// construction time and duplicates are removed.\n+template <class T>\n+IndexSet<T>::IndexSet(const std::vector<size_t> indices, size_t fullRange)","path":"Framework/Indexing/inc/MantidIndexing/IndexSet.h","position":94,"original_position":94,"commit_id":"98964656330f35b61e74b2cd07e5cbda2c375fcc","original_commit_id":"98964656330f35b61e74b2cd07e5cbda2c375fcc","user":{"login":"SimonHeybrock","id":12912489,"avatar_url":"https://avatars.githubusercontent.com/u/12912489?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonHeybrock","html_url":"https://github.com/SimonHeybrock","followers_url":"https://api.github.com/users/SimonHeybrock/followers","following_url":"https://api.github.com/users/SimonHeybrock/following{/other_user}","gists_url":"https://api.github.com/users/SimonHeybrock/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonHeybrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonHeybrock/subscriptions","organizations_url":"https://api.github.com/users/SimonHeybrock/orgs","repos_url":"https://api.github.com/users/SimonHeybrock/repos","events_url":"https://api.github.com/users/SimonHeybrock/events{/privacy}","received_events_url":"https://api.github.com/users/SimonHeybrock/received_events","type":"User","site_admin":false},"body":"No I did not, thanks, I'll fix that.","created_at":"2016-07-13T13:04:16Z","updated_at":"2016-07-13T13:04:16Z","html_url":"https://github.com/mantidproject/mantid/pull/16836#discussion_r70620223","pull_request_url":"https://api.github.com/repos/mantidproject/mantid/pulls/16836","_links":{"self":{"href":"https://api.github.com/repos/mantidproject/mantid/pulls/comments/70620223"},"html":{"href":"https://github.com/mantidproject/mantid/pull/16836#discussion_r70620223"},"pull_request":{"href":"https://api.github.com/repos/mantidproject/mantid/pulls/16836"}}},"pull_request":{"url":"https://api.github.com/repos/mantidproject/mantid/pulls/16836","id":76952921,"html_url":"https://github.com/mantidproject/mantid/pull/16836","diff_url":"https://github.com/mantidproject/mantid/pull/16836.diff","patch_url":"https://github.com/mantidproject/mantid/pull/16836.patch","issue_url":"https://api.github.com/repos/mantidproject/mantid/issues/16836","number":16836,"state":"open","locked":false,"title":"16810 spectrum detector indexing","user":{"login":"SimonHeybrock","id":12912489,"avatar_url":"https://avatars.githubusercontent.com/u/12912489?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonHeybrock","html_url":"https://github.com/SimonHeybrock","followers_url":"https://api.github.com/users/SimonHeybrock/followers","following_url":"https://api.github.com/users/SimonHeybrock/following{/other_user}","gists_url":"https://api.github.com/users/SimonHeybrock/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonHeybrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonHeybrock/subscriptions","organizations_url":"https://api.github.com/users/SimonHeybrock/orgs","repos_url":"https://api.github.com/users/SimonHeybrock/repos","events_url":"https://api.github.com/users/SimonHeybrock/events{/privacy}","received_events_url":"https://api.github.com/users/SimonHeybrock/received_events","type":"User","site_admin":false},"body":"Do not merge, for review and discussion only.\r\n\r\n@OwenArnold These are the essential indexing bits. We would have basically the same also for `DetectorId`.\r\n\r\n - `SpectrumNumberTranslator` would be associated to a workspace (probably via a `shared_ptr` or `cow_ptr` since it changes rarely).\r\n\r\n- Algorithm properties yield spectrum numbers, translated via `SpectrumNumber::makeIndexSet(...)`.\r\n\r\n- Algorithms use\r\n  ```cpp\r\n  #pragma omp parallel for\r\n  for (size_t i=0; i<indexSet.size(); ++i) {\r\n    // use indexSet[i] to access workspace\r\n  }\r\n  ```","created_at":"2016-07-11T13:25:03Z","updated_at":"2016-07-13T13:04:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6cfc27200fae34c183454faf5e684dbce23afe02","assignee":{"login":"SimonHeybrock","id":12912489,"avatar_url":"https://avatars.githubusercontent.com/u/12912489?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonHeybrock","html_url":"https://github.com/SimonHeybrock","followers_url":"https://api.github.com/users/SimonHeybrock/followers","following_url":"https://api.github.com/users/SimonHeybrock/following{/other_user}","gists_url":"https://api.github.com/users/SimonHeybrock/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonHeybrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonHeybrock/subscriptions","organizations_url":"https://api.github.com/users/SimonHeybrock/orgs","repos_url":"https://api.github.com/users/SimonHeybrock/repos","events_url":"https://api.github.com/users/SimonHeybrock/events{/privacy}","received_events_url":"https://api.github.com/users/SimonHeybrock/received_events","type":"User","site_admin":false},"assignees":[{"login":"SimonHeybrock","id":12912489,"avatar_url":"https://avatars.githubusercontent.com/u/12912489?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonHeybrock","html_url":"https://github.com/SimonHeybrock","followers_url":"https://api.github.com/users/SimonHeybrock/followers","following_url":"https://api.github.com/users/SimonHeybrock/following{/other_user}","gists_url":"https://api.github.com/users/SimonHeybrock/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonHeybrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonHeybrock/subscriptions","organizations_url":"https://api.github.com/users/SimonHeybrock/orgs","repos_url":"https://api.github.com/users/SimonHeybrock/repos","events_url":"https://api.github.com/users/SimonHeybrock/events{/privacy}","received_events_url":"https://api.github.com/users/SimonHeybrock/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mantidproject/mantid/pulls/16836/commits","review_comments_url":"https://api.github.com/repos/mantidproject/mantid/pulls/16836/comments","review_comment_url":"https://api.github.com/repos/mantidproject/mantid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mantidproject/mantid/issues/16836/comments","statuses_url":"https://api.github.com/repos/mantidproject/mantid/statuses/98964656330f35b61e74b2cd07e5cbda2c375fcc","head":{"label":"mantidproject:16810_spectrum_detector_indexing","ref":"16810_spectrum_detector_indexing","sha":"98964656330f35b61e74b2cd07e5cbda2c375fcc","user":{"login":"mantidproject","id":671496,"avatar_url":"https://avatars.githubusercontent.com/u/671496?v=3","gravatar_id":"","url":"https://api.github.com/users/mantidproject","html_url":"https://github.com/mantidproject","followers_url":"https://api.github.com/users/mantidproject/followers","following_url":"https://api.github.com/users/mantidproject/following{/other_user}","gists_url":"https://api.github.com/users/mantidproject/gists{/gist_id}","starred_url":"https://api.github.com/users/mantidproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mantidproject/subscriptions","organizations_url":"https://api.github.com/users/mantidproject/orgs","repos_url":"https://api.github.com/users/mantidproject/repos","events_url":"https://api.github.com/users/mantidproject/events{/privacy}","received_events_url":"https://api.github.com/users/mantidproject/received_events","type":"Organization","site_admin":false},"repo":{"id":2594116,"name":"mantid","full_name":"mantidproject/mantid","owner":{"login":"mantidproject","id":671496,"avatar_url":"https://avatars.githubusercontent.com/u/671496?v=3","gravatar_id":"","url":"https://api.github.com/users/mantidproject","html_url":"https://github.com/mantidproject","followers_url":"https://api.github.com/users/mantidproject/followers","following_url":"https://api.github.com/users/mantidproject/following{/other_user}","gists_url":"https://api.github.com/users/mantidproject/gists{/gist_id}","starred_url":"https://api.github.com/users/mantidproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mantidproject/subscriptions","organizations_url":"https://api.github.com/users/mantidproject/orgs","repos_url":"https://api.github.com/users/mantidproject/repos","events_url":"https://api.github.com/users/mantidproject/events{/privacy}","received_events_url":"https://api.github.com/users/mantidproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mantidproject/mantid","description":"Main repository for Mantid code","fork":false,"url":"https://api.github.com/repos/mantidproject/mantid","forks_url":"https://api.github.com/repos/mantidproject/mantid/forks","keys_url":"https://api.github.com/repos/mantidproject/mantid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mantidproject/mantid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mantidproject/mantid/teams","hooks_url":"https://api.github.com/repos/mantidproject/mantid/hooks","issue_events_url":"https://api.github.com/repos/mantidproject/mantid/issues/events{/number}","events_url":"https://api.github.com/repos/mantidproject/mantid/events","assignees_url":"https://api.github.com/repos/mantidproject/mantid/assignees{/user}","branches_url":"https://api.github.com/repos/mantidproject/mantid/branches{/branch}","tags_url":"https://api.github.com/repos/mantidproject/mantid/tags","blobs_url":"https://api.github.com/repos/mantidproject/mantid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mantidproject/mantid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mantidproject/mantid/git/refs{/sha}","trees_url":"https://api.github.com/repos/mantidproject/mantid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mantidproject/mantid/statuses/{sha}","languages_url":"https://api.github.com/repos/mantidproject/mantid/languages","stargazers_url":"https://api.github.com/repos/mantidproject/mantid/stargazers","contributors_url":"https://api.github.com/repos/mantidproject/mantid/contributors","subscribers_url":"https://api.github.com/repos/mantidproject/mantid/subscribers","subscription_url":"https://api.github.com/repos/mantidproject/mantid/subscription","commits_url":"https://api.github.com/repos/mantidproject/mantid/commits{/sha}","git_commits_url":"https://api.github.com/repos/mantidproject/mantid/git/commits{/sha}","comments_url":"https://api.github.com/repos/mantidproject/mantid/comments{/number}","issue_comment_url":"https://api.github.com/repos/mantidproject/mantid/issues/comments{/number}","contents_url":"https://api.github.com/repos/mantidproject/mantid/contents/{+path}","compare_url":"https://api.github.com/repos/mantidproject/mantid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mantidproject/mantid/merges","archive_url":"https://api.github.com/repos/mantidproject/mantid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mantidproject/mantid/downloads","issues_url":"https://api.github.com/repos/mantidproject/mantid/issues{/number}","pulls_url":"https://api.github.com/repos/mantidproject/mantid/pulls{/number}","milestones_url":"https://api.github.com/repos/mantidproject/mantid/milestones{/number}","notifications_url":"https://api.github.com/repos/mantidproject/mantid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mantidproject/mantid/labels{/name}","releases_url":"https://api.github.com/repos/mantidproject/mantid/releases{/id}","deployments_url":"https://api.github.com/repos/mantidproject/mantid/deployments","created_at":"2011-10-17T19:07:38Z","updated_at":"2016-07-09T07:56:13Z","pushed_at":"2016-07-13T12:56:32Z","git_url":"git://github.com/mantidproject/mantid.git","ssh_url":"git@github.com:mantidproject/mantid.git","clone_url":"https://github.com/mantidproject/mantid.git","svn_url":"https://github.com/mantidproject/mantid","homepage":"www.mantidproject.org","size":427520,"stargazers_count":44,"watchers_count":44,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":1566,"forks":33,"open_issues":1566,"watchers":44,"default_branch":"master"}},"base":{"label":"mantidproject:master","ref":"master","sha":"9d3771b1cb75d0bd467319a83d20b9547d55096a","user":{"login":"mantidproject","id":671496,"avatar_url":"https://avatars.githubusercontent.com/u/671496?v=3","gravatar_id":"","url":"https://api.github.com/users/mantidproject","html_url":"https://github.com/mantidproject","followers_url":"https://api.github.com/users/mantidproject/followers","following_url":"https://api.github.com/users/mantidproject/following{/other_user}","gists_url":"https://api.github.com/users/mantidproject/gists{/gist_id}","starred_url":"https://api.github.com/users/mantidproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mantidproject/subscriptions","organizations_url":"https://api.github.com/users/mantidproject/orgs","repos_url":"https://api.github.com/users/mantidproject/repos","events_url":"https://api.github.com/users/mantidproject/events{/privacy}","received_events_url":"https://api.github.com/users/mantidproject/received_events","type":"Organization","site_admin":false},"repo":{"id":2594116,"name":"mantid","full_name":"mantidproject/mantid","owner":{"login":"mantidproject","id":671496,"avatar_url":"https://avatars.githubusercontent.com/u/671496?v=3","gravatar_id":"","url":"https://api.github.com/users/mantidproject","html_url":"https://github.com/mantidproject","followers_url":"https://api.github.com/users/mantidproject/followers","following_url":"https://api.github.com/users/mantidproject/following{/other_user}","gists_url":"https://api.github.com/users/mantidproject/gists{/gist_id}","starred_url":"https://api.github.com/users/mantidproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mantidproject/subscriptions","organizations_url":"https://api.github.com/users/mantidproject/orgs","repos_url":"https://api.github.com/users/mantidproject/repos","events_url":"https://api.github.com/users/mantidproject/events{/privacy}","received_events_url":"https://api.github.com/users/mantidproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mantidproject/mantid","description":"Main repository for Mantid code","fork":false,"url":"https://api.github.com/repos/mantidproject/mantid","forks_url":"https://api.github.com/repos/mantidproject/mantid/forks","keys_url":"https://api.github.com/repos/mantidproject/mantid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mantidproject/mantid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mantidproject/mantid/teams","hooks_url":"https://api.github.com/repos/mantidproject/mantid/hooks","issue_events_url":"https://api.github.com/repos/mantidproject/mantid/issues/events{/number}","events_url":"https://api.github.com/repos/mantidproject/mantid/events","assignees_url":"https://api.github.com/repos/mantidproject/mantid/assignees{/user}","branches_url":"https://api.github.com/repos/mantidproject/mantid/branches{/branch}","tags_url":"https://api.github.com/repos/mantidproject/mantid/tags","blobs_url":"https://api.github.com/repos/mantidproject/mantid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mantidproject/mantid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mantidproject/mantid/git/refs{/sha}","trees_url":"https://api.github.com/repos/mantidproject/mantid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mantidproject/mantid/statuses/{sha}","languages_url":"https://api.github.com/repos/mantidproject/mantid/languages","stargazers_url":"https://api.github.com/repos/mantidproject/mantid/stargazers","contributors_url":"https://api.github.com/repos/mantidproject/mantid/contributors","subscribers_url":"https://api.github.com/repos/mantidproject/mantid/subscribers","subscription_url":"https://api.github.com/repos/mantidproject/mantid/subscription","commits_url":"https://api.github.com/repos/mantidproject/mantid/commits{/sha}","git_commits_url":"https://api.github.com/repos/mantidproject/mantid/git/commits{/sha}","comments_url":"https://api.github.com/repos/mantidproject/mantid/comments{/number}","issue_comment_url":"https://api.github.com/repos/mantidproject/mantid/issues/comments{/number}","contents_url":"https://api.github.com/repos/mantidproject/mantid/contents/{+path}","compare_url":"https://api.github.com/repos/mantidproject/mantid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mantidproject/mantid/merges","archive_url":"https://api.github.com/repos/mantidproject/mantid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mantidproject/mantid/downloads","issues_url":"https://api.github.com/repos/mantidproject/mantid/issues{/number}","pulls_url":"https://api.github.com/repos/mantidproject/mantid/pulls{/number}","milestones_url":"https://api.github.com/repos/mantidproject/mantid/milestones{/number}","notifications_url":"https://api.github.com/repos/mantidproject/mantid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mantidproject/mantid/labels{/name}","releases_url":"https://api.github.com/repos/mantidproject/mantid/releases{/id}","deployments_url":"https://api.github.com/repos/mantidproject/mantid/deployments","created_at":"2011-10-17T19:07:38Z","updated_at":"2016-07-09T07:56:13Z","pushed_at":"2016-07-13T12:56:32Z","git_url":"git://github.com/mantidproject/mantid.git","ssh_url":"git@github.com:mantidproject/mantid.git","clone_url":"https://github.com/mantidproject/mantid.git","svn_url":"https://github.com/mantidproject/mantid","homepage":"www.mantidproject.org","size":427520,"stargazers_count":44,"watchers_count":44,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":1566,"forks":33,"open_issues":1566,"watchers":44,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mantidproject/mantid/pulls/16836"},"html":{"href":"https://github.com/mantidproject/mantid/pull/16836"},"issue":{"href":"https://api.github.com/repos/mantidproject/mantid/issues/16836"},"comments":{"href":"https://api.github.com/repos/mantidproject/mantid/issues/16836/comments"},"review_comments":{"href":"https://api.github.com/repos/mantidproject/mantid/pulls/16836/comments"},"review_comment":{"href":"https://api.github.com/repos/mantidproject/mantid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mantidproject/mantid/pulls/16836/commits"},"statuses":{"href":"https://api.github.com/repos/mantidproject/mantid/statuses/98964656330f35b61e74b2cd07e5cbda2c375fcc"}}}}
{"actor":{"display_login":"SimonHeybrock"}}