swh:1:snp:f521c49ab17ef7db6ec70b2430e1ed203f50383f
Raw File
Tip revision: 54cf21a1380719172c0b049f860dafc30e37cd56 authored by Dmitry Yu. Naumov on 02 March 2021, 22:50:12 UTC
Merge branch 'ExcludeDepsFromWarnings' into 'master'
Tip revision: 54cf21a
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& input)
{
    if (boost::iequals(input, "concentration"))
    {
        return Variable::concentration;
    }
    if (boost::iequals(input, "phase_pressure"))
    {
        return Variable::phase_pressure;
    }
    if (boost::iequals(input, "capillary_pressure"))
    {
        return Variable::capillary_pressure;
    }
    if (boost::iequals(input, "density"))
    {
        return Variable::density;
    }
    if (boost::iequals(input, "equivalent_plastic_strain"))
    {
        return Variable::equivalent_plastic_strain;
    }
    if (boost::iequals(input, "temperature"))
    {
        return Variable::temperature;
    }
    if (boost::iequals(input, "liquid_saturation"))
    {
        return Variable::liquid_saturation;
    }
    if (boost::iequals(input, "displacement"))
    {
        return Variable::displacement;
    }
    if (boost::iequals(input, "grain_compressibility"))
    {
        return Variable::grain_compressibility;
    }
    if (boost::iequals(input, "solid_grain_pressure"))
    {
        return Variable::solid_grain_pressure;
    }

    OGS_FATAL(
        "The variable name '{:s}' does not correspond to any known variable",
        input);

    return Variable::number_of_variables;  // to avoid the 'no return' warning
}
}  // namespace MaterialPropertyLib
back to top