Templated class that specifies a distributed storage of a vector of given objects. More...
#include <DistributedData.h>
Public Member Functions | |
DistributedData (const libMesh::Parallel::Communicator &comm_in) | |
void | initializeContainer (unsigned int num_global_entries) |
Initialize the container with a given number of samples. More... | |
void | changeEntry (unsigned int glob_i, const T &sample) |
Changing a sample with a global index if it is owned locally. More... | |
void | addNewEntry (unsigned int glob_i, const T &sample) |
Adding a new sample locally with a global index. More... | |
void | closeContainer () |
Closes the container meaning that no new samples can be added or the already existing samples canot be changed. More... | |
bool | hasGlobalEntry (unsigned int glob_i) const |
Checking of sample with global ID is locally owned ot not. More... | |
std::vector< T >::iterator | localEntryBegin () |
Getting an itertor to the beginning of the local samples. More... | |
std::vector< T >::iterator | localEntryEnd () |
Getting an iterator to the end of the locally owned samples. More... | |
std::vector< unsigned int >::iterator | localEntryIDBegin () |
Getting an iterator to the beginning of the locally owned sample IDs. More... | |
std::vector< unsigned int >::iterator | localEntryIDEnd () |
Getting an iterator to the end of the locally owned sample IDs. More... | |
const T & | getGlobalEntry (unsigned int glob_i) const |
Getting a sample using its global index. More... | |
const T & | getLocalEntry (unsigned int loc_i) const |
Getting a sample using its local index. More... | |
const std::vector< T > & | getLocalEntries () const |
Getting all of the locally owned samples. More... | |
const std::vector< unsigned int > & | getLocalEntryIDs () const |
Getting the vector of sample IDs for locally owned samples. More... | |
unsigned int | getNumberOfGlobalEntries () const |
Getting the number of global samples. More... | |
unsigned int | getNumberOfLocalEntries () const |
Getting the number of locally owned samples. More... | |
unsigned int | getLocalIndex (unsigned int glob_i) const |
Getting the local index of a global sample if locally owned. More... | |
unsigned int | getGlobalIndex (unsigned int loc_i) const |
Getting the global index of a locally owned sample. More... | |
const Parallel::Communicator & | comm () const |
processor_id_type | n_processors () const |
processor_id_type | processor_id () const |
Protected Attributes | |
std::vector< T > | _local_entries |
The vector where the samples are stored. More... | |
std::vector< unsigned int > | _local_entry_ids |
The vector where the global sample IDs are stored. More... | |
bool | _closed |
Flag which shows if the container is closed or not. More... | |
unsigned int | _n_local_entries |
Number of local samples. More... | |
const Parallel::Communicator & | _communicator |
Templated class that specifies a distributed storage of a vector of given objects.
It has a helper vector that contains global IDs for every stored item.
Definition at line 24 of file DistributedData.h.
StochasticTools::DistributedData< T >::DistributedData | ( | const libMesh::Parallel::Communicator & | comm_in | ) |
Definition at line 19 of file DistributedData.C.
void StochasticTools::DistributedData< T >::addNewEntry | ( | unsigned int | glob_i, |
const T & | sample | ||
) |
Adding a new sample locally with a global index.
Definition at line 56 of file DistributedData.C.
void StochasticTools::DistributedData< T >::changeEntry | ( | unsigned int | glob_i, |
const T & | sample | ||
) |
Changing a sample with a global index if it is owned locally.
Definition at line 71 of file DistributedData.C.
|
inline |
Closes the container meaning that no new samples can be added or the already existing samples canot be changed.
Definition at line 41 of file DistributedData.h.
const T & StochasticTools::DistributedData< T >::getGlobalEntry | ( | unsigned int | glob_i | ) | const |
Getting a sample using its global index.
Definition at line 84 of file DistributedData.C.
unsigned int StochasticTools::DistributedData< T >::getGlobalIndex | ( | unsigned int | loc_i | ) | const |
Getting the global index of a locally owned sample.
Definition at line 140 of file DistributedData.C.
|
inline |
Getting all of the locally owned samples.
Definition at line 68 of file DistributedData.h.
const T & StochasticTools::DistributedData< T >::getLocalEntry | ( | unsigned int | loc_i | ) | const |
Getting a sample using its local index.
Definition at line 95 of file DistributedData.C.
|
inline |
Getting the vector of sample IDs for locally owned samples.
Definition at line 71 of file DistributedData.h.
unsigned int StochasticTools::DistributedData< T >::getLocalIndex | ( | unsigned int | glob_i | ) | const |
Getting the local index of a global sample if locally owned.
Definition at line 129 of file DistributedData.C.
unsigned int StochasticTools::DistributedData< T >::getNumberOfGlobalEntries | ( | ) | const |
Getting the number of global samples.
Definition at line 109 of file DistributedData.C.
|
inline |
Getting the number of locally owned samples.
Definition at line 77 of file DistributedData.h.
bool StochasticTools::DistributedData< T >::hasGlobalEntry | ( | unsigned int | glob_i | ) | const |
Checking of sample with global ID is locally owned ot not.
Definition at line 118 of file DistributedData.C.
void StochasticTools::DistributedData< T >::initializeContainer | ( | unsigned int | num_global_entries | ) |
Initialize the container with a given number of samples.
this partitions the samples using linearPartitioning.
Definition at line 26 of file DistributedData.C.
|
inline |
Getting an itertor to the beginning of the local samples.
Definition at line 47 of file DistributedData.h.
|
inline |
Getting an iterator to the end of the locally owned samples.
Definition at line 50 of file DistributedData.h.
|
inline |
Getting an iterator to the beginning of the locally owned sample IDs.
Definition at line 53 of file DistributedData.h.
|
inline |
Getting an iterator to the end of the locally owned sample IDs.
Definition at line 59 of file DistributedData.h.
|
protected |
Flag which shows if the container is closed or not.
Definition at line 93 of file DistributedData.h.
Referenced by StochasticTools::DistributedData< T >::closeContainer().
|
protected |
The vector where the samples are stored.
Definition at line 87 of file DistributedData.h.
Referenced by StochasticTools::DistributedData< T >::getLocalEntries(), StochasticTools::DistributedData< T >::localEntryBegin(), and StochasticTools::DistributedData< T >::localEntryEnd().
|
protected |
The vector where the global sample IDs are stored.
Definition at line 90 of file DistributedData.h.
Referenced by StochasticTools::DistributedData< T >::getLocalEntryIDs(), StochasticTools::DistributedData< T >::localEntryIDBegin(), and StochasticTools::DistributedData< T >::localEntryIDEnd().
|
protected |
Number of local samples.
Definition at line 96 of file DistributedData.h.
Referenced by StochasticTools::DistributedData< T >::getNumberOfLocalEntries().