Reaktoro 
A unified framework for modeling chemically reactive systems
ChemicalPlot.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2015 Allan Leal
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program 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
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. 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 
36 {
37 public:
39  ChemicalPlot();
40 
42  explicit ChemicalPlot(const ChemicalSystem& system);
43 
45  explicit ChemicalPlot(const ReactionSystem& reactions);
46 
48  virtual ~ChemicalPlot();
49 
51  auto name(std::string name) -> void;
52 
59  auto x(std::string quantity) -> void;
60 
70  auto y(std::string quantity) -> void;
71 
82  auto y(std::string label, std::string quantity) -> void;
83 
89  auto points(std::string label, std::vector<double> xpoints, std::vector<double> ypoints) -> void;
90 
95  auto points(std::string label, std::string xpoints, std::string ypoints) -> void;
96 
104  auto legend(std::string) -> void;
105 
107  auto showlegend(bool active) -> void;
108 
110  auto showlegend() const -> bool;
111 
113  auto title(std::string title) -> void;
114 
117  auto xlabel(std::string) -> void;
118 
121  auto ylabel(std::string) -> void;
122 
125  auto xtics(std::string) -> void;
126 
129  auto ytics(std::string) -> void;
130 
144  auto xformat(std::string) -> void;
145 
159  auto yformat(std::string) -> void;
160 
162  auto xlogscale(int base=10) -> void;
163 
165  auto ylogscale(int base=10) -> void;
166 
168  auto frequency(unsigned frequency) -> void;
169 
171  auto operator<<(std::string command) -> ChemicalPlot&;
172 
174  auto operator<<(std::stringstream command) -> ChemicalPlot&;
175 
177  auto open() -> void;
178 
180  auto update(const ChemicalState& state, double t) -> void;
181 
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
auto x(std::string quantity) -> void
Set the quantity to be plotted along the x-axis.
Definition: ChemicalPlot.cpp:354
auto yformat(std::string) -> void
Set the numeric display format of the y-axis.
Definition: ChemicalPlot.cpp:434
A class to represent a system and its attributes and properties.
Definition: ChemicalSystem.hpp:47
auto showlegend() const -> bool
Return true if legend should be displayed in the plot.
Definition: ChemicalPlot.cpp:397
auto y(std::string quantity) -> void
Add a quantity to be plotted along the y-axis.
Definition: ChemicalPlot.cpp:359
auto frequency(unsigned frequency) -> void
Set the refresh rate of the real-time plot.
Definition: ChemicalPlot.cpp:449
auto xformat(std::string) -> void
Set the numeric display format of the x-axis.
Definition: ChemicalPlot.cpp:429
auto ylogscale(int base=10) -> void
Set the y-axis to log-scale.
Definition: ChemicalPlot.cpp:444
auto ytics(std::string) -> void
Set the tics of the y-axis.
Definition: ChemicalPlot.cpp:424
auto update(const ChemicalState &state, double t) -> void
Update the plot with a new chemical state and a tag.
Definition: ChemicalPlot.cpp:471
auto xlogscale(int base=10) -> void
Set the x-axis to log-scale.
Definition: ChemicalPlot.cpp:439
A class used to create plots from sequence of chemical states.
Definition: ChemicalPlot.hpp:35
auto title(std::string title) -> void
Set the title of the plot.
Definition: ChemicalPlot.cpp:402
virtual ~ChemicalPlot()
Destroy this ChemicalPlot instance.
Definition: ChemicalPlot.cpp:346
auto operator==(const ChemicalPlot &other) -> bool
Compare a ChemicalPlot instance for equality.
Definition: ChemicalPlot.cpp:476
A class that represents a system of chemical reactions.
Definition: ReactionSystem.hpp:41
auto legend(std::string) -> void
Set the legend options.
Definition: ChemicalPlot.cpp:386
auto open() -> void
Open the plot.
Definition: ChemicalPlot.cpp:466
auto xlabel(std::string) -> void
Set the label of the x-axis.
Definition: ChemicalPlot.cpp:407
Provides a computational representation of the state of a multiphase chemical system.
Definition: ChemicalState.hpp:60
auto xtics(std::string) -> void
Set the tics of the x-axis.
Definition: ChemicalPlot.cpp:419
auto ylabel(std::string) -> void
Set the label of the y-axis.
Definition: ChemicalPlot.cpp:413
ChemicalPlot()
Construct a default ChemicalPlot instance.
Definition: ChemicalPlot.cpp:334
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto name(std::string name) -> void
Set the name of the plot and the file names exported.
Definition: ChemicalPlot.cpp:349
auto operator<<(std::string command) -> ChemicalPlot &
Inject a gnuplot command to the script file.
Definition: ChemicalPlot.cpp:454
auto points(std::string label, std::vector< double > xpoints, std::vector< double > ypoints) -> void
Add discrete points in the plot.
Definition: ChemicalPlot.cpp:369