Skip to content

Replace mpl by mp11 (part 1/2) #3834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/source/models/binary_collisions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ To enable collisions between the Ions and Electrons with a constant coulomb loga
*
* the functors are called in order (from first to last functor)
*/
using CollisionPipeline = bmpl::
vector<Collider<relativistic::RelativisticCollisionConstLog<Params>, Pairs> >;
using CollisionPipeline = boost::mp11::
mp_list<Collider<relativistic::RelativisticCollisionConstLog<Params>, Pairs> >;
} // namespace collision
} // namespace particles
} // namespace picongpu
Expand Down Expand Up @@ -100,7 +100,7 @@ Here is an example with :math:`\Lambda = 5` for electron-ion collisions and :mat
using Pairs1 = MakeSeq_t<Pair<Electrons, Ions>>;
using Pairs2 = MakeSeq_t<Pair<Electrons, Electrons>, Pair<Ions, Ions>>;
using CollisionPipeline =
bmpl::vector<
boost::mp11::mp_list<
Collider<relativistic::RelativisticCollisionConstLog<Params1>, Pairs1>,
Collider<relativistic::RelativisticCollisionConstLog<Params2>, Pairs2>
>;
Expand All @@ -112,7 +112,7 @@ For example the previous setup with automatic calculation for the inter-species
.. code:: c++

using CollisionPipeline =
bmpl::vector<
boost::mp11::mp_list<
Collider<relativistic::RelativisticCollisionDynamicLog<>, Pairs1>,
Collider<relativistic::RelativisticCollisionConstLog<Params2>, Pairs2>
>;
Expand All @@ -137,7 +137,7 @@ You need to define your filters in ``particleFilters.param`` and than you can us
using Pairs1 = MakeSeq_t<Pair<Electrons, Ions>>;
using Pairs2 = MakeSeq_t<Pair<Electrons, Electrons>, Pair<Ions, Ions>>;
using CollisionPipeline =
bmpl::vector<
boost::mp11::mp_list<
Collider<
relativistic::RelativisticCollisionConstLog<Params1>,
Pairs1,
Expand Down Expand Up @@ -190,7 +190,7 @@ This debug output can be enabled per collider by setting the optional template p
.. code:: c++

using CollisionPipeline =
bmpl::vector<
boost::mp11::mp_list<
Collider<relativistic::RelativisticCollisionDynamicLog<true>, Pairs1>,
Collider<relativistic::RelativisticCollisionConstLog<Params2, true>, Pairs2>
>;
Expand Down
2 changes: 1 addition & 1 deletion docs/source/pypicongpu/species.rst
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ The operations result in this ``speciesInitialization.param``:

.. code:: c++

using InitPipeline = bmpl::vector<
using InitPipeline = boost::mp11::mp_list<
/**********************************/
/* phase 1: create macroparticles */
/**********************************/
Expand Down
2 changes: 1 addition & 1 deletion docs/source/usage/workflows/probeParticles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ and add it to ``VectorAllSpecies``:

.. code-block:: cpp

