WarpX
Functions
FilterCopyTransform.H File Reference
#include "Particles/ParticleCreation/DefaultInitialization.H"
#include <AMReX_GpuContainers.H>
#include <AMReX_TypeTraits.H>

Go to the source code of this file.

Functions

template<int N, typename DstPC , typename DstTile , typename SrcTile , typename Index , typename TransFunc , typename CopyFunc , amrex::EnableIf_t< std::is_integral< Index >::value, int > foo = 0>
Index filterCopyTransformParticles (DstPC &pc, DstTile &dst, SrcTile &src, Index *mask, Index dst_index, CopyFunc &&copy, TransFunc &&transform) noexcept
 Apply a filter, copy, and transform operation to the particles in src, in that order, writing the result to dst, starting at dst_index. The dst tile will be extended so all the particles will fit, if needed. More...
 
template<int N, typename DstPC , typename DstTile , typename SrcTile , typename Index , typename PredFunc , typename TransFunc , typename CopyFunc >
Index filterCopyTransformParticles (DstPC &pc, DstTile &dst, SrcTile &src, Index dst_index, PredFunc &&filter, CopyFunc &&copy, TransFunc &&transform) noexcept
 Apply a filter, copy, and transform operation to the particles in src, in that order, writing the result to dst, starting at dst_index. The dst tile will be extended so all the particles will fit, if needed. More...
 
template<int N, typename DstPC , typename DstTile , typename SrcTile , typename Index , typename TransFunc , typename CopyFunc1 , typename CopyFunc2 , amrex::EnableIf_t< std::is_integral< Index >::value, int > foo = 0>
Index filterCopyTransformParticles (DstPC &pc1, DstPC &pc2, DstTile &dst1, DstTile &dst2, SrcTile &src, Index *mask, Index dst1_index, Index dst2_index, CopyFunc1 &&copy1, CopyFunc2 &&copy2, TransFunc &&transform) noexcept
 Apply a filter, copy, and transform operation to the particles in src, in that order, writing the results to dst1 and dst2, starting at dst1_index and dst2_index. The dst tiles will be extended so all the particles will fit, if needed. More...
 
template<int N, typename DstPC , typename DstTile , typename SrcTile , typename Index , typename PredFunc , typename TransFunc , typename CopyFunc1 , typename CopyFunc2 >
Index filterCopyTransformParticles (DstPC &pc1, DstPC &pc2, DstTile &dst1, DstTile &dst2, SrcTile &src, Index dst1_index, Index dst2_index, PredFunc &&filter, CopyFunc1 &&copy1, CopyFunc2 &&copy2, TransFunc &&transform) noexcept
 Apply a filter, copy, and transform operation to the particles in src, in that order, writing the results to dst1 and dst2, starting at dst1_index and dst2_index. The dst tiles will be extended so all the particles will fit, if needed. More...
 

Function Documentation

◆ filterCopyTransformParticles() [1/4]

template<int N, typename DstPC , typename DstTile , typename SrcTile , typename Index , typename TransFunc , typename CopyFunc , amrex::EnableIf_t< std::is_integral< Index >::value, int > foo = 0>
Index filterCopyTransformParticles ( DstPC &  pc,
DstTile &  dst,
SrcTile &  src,
Index *  mask,
Index  dst_index,
CopyFunc &&  copy,
TransFunc &&  transform 
)
noexcept

Apply a filter, copy, and transform operation to the particles in src, in that order, writing the result to dst, starting at dst_index. The dst tile will be extended so all the particles will fit, if needed.

Note that the transform function operates on both the src and the dst, so both can be modified.

This version of the function takes as inputs a mask which can be obtained using another version of filterCopyTransformParticles that takes a filter function as input.

Template Parameters
Nnumber of particles created in the dst(s) for each filtered src particle
DstTilethe dst particle tile type
SrcTilethe src particle tile type
Indexthe index type, e.g. unsigned int
TransFuncthe transform function type
CopyFuncthe copy function type
Parameters
dstthe destination tile
srcthe source tile
maskpointer to the mask: 1 means copy, 0 means don't copy
dst_indexthe location at which to starting writing the result to dst
copycallable that defines what will be done for the "copy" step.
transformcallable that defines the transformation to apply on dst and src.
   The form of the callable should model:
       template <typename DstData, typename SrcData>
       AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
       void operator() (DstData& dst, SrcData& src, int i_src, int i_dst);

   where dst and src refer to the destination and source tiles and
   i_src and i_dst and the particle indices in each tile.
Returns
num_added the number of particles that were written to dst.

◆ filterCopyTransformParticles() [2/4]

template<int N, typename DstPC , typename DstTile , typename SrcTile , typename Index , typename PredFunc , typename TransFunc , typename CopyFunc >
Index filterCopyTransformParticles ( DstPC &  pc,
DstTile &  dst,
SrcTile &  src,
Index  dst_index,
PredFunc &&  filter,
CopyFunc &&  copy,
TransFunc &&  transform 
)
noexcept

Apply a filter, copy, and transform operation to the particles in src, in that order, writing the result to dst, starting at dst_index. The dst tile will be extended so all the particles will fit, if needed.

Note that the transform function operates on both the src and the dst, so both can be modified.

This version of the function takes as input a filter functor, uses it to obtain a mask and then calls another version of filterCopyTransformParticles that takes the mask as input.

Template Parameters
Nnumber of particles created in the dst(s) for each filtered src particle
DstTilethe dst particle tile type
SrcTilethe src particle tile type
Indexthe index type, e.g. unsigned int
Filterthe filter function type
TransFuncthe transform function type
CopyFuncthe copy function type
Parameters
dstthe destination tile
srcthe source tile
dst_indexthe location at which to starting writing the result to dst
filtera callable returning true if that particle is to be copied and transformed
copycallable that defines what will be done for the "copy" step.
transformcallable that defines the transformation to apply on dst and src.
   The form of the callable should model:
       template <typename DstData, typename SrcData>
       AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
       void operator() (DstData& dst, SrcData& src, int i_src, int i_dst);

   where dst and src refer to the destination and source tiles and
   i_src and i_dst and the particle indices in each tile.
Returns
num_added the number of particles that were written to dst.

◆ filterCopyTransformParticles() [3/4]

template<int N, typename DstPC , typename DstTile , typename SrcTile , typename Index , typename TransFunc , typename CopyFunc1 , typename CopyFunc2 , amrex::EnableIf_t< std::is_integral< Index >::value, int > foo = 0>
Index filterCopyTransformParticles ( DstPC &  pc1,
DstPC &  pc2,
DstTile &  dst1,
DstTile &  dst2,
SrcTile &  src,
Index *  mask,
Index  dst1_index,
Index  dst2_index,
CopyFunc1 &&  copy1,
CopyFunc2 &&  copy2,
TransFunc &&  transform 
)
noexcept

Apply a filter, copy, and transform operation to the particles in src, in that order, writing the results to dst1 and dst2, starting at dst1_index and dst2_index. The dst tiles will be extended so all the particles will fit, if needed.

Note that the transform function operates on all of src, dst1, and dst2, so all of them can be modified.

This version of the function takes as inputs a mask which can be obtained using another version of filterCopyTransformParticles that takes a filter function as input.

Template Parameters
Nnumber of particles created in the dst(s) for each filtered src particle
DstTilethe dst particle tile type
SrcTilethe src particle tile type
Indexthe index type, e.g. unsigned int
TransFuncthe transform function type
CopyFunc1the copy function type for src-->dst1
CopyFunc2the copy function type for src-->dst2
Parameters
dst1the destination tile
dst2the destination tile
srcthe source tile
maskpointer to the mask: 1 means copy, 0 means don't copy
dst1_indexthe location at which to start writing the result to dst1
dst2_indexthe location at which to start writing the result to dst2
copy1callable that defines what will be done for the "copy" step for src-->dst1.
copy2callable that defines what will be done for the "copy" step for src-->dst2.
transformcallable that defines the transformation to apply on dst and src.
   The form of the callable should model:
       template <typename DstData, typename SrcData>
       AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
       void operator() (DstData& dst, SrcData& src, int i_src, int i_dst);

   where dst and src refer to the destination and source tiles and
   i_src and i_dst and the particle indices in each tile.
Returns
num_added the number of particles that were written to dst.

◆ filterCopyTransformParticles() [4/4]

template<int N, typename DstPC , typename DstTile , typename SrcTile , typename Index , typename PredFunc , typename TransFunc , typename CopyFunc1 , typename CopyFunc2 >
Index filterCopyTransformParticles ( DstPC &  pc1,
DstPC &  pc2,
DstTile &  dst1,
DstTile &  dst2,
SrcTile &  src,
Index  dst1_index,
Index  dst2_index,
PredFunc &&  filter,
CopyFunc1 &&  copy1,
CopyFunc2 &&  copy2,
TransFunc &&  transform 
)
noexcept

Apply a filter, copy, and transform operation to the particles in src, in that order, writing the results to dst1 and dst2, starting at dst1_index and dst2_index. The dst tiles will be extended so all the particles will fit, if needed.

Note that the transform function operates on all of src, dst1, and dst2, so all of them can be modified.

This version of the function takes as input a filter functor, uses it to obtain a mask and then calls another version of filterCopyTransformParticles that takes the mask as input.

Template Parameters
Nnumber of particles created in the dst(s) for each filtered src particle
DstTilethe dst particle tile type
SrcTilethe src particle tile type
Indexthe index type, e.g. unsigned int
Filterthe filter function type
TransFuncthe transform function type
CopyFunc1the copy function type for src-->dst1
CopyFunc2the copy function type for src-->dst2
Parameters
dst1the destination tile
dst2the destination tile
srcthe source tile
dst1_indexthe location at which to starting writing the result to dst1
dst2_indexthe location at which to starting writing the result to dst2
filtera callable returning true if that particle is to be copied and transformed
copy1callable that defines what will be done for the "copy" step for src-->dst1.
copy2callable that defines what will be done for the "copy" step for src-->dst2.
transformcallable that defines the transformation to apply on dst and src.
   The form of the callable should model:
       template <typename DstData, typename SrcData>
       AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
       void operator() (DstData& dst, SrcData& src, int i_src, int i_dst);

   where dst and src refer to the destination and source tiles and
   i_src and i_dst and the particle indices in each tile.
Returns
num_added the number of particles that were written to dst.