From dcb31edb3ce8fbbd2200e55bafe10f59401ab756 Mon Sep 17 00:00:00 2001 From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de> Date: Sat, 2 Mar 2019 08:08:34 +0100 Subject: [PATCH] try suggested number_of_componentns alternative --- bfps/cpp/field.hpp | 1 + bfps/cpp/particles/particles_field_computer.hpp | 12 +----------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/bfps/cpp/field.hpp b/bfps/cpp/field.hpp index fe6f8975..418b11f4 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 50d4df78..92a48639 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"); -- GitLab