.. _cpp-flow/Solution: ********************************************************** flow/Solution.hpp ********************************************************** .. default-domain:: cpp .. default-role:: cpp:expr .. py:currentmodule:: mod .. cpp:namespace:: mod Class ``flow::SolutionRange`` -------------------------------------------------------------------------------------------------------------------------------- .. class:: flow::SolutionRange A range of solutions for a flow model. Synopsis ^^^^^^^^ .. alias:: flow::SolutionRange :maxdepth: 2 :noroot: Details ^^^^^^^ .. cpp:namespace-push:: flow::SolutionRange .. type:: const_iterator iterator Random-access iterator types for solutions in a range. .. function:: std::shared_ptr getFlow() :returns: the flow model that produced these solutions. .. function:: friend std::ostream &operator<<(std::ostream &s, const SolutionRange &r) .. function:: int size() const :returns: the number of solutions in the range. .. function:: const_iterator begin() const const_iterator end() const :returns: the begin and end iterators for the range. .. function:: Solution operator[](int i) const :returns: the `i` th solution in the range. :throws: :class:`LogicError` if the index is out of bounds. .. function:: void list() const List overall information about each solution. .. function:: void print() const void print(const Printer &printer, const dg::PrintData &data) const Print solutions using the settings in the given printer and the structure information in the data object. The `data` defaults to `dg::PrintData(getFlow()->getDG())` and `printer` defaults to `Printer()`. :throws: :class:`LogicError` if the given print data does not belong to the underlying derivation graph. .. cpp:namespace-pop:: Class ``flow::Solution`` -------------------------------------------------------------------------------------------------------------------------------- .. class:: flow::Solution A solution for a flow model. Synopsis ^^^^^^^^ .. alias:: flow::Solution :maxdepth: 2 :noroot: Details ^^^^^^^ .. cpp:namespace-push:: flow::Solution .. function:: std::shared_ptr getFlow() :returns: the flow model that produced the solution. .. function:: int getId() const :returns: an ID for the solution which is unique among all solutions from the parent :class:`Flow` object. .. function:: friend std::ostream &operator<<(std::ostream &s, const Solution &sol) .. function:: friend bool operator==(const Solution &a, const Solution &b) friend bool operator!=(const Solution &a, const Solution &b) friend bool operator<(const Solution &a, const Solution &b) Compares the solution objects, i.e., the values of `getFlow()` and `getId()`. .. function:: std::variant eval(const LinExp &exp) const :returns: the value of the given linear expression evaluated on the solution. .. function:: void list() const List overall information about the solution. .. function:: std::pair, std::optional> \ print() const std::pair, std::optional> \ print(const Printer &printer, const dg::PrintData &data) const Print the solution using the settings in the given printer and the structure information in the data object. The `data` defaults to `dg::PrintData(getFlow()->getDG())` and `printer` defaults to `Printer()`. :returns: the name of the PDF-files that will be compiled in post-processing for respectively the filtered and unfiltered depictions. If either is not requested by the given `printer` the corresponding entry has no string. :throws: :class:`LogicError` if the given print data does not belong to the underlying derivation graph. .. cpp:namespace-pop:: Class ``flow::SolutionOld`` -------------------------------------------------------------------------------------------------------------------------------- .. class:: flow::SolutionOld An object of this class represents a solution for a specific flow model. Synopsis ^^^^^^^^ .. alias:: flow::SolutionOld :maxdepth: 2 :noroot: Details ^^^^^^^ .. cpp:namespace-push:: flow::SolutionOld .. function:: unsigned int getId() const :returns: an id for the solution which is unique among all solutions from the parent :class:`Flow` object. .. function:: std::shared_ptr getFlow() const :returns: the flow model that produced this solution. .. function:: double eval(const LinExp &exp) const :returns: the value of the given linear expression evaluated on the solution. .. function:: void print(const dg::PrintData &data, const Printer &printer) const Print the solution using the settings in the given printer. :returns: the name of the PDF-file that will be compiled in post-processing for the filtered graph. :throws: :class:`LogicError` if the given print data does not belong to the underlying derivation graph. .. function:: void haxListDerivations() const List the solution in more human readable form. Don't expect this function to stay in this form. .. cpp:namespace-pop:: Class ``flow::SolutionSet`` -------------------------------------------------------------------------------------------------------------------------------- .. class:: flow::SolutionSet An object of this class represents the solutions for a specific flow model. Synopsis ^^^^^^^^ .. alias:: flow::SolutionSet :maxdepth: 2 :noroot: Details ^^^^^^^ .. cpp:namespace-push:: flow::SolutionSet .. function:: SolutionSet(std::shared_ptr dgFlow) Construct a representation of the solutions for the given flow model. .. function:: std::shared_ptr getFlow() :returns: the flow model that produced these solutions. .. function:: void list() const List overall information about each solution. .. function:: unsigned int size() const :returns: the number of solutions in the flow model. .. function:: void print(const dg::PrintData &data, const Printer &printer) const Print all solutions using the given flow printer. .. function:: const_iterator begin() const :returns: an iterator to the first solution. .. function:: const_iterator end() const :returns: an iterator to after the last solution. .. function:: Solution operator[](unsigned int i) const :returns: the solution at the given index. :throws: :class:`LogicError` if the index is out of bounds. .. cpp:namespace-pop::