OGS
Dump.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <filesystem>
14#include <iosfwd>
15#include <string>
16#include <vector>
17
18#include "BaseLib/Error.h"
19
20namespace ChemistryLib
21{
22namespace PhreeqcIOData
23{
24extern std::string specifyFileName(std::string const& project_file_name,
25 std::string const& file_extension);
26
27struct Dump
28{
29 explicit Dump(std::string const& project_file_name)
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 }
45
46 void print(std::ostream& os, std::size_t const num_chemical_systems) const;
47
48 void readDumpFile(std::istream& in, std::size_t const num_chemical_systems);
49
50 std::string const dump_file;
51 std::vector<std::string> aqueous_solutions_prev;
52};
53} // namespace PhreeqcIOData
54} // namespace ChemistryLib
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
void readDumpFile(std::istream &in, std::size_t const num_chemical_systems)
Definition Dump.cpp:31
Dump(std::string const &project_file_name)
Definition Dump.h:29
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