Revision 7920af31cd801239be3be9a06386304acbbef6fe authored by Karsten Rink on 05 January 2023, 09:52:43 UTC, committed by Karsten Rink on 05 January 2023, 09:52:43 UTC
[FileIO] XYZ raster reader See merge request ogs/ogs!4430
FormKelvinVectorFromThermalExpansivity.cpp
/**
* \file
* \copyright
* Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
* Created on February 12, 2021, 4:34 PM
*/
#include "FormKelvinVectorFromThermalExpansivity.h"
#include "BaseLib/Error.h"
namespace MaterialPropertyLib
{
static constexpr const char error_info[] =
"The thermal expansivity can only be either a scalar number for isotropic "
"thermal expansion or a three element array for anisotropic thermal "
"expansion.";
template <int GlobalDim>
struct FormKelvinVectorFromThermalExpansivity
{
MathLib::KelvinVector::KelvinVectorType<GlobalDim> operator()(
double const& value) const
{
MathLib::KelvinVector::KelvinVectorType<GlobalDim> result =
MathLib::KelvinVector::KelvinVectorType<GlobalDim>::Zero();
result.template head<3>() = Eigen::Vector3d::Constant(value);
return result;
}
MathLib::KelvinVector::KelvinVectorType<GlobalDim> operator()(
Eigen::Matrix<double, 2, 1> const& /*values*/) const
{
OGS_FATAL(error_info);
}
MathLib::KelvinVector::KelvinVectorType<GlobalDim> operator()(
Eigen::Matrix<double, 3, 1> const& values) const
{
MathLib::KelvinVector::KelvinVectorType<GlobalDim> result =
MathLib::KelvinVector::KelvinVectorType<GlobalDim>::Zero();
result.template head<3>() = values;
return result;
}
MathLib::KelvinVector::KelvinVectorType<GlobalDim> operator()(
Eigen::Matrix<double, 2, 2> const& /*values*/) const
{
OGS_FATAL(error_info);
}
MathLib::KelvinVector::KelvinVectorType<GlobalDim> operator()(
Eigen::Matrix<double, 3, 3> const& /*values*/) const
{
OGS_FATAL(error_info);
}
MathLib::KelvinVector::KelvinVectorType<GlobalDim> operator()(
Eigen::Matrix<double, 4, 1> const& /*values*/) const
{
OGS_FATAL(error_info);
}
MathLib::KelvinVector::KelvinVectorType<GlobalDim> operator()(
Eigen::Matrix<double, 6, 1> const& /*values*/) const
{
OGS_FATAL(error_info);
}
MathLib::KelvinVector::KelvinVectorType<GlobalDim> operator()(
Eigen::MatrixXd const& /*values*/) const
{
OGS_FATAL(error_info);
}
};
template <int GlobalDim>
MathLib::KelvinVector::KelvinVectorType<GlobalDim>
formKelvinVectorFromThermalExpansivity(
MaterialPropertyLib::PropertyDataType const& values)
{
return std::visit(FormKelvinVectorFromThermalExpansivity<GlobalDim>(),
values);
}
template MathLib::KelvinVector::KelvinVectorType<2>
formKelvinVectorFromThermalExpansivity<2>(
MaterialPropertyLib::PropertyDataType const& values);
template MathLib::KelvinVector::KelvinVectorType<3>
formKelvinVectorFromThermalExpansivity<3>(
MaterialPropertyLib::PropertyDataType const& values);
} // namespace MaterialPropertyLib
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...