swh:1:snp:f521c49ab17ef7db6ec70b2430e1ed203f50383f
Raw File
Tip revision: 4470d066c7f8d91905fec008b29598c201cf53b4 authored by Dmitri Naumov on 23 September 2021, 11:17:20 UTC
[T/TH2M] Liakopoulos; Add Newton ctest version.
Tip revision: 4470d06
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