OGS
Output.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <algorithm>
14#include <iosfwd>
15#include <iterator>
16#include <string>
17#include <vector>
18
19namespace ChemistryLib
20{
21namespace PhreeqcIOData
22{
24{
25public:
26 explicit BasicOutputSetups(std::string const& project_file_name,
27 bool const use_high_precision_);
28
35
41
42 friend std::ostream& operator<<(
43 std::ostream& os, BasicOutputSetups const& basic_output_setups);
44
45 std::string const output_file;
46
47private:
48 static const bool display_simulation_id = false;
49 static const bool display_state = true;
50 static const bool display_solution_id = true;
51 static const bool display_distance = false;
52 static const bool display_current_time = false;
53 static const bool display_time_step = false;
54 static const bool display_pH = true;
55 static const bool display_pe = true;
57};
58
59enum class ItemType
60{
61 pH,
62 pe,
67};
68
70{
71 OutputItem(std::string name_, ItemType item_type_)
72 : name(std::move(name_)), item_type(item_type_)
73 {
74 }
75
76 std::string const name;
78};
79
80struct Output
81{
82 Output(BasicOutputSetups&& basic_output_setups_,
83 std::vector<OutputItem>&& accepted_items_,
84 std::vector<int>&& dropped_item_ids_)
85 : basic_output_setups(std::move(basic_output_setups_)),
86 accepted_items(std::move(accepted_items_)),
87 dropped_item_ids(std::move(dropped_item_ids_))
88 {
89 }
90
91 std::vector<OutputItem> getOutputItemsByItemType(ItemType item_type) const
92 {
93 std::vector<OutputItem> matching_items;
94 std::copy_if(accepted_items.cbegin(),
95 accepted_items.cend(),
96 std::back_inserter(matching_items),
97 [&item_type](OutputItem const& accepted_item)
98 { return accepted_item.item_type == item_type; });
99 return matching_items;
100 }
101
102 friend std::ostream& operator<<(std::ostream& os, Output const& output);
103
105 std::vector<OutputItem> const accepted_items;
106 std::vector<int> const dropped_item_ids;
107};
108} // namespace PhreeqcIOData
109} // namespace ChemistryLib
friend std::ostream & operator<<(std::ostream &os, BasicOutputSetups const &basic_output_setups)
Definition Output.cpp:44
BasicOutputSetups(std::string const &project_file_name, bool const use_high_precision_)
Definition Output.cpp:37
OutputItem(std::string name_, ItemType item_type_)
Definition Output.h:71
std::vector< int > const dropped_item_ids
Definition Output.h:106
friend std::ostream & operator<<(std::ostream &os, Output const &output)
Definition Output.cpp:66
std::vector< OutputItem > const accepted_items
Definition Output.h:105
BasicOutputSetups const basic_output_setups
Definition Output.h:104
Output(BasicOutputSetups &&basic_output_setups_, std::vector< OutputItem > &&accepted_items_, std::vector< int > &&dropped_item_ids_)
Definition Output.h:82
std::vector< OutputItem > getOutputItemsByItemType(ItemType item_type) const
Definition Output.h:91