Go to the documentation of this file.
19 #ifndef LIBMESH_PARALLEL_SORT_H
20 #define LIBMESH_PARALLEL_SORT_H
23 #include "libmesh/libmesh_common.h"
24 #include "libmesh/parallel_object.h"
54 template <
typename KeyType,
typename IdxType=
unsigned int>
66 Sort (
const Parallel::Communicator &
comm,
67 std::vector<KeyType> & d);
83 const std::vector<KeyType> &
bin();
151 #endif // LIBMESH_PARALLEL_SORT_H
bool _bin_is_sorted
Flag which lets you know if sorting is complete.
const processor_id_type _proc_id
The identity of this processor.
The parallel sorting method is templated on the type of data which is to be sorted.
The libMesh namespace provides an interface to certain functionality in the library.
std::vector< KeyType > _my_bin
The bin which will eventually be held by this processor.
std::vector< KeyType > & _data
The raw, unsorted data which will need to be sorted (in parallel) across all processors.
void communicate_bins()
Communicates the bins from each processor to the appropriate processor.
const Parallel::Communicator & comm() const
void sort()
This is the only method which needs to be called by the user.
Sort(const Parallel::Communicator &comm, std::vector< KeyType > &d)
Constructor takes the number of processors, the processor id, and a reference to a vector of data to ...
const processor_id_type _n_procs
The number of processors to work with.
const std::vector< KeyType > & bin()
Return a constant reference to _my_bin.
uint8_t processor_id_type
void sort_local_bin()
After all the bins have been communicated, we can sort our local bin.
std::vector< IdxType > _local_bin_sizes
Vector which holds the size of each bin on this processor.
void binsort()
Sorts the local data into bins across all processors.
An object whose state is distributed along a set of processors.