DNDSR 0.2.1
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
DNDS::PermutationTransfer Struct Reference

#include <PermutationTransfer.hpp>

Collaboration diagram for DNDS::PermutationTransfer:
[legend]

Classes

struct  LookupResult
 Result of buildLookup: ghost-pullable old-global -> new-global map. More...
 

Public Member Functions

template<class TPair >
void transferRows (TPair &pair, const MPIInfo &mpi) const
 
LookupResult buildLookup (const std::vector< index > &pullSet, const MPIInfo &mpi) const
 
index size () const
 Number of entities (father slots) in this transfer.
 

Static Public Member Functions

static PermutationTransfer fromPartition (const std::vector< MPI_int > &partition, const ssp< GlobalOffsetsMapping > &oldGlobalMapping, const MPIInfo &mpi)
 
static PermutationTransfer fromLocalPermutation (const std::vector< index > &old2new, const ssp< GlobalOffsetsMapping > &oldGlobalMapping, const MPIInfo &mpi)
 

Public Attributes

std::vector< MPI_inttargetRanks
 Per father slot: target rank after reorder.
 
std::vector< indexnewGlobalIndices
 New global index for each father slot (same size as targetRanks).
 
std::vector< indexpushIndex
 
std::vector< indexpushStart
 
std::vector< indexlocalOld2New
 
bool isLocalOnly {false}
 Whether this is a pure rank-local permutation (no cross-rank traffic).
 
std::vector< indexnewGlobalOffsets
 

Detailed Description

Encapsulates a distributed or local permutation of array rows.

Given a per-slot target rank assignment, computes:

  • New global indices (prefix-sum across ranks grouped by target)
  • Push CSR indices for MPI communication
  • Local permutation vector (when all rows stay on the same rank)

Then provides transferRows to actually move/permute the data, and buildLookup to create a ghost-pullable old->new global map.

Definition at line 25 of file PermutationTransfer.hpp.

Member Function Documentation

◆ buildLookup()

PermutationTransfer::LookupResult DNDS::PermutationTransfer::buildLookup ( const std::vector< index > &  pullSet,
const MPIInfo mpi 
) const
inline

Build a ghost-pullable lookup array for old->new global conversion.

Parameters
pullSetSorted, deduplicated set of off-rank old globals that need to be resolvable. Typically collected from adj entries pointing to this entity kind.
mpiMPI communicator.
Returns
LookupResult with resolve() method.
Warning
Collective.

Definition at line 343 of file PermutationTransfer.hpp.

Here is the call graph for this function:

◆ fromLocalPermutation()

PermutationTransfer DNDS::PermutationTransfer::fromLocalPermutation ( const std::vector< index > &  old2new,
const ssp< GlobalOffsetsMapping > &  oldGlobalMapping,
const MPIInfo mpi 
)
inlinestatic

Build from a local-only permutation vector. All entities stay on the same rank. targetRanks all == mpi.rank.

Parameters
old2newLocal permutation: old local index -> new local index. Must be a valid permutation of [0, N).
oldGlobalMappingCurrent global offsets mapping.
mpiMPI communicator (used only for rank/size, no communication).
Note
Non-collective: performs zero MPI communication.

Definition at line 230 of file PermutationTransfer.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromPartition()

PermutationTransfer DNDS::PermutationTransfer::fromPartition ( const std::vector< MPI_int > &  partition,
const ssp< GlobalOffsetsMapping > &  oldGlobalMapping,
const MPIInfo mpi 
)
inlinestatic

Build from partition assignment (target ranks only). New global indices are computed automatically via prefix-sum.

Parameters
partitionPer-slot target rank. Size == father size.
oldGlobalMappingCurrent global offsets mapping for this entity.
mpiMPI communicator.
Warning
Collective.

Definition at line 141 of file PermutationTransfer.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

index DNDS::PermutationTransfer::size ( ) const
inline

Number of entities (father slots) in this transfer.

Definition at line 134 of file PermutationTransfer.hpp.

Here is the caller graph for this function:

◆ transferRows()

template<class TPair >
void DNDS::PermutationTransfer::transferRows ( TPair &  pair,
const MPIInfo mpi 
) const

Transfer (or permute) rows of an ArrayPair.

  • Local-only: in-place row permutation via PermuteRows.
  • Distributed: father=old, son=new ArrayTransformer push trick.

After return, pair.father contains the new data. pair.son is reset (stale after distributed transfer).

Warning
Collective (when !isLocalOnly).

Definition at line 285 of file PermutationTransfer.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ isLocalOnly

bool DNDS::PermutationTransfer::isLocalOnly {false}

Whether this is a pure rank-local permutation (no cross-rank traffic).

Definition at line 43 of file PermutationTransfer.hpp.

◆ localOld2New

std::vector<index> DNDS::PermutationTransfer::localOld2New

Local permutation: localOld2New[i] = new local index for old local i. Only valid when isLocalOnly == true. Empty otherwise.

Definition at line 40 of file PermutationTransfer.hpp.

◆ newGlobalIndices

std::vector<index> DNDS::PermutationTransfer::newGlobalIndices

New global index for each father slot (same size as targetRanks).

Definition at line 31 of file PermutationTransfer.hpp.

◆ newGlobalOffsets

std::vector<index> DNDS::PermutationTransfer::newGlobalOffsets

New global offsets: newGlobalOffsets[r] = first global index owned by rank r after reorder. Size = nRanks + 1.

Definition at line 47 of file PermutationTransfer.hpp.

◆ pushIndex

std::vector<index> DNDS::PermutationTransfer::pushIndex

Push CSR: pushIndex[pushStart[r]..pushStart[r+1]) are the local father indices that go to rank r.

Definition at line 35 of file PermutationTransfer.hpp.

◆ pushStart

std::vector<index> DNDS::PermutationTransfer::pushStart

Definition at line 36 of file PermutationTransfer.hpp.

◆ targetRanks

std::vector<MPI_int> DNDS::PermutationTransfer::targetRanks

Per father slot: target rank after reorder.

Definition at line 28 of file PermutationTransfer.hpp.


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