OGS
UserPunch.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "UserPunch.h"
5
7
8namespace ChemistryLib
9{
10namespace PhreeqcIOData
11{
12void UserPunch::initialize(std::size_t const num_chemical_systems)
13{
14 for (auto& secondary_variable : secondary_variables)
15 {
16 secondary_variable.value->resize(num_chemical_systems);
17 }
18}
19
20std::ostream& operator<<(std::ostream& os, UserPunch const& user_punch)
21{
22 os << "USER_PUNCH"
23 << "\n";
24 os << "-headings ";
25 auto const& secondary_variables = user_punch.secondary_variables;
26 for (auto const& secondary_variable : secondary_variables)
27 {
28 os << secondary_variable.name << " ";
29 }
30 os << "\n";
31
32 os << "-start"
33 << "\n";
34 int line_number = 1;
35 for (auto const& statement : user_punch.statements)
36 {
37 os << line_number << " " << statement << "\n";
38 ++line_number;
39 }
40 os << "-end"
41 << "\n";
42
43 return os;
44}
45} // namespace PhreeqcIOData
46} // namespace ChemistryLib
std::ostream & operator<<(std::ostream &os, PhreeqcIO const &phreeqc_io)
void initialize(std::size_t const num_chemical_systems)
Definition UserPunch.cpp:12
UserPunch(std::vector< SecondaryVariable > &&secondary_variables_, std::vector< std::string > &&statements_)
Definition UserPunch.h:37
std::vector< SecondaryVariable > secondary_variables
Definition UserPunch.h:49
std::vector< std::string > const statements
Definition UserPunch.h:50