ORB5X 1.0.0
Performance-portable global electromagnetic gyrokinetic PIC code
orb5x::ParMove Class Reference

Migrate complete marker records between toroidal spatial subdomains. More...

#include "parmove.hpp"

Public Member Functions

void diag (int iter, int isp)
 Record statistics from the most recently built migration plan.
 
void exec_i8 (Kokkos::View< Int8 * > arr, int natts, int npmax, int np, bool run_on_device)
 Apply the active plan to flattened 64-bit integer storage.
 
void exec_i8 (Kokkos::View< Int8 **, Kokkos::LayoutStride > arr, int natts, int npmax, int np, bool run_on_device)
 Apply the active plan to 2-D signed 64-bit marker attributes.
 
void exec_logical (Kokkos::View< bool * > arr, int natts, int npmax, int np, bool run_on_device)
 Apply the active plan to flattened attribute-major logical storage.
 
void exec_logical (Kokkos::View< bool **, Kokkos::LayoutStride > arr, int natts, int npmax, int np, bool run_on_device)
 Apply the active plan to 2-D logical marker attributes.
 
void exec_r4 (Kokkos::View< Real32 * > arr, int natts, int npmax, int np, bool run_on_device)
 Apply the active plan to flattened single-precision storage.
 
void exec_r4 (Kokkos::View< Real32 **, Kokkos::LayoutStride > arr, int natts, int npmax, int np, bool run_on_device)
 Apply the active plan to 2-D single-precision attributes.
 
void exec_real (Kokkos::View< Real * > arr, int natts, int npmax, int np, bool run_on_device)
 Apply the active plan to flattened attribute-major real storage.
 
void exec_real (Kokkos::View< Real **, Kokkos::LayoutStride > arr, int natts, int npmax, int np, bool run_on_device)
 Apply the active migration plan to a 2-D real attribute array.
 
void exec_real_batch (const std::vector< Kokkos::View< Real **, Kokkos::LayoutStride > > &arrs, const std::vector< int > &natts_per_arr, int npmax, int np, bool run_on_device)
 Apply the active migration plan to several 2-D real attribute arrays in one combined MPI exchange, instead of one exchange per array.
 
int get_ndest (int substep, int ispecies) const
 Read a stored non-empty-destination count.
 
int get_np_leaving (int substep, int ispecies) const
 Read a stored outgoing-marker count.
 
void init (Kokkos::View< Real *, Kokkos::LayoutStride > pos, int np, int &np_new, int npmax, bool run_on_device)
 Build the migration plan from marker ownership coordinates.
 
void init_module (Real ld_, int nsd_, int me_sd_, MPI_Comm comm_sd_, int natts_max_, int nspecies, int nsubstep, int p_nthreads_, int natts_max_l_=-1, int natts_max_i8_=-1, int natts_max_r4_=-1)
 Configure topology, capacities, and diagnostic storage.
 

Public Attributes

Kokkos::View< int ** > ndest
 Non-empty destination count [substep][species].
 
Kokkos::View< int ** > np_leaving
 Outgoing marker count [substep][species].
 

Detailed Description

Migrate complete marker records between toroidal spatial subdomains.

Particle ownership is determined from a periodic position coordinate. A call to init() first computes one migration plan—send/receive counts, holes, and local backfill moves. Every attribute array belonging to those markers must then be passed through the matching exec_* overload using the same old particle count. This preserves alignment between positions, weights, identifiers, flags, and diagnostic attributes while compacting local storage.

Communication is collective over the supplied spatial-domain communicator. Data are currently staged through host mirrors even when Kokkos Views reside in accelerator memory.

Member Function Documentation

◆ diag()

void orb5x::ParMove::diag ( int  iter,
int  isp 
)

Record statistics from the most recently built migration plan.

Parameters
[in]iterZero-based substep row.
[in]ispZero-based species column.
Note
Invalid indices are ignored.

◆ exec_i8() [1/2]

void orb5x::ParMove::exec_i8 ( Kokkos::View< Int8 * >  arr,
int  natts,
int  npmax,
int  np,
bool  run_on_device 
)

