Reaktoro 
A unified framework for modeling chemically reactive systems
ChemicalOutput.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:
40 
42  explicit ChemicalOutput(const ChemicalSystem& system);
43 
45  explicit ChemicalOutput(const ReactionSystem& reactions);
46 
48  virtual ~ChemicalOutput();
49 
51  auto filename(std::string filename) -> void;
52 
54  auto filename() const -> std::string;
55 
58  auto add(std::string quantity) -> void;
59 
63  auto add(std::string quantity, std::string label) -> void;
64 
66  auto attachments(std::vector<std::string> titles) -> void;
67 
69  auto attach(int value) -> void;
70 
72  auto attach(double value) -> void;
73 
75  auto attach(std::string value) -> void;
76 
78  auto precision(int val) -> void;
79 
81  auto scientific(bool enable) -> void;
82 
84  auto terminal(bool enabled) -> void;
85 
87  auto quantities() const -> std::vector<std::string>;
88 
90  auto headings() const -> std::vector<std::string>;
91 
93  auto open() -> void;
94 
96  auto update(const ChemicalState& state, double t) -> void;
97 
99  auto close() -> void;
100 
102  operator bool() const;
103 
104 private:
105  struct Impl;
106 
107  std::shared_ptr<Impl> pimpl;
108 };
109 
110 } // namespace Reaktoro
auto update(const ChemicalState &state, double t) -> void
Update the output with a new chemical state and its tag.
Definition: ChemicalOutput.cpp:277
auto filename() const -> std::string
Return the name of the output file.
Definition: ChemicalOutput.cpp:210
A class to represent a system and its attributes and properties.
Definition: ChemicalSystem.hpp:47
ChemicalOutput()
Construct a default ChemicalOutput instance.
Definition: ChemicalOutput.cpp:190
virtual ~ChemicalOutput()
Destroy this ChemicalOutput instance.
Definition: ChemicalOutput.cpp:202
auto precision(int val) -> void
Set the floating-point precision in the output.
Definition: ChemicalOutput.cpp:247
auto open() -> void
Open the output file.
Definition: ChemicalOutput.cpp:272
auto attachments(std::vector< std::string > titles) -> void
Set the titles of extra columns in the output file.
Definition: ChemicalOutput.cpp:226
auto headings() const -> std::vector< std::string >
Return the headings of the output file.
Definition: ChemicalOutput.cpp:267
A class that represents a system of chemical reactions.
Definition: ReactionSystem.hpp:41
auto terminal(bool enabled) -> void
Enable or disable the output to the terminal.
Definition: ChemicalOutput.cpp:257
Provides a computational representation of the state of a multiphase chemical system.
Definition: ChemicalState.hpp:60
A type used to output sequence of chemical states to a file or terminal.
Definition: ChemicalOutput.hpp:35
auto scientific(bool enable) -> void
Enable or disable output in scientific format.
Definition: ChemicalOutput.cpp:252
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto quantities() const -> std::vector< std::string >
Return the name of the quantities in the output file.
Definition: ChemicalOutput.cpp:262
auto attach(int value) -> void
Attach value to extra column data in the output file.
Definition: ChemicalOutput.cpp:232
auto add(std::string quantity) -> void
Add a quantity to be output.
Definition: ChemicalOutput.cpp:215
auto close() -> void
Close the output file.
Definition: ChemicalOutput.cpp:282