swh:1:snp:6088ab52ef49920e01e3f334cdf4d5d6c8a822b9
Raw File
Tip revision: fc4e4ab7dd2981e087cafb3aa3a5ed197df9d58b authored by Dmitry Yu. Naumov on 04 July 2021, 20:20:51 UTC
Merge branch 'SmallFixes' into 'master'
Tip revision: fc4e4ab
UserPunch.cpp
/**
 * \file
 * \copyright
 * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#include "UserPunch.h"

#include "BaseLib/ConfigTreeUtil.h"

namespace ChemistryLib
{
namespace PhreeqcIOData
{
void UserPunch::initialize(std::size_t const num_chemical_systems)
{
    for (auto& secondary_variable : secondary_variables)
    {
        secondary_variable.value->resize(num_chemical_systems);
    }
}

std::ostream& operator<<(std::ostream& os, UserPunch const& user_punch)
{
    os << "USER_PUNCH"
       << "\n";
    os << "-headings ";
    auto const& secondary_variables = user_punch.secondary_variables;
    for (auto& secondary_variable : secondary_variables)
    {
        os << secondary_variable.name << " ";
    }
    os << "\n";

    os << "-start"
       << "\n";
    int line_number = 1;
    for (auto const& statement : user_punch.statements)
    {
        os << line_number << " " << statement << "\n";
        ++line_number;
    }
    os << "-end"
       << "\n";

    return os;
}
}  // namespace PhreeqcIOData
}  // namespace ChemistryLib
back to top