Definition at line 12 of file parallel_sort_test.C.
◆ CPPUNIT_TEST()
ParallelSortTest::CPPUNIT_TEST |
( |
testSort |
| ) |
|
◆ CPPUNIT_TEST_SUITE_END()
ParallelSortTest::CPPUNIT_TEST_SUITE_END |
( |
| ) |
|
◆ LIBMESH_CPPUNIT_TEST_SUITE()
◆ setUp()
void ParallelSortTest::setUp |
( |
| ) |
|
|
inline |
◆ tearDown()
void ParallelSortTest::tearDown |
( |
| ) |
|
|
inline |
◆ testSort()
void ParallelSortTest::testSort |
( |
| ) |
|
|
inline |
Definition at line 27 of file parallel_sort_test.C.
References libMesh::Parallel::Sort< KeyType, IdxType >::bin(), libMesh::Parallel::Utils::is_sorted(), TIMPI::Communicator::max(), TIMPI::Communicator::rank(), TIMPI::Communicator::size(), libMesh::Parallel::Sort< KeyType, IdxType >::sort(), TIMPI::Communicator::sum(), and TestCommWorld.
33 const int n_vals = size - rank;
34 std::vector<int> vals(n_vals);
38 int val = rank+1, stride = size;
39 for (
int i=0; i != n_vals; ++i)
41 vals[n_vals-i-1] = val;
50 const std::vector<int> & my_bin = sorter.bin();
57 int total_size = cast_int<int>(my_bin.size());
60 CPPUNIT_ASSERT_EQUAL(total_size, size*(size+1)/2);
65 for (
int i=1; i <= total_size; ++i)
67 int count_i = std::count(my_bin.begin(), my_bin.end(), i);
68 CPPUNIT_ASSERT(count_i < 2);
72 CPPUNIT_ASSERT(rank_with_i <= rank);
78 CPPUNIT_ASSERT_EQUAL(count_i, 1);
libMesh::Parallel::Communicator * TestCommWorld
processor_id_type rank() const
processor_id_type size() const
bool is_sorted(const std::vector< KeyType > &v)
The parallel sorting method is templated on the type of data which is to be sorted.
void max(const T &r, T &o, Request &req) const
The documentation for this class was generated from the following file: