Skip to content
Snippets Groups Projects
Commit f92d28e2 authored by Christoph Lehmann's avatar Christoph Lehmann Committed by Dmitri Naumov
Browse files

[MPL] Fixed storage order of property input

parent aaa5ca71
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,9 @@ PropertyDataType fromVector(std::vector<double> const& values) ...@@ -39,7 +39,9 @@ PropertyDataType fromVector(std::vector<double> const& values)
case 4: case 4:
{ {
using M = Eigen::Matrix2d; using M = Eigen::Matrix2d;
return M{Eigen::Map<M const>{values.data(), 2, 2}}; // the values vector is in row major order
using MRM = Eigen::Matrix<double, 2, 2, Eigen::RowMajor>;
return M{Eigen::Map<MRM const>{values.data(), 2, 2}};
} }
case 6: case 6:
{ {
...@@ -50,7 +52,9 @@ PropertyDataType fromVector(std::vector<double> const& values) ...@@ -50,7 +52,9 @@ PropertyDataType fromVector(std::vector<double> const& values)
case 9: case 9:
{ {
using M = Eigen::Matrix3d; using M = Eigen::Matrix3d;
return M{Eigen::Map<M const>{values.data(), 3, 3}}; // the values vector is in row major order
using MRM = Eigen::Matrix<double, 3, 3, Eigen::RowMajor>;
return M{Eigen::Map<MRM const>{values.data(), 3, 3}};
} }
default: default:
{ {
......
...@@ -36,7 +36,12 @@ using PropertyDataType = ...@@ -36,7 +36,12 @@ using PropertyDataType =
/// Conversion of a vector to PropertyDataType for different sizes of the /// Conversion of a vector to PropertyDataType for different sizes of the
/// vector. /// vector.
/// \attention It cannot distinguish between 2x2 matrix and 4x1 vector. ///
/// \attention This method cannot distinguish between 2x2 matrix and 4x1 vector.
///
/// \note If the \c values vector stores all elements of a 2x2 or 3x3 matrix
/// (i.e. the general case for 2x2 and 3x3 matrices), it is assumed to be in row
/// major storage order.
PropertyDataType fromVector(std::vector<double> const& values); PropertyDataType fromVector(std::vector<double> const& values);
/// This class is the base class for any material property of any /// This class is the base class for any material property of any
......
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