{"action":"created","comment":{"url":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/comments/234420366","pull_request_review_id":176066738,"id":234420366,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNDQyMDM2Ng==","diff_hunk":"@@ -339,24 +442,63 @@ bool contains_attribute(const hid_t file_id, const std::string& group_name,\n          std::end(names);\n }\n \n-DataVector read_data(const hid_t group_id, const std::string& dataset_name) {\n-  // Read a DataVector from the group\n-  const hid_t dataset_id =\n-      H5Dopen2(group_id, dataset_name.c_str(), h5p_default());\n-  CHECK_H5(dataset_id, \"could not open dataset '\" << dataset_name << \"'\");\n-  // Get the number of points. These do not need a \"close\" call.\n-  const hid_t space_id = H5Dget_space(dataset_id);\n-  CHECK_H5(space_id, \"Failed to open dataspace\");\n-  const hid_t number_of_points = H5Sget_simple_extent_npoints(space_id);\n-  CHECK_H5(number_of_points, \"Failed to get number of points\");\n-  H5Sclose(space_id);\n-  // Load the data\n-  DataVector data(static_cast<size_t>(number_of_points));\n-  CHECK_H5(H5Dread(dataset_id, h5_type<double>(), h5s_all(), h5s_all(),\n-                   h5p_default(), static_cast<void*>(data.data())),\n-           \"Failed to read data\");\n-  CHECK_H5(H5Dclose(dataset_id), \"Failed to close dataset\");\n-  return data;\n+hid_t open_dataset(const hid_t group_id,\n+                   const std::string& dataset_name) noexcept {\n+  const hid_t dataset_id = H5Dopen2(\n+                           group_id, dataset_name.c_str(), h5p_default());\n+  CHECK_H5(dataset_id, \"Failed to open dataset '\" << dataset_name << \"'\");\n+  return dataset_id;\n+}\n+\n+void close_dataset(const hid_t dataset_id) noexcept {\n+CHECK_H5(H5Dclose(dataset_id), \"Failed to close dataset\");\n+}\n+\n+hid_t open_dataspace(const hid_t dataset_id) noexcept {\n+  const hid_t dataspace_id = H5Dget_space(dataset_id);\n+  CHECK_H5(dataspace_id, \"Failed to open dataspace\");\n+  return dataspace_id;\n+}\n+\n+void close_dataspace(const hid_t dataspace_id) noexcept {\n+  CHECK_H5(H5Sclose(dataspace_id), \"Failed to close dataspace\");\n+}\n+\n+template <size_t Rank, typename T>\n+T read_data(const hid_t group_id, const std::string& dataset_name) noexcept {\n+  const hid_t dataset_id = open_dataset(group_id, dataset_name);\n+  const hid_t dataspace_id = open_dataspace(dataset_id);\n+  std::array<hsize_t, Rank == 0 ? 1 : Rank> size{}, max_size{};","path":"src/IO/H5/Helpers.cpp","position":206,"original_position":206,"commit_id":"21641021cca8a70d7694fd93bd0c93fe61aff016","original_commit_id":"21641021cca8a70d7694fd93bd0c93fe61aff016","user":{"login":"wthrowe","id":867117,"node_id":"MDQ6VXNlcjg2NzExNw==","avatar_url":"https://avatars1.githubusercontent.com/u/867117?v=4","gravatar_id":"","url":"https://api.github.com/users/wthrowe","html_url":"https://github.com/wthrowe","followers_url":"https://api.github.com/users/wthrowe/followers","following_url":"https://api.github.com/users/wthrowe/following{/other_user}","gists_url":"https://api.github.com/users/wthrowe/gists{/gist_id}","starred_url":"https://api.github.com/users/wthrowe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wthrowe/subscriptions","organizations_url":"https://api.github.com/users/wthrowe/orgs","repos_url":"https://api.github.com/users/wthrowe/repos","events_url":"https://api.github.com/users/wthrowe/events{/privacy}","received_events_url":"https://api.github.com/users/wthrowe/received_events","type":"User","site_admin":false},"body":"`size` is an array, so I'm not sure exactly what you're trying to say.\r\n\r\nThe vector passed to `VectorToArray::apply` has length `size_product == 0 ? 1 : size_product`, which is always non-zero by construction, so that can't interfere with the indexing.  In fact, as far as I can see, the only reason the special check for zero `size_product` is needed is because you're making the `size` array longer than necessary when `Rank == 0`.","created_at":"2018-11-17T20:29:29Z","updated_at":"2018-11-17T20:37:37Z","html_url":"https://github.com/sxs-collaboration/spectre/pull/920#discussion_r234420366","pull_request_url":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/920","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/comments/234420366"},"html":{"href":"https://github.com/sxs-collaboration/spectre/pull/920#discussion_r234420366"},"pull_request":{"href":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/920"}},"in_reply_to_id":234024937},"pull_request":{"url":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/920","id":213394029,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzMzk0MDI5","html_url":"https://github.com/sxs-collaboration/spectre/pull/920","diff_url":"https://github.com/sxs-collaboration/spectre/pull/920.diff","patch_url":"https://github.com/sxs-collaboration/spectre/pull/920.patch","issue_url":"https://api.github.com/repos/sxs-collaboration/spectre/issues/920","number":920,"state":"open","locked":false,"title":"Read Tabulated Equations of State","user":{"login":"dkvieira","id":32203428,"node_id":"MDQ6VXNlcjMyMjAzNDI4","avatar_url":"https://avatars2.githubusercontent.com/u/32203428?v=4","gravatar_id":"","url":"https://api.github.com/users/dkvieira","html_url":"https://github.com/dkvieira","followers_url":"https://api.github.com/users/dkvieira/followers","following_url":"https://api.github.com/users/dkvieira/following{/other_user}","gists_url":"https://api.github.com/users/dkvieira/gists{/gist_id}","starred_url":"https://api.github.com/users/dkvieira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkvieira/subscriptions","organizations_url":"https://api.github.com/users/dkvieira/orgs","repos_url":"https://api.github.com/users/dkvieira/repos","events_url":"https://api.github.com/users/dkvieira/events{/privacy}","received_events_url":"https://api.github.com/users/dkvieira/received_events","type":"User","site_admin":false},"body":"## Proposed changes\r\n\r\nRead in rank-1 and rank-3 datasets from h5 file containing tabulated equation of state information.\r\n\r\n### Types of changes:\r\n\r\n- [ ] Bugfix\r\n- [ ] New feature\r\n\r\n### Component:\r\n\r\n- [ ] Code\r\n- [ ] Documentation\r\n- [ ] Build system\r\n- [ ] Continuous integration\r\n\r\n### Code review checklist\r\n\r\n- [ ] The PR passes all checks, including unit tests, `clang-tidy` and `IWYU`. For\r\n  instructions on how to perform the CI checks locally refer to the [Dev guide\r\n  on the Travis CI](https://spectre-code.org/travis_guide.html).\r\n- [ ] The code is documented and the documentation renders correctly. Run `make doc`\r\n  to generate the documentation locally into `BUILD_DIR/docs/html`. Then open\r\n  `index.html`.\r\n- [ ] The code follows the stylistic and code quality guidelines listed in the\r\n  [code review guide](https://spectre-code.org/code_review_guide.html).\r\n\r\n### Further comments\r\n\r\n<!--\r\nIf this is a relatively large or complex change, kick off the discussion by\r\nexplaining why you chose the solution you did and what alternatives you\r\nconsidered, etc...\r\n-->\r\n","created_at":"2018-09-05T18:54:56Z","updated_at":"2018-11-17T20:37:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"52b2fdbe7cf97724ba2723e4927e236083e44f62","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/920/commits","review_comments_url":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/920/comments","review_comment_url":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sxs-collaboration/spectre/issues/920/comments","statuses_url":"https://api.github.com/repos/sxs-collaboration/spectre/statuses/21641021cca8a70d7694fd93bd0c93fe61aff016","head":{"label":"dkvieira:tabulated","ref":"tabulated","sha":"21641021cca8a70d7694fd93bd0c93fe61aff016","user":{"login":"dkvieira","id":32203428,"node_id":"MDQ6VXNlcjMyMjAzNDI4","avatar_url":"https://avatars2.githubusercontent.com/u/32203428?v=4","gravatar_id":"","url":"https://api.github.com/users/dkvieira","html_url":"https://github.com/dkvieira","followers_url":"https://api.github.com/users/dkvieira/followers","following_url":"https://api.github.com/users/dkvieira/following{/other_user}","gists_url":"https://api.github.com/users/dkvieira/gists{/gist_id}","starred_url":"https://api.github.com/users/dkvieira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkvieira/subscriptions","organizations_url":"https://api.github.com/users/dkvieira/orgs","repos_url":"https://api.github.com/users/dkvieira/repos","events_url":"https://api.github.com/users/dkvieira/events{/privacy}","received_events_url":"https://api.github.com/users/dkvieira/received_events","type":"User","site_admin":false},"repo":{"id":124443636,"node_id":"MDEwOlJlcG9zaXRvcnkxMjQ0NDM2MzY=","name":"spectre","full_name":"dkvieira/spectre","private":false,"owner":{"login":"dkvieira","id":32203428,"node_id":"MDQ6VXNlcjMyMjAzNDI4","avatar_url":"https://avatars2.githubusercontent.com/u/32203428?v=4","gravatar_id":"","url":"https://api.github.com/users/dkvieira","html_url":"https://github.com/dkvieira","followers_url":"https://api.github.com/users/dkvieira/followers","following_url":"https://api.github.com/users/dkvieira/following{/other_user}","gists_url":"https://api.github.com/users/dkvieira/gists{/gist_id}","starred_url":"https://api.github.com/users/dkvieira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkvieira/subscriptions","organizations_url":"https://api.github.com/users/dkvieira/orgs","repos_url":"https://api.github.com/users/dkvieira/repos","events_url":"https://api.github.com/users/dkvieira/events{/privacy}","received_events_url":"https://api.github.com/users/dkvieira/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dkvieira/spectre","description":"SpECTRE is a code for multi-scale, multi-physics problems in astrophysics and gravitational physics.","fork":true,"url":"https://api.github.com/repos/dkvieira/spectre","forks_url":"https://api.github.com/repos/dkvieira/spectre/forks","keys_url":"https://api.github.com/repos/dkvieira/spectre/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dkvieira/spectre/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dkvieira/spectre/teams","hooks_url":"https://api.github.com/repos/dkvieira/spectre/hooks","issue_events_url":"https://api.github.com/repos/dkvieira/spectre/issues/events{/number}","events_url":"https://api.github.com/repos/dkvieira/spectre/events","assignees_url":"https://api.github.com/repos/dkvieira/spectre/assignees{/user}","branches_url":"https://api.github.com/repos/dkvieira/spectre/branches{/branch}","tags_url":"https://api.github.com/repos/dkvieira/spectre/tags","blobs_url":"https://api.github.com/repos/dkvieira/spectre/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dkvieira/spectre/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dkvieira/spectre/git/refs{/sha}","trees_url":"https://api.github.com/repos/dkvieira/spectre/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dkvieira/spectre/statuses/{sha}","languages_url":"https://api.github.com/repos/dkvieira/spectre/languages","stargazers_url":"https://api.github.com/repos/dkvieira/spectre/stargazers","contributors_url":"https://api.github.com/repos/dkvieira/spectre/contributors","subscribers_url":"https://api.github.com/repos/dkvieira/spectre/subscribers","subscription_url":"https://api.github.com/repos/dkvieira/spectre/subscription","commits_url":"https://api.github.com/repos/dkvieira/spectre/commits{/sha}","git_commits_url":"https://api.github.com/repos/dkvieira/spectre/git/commits{/sha}","comments_url":"https://api.github.com/repos/dkvieira/spectre/comments{/number}","issue_comment_url":"https://api.github.com/repos/dkvieira/spectre/issues/comments{/number}","contents_url":"https://api.github.com/repos/dkvieira/spectre/contents/{+path}","compare_url":"https://api.github.com/repos/dkvieira/spectre/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dkvieira/spectre/merges","archive_url":"https://api.github.com/repos/dkvieira/spectre/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dkvieira/spectre/downloads","issues_url":"https://api.github.com/repos/dkvieira/spectre/issues{/number}","pulls_url":"https://api.github.com/repos/dkvieira/spectre/pulls{/number}","milestones_url":"https://api.github.com/repos/dkvieira/spectre/milestones{/number}","notifications_url":"https://api.github.com/repos/dkvieira/spectre/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dkvieira/spectre/labels{/name}","releases_url":"https://api.github.com/repos/dkvieira/spectre/releases{/id}","deployments_url":"https://api.github.com/repos/dkvieira/spectre/deployments","created_at":"2018-03-08T20:20:31Z","updated_at":"2018-03-08T20:20:34Z","pushed_at":"2018-11-15T18:01:50Z","git_url":"git://github.com/dkvieira/spectre.git","ssh_url":"git@github.com:dkvieira/spectre.git","clone_url":"https://github.com/dkvieira/spectre.git","svn_url":"https://github.com/dkvieira/spectre","homepage":"","size":13083,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"sxs-collaboration:develop","ref":"develop","sha":"b1172c8617ccedc2b19962c208ccf477aaa57313","user":{"login":"sxs-collaboration","id":26882595,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2ODgyNTk1","avatar_url":"https://avatars2.githubusercontent.com/u/26882595?v=4","gravatar_id":"","url":"https://api.github.com/users/sxs-collaboration","html_url":"https://github.com/sxs-collaboration","followers_url":"https://api.github.com/users/sxs-collaboration/followers","following_url":"https://api.github.com/users/sxs-collaboration/following{/other_user}","gists_url":"https://api.github.com/users/sxs-collaboration/gists{/gist_id}","starred_url":"https://api.github.com/users/sxs-collaboration/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sxs-collaboration/subscriptions","organizations_url":"https://api.github.com/users/sxs-collaboration/orgs","repos_url":"https://api.github.com/users/sxs-collaboration/repos","events_url":"https://api.github.com/users/sxs-collaboration/events{/privacy}","received_events_url":"https://api.github.com/users/sxs-collaboration/received_events","type":"Organization","site_admin":false},"repo":{"id":87570510,"node_id":"MDEwOlJlcG9zaXRvcnk4NzU3MDUxMA==","name":"spectre","full_name":"sxs-collaboration/spectre","private":false,"owner":{"login":"sxs-collaboration","id":26882595,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2ODgyNTk1","avatar_url":"https://avatars2.githubusercontent.com/u/26882595?v=4","gravatar_id":"","url":"https://api.github.com/users/sxs-collaboration","html_url":"https://github.com/sxs-collaboration","followers_url":"https://api.github.com/users/sxs-collaboration/followers","following_url":"https://api.github.com/users/sxs-collaboration/following{/other_user}","gists_url":"https://api.github.com/users/sxs-collaboration/gists{/gist_id}","starred_url":"https://api.github.com/users/sxs-collaboration/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sxs-collaboration/subscriptions","organizations_url":"https://api.github.com/users/sxs-collaboration/orgs","repos_url":"https://api.github.com/users/sxs-collaboration/repos","events_url":"https://api.github.com/users/sxs-collaboration/events{/privacy}","received_events_url":"https://api.github.com/users/sxs-collaboration/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/sxs-collaboration/spectre","description":"SpECTRE is a code for multi-scale, multi-physics problems in astrophysics and gravitational physics.","fork":false,"url":"https://api.github.com/repos/sxs-collaboration/spectre","forks_url":"https://api.github.com/repos/sxs-collaboration/spectre/forks","keys_url":"https://api.github.com/repos/sxs-collaboration/spectre/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sxs-collaboration/spectre/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sxs-collaboration/spectre/teams","hooks_url":"https://api.github.com/repos/sxs-collaboration/spectre/hooks","issue_events_url":"https://api.github.com/repos/sxs-collaboration/spectre/issues/events{/number}","events_url":"https://api.github.com/repos/sxs-collaboration/spectre/events","assignees_url":"https://api.github.com/repos/sxs-collaboration/spectre/assignees{/user}","branches_url":"https://api.github.com/repos/sxs-collaboration/spectre/branches{/branch}","tags_url":"https://api.github.com/repos/sxs-collaboration/spectre/tags","blobs_url":"https://api.github.com/repos/sxs-collaboration/spectre/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sxs-collaboration/spectre/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sxs-collaboration/spectre/git/refs{/sha}","trees_url":"https://api.github.com/repos/sxs-collaboration/spectre/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sxs-collaboration/spectre/statuses/{sha}","languages_url":"https://api.github.com/repos/sxs-collaboration/spectre/languages","stargazers_url":"https://api.github.com/repos/sxs-collaboration/spectre/stargazers","contributors_url":"https://api.github.com/repos/sxs-collaboration/spectre/contributors","subscribers_url":"https://api.github.com/repos/sxs-collaboration/spectre/subscribers","subscription_url":"https://api.github.com/repos/sxs-collaboration/spectre/subscription","commits_url":"https://api.github.com/repos/sxs-collaboration/spectre/commits{/sha}","git_commits_url":"https://api.github.com/repos/sxs-collaboration/spectre/git/commits{/sha}","comments_url":"https://api.github.com/repos/sxs-collaboration/spectre/comments{/number}","issue_comment_url":"https://api.github.com/repos/sxs-collaboration/spectre/issues/comments{/number}","contents_url":"https://api.github.com/repos/sxs-collaboration/spectre/contents/{+path}","compare_url":"https://api.github.com/repos/sxs-collaboration/spectre/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sxs-collaboration/spectre/merges","archive_url":"https://api.github.com/repos/sxs-collaboration/spectre/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sxs-collaboration/spectre/downloads","issues_url":"https://api.github.com/repos/sxs-collaboration/spectre/issues{/number}","pulls_url":"https://api.github.com/repos/sxs-collaboration/spectre/pulls{/number}","milestones_url":"https://api.github.com/repos/sxs-collaboration/spectre/milestones{/number}","notifications_url":"https://api.github.com/repos/sxs-collaboration/spectre/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sxs-collaboration/spectre/labels{/name}","releases_url":"https://api.github.com/repos/sxs-collaboration/spectre/releases{/id}","deployments_url":"https://api.github.com/repos/sxs-collaboration/spectre/deployments","created_at":"2017-04-07T17:28:20Z","updated_at":"2018-11-17T15:25:06Z","pushed_at":"2018-11-17T15:56:20Z","git_url":"git://github.com/sxs-collaboration/spectre.git","ssh_url":"git@github.com:sxs-collaboration/spectre.git","clone_url":"https://github.com/sxs-collaboration/spectre.git","svn_url":"https://github.com/sxs-collaboration/spectre","homepage":"","size":13378,"stargazers_count":29,"watchers_count":29,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":34,"mirror_url":null,"archived":false,"open_issues_count":179,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":34,"open_issues":179,"watchers":29,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/920"},"html":{"href":"https://github.com/sxs-collaboration/spectre/pull/920"},"issue":{"href":"https://api.github.com/repos/sxs-collaboration/spectre/issues/920"},"comments":{"href":"https://api.github.com/repos/sxs-collaboration/spectre/issues/920/comments"},"review_comments":{"href":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/920/comments"},"review_comment":{"href":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sxs-collaboration/spectre/pulls/920/commits"},"statuses":{"href":"https://api.github.com/repos/sxs-collaboration/spectre/statuses/21641021cca8a70d7694fd93bd0c93fe61aff016"}},"author_association":"NONE"}}
{"actor":{"display_login":"wthrowe"}}