diff --git a/dune/xt/common/convergence-study.cc b/dune/xt/common/convergence-study.cc index a62fa69b3d4d1959e683bd27afa2f51e2b2a8014..523d4217061e0b19a126a598b265b325af3c1d97 100644 --- a/dune/xt/common/convergence-study.cc +++ b/dune/xt/common/convergence-study.cc @@ -146,7 +146,8 @@ void ConvergenceStudy::print_eoc(std::ostream& out, } } // ... print_eoc(...) -void ConvergenceStudy::run(const std::vector<std::string>& only_these, std::ostream& out) +std::map<std::string, std::map<std::string, std::map<size_t, double>>> +ConvergenceStudy::run(const std::vector<std::string>& only_these, std::ostream& out) { auto& self = *this; // check what we want to compute and print @@ -340,6 +341,13 @@ void ConvergenceStudy::run(const std::vector<std::string>& only_these, std::ostr out << delim; out << std::endl; } + // convert data + std::map<std::string, std::map<std::string, std::map<size_t, double>>> return_data; + for (const auto& level : data) + for (const auto& category : level.second) + for (const auto& type : category.second) + return_data[category.first][type.first][level.first] = type.second; + return return_data; } // ... run(...) diff --git a/dune/xt/common/convergence-study.hh b/dune/xt/common/convergence-study.hh index 3de1bc2e36a0486062721a56b6450d77c4848855..e085d131d579029e2c31b706ae0f5d351a86b61a 100644 --- a/dune/xt/common/convergence-study.hh +++ b/dune/xt/common/convergence-study.hh @@ -138,7 +138,16 @@ protected: const std::string& target_id) const; public: - void run(const std::vector<std::string>& only_these = {}, std::ostream& out = std::cout); + /** + * \brief Runs the study and displays a table with all targets, norms, estimates and quantities given by the study + * (if only_these is empty) or only those which are contained in only_these (else). + * + * \return data with data[foo][bar][level] where 0 <= level <= num_refinements(), "foo" is one of + * {"target", "norm", "estimate", "quantity"} and bar is one of targets(), norms(), estimates() or + * quantities() (intersected with only_these), respectively. + **/ + std::map<std::string, std::map<std::string, std::map<size_t, double>>> + run(const std::vector<std::string>& only_these = {}, std::ostream& out = std::cout); }; // class ConvergenceStudy