Skip to content
Snippets Groups Projects
Commit a52a654b authored by Florian Zill's avatar Florian Zill Committed by Dmitri Naumov
Browse files

[ML] EigenMatrixXd to EigenTensor

parent 8737da29
No related branches found
No related tags found
No related merge requests found
...@@ -101,32 +101,14 @@ struct FormEigenTensor ...@@ -101,32 +101,14 @@ struct FormEigenTensor
Eigen::Matrix<double, GlobalDim, GlobalDim> operator()( Eigen::Matrix<double, GlobalDim, GlobalDim> operator()(
Eigen::MatrixXd const& values) const Eigen::MatrixXd const& values) const
{ {
if constexpr (GlobalDim == 3) if (GlobalDim == values.rows() && GlobalDim == values.cols())
{
if (values.rows() != 6 && values.cols() != 1)
{
OGS_FATAL("Input wrong size.");
}
Eigen::Matrix<double, GlobalDim, GlobalDim> result;
result << values(0, 0), values(3, 0), values(5, 0), values(3, 0),
values(1, 0), values(4, 0), values(5, 0), values(4, 0),
values(2, 0);
return result;
}
if constexpr (GlobalDim == 2)
{ {
if (values.rows() != 4 && values.cols() != 1) return values;
{
OGS_FATAL("Input wrong size.");
}
// skip the z-direction in this case
Eigen::Matrix<double, GlobalDim, GlobalDim> result;
result << values(0, 0), values(3, 0), values(3, 0), values(1, 0);
return result;
} }
OGS_FATAL("Cannot convert something TODO to {:d}x{:d} matrix", OGS_FATAL(
GlobalDim); "Cannot convert a dynamic {:d}x{:d} matrix to a {:d}x{:d} matrix",
values.rows(), values.cols(), GlobalDim, GlobalDim);
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment