fpmas 1.4
Public Member Functions | Static Public Member Functions | List of all members
fpmas::random::DistributedIndex Class Reference

#include <random.h>

Inheritance diagram for fpmas::random::DistributedIndex:
Inheritance graph
[legend]
Collaboration diagram for fpmas::random::DistributedIndex:
Collaboration graph
[legend]

Public Member Functions

 DistributedIndex (const Index< int > &index)
 
 DistributedIndex (Index< int > &&index)
 
DistributedIndexoperator= (const Index< int > &index)
 
DistributedIndexoperator= (Index< int > &&index)
 
- Public Member Functions inherited from fpmas::random::Index< int >
 Index (const std::map< int, std::size_t > &item_counts, int key, std::size_t offset)
 
 Index (const Index< int > &index)
 
 Index (Index< int > &&index)
 
Index< int > & operator= (const Index< int > &index)
 
Index< int > & operator= (Index< int > &&index)
 
int key () const
 
std::size_t offset () const
 
Indexoperator++ ()
 
Index operator++ (int)
 
Index operator+ (std::size_t n) const
 
bool operator== (const Index &index) const
 
bool operator!= (const Index &index) const
 
bool operator< (const Index &index) const
 

Static Public Member Functions

static DistributedIndex begin (const std::vector< std::size_t > &item_counts)
 
static DistributedIndex end (const std::vector< std::size_t > &item_counts)
 
- Static Public Member Functions inherited from fpmas::random::Index< int >
static Index begin (const std::map< int, std::size_t > &item_counts)
 
static Index end (const std::map< int, std::size_t > &item_counts)
 
static std::size_t distance (const Index &i1, const Index &i2)
 

Detailed Description

Represents a continuous index distributed across processes.

A distributed index is represented as a (process, local_offset) pair. Processes are indexed from 0 to p-1. Each process is assigned to a given number of items n_p.

The sequence of values iterated by the index is as all processes items were iterated in a single sequence, from process 0 to p-1:

(0, 0) (0, 1) ... (0, n_0-1) (1, 0) ... (1, n_1-1) ... (p-1, 0) ... (p-1, n_(p-1)-1) (p, 0)

The interest of this structure is that local offsets associated to a process p can for exemple be used as indexes in a vector hosted by the process p.

Constructor & Destructor Documentation

◆ DistributedIndex() [1/2]

fpmas::random::DistributedIndex::DistributedIndex ( const Index< int > &  index)
inline

Builds a distributed index from the corresponding Index.

◆ DistributedIndex() [2/2]

fpmas::random::DistributedIndex::DistributedIndex ( Index< int > &&  index)
inline

Builds a distributed index from the corresponding Index.

Member Function Documentation

◆ operator=() [1/2]

DistributedIndex & fpmas::random::DistributedIndex::operator= ( const Index< int > &  index)
inline

Assigns the specified Index to this DistributedIndex.

◆ operator=() [2/2]

DistributedIndex & fpmas::random::DistributedIndex::operator= ( Index< int > &&  index)
inline

Assigns the specified Index to this DistributedIndex.

◆ begin()

DistributedIndex fpmas::random::DistributedIndex::begin ( const std::vector< std::size_t > &  item_counts)
static

Begin of the distributed index associated to item_counts, i.e. (p0, 0) where p0 is the first process that owns at least one item.

◆ end()

DistributedIndex fpmas::random::DistributedIndex::end ( const std::vector< std::size_t > &  item_counts)
static

End of the distributed index associated to item_counts, i.e. (p, 0).


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