Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit d4b94fcc authored by Quentin Khan's avatar Quentin Khan
Browse files

FBasicParticle: inherit from the data tuple

parent c03edfdd
......@@ -77,7 +77,7 @@ namespace scalfmm {
template<typename _FReal, std::size_t _Dim = 3, typename... Types>
class FBasicParticle {
class FBasicParticle : public scalfmm::pack_expand_tuple< scalfmm::pack<_Dim, _FReal>, Types... >{
public:
/// Storage class : std::tuple<FReal,...(Dim times), Types...>
......@@ -119,13 +119,13 @@ public:
/// Constructor from tuple equivalent to #data_t
template<typename... Ts>
FBasicParticle(const std::tuple<Ts...>& ts) :
_data(ts)
data_t(ts)
{}
/// #data_t cast operator
operator data_t() const {
return this->_data;
}
// operator data_t() const {
// return this->_data;
// }
/** \brief Position getter
......@@ -151,11 +151,11 @@ public:
}
data_t& data() {
return this->_data;
return *this;
}
const data_t& data() const {
return this->_data;
return *this;
}
template<std::size_t I>
......@@ -174,23 +174,23 @@ public:
}
private:
data_t _data;
//data_t _data;
template<typename... Ts, std::size_t... Is>
FBasicParticle(std::index_sequence<Is...>, const FPoint<FReal, Dim>& pos, Ts&&... ts) :
_data(pos[Is]..., std::forward<Ts>(ts)...)
data_t(pos[Is]..., std::forward<Ts>(ts)...)
{
static_assert(sizeof...(Ts) == NbAttributes, "Parameter count is incorrect");
}
template<std::size_t... Is>
position_t position_impl(std::index_sequence<Is...>) const{
return position_t(std::get<Is>(_data)...);
return position_t(std::get<Is>(this->data())...);
}
template<std::size_t... Is>
void setPosition_impl(const position_t& pos, std::index_sequence<Is...>) const{
auto l = {std::get<Is>(this->_data) = pos[Is] ...};
void setPosition_impl(const position_t& pos, std::index_sequence<Is...>) {
auto l = {std::get<Is>(this->data()) = pos[Is] ...};
(void)l;
}
......@@ -200,7 +200,7 @@ private:
std::tuple<Attributes...>)
const
{
return std::tuple<Attributes...>(std::get<Is+Dim>(this->_data)...);
return std::tuple<Attributes...>(std::get<Is+Dim>(this->data())...);
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment