From 4517f564229304f3aec5f03b8aca26db5d65e94b Mon Sep 17 00:00:00 2001 From: Pierre Matalon Date: Mon, 16 Dec 2024 14:41:08 +0100 Subject: [PATCH] static_assert in transfer() with Eigen --- include/samurai/reconstruction.hpp | 4 ++++ include/samurai/storage/eigen/eigen.hpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/samurai/reconstruction.hpp b/include/samurai/reconstruction.hpp index 083697054..f2d1156d3 100644 --- a/include/samurai/reconstruction.hpp +++ b/include/samurai/reconstruction.hpp @@ -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(ii)) / (1 << shift * dim); } } diff --git a/include/samurai/storage/eigen/eigen.hpp b/include/samurai/storage/eigen/eigen.hpp index fdd7b3ca4..05adf9de5 100644 --- a/include/samurai/storage/eigen/eigen.hpp +++ b/include/samurai/storage/eigen/eigen.hpp @@ -276,7 +276,7 @@ namespace samurai } template - inline auto& view(Eigen::IndexedView, RowIndices, ColIndices>& exp, + auto view(Eigen::IndexedView, RowIndices, ColIndices>& exp, Ranges... ranges) { return exp(ranges...);