OGS
Dump.cpp
Go to the documentation of this file.
1
11#include "Dump.h"
12
13#include <iostream>
14
15namespace ChemistryLib
16{
17namespace PhreeqcIOData
18{
19void Dump::print(std::ostream& os, std::size_t const num_chemical_systems) const
20{
21 os << "DUMP"
22 << "\n";
23 os << "-file " << dump_file << "\n";
24 os << "-append false"
25 << "\n";
26 os << "-solution 1-" << num_chemical_systems << "\n";
27 os << "END"
28 << "\n";
29}
30
31void Dump::readDumpFile(std::istream& in,
32 std::size_t const num_chemical_systems)
33{
35 aqueous_solutions_prev.reserve(num_chemical_systems);
36
37 std::string line;
38 std::string aqueous_solution_prev_;
39 std::size_t chemical_system_id = 0;
40 while (std::getline(in, line))
41 {
42 if (line.find("USE reaction_pressure none") != std::string::npos)
43 {
44 break;
45 }
46
47 if (line.find("SOLUTION_RAW") != std::string::npos)
48 {
49 aqueous_solution_prev_ =
50 "SOLUTION_RAW " +
51 std::to_string(num_chemical_systems + chemical_system_id + 1) +
52 "\n";
53 continue;
54 }
55
56 aqueous_solution_prev_ += line + "\n";
57
58 if (line.find("-gammas") != std::string::npos)
59 {
60 aqueous_solutions_prev.push_back(aqueous_solution_prev_);
61 aqueous_solution_prev_.clear();
62 ++chemical_system_id;
63 }
64 }
65}
66} // namespace PhreeqcIOData
67} // namespace ChemistryLib
std::string const dump_file
Definition Dump.h:50
void readDumpFile(std::istream &in, std::size_t const num_chemical_systems)
Definition Dump.cpp:31
void print(std::ostream &os, std::size_t const num_chemical_systems) const
Definition Dump.cpp:19
std::vector< std::string > aqueous_solutions_prev
Definition Dump.h:51