{"action":"created","issue":{"url":"https://api.github.com/repos/OPM/opm-autodiff/issues/561","labels_url":"https://api.github.com/repos/OPM/opm-autodiff/issues/561/labels{/name}","comments_url":"https://api.github.com/repos/OPM/opm-autodiff/issues/561/comments","events_url":"https://api.github.com/repos/OPM/opm-autodiff/issues/561/events","html_url":"https://github.com/OPM/opm-autodiff/pull/561","id":122946022,"number":561,"title":"Refactor main functions of all Flow variants.","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-18T13:11:05Z","updated_at":"2015-12-18T14:26:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/OPM/opm-autodiff/pulls/561","html_url":"https://github.com/OPM/opm-autodiff/pull/561","diff_url":"https://github.com/OPM/opm-autodiff/pull/561.diff","patch_url":"https://github.com/OPM/opm-autodiff/pull/561.patch"},"body":"With this PR, I consider the refactoring of the main functions complete for now. Main points are:\r\n - There is a new class `FlowMain`, the `flowMain()` function is now `FlowMain::execute()`.\r\n - The content is split into many smaller functions instead of a single 350-line method.\r\n - `FlowMain` is a template, using the Curiously Recurring Template Pattern (CRTP) to support polymorphism.\r\n - Flow-polymer and Flow-solvent use this, overriding a few of the methods to provide special property classes etc.\r\n\r\nAn intentional side effect of this is that some minor options that were unavailable in Flow-Solvent or Flow-Polymer (or behaved differently) are now available universally. One could argue that the code in this class (or classes) should be part of the Simulator classes instead, but that was impractical as a first step. It could be considered a target for further refactoring.\r\n\r\nThe PR should see some more testing before merging. I'll report testing results as they are complete, but expect identical results to previous ones for flow. For the polymer and solvent simulators there may be minor differences related to default options used."},"comment":{"url":"https://api.github.com/repos/OPM/opm-autodiff/issues/comments/165789932","html_url":"https://github.com/OPM/opm-autodiff/pull/561#issuecomment-165789932","issue_url":"https://api.github.com/repos/OPM/opm-autodiff/issues/561","id":165789932,"user":{"login":"GitPaean","id":6847941,"avatar_url":"https://avatars.githubusercontent.com/u/6847941?v=3","gravatar_id":"","url":"https://api.github.com/users/GitPaean","html_url":"https://github.com/GitPaean","followers_url":"https://api.github.com/users/GitPaean/followers","following_url":"https://api.github.com/users/GitPaean/following{/other_user}","gists_url":"https://api.github.com/users/GitPaean/gists{/gist_id}","starred_url":"https://api.github.com/users/GitPaean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GitPaean/subscriptions","organizations_url":"https://api.github.com/users/GitPaean/orgs","repos_url":"https://api.github.com/users/GitPaean/repos","events_url":"https://api.github.com/users/GitPaean/events{/privacy}","received_events_url":"https://api.github.com/users/GitPaean/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T14:26:09Z","updated_at":"2015-12-18T14:26:09Z","body":"I got this compilation error, while I did not figure out yet. Anyone saw this error too?\r\n\r\n```\r\n2464 In file included from /home/kaib/OPM/debug/opm-autodiff/examples/flow_multisegment_mpi.cpp:30:0:\r\n2465 /home/kaib/OPM/debug/opm-autodiff/opm/autodiff/FlowMain.hpp: In constructor ‘Opm::FlowMainBase<Opm::FlowMain<Dune::CpGrid, Opm::SimulatorFullyImplicitBlackoilMultiSegment<Dune::CpGrid> >, Dune::CpGrid, Opm::SimulatorFullyImplicitBlackoilMultiSegment<Dune::CpGrid> >::FlowMainBa     se()’:\r\n2466 /home/kaib/OPM/debug/opm-autodiff/opm/autodiff/FlowMain.hpp:106:11: error: conversion from ‘const char [7]’ to non-scalar type ‘std::string {aka std::basic_string<char>}’ requested\r\n2467      class FlowMainBase\r\n2468            ^\r\n2469 In file included from /home/kaib/OPM/debug/opm-autodiff/examples/flow_multisegment_mpi.cpp:30:0:\r\n2470 /home/kaib/OPM/debug/opm-autodiff/opm/autodiff/FlowMain.hpp: In constructor ‘Opm::FlowMain<Dune::CpGrid, Opm::SimulatorFullyImplicitBlackoilMultiSegment<Dune::CpGrid> >::FlowMain()’:\r\n2471 /home/kaib/OPM/debug/opm-autodiff/opm/autodiff/FlowMain.hpp:642:11: note: synthesized method ‘Opm::FlowMainBase<Opm::FlowMain<Dune::CpGrid, Opm::SimulatorFullyImplicitBlackoilMultiSegment<Dune::CpGrid> >, Dune::CpGrid, Opm::SimulatorFullyImplicitBlackoilMultiSegment<Dune::CpGr     id> >::FlowMainBase()’ first required here \r\n2472      class FlowMain : public FlowMainBase<FlowMain<Grid, Simulator>, Grid, Simulator>\r\n2473            ^\r\n2474 /home/kaib/OPM/debug/opm-autodiff/examples/flow_multisegment_mpi.cpp: In function ‘int main(int, char**)’:\r\n2475 /home/kaib/OPM/debug/opm-autodiff/examples/flow_multisegment_mpi.cpp:40:36: note: synthesized method ‘Opm::FlowMain<Dune::CpGrid, Opm::SimulatorFullyImplicitBlackoilMultiSegment<Dune::CpGrid> >::FlowMain()’ first required here \r\n2476      Opm::FlowMain<Grid, Simulator> mainfunc;\r\n```"}}