Class Dune::XT::Common::ConvergenceStudy

class Dune::XT::Common::ConvergenceStudy

Base class for convergence studies that refine a discretization and report experimental orders of convergence.

Method Dune::XT::Common::ConvergenceStudy::num_refinements

virtual size_t Dune::XT::Common::ConvergenceStudy::num_refinements() const = 0

The number of refinements to carry out.

discretiztion_info() and compute() will be called for 0 < = refinement_level < = num_refinements.

Method Dune::XT::Common::ConvergenceStudy::targets

virtual std::vector<std::string> Dune::XT::Common::ConvergenceStudy::targets() const = 0

The identifiers of the targets with respect to which the EOCs will be computed.

This is usually something like “h” or “dt”.

Note

This must not be empty!

Note

Target ids are shortened to length 4 in EOC column headers.

Method Dune::XT::Common::ConvergenceStudy::norms

virtual std::vector<std::string> Dune::XT::Common::ConvergenceStudy::norms() const

Error norms of which the EOCs will be computed.

Method Dune::XT::Common::ConvergenceStudy::estimates

virtual std::vector<std::pair<std::string, std::string>> Dune::XT::Common::ConvergenceStudy::estimates() const

A posteriori error estimates (and corresponding norms) of which the EOCs will be computed.

Method Dune::XT::Common::ConvergenceStudy::quantities

virtual std::vector<std::string> Dune::XT::Common::ConvergenceStudy::quantities() const

Quantities to be displayed.

Method Dune::XT::Common::ConvergenceStudy::discretization_info_title

virtual std::string Dune::XT::Common::ConvergenceStudy::discretization_info_title() const = 0

Header to be printed in the column which displays discretization_info().

Method Dune::XT::Common::ConvergenceStudy::discretization_info

virtual std::string Dune::XT::Common::ConvergenceStudy::discretization_info(const size_t refinement_level) = 0

Statistics about the discretization, in addition to targets().

This is usually somthing like the number of DoFs or grid elements

Note

This is the first called on a new level and can be used to set the internal current refinemen_level.

Method Dune::XT::Common::ConvergenceStudy::compute

virtual std::map<std::string, std::map<std::string, double>> Dune::XT::Common::ConvergenceStudy::compute(const size_t refinement_level, const std::vector<std::string> &actual_norms, const std::vector<std::pair<std::string, std::string>> &actual_estimates, const std::vector<std::string> &actual_quantities) = 0

Carries out the actual computations on this refinement_level.

This usually solves the problem and computes various statistics, which are expected to be of the form

for (std::string type : {"target", "norm", "estimate"}) {
  for (std::string id : this->type()) { // <- this is pseudocode
    if (id in only_these) {
      data[type][id] = some_quantity;
    }
  }
}

and to contain data[“info”][“time_to_solution”] (in seconds).

Method Dune::XT::Common::ConvergenceStudy::expected_rate

virtual double Dune::XT::Common::ConvergenceStudy::expected_rate(const std::string &type, const std::string &id) const

The expected rates of convergence, merely to be used to color the EOCs.

Method Dune::XT::Common::ConvergenceStudy::filter

std::vector<std::string> Dune::XT::Common::ConvergenceStudy::filter(const std::vector<std::string> &vec, const std::vector<std::string> &only_these) const

No documentation provided.

Method Dune::XT::Common::ConvergenceStudy::filter

std::vector<std::pair<std::string, std::string>> Dune::XT::Common::ConvergenceStudy::filter(const std::vector<std::pair<std::string, std::string>> &vec, const std::vector<std::string> &only_these) const

No documentation provided.

Method Dune::XT::Common::ConvergenceStudy::lfill

std::string Dune::XT::Common::ConvergenceStudy::lfill(const std::string &id, const size_t len) const

No documentation provided.

Method Dune::XT::Common::ConvergenceStudy::cfill

std::string Dune::XT::Common::ConvergenceStudy::cfill(const std::string &id, const size_t len) const

No documentation provided.

Method Dune::XT::Common::ConvergenceStudy::extract

double Dune::XT::Common::ConvergenceStudy::extract(const std::map<std::string, std::map<std::string, double>> &level_data, const std::string &type, const std::string &id) const

To do

improve

Method Dune::XT::Common::ConvergenceStudy::extract

double Dune::XT::Common::ConvergenceStudy::extract(const std::map<size_t, std::map<std::string, std::map<std::string, double>>> &data, const size_t level, const std::string &type, const std::string &id) const

No documentation provided.

Method Dune::XT::Common::ConvergenceStudy::print_eoc

void Dune::XT::Common::ConvergenceStudy::print_eoc(std::ostream &out, const size_t len, const std::map<size_t, std::map<std::string, std::map<std::string, double>>> &data, const size_t level, const std::string &type, const std::string &id, const std::string &target_id) const

No documentation provided.

Method Dune::XT::Common::ConvergenceStudy::wrap_quantity_id

std::array<std::string, 3> Dune::XT::Common::ConvergenceStudy::wrap_quantity_id(const std::string &id, const size_t column_width) const

No documentation provided.

Method Dune::XT::Common::ConvergenceStudy::print_norm_eocs

void Dune::XT::Common::ConvergenceStudy::print_norm_eocs(std::ostream &out, const size_t eoc_column_width, const std::map<size_t, std::map<std::string, std::map<std::string, double>>> &data, const size_t level, const std::string &id, const std::vector<std::string> &actual_targets) const

No documentation provided.

Method Dune::XT::Common::ConvergenceStudy::run

std::map<std::string, std::map<std::string, std::map<size_t, double>>> Dune::XT::Common::ConvergenceStudy::run(const std::vector<std::string> &only_these = {}, std::ostream &out = std::cout)

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).

:returns: 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.

Destructor Dune::XT::Common::ConvergenceStudy::~ConvergenceStudy

virtual Dune::XT::Common::ConvergenceStudy::~ConvergenceStudy() = default

No documentation provided.