Skip to content

Commit

Permalink
Switch back to host side std tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
ikbuibui committed Feb 10, 2025
1 parent bf2c805 commit 47eb19a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions include/picongpu/plugins/binning/Binner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ namespace picongpu
// Do binning for species. Writes to histBuffer
if(binningData.isRegionEnabled(ParticleRegion::Bounded))
{
binning::apply(
std::apply(
[&](auto const&... tupleArgs) { ((doBinningForSpecies(tupleArgs, currentStep)), ...); },
binningData.speciesTuple);
}
Expand Down Expand Up @@ -246,7 +246,7 @@ namespace picongpu
this->histBuffer->getDeviceBuffer().getDataBox());

// change output dimensions
binning::apply(
std::apply(
[&](auto const&... tupleArgs)
{ ((dimensionSubtraction(outputUnits, tupleArgs.units)), ...); },
binningData.axisTuple);
Expand Down Expand Up @@ -304,7 +304,7 @@ namespace picongpu

if(binningData.isRegionEnabled(ParticleRegion::Leaving))
{
binning::apply(
std::apply(
[&](auto const&... tupleArgs)
{
(misc::ExecuteIf{}(
Expand Down
4 changes: 2 additions & 2 deletions include/picongpu/plugins/binning/BinningData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace picongpu
T_DepositionData depositionData;
std::function<void(::openPMD::Series& series, ::openPMD::Iteration& iteration, ::openPMD::Mesh& mesh)>
writeOpenPMDFunctor;
DataSpace<pmacc::memory::tuple::tuple_size_v<T_AxisTuple>> axisExtentsND;
DataSpace<std::tuple_size_v<T_AxisTuple>> axisExtentsND;

/* Optional parameters not initialized by constructor.
* Use the return value of addBinner() to modify them if needed. */
Expand Down Expand Up @@ -104,7 +104,7 @@ namespace picongpu

static constexpr uint32_t getNAxes()
{
return pmacc::memory::tuple::tuple_size_v<T_AxisTuple>;
return std::tuple_size_v<T_AxisTuple>;
}

/** @brief Time average the accumulated data when doing the dump. Defaults to true. */
Expand Down
2 changes: 1 addition & 1 deletion include/picongpu/plugins/binning/WriteHist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ namespace picongpu
mesh.setGeometry(::openPMD::Mesh::Geometry::cartesian);
mesh.setDataOrder(::openPMD::Mesh::DataOrder::C);

binning::apply(
std::apply(
[&](auto const&... tupleArgs)
{
((mesh.setAttribute(tupleArgs.label + "_bin_edges", tupleArgs.getBinEdgesSI())), ...);
Expand Down
18 changes: 9 additions & 9 deletions include/picongpu/plugins/binning/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,30 +72,30 @@ namespace picongpu

namespace detail
{
template<size_t... Is, typename TPmaccTuple, typename Functor>
constexpr auto tupleMapHelper(std::index_sequence<Is...>, TPmaccTuple&& tuple, Functor&& functor) noexcept
template<size_t... Is, typename TStdTuple, typename Functor>
constexpr auto tupleMapHelper(std::index_sequence<Is...>, TStdTuple&& tuple, Functor&& functor) noexcept
{
return pmacc::memory::tuple::make_tuple(std::forward<Functor>(functor)(
pmacc::memory::tuple::get<Is>(std::forward<TPmaccTuple>(tuple)))...);
return pmacc::memory::tuple::make_tuple(
std::forward<Functor>(functor)(std::get<Is>(std::forward<TStdTuple>(tuple)))...);
}
} // namespace detail

/**
* @brief create a new tuple from the return value of a functor applied on all arguments of a tuple
*/
template<typename TPmaccTuple, typename Functor>
constexpr auto tupleMap(TPmaccTuple&& tuple, Functor&& functor) noexcept
template<typename TStdTuple, typename Functor>
constexpr auto tupleMap(TStdTuple&& tuple, Functor&& functor) noexcept
{
return detail::tupleMapHelper(
std::make_index_sequence<pmacc::memory::tuple::tuple_size_v<TPmaccTuple>>{},
std::forward<TPmaccTuple>(tuple),
std::make_index_sequence<std::tuple_size_v<TStdTuple>>{},
std::forward<TStdTuple>(tuple),
std::forward<Functor>(functor));
}

template<typename... Args>
constexpr auto createTuple(Args&&... args) noexcept
{
return pmacc::memory::tuple::make_tuple(std::forward<Args>(args)...);
return std::make_tuple(std::forward<Args>(args)...);
}

} // namespace plugins::binning
Expand Down

0 comments on commit 47eb19a

Please sign in to comment.