58 using Teuchos::ArrayRCP;
61 int main(
int argc,
char *argv[])
63 Teuchos::GlobalMPISession session(&argc, &argv);
64 RCP<const Comm<int> > comm = Teuchos::DefaultComm<int>::getComm();
65 int rank = comm->getRank();
70 int *buf =
new int [10];
71 for (
int i=0; i < 10; i++)
75 cout << endl <<
"10 distinct int gids" << endl;
76 ArrayRCP<const int> intGids = Teuchos::arcp(buf, 0, 10,
true);
78 cout <<
"Lookup:" << endl;
79 for (
int i=0; i < 10; i++){
80 cout <<
"Gid: " << buf[i] <<
" idx: " << glhInt.
lookup(buf[i]) << endl;
84 cout << endl <<
"10 int gids with duplicates" << endl;
85 for (
int i=0; i < 5; i++)
86 buf[i] = buf[i+5] = i;
88 cout <<
"Lookup:" << endl;
89 for (
int i=0; i < 10; i++){
90 cout <<
"Gid: " << buf[i] <<
" idx: " << glhIntDup.
lookup(buf[i]) << endl;
94 cout << endl <<
"4 string gids" << endl;
95 string *sbuf =
new string [4];
96 sbuf[0] = string(
"gid number 0");
97 sbuf[1] = string(
"gid number 1");
98 sbuf[2] = string(
"gid number 2");
99 sbuf[3] = string(
"gid number 3");
100 ArrayRCP<const string> sGids = Teuchos::arcp(sbuf, 0, 4,
true);
102 cout <<
"Lookup:" << endl;
103 for (
int i=0; i < 4; i++){
104 cout <<
"Gid: " << sbuf[i] <<
" idx: " << glhString.
lookup(sbuf[i]) << endl;
108 cout << endl <<
"4 string gids with a duplicate" << endl;
109 sbuf[3] = string(
"gid number 0");
111 cout <<
"Lookup:" << endl;
112 for (
int i=0; i < 4; i++){
113 cout <<
"Gid: " << sbuf[i] <<
" idx: " << glhStringDup.
lookup(sbuf[i]) << endl;
116 cout <<
"PASS" << endl;
Defines GidLookupHelper class.
int main(int argc, char *argv[])
lno_t lookup(const T gid) const
the index of the global id in the gidList passed into the constructor.
The user parameters, debug, timing and memory profiling output objects, and error checking methods...
A class to do GID lookups.