diff --git a/bfps/cpp/field.hpp b/bfps/cpp/field.hpp index fe6f8975e63ad1acd766b26baa84aca20ef92cc2..418b11f431437e14131978e8f7721eb0242a1a27 100644 --- a/bfps/cpp/field.hpp +++ b/bfps/cpp/field.hpp @@ -58,6 +58,7 @@ class field private: rnumber *__restrict__ data; /**< data array */ public: + static const int number_of_components = ncomp(fc); hsize_t npoints; /**< total number of grid points. Useful for normalization. */ bool real_space_representation; /**< `true` if field is in real space representation. */ diff --git a/bfps/cpp/particles/particles_field_computer.hpp b/bfps/cpp/particles/particles_field_computer.hpp index 50d4df7818bba1df96e10f0704f4ad995c65a133..92a486397ab7c508cb8767d92e1227b1e2e5e654 100644 --- a/bfps/cpp/particles/particles_field_computer.hpp +++ b/bfps/cpp/particles/particles_field_computer.hpp @@ -12,16 +12,6 @@ template <class partsize_t, class interpolator_class, int interp_neighbours> class particles_field_computer { - // TODO but not critical, add in field: - // static const int nb_components = ncomp(fc); - // and use it as field_class::nb_components - // but failed up to now.... - template <typename rnumber, - field_backend be, - field_components fc> - static constexpr int nbcomp(const field<rnumber, be, fc>& /*field*/){ - return ncomp(fc); - } const std::array<int,3> field_grid_dim; const std::pair<int,int> current_partition_interval; @@ -77,7 +67,7 @@ public: const real_number particles_positions[], real_number particles_current_rhs[], const partsize_t nb_particles) const { - constexpr int nb_components_in_field = nbcomp(field); + constexpr int nb_components_in_field = field.number_of_components; static_assert(nb_components_in_field <= size_particle_rhs, "Cannot store all the component in the given array"); TIMEZONE("particles_field_computer::apply_computation");