{"action":"created","issue":{"url":"https://api.github.com/repos/OPM/opm-material/issues/302","repository_url":"https://api.github.com/repos/OPM/opm-material","labels_url":"https://api.github.com/repos/OPM/opm-material/issues/302/labels{/name}","comments_url":"https://api.github.com/repos/OPM/opm-material/issues/302/comments","events_url":"https://api.github.com/repos/OPM/opm-material/issues/302/events","html_url":"https://github.com/OPM/opm-material/pull/302","id":335394067,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3MTAzMDI1","number":302,"title":"Dynamically sized evaluations","user":{"login":"andlaus","id":1837735,"node_id":"MDQ6VXNlcjE4Mzc3MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/1837735?v=4","gravatar_id":"","url":"https://api.github.com/users/andlaus","html_url":"https://github.com/andlaus","followers_url":"https://api.github.com/users/andlaus/followers","following_url":"https://api.github.com/users/andlaus/following{/other_user}","gists_url":"https://api.github.com/users/andlaus/gists{/gist_id}","starred_url":"https://api.github.com/users/andlaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andlaus/subscriptions","organizations_url":"https://api.github.com/users/andlaus/orgs","repos_url":"https://api.github.com/users/andlaus/repos","events_url":"https://api.github.com/users/andlaus/events{/privacy}","received_events_url":"https://api.github.com/users/andlaus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2018-06-25T12:54:00Z","updated_at":"2018-06-27T13:23:54Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/OPM/opm-material/pulls/302","html_url":"https://github.com/OPM/opm-material/pull/302","diff_url":"https://github.com/OPM/opm-material/pull/302.diff","patch_url":"https://github.com/OPM/opm-material/pull/302.patch"},"body":"this works by passing -1 as the template argument for the number of derivatives. most of the code is identical, but creation of such objects requires the number of derivatives passed to the constructor or the copy constructor must be used.\r\n\r\nFinally `DynamicEvaluation<Scalar>` is provided as a more expressive alias for `Evaluation<Scalar, -1>`.\r\n\r\n@GitPaean: can you test if this is sufficient for you?"},"comment":{"url":"https://api.github.com/repos/OPM/opm-material/issues/comments/400669665","html_url":"https://github.com/OPM/opm-material/pull/302#issuecomment-400669665","issue_url":"https://api.github.com/repos/OPM/opm-material/issues/302","id":400669665,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDY2OTY2NQ==","user":{"login":"andlaus","id":1837735,"node_id":"MDQ6VXNlcjE4Mzc3MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/1837735?v=4","gravatar_id":"","url":"https://api.github.com/users/andlaus","html_url":"https://github.com/andlaus","followers_url":"https://api.github.com/users/andlaus/followers","following_url":"https://api.github.com/users/andlaus/following{/other_user}","gists_url":"https://api.github.com/users/andlaus/gists{/gist_id}","starred_url":"https://api.github.com/users/andlaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andlaus/subscriptions","organizations_url":"https://api.github.com/users/andlaus/orgs","repos_url":"https://api.github.com/users/andlaus/repos","events_url":"https://api.github.com/users/andlaus/events{/privacy}","received_events_url":"https://api.github.com/users/andlaus/received_events","type":"User","site_admin":false},"created_at":"2018-06-27T13:23:54Z","updated_at":"2018-06-27T13:23:54Z","author_association":"MEMBER","body":"You could use the copy constructor to create a return object out of the Scalar:\r\n\r\n```c++\r\ntemplate <class Evaluation>\r\nEvaluation evalDerivative_(const Evaluation& x, size_t segIdx) const\r\n{\r\n         Scalar x0 = xValues_[segIdx];\r\n         Scalar x1 = xValues_[segIdx + 1];\r\n \r\n         Scalar y0 = yValues_[segIdx];\r\n         Scalar y1 = yValues_[segIdx + 1];\r\n \r\n         Evaluation ret(x);\r\n         ret = (y1 - y0)/(x1 - x0);\r\n         return ret;\r\n}\r\n```\r\n\r\nThis is slightly inelegant, and I'm not sure about the performance impact of this, so maybe an `Opm::createBlankCopy(x);` or something needs to be added."}}
{"actor":{"display_login":"andlaus"}}