Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace mpl::apply
Browse files Browse the repository at this point in the history
bernhardmgruber committed Mar 29, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 2970967 commit 91e9550
Showing 85 changed files with 295 additions and 369 deletions.
2 changes: 0 additions & 2 deletions include/picongpu/algorithms/ShiftCoordinateSystem.hpp
Original file line number Diff line number Diff line change
@@ -23,8 +23,6 @@
#include <pmacc/meta/ForEach.hpp>
#include <pmacc/types.hpp>

#include <boost/mpl/placeholders.hpp>

namespace picongpu
{
/** shift to new coordinate system
Original file line number Diff line number Diff line change
@@ -158,7 +158,7 @@ namespace picongpu

using SimulationDimensions = pmacc::mp_iota<pmacc::mp_int<simDim>>;

meta::ForEach<SimulationDimensions, detail::AbsorbInOneDirection<boost::mpl::_1>>
meta::ForEach<SimulationDimensions, detail::AbsorbInOneDirection<pmacc::_1>>
absorbInAllDirections;

absorbInAllDirections(worker, field, thickness, absorberStrength, mapper, relExchangeDir);
2 changes: 1 addition & 1 deletion include/picongpu/initialization/InitialiserController.hpp
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ namespace picongpu
* Calculate omega_p for each given species and create a `picLog::PHYSICS`
* log message
*/
template<typename T_Species = boost::mpl::_1>
template<typename T_Species = pmacc::_1>
struct LogOmegaP
{
void operator()()
21 changes: 9 additions & 12 deletions include/picongpu/particles/InitFunctors.hpp
Original file line number Diff line number Diff line change
@@ -28,13 +28,13 @@
#include "picongpu/particles/manipulators/manipulators.def"

#include <pmacc/Environment.hpp>
#include <pmacc/meta/Apply.hpp>
#include <pmacc/meta/conversion/TypeToPointerPair.hpp>
#include <pmacc/particles/meta/FindByNameOrType.hpp>
#include <pmacc/traits/GetFlagType.hpp>
#include <pmacc/traits/HasFlag.hpp>
#include <pmacc/traits/Resolve.hpp>

#include <boost/mpl/apply.hpp>

namespace picongpu
{
@@ -85,18 +85,18 @@ namespace picongpu
* @tparam T_SpeciesType type or name as PMACC_CSTRING of the used species,
* see speciesDefinition.param
*/
template<typename T_DensityFunctor, typename T_PositionFunctor, typename T_SpeciesType = boost::mpl::_1>
template<typename T_DensityFunctor, typename T_PositionFunctor, typename T_SpeciesType = pmacc::_1>
struct CreateDensity
{
using SpeciesType = pmacc::particles::meta::FindByNameOrType_t<VectorAllSpecies, T_SpeciesType>;
using FrameType = typename SpeciesType::FrameType;


using UserDensityFunctor = typename boost::mpl::apply1<T_DensityFunctor, SpeciesType>::type;
using UserDensityFunctor = pmacc::Apply<T_DensityFunctor, SpeciesType>;
/* add interface for compile time interface validation*/
using DensityFunctor = densityProfiles::IProfile<UserDensityFunctor>;

using UserPositionFunctor = typename boost::mpl::apply1<T_PositionFunctor, SpeciesType>::type;
using UserPositionFunctor = pmacc::Apply<T_PositionFunctor, SpeciesType>;
/* add interface for compile time interface validation*/
using PositionFunctor = manipulators::IUnary<UserPositionFunctor>;

@@ -137,7 +137,7 @@ namespace picongpu
template<
typename T_Manipulator,
typename T_SrcSpeciesType,
typename T_DestSpeciesType = boost::mpl::_1,
typename T_DestSpeciesType = pmacc::_1,
typename T_SrcFilter = filter::All>
struct ManipulateDerive
{
@@ -146,9 +146,9 @@ namespace picongpu
using SrcSpeciesType = pmacc::particles::meta::FindByNameOrType_t<VectorAllSpecies, T_SrcSpeciesType>;
using SrcFrameType = typename SrcSpeciesType::FrameType;

using DestFunctor = typename boost::mpl::apply1<T_Manipulator, DestSpeciesType>::type;
using DestFunctor = pmacc::Apply<T_Manipulator, DestSpeciesType>;

using SrcFilter = typename boost::mpl::apply1<T_SrcFilter, SrcSpeciesType>::type;
using SrcFilter = pmacc::Apply<T_SrcFilter, SrcSpeciesType>;

/* note: this is a FilteredManipulator with filter::All for
* destination species, users can filter the destination directly via if's
@@ -184,10 +184,7 @@ namespace picongpu
* @tparam T_Filter picongpu::particles::filter,
* particle filter type to select source particles to derive
*/
template<
typename T_SrcSpeciesType,
typename T_DestSpeciesType = boost::mpl::_1,
typename T_Filter = filter::All>
template<typename T_SrcSpeciesType, typename T_DestSpeciesType = pmacc::_1, typename T_Filter = filter::All>
struct Derive : ManipulateDerive<manipulators::generic::None, T_SrcSpeciesType, T_DestSpeciesType, T_Filter>
{
};
@@ -208,7 +205,7 @@ namespace picongpu
* @tparam T_SpeciesType type or name as PMACC_CSTRING of the particle species
* to fill gaps in memory
*/
template<typename T_SpeciesType = boost::mpl::_1>
template<typename T_SpeciesType = pmacc::_1>
struct FillAllGaps
{
using SpeciesType = pmacc::particles::meta::FindByNameOrType_t<VectorAllSpecies, T_SpeciesType>;
17 changes: 7 additions & 10 deletions include/picongpu/particles/Manipulate.hpp
Original file line number Diff line number Diff line change
@@ -29,8 +29,6 @@
#include <pmacc/particles/algorithm/CallForEach.hpp>
#include <pmacc/particles/meta/FindByNameOrType.hpp>

#include <boost/mpl/placeholders.hpp>

#include <cstdint>
#include <type_traits>

@@ -48,8 +46,8 @@ namespace picongpu
{
private:
using Species = pmacc::particles::meta::FindByNameOrType_t<VectorAllSpecies, T_Species>;
using SpeciesFunctor = typename boost::mpl::apply1<T_Manipulator, Species>::type;
using ParticleFilter = typename boost::mpl::apply1<T_Filter, Species>::type;
using SpeciesFunctor = pmacc::Apply<T_Manipulator, Species>;
using ParticleFilter = pmacc::Apply<T_Filter, Species>;

public:
using type = manipulators::IUnary<SpeciesFunctor, ParticleFilter>;
@@ -76,12 +74,12 @@ namespace picongpu
* @tparam T_Filter picongpu::particles::filter, particle filter type to
* select particles in `T_Species` to manipulate
* @tparam T_Area area to process particles in operator()(currentStep),
* wrapped into std::integral_constant for boost::mpl::apply to work;
* wrapped into std::integral_constant for meta programming to work;
* does not affect operator()(currentStep, areaMapperFactory)
*/
template<
typename T_Manipulator,
typename T_Species = boost::mpl::_1,
typename T_Species = pmacc::_1,
typename T_Filter = filter::All,
typename T_Area = std::integral_constant<uint32_t, CORE + BORDER>>
struct Manipulate
@@ -99,7 +97,7 @@ namespace picongpu
* workflow is as follows:
* - select the species to manipulate, often by filtering VectorAllSpecies
* - define a manipulator type; in case the manipulator has a species type
* as a template parameter, use the boost::mpl::_1 placeholder instead
* as a template parameter, use the pmacc::_1 placeholder instead
* - define a filter type when necessary
* - call manipulate()
*
@@ -135,8 +133,7 @@ namespace picongpu
inline void manipulate(uint32_t const currentStep)
{
using SpeciesSeq = pmacc::ToSeq<T_Species>;
using Functor
= Manipulate<T_Manipulator, boost::mpl::_1, T_Filter, std::integral_constant<uint32_t, T_area>>;
using Functor = Manipulate<T_Manipulator, pmacc::_1, T_Filter, std::integral_constant<uint32_t, T_area>>;
pmacc::meta::ForEach<SpeciesSeq, Functor> forEach;
forEach(currentStep);
}
@@ -156,7 +153,7 @@ namespace picongpu
inline void manipulate(uint32_t const currentStep, T_AreaMapperFactory const& areaMapperFactory)
{
using SpeciesSeq = pmacc::ToSeq<T_Species>;
using Functor = Manipulate<T_Manipulator, boost::mpl::_1, T_Filter>;
using Functor = Manipulate<T_Manipulator, pmacc::_1, T_Filter>;
pmacc::meta::ForEach<SpeciesSeq, Functor> forEach;
forEach(currentStep, areaMapperFactory);
}
10 changes: 4 additions & 6 deletions include/picongpu/particles/ParticlesFunctors.hpp
Original file line number Diff line number Diff line change
@@ -213,7 +213,7 @@ namespace picongpu
/* push all species */
using VectorSpeciesWithPusher =
typename pmacc::particles::traits::FilterByFlag<VectorAllSpecies, particlePusher<>>::type;
meta::ForEach<VectorSpeciesWithPusher, PushSpecies<boost::mpl::_1>> pushSpecies;
meta::ForEach<VectorSpeciesWithPusher, PushSpecies<pmacc::_1>> pushSpecies;
pushSpecies(currentStep, eventInt, updateEventList);

/* join all push events */
@@ -223,8 +223,7 @@ namespace picongpu
}

/* call communication for all species */
meta::ForEach<VectorSpeciesWithPusher, particles::CommunicateSpecies<boost::mpl::_1>>
communicateSpecies;
meta::ForEach<VectorSpeciesWithPusher, particles::CommunicateSpecies<pmacc::_1>> communicateSpecies;
communicateSpecies(updateEventList, commEventList);

/* join all communication events */
@@ -246,7 +245,7 @@ namespace picongpu
{
using VectorSpeciesWithPusher =
typename pmacc::particles::traits::FilterByFlag<VectorAllSpecies, particlePusher<>>::type;
meta::ForEach<VectorSpeciesWithPusher, RemoveOuterParticles<boost::mpl::_1>> removeOuterParticles;
meta::ForEach<VectorSpeciesWithPusher, RemoveOuterParticles<pmacc::_1>> removeOuterParticles;
removeOuterParticles(currentStep);
}
};
@@ -326,8 +325,7 @@ namespace picongpu
using hasIonizers = typename HasFlag<FrameType, ionizers<>>::type;
if(hasIonizers::value)
{
meta::ForEach<SelectIonizerList, CallIonizationScheme<SpeciesType, boost::mpl::_1>>
particleIonization;
meta::ForEach<SelectIonizerList, CallIonizationScheme<SpeciesType, pmacc::_1>> particleIonization;
particleIonization(cellDesc, currentStep);
}
}
3 changes: 1 addition & 2 deletions include/picongpu/particles/ParticlesInit.kernel
Original file line number Diff line number Diff line change
@@ -205,8 +205,7 @@ namespace picongpu
using ParticleCleanedAttrList =
typename ResolveAndRemoveFromSeq<ParticleAttrList, AttrToIgnore>::type;

meta::ForEach<ParticleCleanedAttrList, SetAttributeToDefault<boost::mpl::_1>>
setToDefault;
meta::ForEach<ParticleCleanedAttrList, SetAttributeToDefault<pmacc::_1>> setToDefault;
setToDefault(particle);
}
particle[multiMask_] = 1;
6 changes: 2 additions & 4 deletions include/picongpu/particles/collision/WithPeer.hpp
Original file line number Diff line number Diff line change
@@ -24,10 +24,9 @@
#include "picongpu/particles/collision/InterCollision.hpp"
#include "picongpu/particles/collision/IntraCollision.hpp"

#include <pmacc/meta/Apply.hpp>
#include <pmacc/particles/meta/FindByNameOrType.hpp>

#include <boost/mpl/apply.hpp>

#include <cstdio>


@@ -106,8 +105,7 @@ namespace picongpu

using PeerSpecies = pmacc::particles::meta::FindByNameOrType_t<VectorAllSpecies, T_PeerSpecies>;

using CollisionFunctor =
typename boost::mpl::apply2<T_CollisionFunctor, BaseSpecies, PeerSpecies>::type;
using CollisionFunctor = pmacc::Apply<T_CollisionFunctor, BaseSpecies, PeerSpecies>;

detail::WithPeer<CollisionFunctor, T_FilterPair, BaseSpecies, PeerSpecies, colliderId, pairId>{}(
deviceHeap,
4 changes: 2 additions & 2 deletions include/picongpu/particles/debyeLength/Check.hpp
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ namespace picongpu
HINLINE std::uint32_t countElectronLikeSpecies()
{
Counter::value() = 0u;
meta::ForEach<T_SpeciesSeq, ElectonLikeSpeciesCounter<boost::mpl::_1>> count;
meta::ForEach<T_SpeciesSeq, ElectonLikeSpeciesCounter<pmacc::_1>> count;
count();
return Counter::value();
}
@@ -203,7 +203,7 @@ namespace picongpu
}
else
{
meta::ForEach<AllSpeciesWithCurrent, detail::CheckDebyeLength<boost::mpl::_1>> checkDebyeLength;
meta::ForEach<AllSpeciesWithCurrent, detail::CheckDebyeLength<pmacc::_1>> checkDebyeLength;
checkDebyeLength(cellDescription, isPrinting);
}
}
Original file line number Diff line number Diff line change
@@ -37,10 +37,7 @@ namespace picongpu
using SkipCells = typename pmacc::math::CT::shrinkTo<OrgSkipCells, simDim>::type;

template<typename T_SpeciesType>
struct apply
{
using type = EveryNthCellImpl<OrgSkipCells>;
};
using fn = EveryNthCellImpl;

HINLINE
EveryNthCellImpl(uint32_t currentStep)
Original file line number Diff line number Diff line change
@@ -35,10 +35,7 @@ namespace picongpu
using UserFunctor = particles::functor::User<T_UserFunctor>;

template<typename T_SpeciesType>
struct apply
{
using type = FreeFormulaImpl<UserFunctor>;
};
using fn = FreeFormulaImpl<UserFunctor>;

HINLINE FreeFormulaImpl(uint32_t currentStep) : UserFunctor(currentStep)
{
Original file line number Diff line number Diff line change
@@ -305,14 +305,13 @@ namespace picongpu
} // namespace detail

/** Wrapper to be used in density.param, compatible with other density definitions
*
* Hooks internal implementation in detail:: to boost::mpl::apply
*
* @tparam T_ParamClass parameter type
*/
template<typename T_ParamClass>
struct FromOpenPMDImpl : public T_ParamClass
{
// TODO(bgruber): is this supposed to hook into MPL? I cannot find where this is used.
template<typename T_SpeciesType>
struct apply
{
Original file line number Diff line number Diff line change
@@ -34,10 +34,7 @@ namespace picongpu
using ParamClass = T_ParamClass;

template<typename T_SpeciesType>
struct apply
{
using type = GaussianCloudImpl<ParamClass>;
};
using fn = GaussianCloudImpl;

HINLINE GaussianCloudImpl(uint32_t currentStep)
{
5 changes: 1 addition & 4 deletions include/picongpu/particles/densityProfiles/GaussianImpl.hpp
Original file line number Diff line number Diff line change
@@ -34,10 +34,7 @@ namespace picongpu
using ParamClass = T_ParamClass;

template<typename T_SpeciesType>
struct apply
{
using type = GaussianImpl<ParamClass>;
};
using fn = GaussianImpl;

HINLINE GaussianImpl(uint32_t currentStep)
{
Original file line number Diff line number Diff line change
@@ -29,10 +29,7 @@ namespace picongpu
struct HomogenousImpl
{
template<typename T_SpeciesType>
struct apply
{
using type = HomogenousImpl;
};
using fn = HomogenousImpl;

HINLINE HomogenousImpl(uint32_t currentStep)
{
Original file line number Diff line number Diff line change
@@ -32,10 +32,7 @@ namespace picongpu
using ParamClass = T_ParamClass;

template<typename T_SpeciesType>
struct apply
{
using type = LinearExponentialImpl<ParamClass>;
};
using fn = LinearExponentialImpl;

HINLINE LinearExponentialImpl(uint32_t currentStep)
{
Original file line number Diff line number Diff line change
@@ -33,10 +33,7 @@ namespace picongpu
using ParamClass = T_ParamClass;

template<typename T_SpeciesType>
struct apply
{
using type = SphereFlanksImpl<ParamClass>;
};
using fn = SphereFlanksImpl;

HINLINE SphereFlanksImpl(uint32_t currentStep)
{
5 changes: 1 addition & 4 deletions include/picongpu/particles/filter/All.hpp
Original file line number Diff line number Diff line change
@@ -54,10 +54,7 @@ namespace picongpu
struct All
{
template<typename T_SpeciesType>
struct apply
{
using type = All;
};
using fn = All;

/** create filter for the accelerator
*
Original file line number Diff line number Diff line change
@@ -102,10 +102,7 @@ namespace picongpu
using Params = T_Params;

template<typename T_SpeciesType>
struct apply
{
using type = RelativeGlobalDomainPosition;
};
using fn = RelativeGlobalDomainPosition;

HINLINE RelativeGlobalDomainPosition()
{
5 changes: 1 addition & 4 deletions include/picongpu/particles/filter/generic/Free.hpp
Original file line number Diff line number Diff line change
@@ -74,10 +74,7 @@ namespace picongpu
using Functor = functor::User<T_Functor>;

template<typename T_SpeciesType>
struct apply
{
using type = Free;
};
using fn = Free;

/** constructor
*
Loading

0 comments on commit 91e9550

Please sign in to comment.