using InitPipeline = bmpl::vector<
using InitPipeline = pmacc::mp_list<
// ... ,
CreateDensity<
densityProfiles::ProbeEveryFourthCell,
Expand Down
4 changes: 2 additions & 2 deletions docs/source/usage/workflows/quasiNeutrality.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ For fully ionized ions, just use ``ManipulateDerive`` in :ref:`speciesInitializa

.. code-block:: cpp

using InitPipeline = bmpl::vector<
using InitPipeline = pmacc::mp_list<
/* density profile from density.param and
* start position from particle.param */
CreateDensity<
Expand Down Expand Up @@ -72,7 +72,7 @@ Then again in :ref:`speciesInitialization.param <usage-params-core>` set your in

.. code-block:: cpp

using InitPipeline = bmpl::vector<
using InitPipeline = pmacc::mp_list<
/* density profile from density.param and
* start position from particle.param */
CreateDensity<
Expand Down
5 changes: 1 addition & 4 deletions include/picongpu/algorithms/ShiftCoordinateSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@

#pragma once

#include <pmacc/math/vector/Int.hpp>
#include <pmacc/meta/AllCombinations.hpp>
#include <pmacc/meta/ForEach.hpp>
#include <pmacc/types.hpp>

#include <boost/mpl/range_c.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/placeholders.hpp>

namespace picongpu
{
Expand Down
37 changes: 21 additions & 16 deletions include/picongpu/fields/EMFieldBase.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,25 @@
#include <pmacc/particles/traits/FilterByFlag.hpp>
#include <pmacc/traits/GetUniqueTypeId.hpp>

#include <boost/mpl/accumulate.hpp>

#include <cstdint>
#include <memory>
#include <type_traits>


namespace picongpu
{
namespace fields
{
template<typename A, typename B>
using LowerMarginInterpolationOp =
typename pmacc::math::CT::max<A, typename GetLowerMargin<typename GetInterpolation<B>::type>::type>::type;
template<typename A, typename B>
using UpperMarginInterpolationOp =
typename pmacc::math::CT::max<A, typename GetUpperMargin<typename GetInterpolation<B>::type>::type>::type;
template<typename A, typename B>
using LowerMarginOp = typename pmacc::math::CT::max<A, typename GetLowerMarginPusher<B>::type>::type;
template<typename A, typename B>
using UpperMarginOp = typename pmacc::math::CT::max<A, typename GetUpperMarginPusher<B>::type>::type;

template<typename T_DerivedField>
EMFieldBase<T_DerivedField>::EMFieldBase(MappingDesc const& cellDescription, pmacc::SimulationDataId const& id)
: SimulationFieldHelper<MappingDesc>(cellDescription)
Expand All @@ -57,14 +65,15 @@ namespace picongpu

using VectorSpeciesWithInterpolation =
typename pmacc::particles::traits::FilterByFlag<VectorAllSpecies, interpolation<>>::type;
using LowerMarginInterpolation = bmpl::accumulate<

using LowerMarginInterpolation = pmacc::mp_fold<
VectorSpeciesWithInterpolation,
typename pmacc::math::CT::make_Int<simDim, 0>::type,
pmacc::math::CT::max<bmpl::_1, GetLowerMargin<GetInterpolation<bmpl::_2>>>>::type;
using UpperMarginInterpolation = bmpl::accumulate<
LowerMarginInterpolationOp>;
using UpperMarginInterpolation = pmacc::mp_fold<
VectorSpeciesWithInterpolation,
typename pmacc::math::CT::make_Int<simDim, 0>::type,
pmacc::math::CT::max<bmpl::_1, GetUpperMargin<GetInterpolation<bmpl::_2>>>>::type;
UpperMarginInterpolationOp>;

/* Calculate the maximum Neighbors we need from MAX(ParticleShape, FieldSolver) */
using LowerMarginSolver = typename traits::GetLowerMargin<fields::Solver, DerivedField>::type;
Expand All @@ -80,15 +89,11 @@ namespace picongpu
*/
using VectorSpeciesWithPusherAndInterpolation = typename pmacc::particles::traits::
FilterByFlag<VectorSpeciesWithInterpolation, particlePusher<>>::type;
using LowerMargin = typename bmpl::accumulate<
VectorSpeciesWithPusherAndInterpolation,
LowerMarginInterpolationAndSolver,
pmacc::math::CT::max<bmpl::_1, GetLowerMarginPusher<bmpl::_2>>>::type;

using UpperMargin = typename bmpl::accumulate<
VectorSpeciesWithPusherAndInterpolation,
UpperMarginInterpolationAndSolver,
pmacc::math::CT::max<bmpl::_1, GetUpperMarginPusher<bmpl::_2>>>::type;

using LowerMargin = pmacc::
mp_fold<VectorSpeciesWithPusherAndInterpolation, LowerMarginInterpolationAndSolver, LowerMarginOp>;
using UpperMargin = pmacc::
mp_fold<VectorSpeciesWithPusherAndInterpolation, UpperMarginInterpolationAndSolver, UpperMarginOp>;

const DataSpace<simDim> originGuard(LowerMargin().toRT());
const DataSpace<simDim> endGuard(UpperMargin().toRT());
Expand Down
22 changes: 11 additions & 11 deletions include/picongpu/fields/FieldJ.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
#include <pmacc/traits/GetUniqueTypeId.hpp>
#include <pmacc/traits/Resolve.hpp>

#include <boost/mpl/accumulate.hpp>

#include <algorithm>
#include <cstdint>
#include <iostream>
Expand All @@ -52,6 +50,13 @@ namespace picongpu
{
using namespace pmacc;

template<typename A, typename B>
using LowerMarginShapesOp =
typename pmacc::math::CT::max<A, typename GetLowerMargin<typename GetCurrentSolver<B>::type>::type>::type;
template<typename A, typename B>
using UpperMarginShapesOp =
typename pmacc::math::CT::max<A, typename GetUpperMargin<typename GetCurrentSolver<B>::type>::type>::type;

FieldJ::FieldJ(MappingDesc const& cellDescription)
: SimulationFieldHelper<MappingDesc>(cellDescription)
, buffer(cellDescription.getGridLayout())
Expand All @@ -63,15 +68,10 @@ namespace picongpu
using AllSpeciesWithCurrent =
typename pmacc::particles::traits::FilterByFlag<VectorAllSpecies, current<>>::type;

using LowerMarginShapes = bmpl::accumulate<
AllSpeciesWithCurrent,
typename pmacc::math::CT::make_Int<simDim, 0>::type,
pmacc::math::CT::max<bmpl::_1, GetLowerMargin<GetCurrentSolver<bmpl::_2>>>>::type;

using UpperMarginShapes = bmpl::accumulate<
AllSpeciesWithCurrent,
typename pmacc::math::CT::make_Int<simDim, 0>::type,
pmacc::math::CT::max<bmpl::_1, GetUpperMargin<GetCurrentSolver<bmpl::_2>>>>::type;
using LowerMarginShapes = pmacc::
mp_fold<AllSpeciesWithCurrent, typename pmacc::math::CT::make_Int<simDim, 0>::type, LowerMarginShapesOp>;
using UpperMarginShapes = pmacc::
mp_fold<AllSpeciesWithCurrent, typename pmacc::math::CT::make_Int<simDim, 0>::type, UpperMarginShapesOp>;

/* margins are always positive, also for lower margins
* additional current interpolations and current filters on FieldJ might
Expand Down
35 changes: 20 additions & 15 deletions include/picongpu/fields/FieldTmp.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,25 @@
#include <pmacc/particles/traits/FilterByFlag.hpp>
#include <pmacc/traits/GetUniqueTypeId.hpp>

#include <boost/mpl/accumulate.hpp>

#include <memory>
#include <string>


namespace picongpu
{
using namespace pmacc;

template<typename A, typename B>
using SpeciesLowerMarginOp =
typename pmacc::math::CT::max<A, typename GetLowerMargin<typename GetInterpolation<B>::type>::type>::type;
template<typename A, typename B>
using SpeciesUpperMarginOp =
typename pmacc::math::CT::max<A, typename GetUpperMargin<typename GetInterpolation<B>::type>::type>::type;

template<typename A, typename B>
using FieldTmpLowerMarginOp = typename pmacc::math::CT::max<A, typename GetLowerMargin<B>::type>::type;
template<typename A, typename B>
using FieldTmpUpperMarginOp = typename pmacc::math::CT::max<A, typename GetUpperMargin<B>::type>::type;

FieldTmp::FieldTmp(MappingDesc const& cellDescription, uint32_t slotId)
: SimulationFieldHelper<MappingDesc>(cellDescription)
, m_slotId(slotId)
Expand Down Expand Up @@ -79,15 +88,13 @@ namespace picongpu
typename pmacc::particles::traits::FilterByFlag<VectorAllSpecies, interpolation<>>::type;

/* ------------------ lower margin ----------------------------------*/
using SpeciesLowerMargin = bmpl::accumulate<
using SpeciesLowerMargin = pmacc::mp_fold<
VectorSpeciesWithInterpolation,
typename pmacc::math::CT::make_Int<simDim, 0>::type,
pmacc::math::CT::max<bmpl::_1, GetLowerMargin<GetInterpolation<bmpl::_2>>>>::type;
SpeciesLowerMarginOp>;

using FieldTmpLowerMargin = bmpl::accumulate<
FieldTmpSolvers,
typename pmacc::math::CT::make_Int<simDim, 0>::type,
pmacc::math::CT::max<bmpl::_1, GetLowerMargin<bmpl::_2>>>::type;
using FieldTmpLowerMargin = pmacc::
mp_fold<FieldTmpSolvers, typename pmacc::math::CT::make_Int<simDim, 0>::type, FieldTmpLowerMarginOp>;

using SpeciesFieldTmpLowerMargin = pmacc::math::CT::max<SpeciesLowerMargin, FieldTmpLowerMargin>::type;

Expand All @@ -98,15 +105,13 @@ namespace picongpu

/* ------------------ upper margin -----------------------------------*/

using SpeciesUpperMargin = bmpl::accumulate<
using SpeciesUpperMargin = pmacc::mp_fold<
VectorSpeciesWithInterpolation,
typename pmacc::math::CT::make_Int<simDim, 0>::type,
pmacc::math::CT::max<bmpl::_1, GetUpperMargin<GetInterpolation<bmpl::_2>>>>::type;
SpeciesUpperMarginOp>;

using FieldTmpUpperMargin = bmpl::accumulate<
FieldTmpSolvers,
typename pmacc::math::CT::make_Int<simDim, 0>::type,
pmacc::math::CT::max<bmpl::_1, GetUpperMargin<bmpl::_2>>>::type;
using FieldTmpUpperMargin = pmacc::
mp_fold<FieldTmpSolvers, typename pmacc::math::CT::make_Int<simDim, 0>::type, FieldTmpUpperMarginOp>;

using SpeciesFieldTmpUpperMargin = pmacc::math::CT::max<SpeciesUpperMargin, FieldTmpUpperMargin>::type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ namespace picongpu
typename pmacc::particles::traits::FilterByFlag<VectorAllSpecies, current<>>::type;
//! Whether the simulation has any current sources
static constexpr auto existsCurrent
= (bmpl::size<SpeciesWithCurrentSolver>::type::value > 0) || FieldBackgroundJ::activated;
= (pmacc::mp_size<SpeciesWithCurrentSolver>::value > 0) || FieldBackgroundJ::activated;

/** Whether previousJ is initialized with data of J from previous time step
*
Expand Down
12 changes: 2 additions & 10 deletions include/picongpu/fields/absorber/exponential/Exponential.kernel
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
#include <pmacc/memory/shared/Allocate.hpp>
#include <pmacc/meta/ForEach.hpp>

#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/range_c.hpp>


namespace picongpu
{
namespace fields
Expand All @@ -41,7 +37,7 @@ namespace picongpu
{
/** damp each field component at exchange the border
*
* @tparam T_Axis, boost::mpl::integral_c axis of the coordinate system
* @tparam T_Axis, std::integral_constant axis of the coordinate system
* (0 = x, 1 = y, 2 = z)
*/
template<typename T_Axis>
Expand Down Expand Up @@ -160,11 +156,7 @@ namespace picongpu
DataSpace<simDim> const relExchangeDir
= Mask::getRelativeDirections<simDim>(mapper.getExchangeType());

/* create a sequence with int values [0;simDim)
* MakeSeq_t allows to use the result of mpl::range_c
* within the PMacc ForEach
*/
using SimulationDimensions = MakeSeq_t<boost::mpl::range_c<int, 0, int(simDim)>>;
using SimulationDimensions = pmacc::mp_iota<pmacc::mp_int<simDim>>;

meta::ForEach<SimulationDimensions, detail::AbsorbInOneDirection<boost::mpl::_1>>
absorbInAllDirections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ namespace picongpu
//! Number of coefficients: T_neighbors along T_axis, 1 along other axes
using Size = typename pmacc::math::CT::Assign<
pmacc::math::CT::make_Int<3, 1>::type::vector_type,
bmpl::integral_c<int, T_axis>,
bmpl::integral_c<int, T_neighbors>>::type;
std::integral_constant<int, T_axis>,
std::integral_constant<int, T_neighbors>>::type;

//! Normalized coefficient values, actual coefficient = value[...] / step[T_axis]
float_X value[Size::x::value][Size::y::value][Size::z::value];
Expand Down Expand Up @@ -189,8 +189,8 @@ namespace picongpu
//! Number of coefficients: 2 along T_cherenkovFreeDirection, 1 along other axes
using Size = typename pmacc::math::CT::Assign<
pmacc::math::CT::make_Int<3, 1>::type::vector_type,
bmpl::integral_c<int, T_cherenkovFreeDirection>,
bmpl::integral_c<int, 2>>::type;
std::integral_constant<int, T_cherenkovFreeDirection>,
std::integral_constant<int, 2>>::type;

//! Normalized coefficient values, actual coefficient = value[...] / step[T_axis]
float_X value[Size::x::value][Size::y::value][Size::z::value];
Expand Down
12 changes: 6 additions & 6 deletions include/picongpu/fields/incidentField/Solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ namespace picongpu
constexpr int blockSizeAlongAxis = std::min(sizeAlongAxis, supercellSizeAlongAxis);
using BlockSize = typename pmacc::math::CT::AssignIfInRange<
typename SuperCellSize::vector_type,
bmpl::integral_c<uint32_t, T_axis>,
bmpl::integral_c<int, blockSizeAlongAxis>>::type;
std::integral_constant<uint32_t, T_axis>,
std::integral_constant<int, blockSizeAlongAxis>>::type;
auto const superCellSize = SuperCellSize::toRT();
auto const gridBlocks
= (endLocalUserIdx - beginLocalUserIdx + superCellSize - Index::create(1)) / superCellSize;
Expand Down Expand Up @@ -633,10 +633,10 @@ namespace picongpu
parameters.direction = 1.0_X;
parameters.sourceTimeIteration = sourceTimeIteration;
parameters.timeIncrement = maxwellSolver::getTimeStep();
meta::ForEach<T_MinProfiles, ApplyUpdateE<bmpl::_1>> applyMinProfiles;
meta::ForEach<T_MinProfiles, ApplyUpdateE<boost::mpl::_1>> applyMinProfiles;
applyMinProfiles(parameters);
parameters.direction = -1.0_X;
meta::ForEach<T_MaxProfiles, ApplyUpdateE<bmpl::_1>> applyMaxProfiles;
meta::ForEach<T_MaxProfiles, ApplyUpdateE<boost::mpl::_1>> applyMaxProfiles;
applyMaxProfiles(parameters);
}

Expand Down Expand Up @@ -682,10 +682,10 @@ namespace picongpu
parameters.direction = 1.0_X;
parameters.sourceTimeIteration = sourceTimeIteration;
parameters.timeIncrement = 0.5_X * maxwellSolver::getTimeStep();
meta::ForEach<T_MinProfiles, ApplyUpdateB<bmpl::_1>> applyMinProfiles;
meta::ForEach<T_MinProfiles, ApplyUpdateB<boost::mpl::_1>> applyMinProfiles;
applyMinProfiles(parameters);
parameters.direction = -1.0_X;
meta::ForEach<T_MaxProfiles, ApplyUpdateB<bmpl::_1>> applyMaxProfiles;
meta::ForEach<T_MaxProfiles, ApplyUpdateB<boost::mpl::_1>> applyMaxProfiles;
applyMaxProfiles(parameters);
}

Expand Down
Loading