diff --git a/include/picongpu/particles/Manipulate.hpp b/include/picongpu/particles/Manipulate.hpp index fef2a88a150..ea5ebf13713 100644 --- a/include/picongpu/particles/Manipulate.hpp +++ b/include/picongpu/particles/Manipulate.hpp @@ -134,7 +134,7 @@ namespace picongpu uint32_t T_area = CORE + BORDER> inline void manipulate(uint32_t const currentStep) { - using SpeciesSeq = typename pmacc::ToSeq::type; + using SpeciesSeq = pmacc::ToSeq; using Functor = Manipulate>; pmacc::meta::ForEach forEach; @@ -155,7 +155,7 @@ namespace picongpu typename T_Filter = filter::All> inline void manipulate(uint32_t const currentStep, T_AreaMapperFactory const& areaMapperFactory) { - using SpeciesSeq = typename pmacc::ToSeq::type; + using SpeciesSeq = pmacc::ToSeq; using Functor = Manipulate; pmacc::meta::ForEach forEach; forEach(currentStep, areaMapperFactory); diff --git a/include/picongpu/particles/collision/Collider.hpp b/include/picongpu/particles/collision/Collider.hpp index 6d484b6363f..2a4bbf361de 100644 --- a/include/picongpu/particles/collision/Collider.hpp +++ b/include/picongpu/particles/collision/Collider.hpp @@ -66,7 +66,7 @@ namespace picongpu { void operator()(std::shared_ptr const& deviceHeap, uint32_t currentStep) { - using SpeciesPairList = typename pmacc::ToSeq::type; + using SpeciesPairList = pmacc::ToSeq; constexpr size_t numPairs = pmacc::mp_size::value; std::make_index_sequence index{}; detail::CallColliderForAPair{}( diff --git a/include/picongpu/particles/particleToGrid/ComputeGridValuePerFrame.def b/include/picongpu/particles/particleToGrid/ComputeGridValuePerFrame.def index 2ace38cfc2a..c8545572d75 100644 --- a/include/picongpu/particles/particleToGrid/ComputeGridValuePerFrame.def +++ b/include/picongpu/particles/particleToGrid/ComputeGridValuePerFrame.def @@ -193,7 +193,7 @@ namespace picongpu struct CreateEligible { // wrap single arguments to sequence - using SeqSpecies = typename pmacc::ToSeq::type; + using SeqSpecies = pmacc::ToSeq; using FilteredAttribute = FilteredDerivedAttribute; using type = typename traits::GenerateSolversIfSpeciesEligible< diff --git a/include/picongpu/particles/traits/GenerateSolversIfSpeciesEligible.hpp b/include/picongpu/particles/traits/GenerateSolversIfSpeciesEligible.hpp index 7abfe5ec7a8..89af7e7bb75 100644 --- a/include/picongpu/particles/traits/GenerateSolversIfSpeciesEligible.hpp +++ b/include/picongpu/particles/traits/GenerateSolversIfSpeciesEligible.hpp @@ -54,7 +54,7 @@ namespace picongpu struct GenerateSolversIfSpeciesEligible { // wrap single arguments to sequence - using SeqSpecies = typename pmacc::ToSeq::type; + using SeqSpecies = pmacc::ToSeq; // unspecialized solver using Solver = T_Solver; diff --git a/include/picongpu/plugins/BinEnergyParticles.hpp b/include/picongpu/plugins/BinEnergyParticles.hpp index 6f2e9f64d67..9a4bed0b7c3 100644 --- a/include/picongpu/plugins/BinEnergyParticles.hpp +++ b/include/picongpu/plugins/BinEnergyParticles.hpp @@ -212,8 +212,7 @@ namespace picongpu // find all valid filter for the current used species template using Op = typename particles::traits::GenerateSolversIfSpeciesEligible::type; - using EligibleFilters = - typename MakeSeqFromNestedSeq>::type; + using EligibleFilters = pmacc::mp_flatten>; //! periodicity of computing the particle energy plugins::multi::Option notifyPeriod = {"period", "enable plugin [for each n-th step]"}; diff --git a/include/picongpu/plugins/Emittance.hpp b/include/picongpu/plugins/Emittance.hpp index e2262486589..b1c1cc7fb0c 100644 --- a/include/picongpu/plugins/Emittance.hpp +++ b/include/picongpu/plugins/Emittance.hpp @@ -221,8 +221,7 @@ namespace picongpu // find all valid filter for the current used species template using Op = typename particles::traits::GenerateSolversIfSpeciesEligible::type; - using EligibleFilters = - typename MakeSeqFromNestedSeq>::type; + using EligibleFilters = pmacc::mp_flatten>; //! periodicity of computing the particle energy plugins::multi::Option notifyPeriod diff --git a/include/picongpu/plugins/EnergyParticles.hpp b/include/picongpu/plugins/EnergyParticles.hpp index e01099b56c2..a59b78c8877 100644 --- a/include/picongpu/plugins/EnergyParticles.hpp +++ b/include/picongpu/plugins/EnergyParticles.hpp @@ -178,8 +178,7 @@ namespace picongpu // find all valid filter for the current used species template using Op = typename particles::traits::GenerateSolversIfSpeciesEligible::type; - using EligibleFilters = - typename MakeSeqFromNestedSeq>::type; + using EligibleFilters = pmacc::mp_flatten>; //! periodicity of computing the particle energy plugins::multi::Option notifyPeriod diff --git a/include/picongpu/plugins/PhaseSpace/PhaseSpace.hpp b/include/picongpu/plugins/PhaseSpace/PhaseSpace.hpp index 6fe290ad5d3..bac9ce7b44e 100644 --- a/include/picongpu/plugins/PhaseSpace/PhaseSpace.hpp +++ b/include/picongpu/plugins/PhaseSpace/PhaseSpace.hpp @@ -71,8 +71,7 @@ namespace picongpu // find all valid filter for the current used species template using Op = typename particles::traits::GenerateSolversIfSpeciesEligible::type; - using EligibleFilters = - typename MakeSeqFromNestedSeq>::type; + using EligibleFilters = pmacc::mp_flatten>; //! periodicity of computing the particle energy plugins::multi::Option notifyPeriod = {"period", "notify period"}; diff --git a/include/picongpu/plugins/PluginController.hpp b/include/picongpu/plugins/PluginController.hpp index 10333a0957a..9a3c984df67 100644 --- a/include/picongpu/plugins/PluginController.hpp +++ b/include/picongpu/plugins/PluginController.hpp @@ -70,7 +70,6 @@ #include #include -#include #include #include diff --git a/include/picongpu/plugins/particleCalorimeter/ParticleCalorimeter.hpp b/include/picongpu/plugins/particleCalorimeter/ParticleCalorimeter.hpp index c9563b95a5c..98a22bbf8a2 100644 --- a/include/picongpu/plugins/particleCalorimeter/ParticleCalorimeter.hpp +++ b/include/picongpu/plugins/particleCalorimeter/ParticleCalorimeter.hpp @@ -405,8 +405,7 @@ namespace picongpu // find all valid filter for the current used species template using Op = typename particles::traits::GenerateSolversIfSpeciesEligible::type; - using EligibleFilters = - typename MakeSeqFromNestedSeq>::type; + using EligibleFilters = pmacc::mp_flatten>; //! periodicity of computing the particle energy plugins::multi::Option notifyPeriod = {"period", "enable plugin [for each n-th step]"}; diff --git a/include/pmacc/meta/ForEach.hpp b/include/pmacc/meta/ForEach.hpp index 329d660a8ef..ef9e26b65c2 100644 --- a/include/pmacc/meta/ForEach.hpp +++ b/include/pmacc/meta/ForEach.hpp @@ -21,7 +21,6 @@ #pragma once -#include "pmacc/meta/SeqToList.hpp" #include "pmacc/meta/accessors/Identity.hpp" #include @@ -32,7 +31,7 @@ namespace pmacc::meta { /** Compile-Time for each for Boost::MPL Type Lists * - * @tparam T_MPLSeq A mpl sequence that can be accessed by mpl::begin, mpl::end, mpl::next + * @tparam List An mp_list. * @tparam T_Functor An unary lambda functor with a HDINLINE void operator()(...) method * _1 is substituted by Accessor's result using boost::mpl::apply with elements from T_MPLSeq. * The maximum number of parameters for the operator() is limited by @@ -40,21 +39,19 @@ namespace pmacc::meta * @tparam T_Accessor An unary lambda operation * * Example: - * MPLSeq = pmacc::mp_list + * List = pmacc::mp_list * Functor = any unary lambda functor * Accessor = lambda operation identity * * definition: F(X) means boost::apply * - * call: ForEach()(42); + * call: ForEach()(42); * unrolled code: Functor(Accessor(int))(42); * Functor(Accessor(float))(42); */ - template> + template> struct ForEach { - using List = detail::SeqToList; - template using ReplacePlaceholder = typename boost::mpl::apply1::type>::type; diff --git a/include/pmacc/meta/SeqToList.hpp b/include/pmacc/meta/SeqToList.hpp deleted file mode 100644 index 3491f14c9ca..00000000000 --- a/include/pmacc/meta/SeqToList.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright 2013-2022 Rene Widera, Bernhard Manfred Gruber - * - * This file is part of PMacc. - * - * PMacc is free software: you can redistribute it and/or modify - * it under the terms of either the GNU General Public License or - * the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PMacc is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License and the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License - * and the GNU Lesser General Public License along with PMacc. - * If not, see . - */ - -#pragma once - -#include "Mp11.hpp" - -#include - -namespace pmacc -{ - namespace meta - { - namespace detail - { - template - using SeqToList = typename boost::mpl::copy>>::type; - } // namespace detail - } // namespace meta -} // namespace pmacc diff --git a/include/pmacc/meta/conversion/MakeSeq.hpp b/include/pmacc/meta/conversion/MakeSeq.hpp index 908712a52c4..c385df49fad 100644 --- a/include/pmacc/meta/conversion/MakeSeq.hpp +++ b/include/pmacc/meta/conversion/MakeSeq.hpp @@ -1,4 +1,4 @@ -/* Copyright 2013-2022 Rene Widera +/* Copyright 2013-2022 Rene Widera, Bernhard Manfred Gruber * * This file is part of PMacc. * @@ -22,12 +22,12 @@ #pragma once -#include "pmacc/meta/conversion/MakeSeqFromNestedSeq.hpp" +#include "pmacc/meta/Mp11.hpp" namespace pmacc { - /** short hand definition for @see MakeSeqFromNestedSeq<> */ + /** Makes an mp_list from T_Args. If any type in T_Args is a list itself, it will be unwrapped. + */ template - using MakeSeq_t = typename MakeSeqFromNestedSeq>::type; - + using MakeSeq_t = mp_flatten>; } // namespace pmacc diff --git a/include/pmacc/meta/conversion/MakeSeqFromNestedSeq.hpp b/include/pmacc/meta/conversion/MakeSeqFromNestedSeq.hpp deleted file mode 100644 index 70856a68b37..00000000000 --- a/include/pmacc/meta/conversion/MakeSeqFromNestedSeq.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright 2013-2022 Rene Widera - * - * This file is part of PMacc. - * - * PMacc is free software: you can redistribute it and/or modify - * it under the terms of either the GNU General Public License or - * the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PMacc is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License and the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License - * and the GNU Lesser General Public License along with PMacc. - * If not, see . - */ - - -#pragma once - -#include "pmacc/meta/Mp11.hpp" -#include "pmacc/meta/conversion/ToSeq.hpp" - -namespace pmacc -{ - /** combine all elements of the input type to a single vector - * - * If elements of the input sequence are a sequence themself, all of their - * elements will be added to the resulting sequence - * - * @tparam T_In a boost mpl sequence or single type - */ - template - struct MakeSeqFromNestedSeq - { - using type = mp_flatten::type>; - }; - -} // namespace pmacc diff --git a/include/pmacc/meta/conversion/SeqToMap.hpp b/include/pmacc/meta/conversion/SeqToMap.hpp index 193d3667fac..0cb8cd2d952 100644 --- a/include/pmacc/meta/conversion/SeqToMap.hpp +++ b/include/pmacc/meta/conversion/SeqToMap.hpp @@ -21,7 +21,6 @@ #pragma once -#include "pmacc/meta/SeqToList.hpp" #include "pmacc/meta/accessors/Identity.hpp" #include "pmacc/types.hpp" @@ -29,23 +28,23 @@ namespace pmacc { - /** convert boost mp11 list to a map + /** convert a list to a map * - * @tparam T_MPLSeq any boost mp11 list + * @tparam T_List an mp_list. * @tparam T_UnaryOperator unary operator to translate type from the sequence * to a mpl pair * @tparam T_Accessor An unary lambda operator which is used before the type * from the sequence is passed to T_UnaryOperator * @return ::type mpl map */ - template> + template> struct SeqToMap { template using Op = typename boost::mpl::apply1::type>::type; - using ListOfTuples = mp_transform>; + using ListOfTuples = mp_transform; using type = mp_fold, mp_map_insert>; }; } // namespace pmacc diff --git a/include/pmacc/meta/conversion/ToSeq.hpp b/include/pmacc/meta/conversion/ToSeq.hpp index 65cebee6717..0f6a70d5489 100644 --- a/include/pmacc/meta/conversion/ToSeq.hpp +++ b/include/pmacc/meta/conversion/ToSeq.hpp @@ -21,23 +21,27 @@ #pragma once -#include "pmacc/types.hpp" +#include "pmacc/meta/Mp11.hpp" namespace pmacc { - /** cast type to boost mpl vector - * @return ::type if T_Type is sequence then identity of T_Type - * else mp_list - */ - template - struct ToSeq + namespace detail { - using type = mp_list; - }; + template + struct ToSeq + { + using type = mp_list; + }; - template - struct ToSeq> - { - using type = mp_list; - }; + template + struct ToSeq> + { + using type = mp_list; + }; + } // namespace detail + + /** If T_Type is an mp_list, return it. Otherwise wrap it in an mp_list. + */ + template + using ToSeq = typename detail::ToSeq::type; } // namespace pmacc diff --git a/include/pmacc/particles/ParticleDescription.hpp b/include/pmacc/particles/ParticleDescription.hpp index 716660d4838..9c176dd5956 100644 --- a/include/pmacc/particles/ParticleDescription.hpp +++ b/include/pmacc/particles/ParticleDescription.hpp @@ -63,11 +63,11 @@ namespace pmacc { using Name = T_Name; using SuperCellSize = T_SuperCellSize; - using ValueTypeSeq = typename ToSeq::type; - using FlagsList = typename ToSeq::type; + using ValueTypeSeq = ToSeq; + using FlagsList = ToSeq; using HandleGuardRegion = T_HandleGuardRegion; - using MethodsList = typename ToSeq::type; - using FrameExtensionList = typename ToSeq::type; + using MethodsList = ToSeq; + using FrameExtensionList = ToSeq; using ThisType = ParticleDescription< Name, SuperCellSize, @@ -100,7 +100,7 @@ namespace pmacc using type = ParticleDescription< typename OldParticleDescription::Name, typename OldParticleDescription::SuperCellSize, - typename ToSeq::type, + ToSeq, typename OldParticleDescription::FlagsList, typename OldParticleDescription::HandleGuardRegion, typename OldParticleDescription::MethodsList, @@ -124,7 +124,7 @@ namespace pmacc typename OldParticleDescription::FlagsList, typename OldParticleDescription::HandleGuardRegion, typename OldParticleDescription::MethodsList, - typename ToSeq::type>; + ToSeq>; }; } // namespace pmacc diff --git a/include/pmacc/particles/operations/Deselect.hpp b/include/pmacc/particles/operations/Deselect.hpp index d8a01a20d4a..87f101041ab 100644 --- a/include/pmacc/particles/operations/Deselect.hpp +++ b/include/pmacc/particles/operations/Deselect.hpp @@ -46,7 +46,7 @@ namespace pmacc template HDINLINE decltype(auto) deselect(T_Object& object) { - using DeselectSeq = typename ToSeq::type; + using DeselectSeq = ToSeq; using BaseType = detail::Deselect; return BaseType()(object);