swh:1:snp:f521c49ab17ef7db6ec70b2430e1ed203f50383f
Raw File
Tip revision: e2d843bf4398ef897d7c0d424da315ad9ae23323 authored by Norbert Grunwald on 04 July 2021, 12:26:02 UTC
Merge branch 'TH2M_confined_compression' into 'master'
Tip revision: e2d843b
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