Skip to content

Commit

Permalink
static_assert in transfer() with Eigen
Browse files Browse the repository at this point in the history
  • Loading branch information
pmatalon committed Dec 16, 2024
1 parent fe1bb64 commit 4517f56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions include/samurai/reconstruction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,10 @@ namespace samurai
}
else
{
#if defined(SAMURAI_FIELD_CONTAINER_EIGEN3)
static_assert(Field_src::is_soa && Field_src::size > 1, "transfer() is not implemented with Eigen for scalar fields and vectorial fields in AOS.");
// In the lid-driven-cavity demo, the following line does not compile with Eigen.
#endif
view(dst, i_dst) += view(src, static_cast<size_type>(ii)) / (1 << shift * dim);
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/samurai/storage/eigen/eigen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ namespace samurai
}

template <class Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options, class RowIndices, class ColIndices, class... Ranges>
inline auto& view(Eigen::IndexedView<Eigen::Array<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options>, RowIndices, ColIndices>& exp,
auto view(Eigen::IndexedView<Eigen::Array<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options>, RowIndices, ColIndices>& exp,
Ranges... ranges)
{
return exp(ranges...);
Expand Down

0 comments on commit 4517f56

Please sign in to comment.