HP-MPI User's Guide (11th Edition)
Example applications
sort.C
Appendix A 271
//BlockOfEntries::singleStepOddEntries
//
//Function: - Adjust the odd entries.
//
void
BlockOfEntries::singleStepOddEntries()
{
for(int i = 0; i < numOfEntries-1; i += 2) {
if (*(entries[i]) > *(entries[i+1]) ) {
Entry *temp = entries[i+1];
entries[i+1] = entries[i];
entries[i] = temp;
}
}
}
//
//BlockOfEntries::singleStepEvenEntries
//
//Function: - Adjust the even entries.
//
void
BlockOfEntries::singleStepEvenEntries()
{
for(int i = 1; i < numOfEntries-2; i += 2) {
if (*(entries[i]) > *(entries[i+1]) ) {
Entry *temp = entries[i+1];
entries[i+1] = entries[i];
entries[i] = temp;
}
}
}
//
//BlockOfEntries::verifyEntries
//
//Function: - Verify that the block of entries for rank myRank
// is sorted and each entry value is greater than
// or equal to argument baseLine.
//
void
BlockOfEntries::verifyEntries(int myRank, int baseLine)
{