{"action":"created","comment":{"url":"https://api.github.com/repos/OPM/opm-core/pulls/comments/31993752","id":31993752,"diff_hunk":"@@ -107,6 +116,146 @@ namespace Opm\n             }\n         }\n \n+        void resize(const EclipseState& state, size_t reportStep)\n+        {\n+            std::vector<WellPtr> wells = state.getSchedule()->getOpenWells(reportStep);\n+            size_t numPhases = state.getNumPhases();\n+            int numCompl = getNumCompletions(wells, reportStep);\n+\n+            size_t numWells = wells.size();\n+            std::vector<double> bhpTemp(bhp_.begin(), bhp_.end());\n+            std::vector<double> temperatureTemp(temperature_.begin(), temperature_.end());\n+            std::vector<double> wellRatesTemp(wellrates_.begin(), wellrates_.end());\n+            std::vector<double> perfratesTemp(perfrates_.begin(), perfrates_.end());\n+            std::vector<double> perfpressTemp(perfpress_.begin(), perfpress_.end());\n+\n+            std::map<std::string, WellIndex> newMap = createWellIndexMap(state, wells, reportStep);\n+\n+            bhp_.resize(numWells);\n+            temperature_.resize(numWells, 273.15 + 20);\n+            wellrates_.resize(numWells * numPhases, 0.0);\n+            perfrates_.resize(numCompl, 0.0);\n+            perfpress_.resize(numCompl, -1e100);\n+\n+            for (auto oldIter = wellIndexMap_.begin(); oldIter != wellIndexMap_.end(); ++oldIter){\n+                const std::string& wellName = (*oldIter).first;\n+                auto newIter = newMap.find(wellName);\n+\n+                if(newIter != newMap.end()){\n+                    const WellIndex& oldWi = (*oldIter).second;\n+                    size_t oldIndex = oldWi.wellNumber;\n+\n+                    const WellIndex& newWi = (*newIter).second;\n+                    size_t newIndex = newWi.wellNumber;\n+\n+                    bhp_[newIndex] = bhpTemp[oldIndex];\n+                    temperature_[newIndex] = temperatureTemp[oldIndex];\n+\n+                    for (int i = 0; i < numPhases; i++){\n+                        wellrates_[newIndex * numPhases + i] = wellRatesTemp[oldIndex * numPhases + i];\n+                    }\n+\n+                    for (auto oldComplIter = oldWi.completionMap.begin(); oldComplIter != oldWi.completionMap.end(); ++oldComplIter){\n+                        size_t completionId = (*oldComplIter).first;\n+                        auto newComplIter = newWi.completionMap.find(completionId);\n+\n+                        if(newComplIter != newWi.completionMap.end()){\n+                            size_t oldComplIndex = (*oldComplIter).second;\n+                            size_t newComplIndex = (*newComplIter).second;\n+\n+                            size_t oldWellCompletionOffset = oldWi.wellCompletionOffset;\n+                            size_t newWellCompletionOffset = newWi.wellCompletionOffset;\n+\n+                            perfrates_[newWellCompletionOffset + newComplIndex] = perfratesTemp[oldWellCompletionOffset + oldComplIndex];\n+                            perfpress_[newWellCompletionOffset + newComplIndex] = perfpressTemp[oldWellCompletionOffset + oldComplIndex];\n+                        }\n+                    }\n+                }\n+            }\n+\n+            wellIndexMap_ = newMap;\n+        }\n+\n+        void setBhpValue(size_t index, double value){","path":"opm/core/simulator/WellState.hpp","position":85,"original_position":85,"commit_id":"2557736fcbdb5bcbd998b7fb728719b1cff7531c","original_commit_id":"2557736fcbdb5bcbd998b7fb728719b1cff7531c","user":{"login":"atgeirr","id":1876621,"avatar_url":"https://avatars.githubusercontent.com/u/1876621?v=3","gravatar_id":"","url":"https://api.github.com/users/atgeirr","html_url":"https://github.com/atgeirr","followers_url":"https://api.github.com/users/atgeirr/followers","following_url":"https://api.github.com/users/atgeirr/following{/other_user}","gists_url":"https://api.github.com/users/atgeirr/gists{/gist_id}","starred_url":"https://api.github.com/users/atgeirr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atgeirr/subscriptions","organizations_url":"https://api.github.com/users/atgeirr/orgs","repos_url":"https://api.github.com/users/atgeirr/repos","events_url":"https://api.github.com/users/atgeirr/events{/privacy}","received_events_url":"https://api.github.com/users/atgeirr/received_events","type":"User","site_admin":false},"body":"I do not see the point of adding this method, for the following reasons:\r\n - Doing `state.bhp()[index] = value` serves this purpose well enough.\r\n - It adds overhead by checking the index, but fails to make it an error if the index is out-of-bounds!\r\n\r\nA better implementation would `assert(index < bhp_.size())` instead of the if.","created_at":"2015-06-09T08:53:33Z","updated_at":"2015-06-09T08:53:33Z","html_url":"https://github.com/OPM/opm-core/pull/814#discussion_r31993752","pull_request_url":"https://api.github.com/repos/OPM/opm-core/pulls/814","_links":{"self":{"href":"https://api.github.com/repos/OPM/opm-core/pulls/comments/31993752"},"html":{"href":"https://github.com/OPM/opm-core/pull/814#discussion_r31993752"},"pull_request":{"href":"https://api.github.com/repos/OPM/opm-core/pulls/814"}}},"pull_request":{"url":"https://api.github.com/repos/OPM/opm-core/pulls/814","id":37026834,"html_url":"https://github.com/OPM/opm-core/pull/814","diff_url":"https://github.com/OPM/opm-core/pull/814.diff","patch_url":"https://github.com/OPM/opm-core/pull/814.patch","issue_url":"https://api.github.com/repos/OPM/opm-core/issues/814","number":814,"state":"open","locked":false,"title":"Opm 187: Added resize method to WellState","user":{"login":"edbru","id":1325295,"avatar_url":"https://avatars.githubusercontent.com/u/1325295?v=3","gravatar_id":"","url":"https://api.github.com/users/edbru","html_url":"https://github.com/edbru","followers_url":"https://api.github.com/users/edbru/followers","following_url":"https://api.github.com/users/edbru/following{/other_user}","gists_url":"https://api.github.com/users/edbru/gists{/gist_id}","starred_url":"https://api.github.com/users/edbru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edbru/subscriptions","organizations_url":"https://api.github.com/users/edbru/orgs","repos_url":"https://api.github.com/users/edbru/repos","events_url":"https://api.github.com/users/edbru/events{/privacy}","received_events_url":"https://api.github.com/users/edbru/received_events","type":"User","site_admin":false},"body":"Added resize method to WellState.hpp. \r\nThe overall trigger for this is to be able to support the RESTART and SKIPREST keywords, \r\nWe want to be able to populate WellState object from a RESTART file \r\n\r\nThe intention for the resize method is to be able to implement the following: \r\n\r\n1) One instance of the wellstate object for a simulation (all reportsteps). Call the resize method for each reportstep.\r\n2) With only one instance of WellState, calling resize for each reportstep, WellsManager, WellsManager.cwells, and the call to wellstate.init (for each reportstep) can be removed.\r\n\r\n\r\nThis PR depends on opm-parser PR: https://github.com/OPM/opm-parser/pull/490","created_at":"2015-06-05T12:31:49Z","updated_at":"2015-06-09T08:53:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e893ccd9445859626cb695d29ca041170cbc962","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OPM/opm-core/pulls/814/commits","review_comments_url":"https://api.github.com/repos/OPM/opm-core/pulls/814/comments","review_comment_url":"https://api.github.com/repos/OPM/opm-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OPM/opm-core/issues/814/comments","statuses_url":"https://api.github.com/repos/OPM/opm-core/statuses/2557736fcbdb5bcbd998b7fb728719b1cff7531c","head":{"label":"edbru:OPM-187-p2","ref":"OPM-187-p2","sha":"2557736fcbdb5bcbd998b7fb728719b1cff7531c","user":{"login":"edbru","id":1325295,"avatar_url":"https://avatars.githubusercontent.com/u/1325295?v=3","gravatar_id":"","url":"https://api.github.com/users/edbru","html_url":"https://github.com/edbru","followers_url":"https://api.github.com/users/edbru/followers","following_url":"https://api.github.com/users/edbru/following{/other_user}","gists_url":"https://api.github.com/users/edbru/gists{/gist_id}","starred_url":"https://api.github.com/users/edbru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edbru/subscriptions","organizations_url":"https://api.github.com/users/edbru/orgs","repos_url":"https://api.github.com/users/edbru/repos","events_url":"https://api.github.com/users/edbru/events{/privacy}","received_events_url":"https://api.github.com/users/edbru/received_events","type":"User","site_admin":false},"repo":{"id":32387760,"name":"opm-core","full_name":"edbru/opm-core","owner":{"login":"edbru","id":1325295,"avatar_url":"https://avatars.githubusercontent.com/u/1325295?v=3","gravatar_id":"","url":"https://api.github.com/users/edbru","html_url":"https://github.com/edbru","followers_url":"https://api.github.com/users/edbru/followers","following_url":"https://api.github.com/users/edbru/following{/other_user}","gists_url":"https://api.github.com/users/edbru/gists{/gist_id}","starred_url":"https://api.github.com/users/edbru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edbru/subscriptions","organizations_url":"https://api.github.com/users/edbru/orgs","repos_url":"https://api.github.com/users/edbru/repos","events_url":"https://api.github.com/users/edbru/events{/privacy}","received_events_url":"https://api.github.com/users/edbru/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/edbru/opm-core","description":"Open Porous Media Core Library","fork":true,"url":"https://api.github.com/repos/edbru/opm-core","forks_url":"https://api.github.com/repos/edbru/opm-core/forks","keys_url":"https://api.github.com/repos/edbru/opm-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edbru/opm-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edbru/opm-core/teams","hooks_url":"https://api.github.com/repos/edbru/opm-core/hooks","issue_events_url":"https://api.github.com/repos/edbru/opm-core/issues/events{/number}","events_url":"https://api.github.com/repos/edbru/opm-core/events","assignees_url":"https://api.github.com/repos/edbru/opm-core/assignees{/user}","branches_url":"https://api.github.com/repos/edbru/opm-core/branches{/branch}","tags_url":"https://api.github.com/repos/edbru/opm-core/tags","blobs_url":"https://api.github.com/repos/edbru/opm-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edbru/opm-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edbru/opm-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/edbru/opm-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edbru/opm-core/statuses/{sha}","languages_url":"https://api.github.com/repos/edbru/opm-core/languages","stargazers_url":"https://api.github.com/repos/edbru/opm-core/stargazers","contributors_url":"https://api.github.com/repos/edbru/opm-core/contributors","subscribers_url":"https://api.github.com/repos/edbru/opm-core/subscribers","subscription_url":"https://api.github.com/repos/edbru/opm-core/subscription","commits_url":"https://api.github.com/repos/edbru/opm-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/edbru/opm-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/edbru/opm-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/edbru/opm-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/edbru/opm-core/contents/{+path}","compare_url":"https://api.github.com/repos/edbru/opm-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edbru/opm-core/merges","archive_url":"https://api.github.com/repos/edbru/opm-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edbru/opm-core/downloads","issues_url":"https://api.github.com/repos/edbru/opm-core/issues{/number}","pulls_url":"https://api.github.com/repos/edbru/opm-core/pulls{/number}","milestones_url":"https://api.github.com/repos/edbru/opm-core/milestones{/number}","notifications_url":"https://api.github.com/repos/edbru/opm-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edbru/opm-core/labels{/name}","releases_url":"https://api.github.com/repos/edbru/opm-core/releases{/id}","created_at":"2015-03-17T10:48:24Z","updated_at":"2015-04-10T11:47:28Z","pushed_at":"2015-06-08T08:07:20Z","git_url":"git://github.com/edbru/opm-core.git","ssh_url":"git@github.com:edbru/opm-core.git","clone_url":"https://github.com/edbru/opm-core.git","svn_url":"https://github.com/edbru/opm-core","homepage":"http://www.opm-project.org","size":11495,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OPM:master","ref":"master","sha":"901209a723083a7af3a7ec8533ca5953832f5b10","user":{"login":"OPM","id":1827197,"avatar_url":"https://avatars.githubusercontent.com/u/1827197?v=3","gravatar_id":"","url":"https://api.github.com/users/OPM","html_url":"https://github.com/OPM","followers_url":"https://api.github.com/users/OPM/followers","following_url":"https://api.github.com/users/OPM/following{/other_user}","gists_url":"https://api.github.com/users/OPM/gists{/gist_id}","starred_url":"https://api.github.com/users/OPM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OPM/subscriptions","organizations_url":"https://api.github.com/users/OPM/orgs","repos_url":"https://api.github.com/users/OPM/repos","events_url":"https://api.github.com/users/OPM/events{/privacy}","received_events_url":"https://api.github.com/users/OPM/received_events","type":"Organization","site_admin":false},"repo":{"id":4787500,"name":"opm-core","full_name":"OPM/opm-core","owner":{"login":"OPM","id":1827197,"avatar_url":"https://avatars.githubusercontent.com/u/1827197?v=3","gravatar_id":"","url":"https://api.github.com/users/OPM","html_url":"https://github.com/OPM","followers_url":"https://api.github.com/users/OPM/followers","following_url":"https://api.github.com/users/OPM/following{/other_user}","gists_url":"https://api.github.com/users/OPM/gists{/gist_id}","starred_url":"https://api.github.com/users/OPM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OPM/subscriptions","organizations_url":"https://api.github.com/users/OPM/orgs","repos_url":"https://api.github.com/users/OPM/repos","events_url":"https://api.github.com/users/OPM/events{/privacy}","received_events_url":"https://api.github.com/users/OPM/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OPM/opm-core","description":"Open Porous Media Core Library","fork":false,"url":"https://api.github.com/repos/OPM/opm-core","forks_url":"https://api.github.com/repos/OPM/opm-core/forks","keys_url":"https://api.github.com/repos/OPM/opm-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OPM/opm-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OPM/opm-core/teams","hooks_url":"https://api.github.com/repos/OPM/opm-core/hooks","issue_events_url":"https://api.github.com/repos/OPM/opm-core/issues/events{/number}","events_url":"https://api.github.com/repos/OPM/opm-core/events","assignees_url":"https://api.github.com/repos/OPM/opm-core/assignees{/user}","branches_url":"https://api.github.com/repos/OPM/opm-core/branches{/branch}","tags_url":"https://api.github.com/repos/OPM/opm-core/tags","blobs_url":"https://api.github.com/repos/OPM/opm-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OPM/opm-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OPM/opm-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/OPM/opm-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OPM/opm-core/statuses/{sha}","languages_url":"https://api.github.com/repos/OPM/opm-core/languages","stargazers_url":"https://api.github.com/repos/OPM/opm-core/stargazers","contributors_url":"https://api.github.com/repos/OPM/opm-core/contributors","subscribers_url":"https://api.github.com/repos/OPM/opm-core/subscribers","subscription_url":"https://api.github.com/repos/OPM/opm-core/subscription","commits_url":"https://api.github.com/repos/OPM/opm-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/OPM/opm-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/OPM/opm-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/OPM/opm-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/OPM/opm-core/contents/{+path}","compare_url":"https://api.github.com/repos/OPM/opm-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OPM/opm-core/merges","archive_url":"https://api.github.com/repos/OPM/opm-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OPM/opm-core/downloads","issues_url":"https://api.github.com/repos/OPM/opm-core/issues{/number}","pulls_url":"https://api.github.com/repos/OPM/opm-core/pulls{/number}","milestones_url":"https://api.github.com/repos/OPM/opm-core/milestones{/number}","notifications_url":"https://api.github.com/repos/OPM/opm-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OPM/opm-core/labels{/name}","releases_url":"https://api.github.com/repos/OPM/opm-core/releases{/id}","created_at":"2012-06-25T21:14:06Z","updated_at":"2015-04-29T03:56:54Z","pushed_at":"2015-06-08T07:50:48Z","git_url":"git://github.com/OPM/opm-core.git","ssh_url":"git@github.com:OPM/opm-core.git","clone_url":"https://github.com/OPM/opm-core.git","svn_url":"https://github.com/OPM/opm-core","homepage":"http://www.opm-project.org","size":15276,"stargazers_count":17,"watchers_count":17,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":17,"forks":38,"open_issues":17,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OPM/opm-core/pulls/814"},"html":{"href":"https://github.com/OPM/opm-core/pull/814"},"issue":{"href":"https://api.github.com/repos/OPM/opm-core/issues/814"},"comments":{"href":"https://api.github.com/repos/OPM/opm-core/issues/814/comments"},"review_comments":{"href":"https://api.github.com/repos/OPM/opm-core/pulls/814/comments"},"review_comment":{"href":"https://api.github.com/repos/OPM/opm-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OPM/opm-core/pulls/814/commits"},"statuses":{"href":"https://api.github.com/repos/OPM/opm-core/statuses/2557736fcbdb5bcbd998b7fb728719b1cff7531c"}}}}