HP-MPI User's Guide (11th Edition)

Example applications
sort.C
Appendix A 269
Entry **entries;
int numOfEntries;
public:
BlockOfEntries(int *numOfEntries_p, int offset);
~BlockOfEntries();
int getnumOfEntries()
{ return numOfEntries; }
void setLeftShadow(const Entry &e)
{ *(entries[0]) = e; }
void setRightShadow(const Entry &e)
{ *(entries[numOfEntries-1]) = e; }
const Entry& getLeftEnd()
{ return *(entries[1]); }
const Entry& getRightEnd()
{ return *(entries[numOfEntries-2]); }
void singleStepOddEntries();
void singleStepEvenEntries();
void verifyEntries(int myRank, int baseLine);
void printEntries(int myRank);
};
//
// Class member definitions.
//
const Entry MAXENTRY(INT_MAX);
const Entry MINENTRY(INT_MIN);
//
//BlockOfEntries::BlockOfEntries
//
//Function:- create the block of entries.
//
BlockOfEntries::BlockOfEntries(int *numOfEntries_p, int
myRank)
{
//
// Initialize the random number generator's seed based on the
caller's rank;
// thus, each rank should (but might not) get different random
values.
//
srand((unsigned int) myRank);
numOfEntries = NUM_OF_ENTRIES_PER_RANK;