Apply the active plan to flattened 64-bit integer storage.

Parameters
[in,out]arrAttribute-major storage.
[in]nattsNumber of attributes to migrate.
[in]npmaxMarker stride and capacity.
[in]npMarker count used in init().
[in]run_on_deviceCompatibility flag; currently ignored.

◆ exec_i8() [2/2]

void orb5x::ParMove::exec_i8 ( Kokkos::View< Int8 **, Kokkos::LayoutStride >  arr,
int  natts,
int  npmax,
int  np,
bool  run_on_device 
)

Apply the active plan to 2-D signed 64-bit marker attributes.

Parameters
[in,out]arrMarker-major integer attributes.
[in]nattsNumber of attributes to migrate.
[in]npmaxCompatibility capacity argument; ignored for 2-D storage.
[in]npMarker count used in init().
[in]run_on_deviceCompatibility flag; currently ignored.

◆ exec_logical() [1/2]

void orb5x::ParMove::exec_logical ( Kokkos::View< bool * >  arr,
int  natts,
int  npmax,
int  np,
bool  run_on_device 
)

Apply the active plan to flattened attribute-major logical storage.

Parameters
[in,out]arrStorage addressed as attribute*npmax + marker.
[in]nattsNumber of attributes to migrate.
[in]npmaxMarker stride and capacity.
[in]npMarker count used in init().
[in]run_on_deviceCompatibility flag; currently ignored.

◆ exec_logical() [2/2]

void orb5x::ParMove::exec_logical ( Kokkos::View< bool **, Kokkos::LayoutStride >  arr,
int  natts,
int  npmax,
int  np,
bool  run_on_device 
)

Apply the active plan to 2-D logical marker attributes.

Parameters
[in,out]arrMarker-major logical attributes.
[in]nattsNumber of attributes to migrate.
[in]npmaxCompatibility capacity argument; ignored for 2-D storage.
[in]npMarker count used in init().
[in]run_on_deviceCompatibility flag; currently ignored.

◆ exec_r4() [1/2]

void orb5x::ParMove::exec_r4 ( Kokkos::View< Real32 * >  arr,
int  natts,
int  npmax,
int  np,
bool  run_on_device 
)

Apply the active plan to flattened single-precision storage.

Parameters
[in,out]arrAttribute-major storage.
[in]nattsNumber of attributes to migrate.
[in]npmaxMarker stride and capacity.
[in]npMarker count used in init().
[in]run_on_deviceCompatibility flag; currently ignored.

◆ exec_r4() [2/2]

void orb5x::ParMove::exec_r4 ( Kokkos::View< Real32 **, Kokkos::LayoutStride >  arr,
int  natts,
int  npmax,
int  np,
bool  run_on_device 
)

Apply the active plan to 2-D single-precision attributes.

Parameters
[in,out]arrMarker-major single-precision attributes.
[in]nattsNumber of attributes to migrate.
[in]npmaxCompatibility capacity argument; ignored for 2-D storage.
[in]npMarker count used in init().
[in]run_on_deviceCompatibility flag; currently ignored.
Note
MPI transfer preserves the Fortran reference's 32-bit integer bit representation for these diagnostic attributes.

◆ exec_real() [1/2]

void orb5x::ParMove::exec_real ( Kokkos::View< Real * >  arr,
int  natts,
int  npmax,
int  np,
bool  run_on_device 
)

Apply the active plan to flattened attribute-major real storage.

Parameters
[in,out]arrStorage addressed as attribute*npmax + marker.
[in]nattsNumber of attributes to migrate.
[in]npmaxMarker stride and storage capacity.
[in]npMarker count used in init().
[in]run_on_deviceCompatibility flag; currently ignored.

◆ exec_real() [2/2]

void orb5x::ParMove::exec_real ( Kokkos::View< Real **, Kokkos::LayoutStride >  arr,
int  natts,
int  npmax,
int  np,
bool  run_on_device 
)

Apply the active migration plan to a 2-D real attribute array.

