OGS
ChemistryLib::PhreeqcIOData::Dump Struct Reference

Detailed Description

Definition at line 27 of file Dump.h.

#include <Dump.h>

Public Member Functions

 Dump (std::string const &project_file_name)
 
void print (std::ostream &os, std::size_t const num_chemical_systems) const
 
void readDumpFile (std::istream &in, std::size_t const num_chemical_systems)
 

Public Attributes

std::string const dump_file
 
std::vector< std::string > aqueous_solutions_prev
 

Constructor & Destructor Documentation

◆ Dump()

ChemistryLib::PhreeqcIOData::Dump::Dump ( std::string const & project_file_name)
inlineexplicit

Definition at line 29 of file Dump.h.

30 : dump_file(specifyFileName(project_file_name, ".dmp"))
31 {
32 try
33 {
34 if (std::filesystem::remove(dump_file))
35 {
36 INFO("Deleted the redundant phreeqc dump file {:s}\n",
37 dump_file);
38 }
39 }
40 catch (std::filesystem::filesystem_error const& e)
41 {
42 ERR("filesystem error: {:s}\n", e.what());
43 }
44 }
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:45
std::string specifyFileName(std::string const &project_file_name, std::string const &file_extension)
Definition Output.cpp:23
std::string const dump_file
Definition Dump.h:50

References dump_file, ERR(), and INFO().

Member Function Documentation

◆ print()

void ChemistryLib::PhreeqcIOData::Dump::print ( std::ostream & os,
std::size_t const num_chemical_systems ) const

Definition at line 19 of file Dump.cpp.

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}

References dump_file.

◆ readDumpFile()

void ChemistryLib::PhreeqcIOData::Dump::readDumpFile ( std::istream & in,
std::size_t const num_chemical_systems )

Definition at line 31 of file Dump.cpp.

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}
std::vector< std::string > aqueous_solutions_prev
Definition Dump.h:51

References aqueous_solutions_prev.

Member Data Documentation

◆ aqueous_solutions_prev

std::vector<std::string> ChemistryLib::PhreeqcIOData::Dump::aqueous_solutions_prev

Definition at line 51 of file Dump.h.

Referenced by readDumpFile().

◆ dump_file

std::string const ChemistryLib::PhreeqcIOData::Dump::dump_file

Definition at line 50 of file Dump.h.

Referenced by Dump(), and print().


The documentation for this struct was generated from the following files: