Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
ChemicalPlot.hpp
1 // // Reaktoro is a unified framework for modeling chemically reactive systems.
2 // //
3 // // Copyright © 2014-2024 Allan Leal
4 // //
5 // // This library is free software; you can redistribute it and/or
6 // // modify it under the terms of the GNU Lesser General Public
7 // // License as published by the Free Software Foundation; either
8 // // version 2.1 of the License, or (at your option) any later version.
9 // //
10 // // This library is distributed in the hope that it will be useful,
11 // // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // // Lesser General Public License for more details.
14 // //
15 // // You should have received a copy of the GNU Lesser General Public License
16 // // along with this library. If not, see <http://www.gnu.org/licenses/>.
17 
18 // #pragma once
19 
20 // // C++ includes
21 // #include <memory>
22 // #include <vector>
23 // #include <sstream>
24 // #include <string>
25 
26 // namespace Reaktoro {
27 
28 // // Forward declarations
29 // class ChemicalState;
30 // class ChemicalSystem;
31 // class ReactionSystem;
32 // class StringList;
33 
34 // /// A class used to create plots from sequence of chemical states.
35 // class ChemicalPlot
36 // {
37 // public:
38 // /// Construct a default ChemicalPlot instance.
39 // ChemicalPlot();
40 
41 // /// Construct a ChemicalPlot instance using a ChemicalSystem instance.
42 // explicit ChemicalPlot(const ChemicalSystem& system);
43 
44 // /// Construct a ChemicalPlot instance using a ReactionSystem instance.
45 // explicit ChemicalPlot(const ReactionSystem& reactions);
46 
47 // /// Destroy this ChemicalPlot instance.
48 // virtual ~ChemicalPlot();
49 
50 // /// Set the name of the plot and the file names exported.
51 // auto name(std::string name) -> void;
52 
53 // /// Set the quantity to be plotted along the x-axis.
54 // /// **Usage Example**
55 // /// ~~~{.cpp}
56 // /// plot.x("pH");
57 // /// ~~~
58 // /// @see ChemicalQuantity
59 // auto x(std::string quantity) -> void;
60 
61 // /// Add a quantity to be plotted along the y-axis.
62 // /// **Usage Example**
63 // /// ~~~{.cpp}
64 // /// plot.y("elementAmount(Ca)");
65 // /// plot.y("speciesMass(Calcite)");
66 // /// ~~~
67 // /// @note This method can be called multiple times.
68 // /// @param quantity The quantity to be plotted.
69 // /// @see ChemicalQuantity
70 // auto y(std::string quantity) -> void;
71 
72 // /// Add a quantity to be plotted along the y-axis with a label.
73 // /// **Usage Example**
74 // /// ~~~{.cpp}
75 // /// plot.y("elementAmount(Ca)", "Ca [mol]");
76 // /// plot.y("speciesMass(Calcite)", "Calcite [kg]");
77 // /// ~~~
78 // /// @note This method can be called multiple times.
79 // /// @param quantity The quantity to be plotted.
80 // /// @param label The label of the quantity displayed in the legend.
81 // /// @see ChemicalQuantity
82 // auto y(std::string quantity, std::string label) -> void;
83 
84 // /// Add discrete points in the plot.
85 // /// **Usage Example**
86 // /// @param label The label used in the legend to describe the points.
87 // /// @param xpoints The x-coordinates of the points.
88 // /// @param ypoints The y-coordinates of the points.
89 // auto points(std::string label, std::vector<double> xpoints, std::vector<double> ypoints) -> void;
90 
91 // /// Add discrete points in the plot.
92 // /// @param label The label used in the legend to describe the points.
93 // /// @param xpoints The x-coordinates of the points separated by comma or space.
94 // /// @param ypoints The y-coordinates of the points separated by comma or space.
95 // auto points(std::string label, std::string xpoints, std::string ypoints) -> void;
96 
97 // /// Set the legend options.
98 // /// **Usage Example**
99 // /// ~~~{.cpp}
100 // /// plot.legend("left top");
101 // /// plot.legend("right center");
102 // /// ~~~
103 // /// @see showlegend
104 // auto legend(std::string) -> void;
105 
106 // /// Set `true` if legend should be displayed in the plot.
107 // auto showlegend(bool active) -> void;
108 
109 // /// Return `true` if legend should be displayed in the plot.
110 // auto showlegend() const -> bool;
111 
112 // /// Set the title of the plot.
113 // auto title(std::string title) -> void;
114 
115 // /// Set the label of the x-axis.
116 // /// @see ylabel
117 // auto xlabel(std::string) -> void;
118 
119 // /// Set the label of the y-axis.
120 // /// @see xlabel
121 // auto ylabel(std::string) -> void;
122 
123 // /// Set the tics of the x-axis.
124 // /// @see ytics
125 // auto xtics(std::string) -> void;
126 
127 // /// Set the tics of the y-axis.
128 // /// @see xtics
129 // auto ytics(std::string) -> void;
130 
131 // /// Set the numeric display format of the x-axis.
132 // /// **Usage Example**
133 // /// ~~~{.cpp}
134 // /// plot.xformat("%f"); // sets floating point notation.
135 // /// plot.xformat("%e"); // sets exponential notation using lower case `e`.
136 // /// plot.xformat("%E"); // sets exponential notation using upper case `E`.
137 // /// plot.xformat("%g"); // sets exponential notation like "%e", but shorter.
138 // /// plot.xformat("%G"); // sets exponential notation like "%E", but shorter.
139 // /// ~~~
140 // /// @note The full list of supported format specifiers can be found in the [user's manual][gnuplot]
141 // /// of Gnuplot v5.0, at page 123.
142 // /// [gnuplot]: http://www.gnuplot.info/docs_5.0/gnuplot.pdf
143 // /// @see yformat
144 // auto xformat(std::string) -> void;
145 
146 // /// Set the numeric display format of the y-axis.
147 // /// **Usage Example**
148 // /// ~~~{.cpp}
149 // /// plot.yformat("%f"); // sets floating point notation.
150 // /// plot.yformat("%e"); // sets exponential notation using lower case `e`.
151 // /// plot.yformat("%E"); // sets exponential notation using upper case `E`.
152 // /// plot.yformat("%g"); // sets exponential notation like "%e", but shorter.
153 // /// plot.yformat("%G"); // sets exponential notation like "%E", but shorter.
154 // /// ~~~
155 // /// @note The full list of supported format specifiers can be found in the [user's manual][gnuplot]
156 // /// of Gnuplot v5.0, at page 123.
157 // /// [gnuplot]: http://www.gnuplot.info/docs_5.0/gnuplot.pdf
158 // /// @see xformat
159 // auto yformat(std::string) -> void;
160 
161 // /// Set the x-axis to log-scale.
162 // auto xlogscale(int base=10) -> void;
163 
164 // /// Set the y-axis to log-scale.
165 // auto ylogscale(int base=10) -> void;
166 
167 // /// Set the refresh rate of the real-time plot.
168 // auto frequency(unsigned frequency) -> void;
169 
170 // /// Inject a gnuplot command to the script file.
171 // auto operator<<(std::string command) -> ChemicalPlot&;
172 
173 // /// Inject a gnuplot command to the script file.
174 // auto operator<<(std::stringstream command) -> ChemicalPlot&;
175 
176 // /// Open the plot.
177 // auto open() -> void;
178 
179 // /// Update the plot with a new chemical state and a tag.
180 // auto update(const ChemicalState& state, double t) -> void;
181 
182 // /// Compare a ChemicalPlot instance for equality
183 // auto operator==(const ChemicalPlot& other) -> bool;
184 
185 // private:
186 // struct Impl;
187 
188 // std::shared_ptr<Impl> pimpl;
189 // };
190 
191 // } // namespace Reaktoro