Parameters
[in,out]arrMarker-major array [capacity][attribute].
[in]nattsNumber of leading attributes to migrate.
[in]npmaxCompatibility capacity argument; ignored for 2-D storage.
[in]npMarker count used in the preceding init() call.
[in]run_on_deviceCompatibility flag; currently ignored.

◆ exec_real_batch()

void orb5x::ParMove::exec_real_batch ( const std::vector< Kokkos::View< Real **, Kokkos::LayoutStride > > &  arrs,
const std::vector< int > &  natts_per_arr,
int  npmax,
int  np,
bool  run_on_device 
)

Apply the active migration plan to several 2-D real attribute arrays in one combined MPI exchange, instead of one exchange per array.

Parameters
[in,out]arrsMarker-major arrays [capacity][attribute], same migration plan (same particle set) applies to all.
[in]natts_per_arrNumber of leading attributes to migrate from each corresponding array in arrs.
[in]npmaxCompatibility capacity argument; ignored for 2-D storage.
[in]npMarker count used in the preceding init() call.
[in]run_on_deviceCompatibility flag; currently ignored.
Exceptions
std::runtime_errorif the combined attribute count exceeds the capacity init_module was configured with.

◆ get_ndest()

int orb5x::ParMove::get_ndest ( int  substep,
int  ispecies 
) const

Read a stored non-empty-destination count.

Parameters
[in]substepZero-based diagnostic row.
[in]ispeciesZero-based species column.
Returns
Number of subdomains receiving at least one local marker.

◆ get_np_leaving()

int orb5x::ParMove::get_np_leaving ( int  substep,
int  ispecies 
) const

Read a stored outgoing-marker count.

Parameters
[in]substepZero-based diagnostic row.
[in]ispeciesZero-based species column.
Returns
Number of markers sent by the recorded migration.

◆ init()

void orb5x::ParMove::init ( Kokkos::View< Real *, Kokkos::LayoutStride >  pos,
int  np,
int &  np_new,
int  npmax,
bool  run_on_device 
)

Build the migration plan from marker ownership coordinates.

Parameters
[in]posOwnership coordinate for the first np local markers.
[in]npCurrent number of local markers.
[out]np_newLocal count after outgoing and incoming migrations.
[in]npmaxStorage capacity of each marker attribute array.
[in]run_on_deviceCompatibility flag; currently does not alter the Kokkos/host-staging implementation.
Exceptions
std::runtime_errorIf the resulting local count exceeds npmax or the computed hole/backfill lists are inconsistent.

◆ init_module()

void orb5x::ParMove::init_module ( Real  ld_,
int  nsd_,
int  me_sd_,
MPI_Comm  comm_sd_,
int  natts_max_,
int  nspecies,
int  nsubstep,
int  p_nthreads_,
int  natts_max_l_ = -1,
int  natts_max_i8_ = -1,
int  natts_max_r4_ = -1 
)

Configure topology, capacities, and diagnostic storage.

Parameters
[in]ld_Periodic length of the ownership coordinate.
[in]nsd_Number of toroidal spatial subdomains.
[in]me_sd_This rank's zero-based index in comm_sd_.
[in]comm_sd_Communicator containing the spatial subdomains.
[in]natts_max_Maximum double-precision attributes per marker.
[in]nspeciesNumber of species columns in migration diagnostics.
[in]nsubstepNumber of substep rows in migration diagnostics.
[in]p_nthreads_Logical host partitions used when counting markers.
[in]natts_max_l_Maximum logical attributes, or negative to reuse natts_max_ for all auxiliary types.
[in]natts_max_i8_Maximum 64-bit integer attributes.
[in]natts_max_r4_Maximum single-precision attributes.

Member Data Documentation

◆ ndest

Kokkos::View<int**> orb5x::ParMove::ndest

Non-empty destination count [substep][species].

◆ np_leaving

Kokkos::View<int**> orb5x::ParMove::np_leaving

Outgoing marker count [substep][species].


The documentation for this class was generated from the following file: