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>
67 std::vector<KeyType> & d);
83 const std::vector<KeyType> &
bin();
151 #endif // LIBMESH_PARALLEL_SORT_H const std::vector< KeyType > & bin()
Return a constant reference to _my_bin.
const processor_id_type _proc_id
The identity of this processor.
void sort()
This is the only method which needs to be called by the user.
const Parallel::Communicator & comm() const
std::vector< KeyType > & _data
The raw, unsorted data which will need to be sorted (in parallel) across all processors.
std::vector< IdxType > _local_bin_sizes
Vector which holds the size of each bin on this processor.
The libMesh namespace provides an interface to certain functionality in the library.
uint8_t processor_id_type
void sort_local_bin()
After all the bins have been communicated, we can sort our local bin.
void communicate_bins()
Communicates the bins from each processor to the appropriate processor.
const processor_id_type _n_procs
The number of processors to work with.
std::vector< KeyType > _my_bin
The bin which will eventually be held by this processor.
An object whose state is distributed along a set of processors.
The parallel sorting method is templated on the type of data which is to be sorted.
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 ...
bool _bin_is_sorted
Flag which lets you know if sorting is complete.
void binsort()
Sorts the local data into bins across all processors.