Revision 5c2da885a77493bf66aaf5be0089734a795637af authored by Christoph Lehmann on 21 December 2021, 11:16:09 UTC, committed by Christoph Lehmann on 21 December 2021, 11:16:09 UTC
Draft: Do not make direct reference to Process in output functions

See merge request ogs/ogs!3906
2 parent s f0e586b + 12eca54
Raw File
VariableType.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 "VariableType.h"

#include <boost/algorithm/string/predicate.hpp>

#include "BaseLib/Error.h"

namespace MaterialPropertyLib
{
Variable convertStringToVariable(std::string const& string)
{
    for (int i = 0; i < static_cast<int>(Variable::number_of_variables); ++i)
    {
        if (boost::iequals(string, variable_enum_to_string[i]))
        {
            return static_cast<Variable>(i);
        }
    }

    OGS_FATAL(
        "The variable name '{:s}' does not correspond to any known variable",
        string);
}
}  // namespace MaterialPropertyLib
back to top