57 #include <Teuchos_GlobalMPISession.hpp>
64 Teuchos::RCP<
const Teuchos::Comm<int> > &tcomm , T &val, T &higherVal)
66 const Teuchos::Comm<int> *comm = tcomm.get();
68 T valueList[2] = {val, higherVal};
71 if (id::hasUniqueKey())
74 std::cout <<
"ID type: " << id::name() << std::endl;
75 std::cout <<
"Value: " << id::stringify(val) << std::endl;
76 std::cout <<
"\"Higher\" value: " << id::stringify(higherVal) << std::endl;
77 std::cout <<
"Int hash code (non-unique): " << id::hashCode(val) << std::endl;
78 std::cout <<
"Supports unique key: " << id::hasUniqueKey() << std::endl;
79 if (id::hasUniqueKey())
80 std::cout <<
"Key value: " << k << std::endl;
81 std::cout <<
"Is Teuchos Global Ordinal: " << id::isGlobalOrdinal() << std::endl;
82 std::cout <<
"Is valid id type: " << id::is_valid_id_type() << std::endl;
86 bool supported =
true;
88 std::cout <<
"minMax: ";
90 id::minMax(valueList, 2, lo, hi);
97 std::cout << id::stringify(lo) <<
", " << id::stringify(hi) << std::endl;
99 std::cout <<
"not supported" << std::endl;
105 std::cout <<
"global minMax: ";
107 id::globalMinMax(*comm,
false, lo, hi, gmin, gmax);
114 std::cout << id::stringify(lo) <<
", " << id::stringify(hi) << std::endl;
116 std::cout <<
"not supported" << std::endl;
122 std::cout <<
"Difference : ";
124 diff = id::difference(val, higherVal);
131 std::cout << id::stringify(diff) << std::endl;
133 std::cout <<
"not supported" << std::endl;
139 std::cout <<
"Are consecutive: ";
141 consec = id::areConsecutive(valueList, 2);
148 std::cout << consec << std::endl;
150 std::cout <<
"not supported" << std::endl;
152 std::cout << std::endl;
154 int main(
int argc,
char *argv[])
156 Teuchos::GlobalMPISession session(&argc, &argv);
157 Teuchos::RCP<const Teuchos::Comm<int> > nullComm;
158 Teuchos::RCP<const Teuchos::Comm<int> > comm =
159 Teuchos::DefaultComm<int>::getDefaultSerialComm(nullComm);
161 int rank = session.getRank();
166 unsigned char uc=
'A';
167 unsigned char uc_other =
'Z';
169 short int si_other =11024;
170 unsigned short int usi=1024;
171 unsigned short int usi_other =11024;
174 unsigned int ui=1024;
175 unsigned int ui_other=11024;
177 long int li_other=11024;
178 long unsigned int lui =1024;
179 long unsigned int lui_other =11024;
180 #ifdef HAVE_ZOLTAN2_LONG_LONG
181 long long int lli = 3000000000;
182 long long int lli_other = 3102400000000;
183 unsigned long long int ulli = 3000000000;
184 unsigned long long int ulli_other = 3102400000000;
186 std::pair<int, int> pairVals(1024, 1024);
187 std::pair<int, int> pairVals_other(11024, 11024);
189 std::pair<long, long> pairValsLong(1024, 1024);
190 std::pair<long, long> pairValsLong_other(11024, 11024);
192 string strVal(
"right front wheel");
193 string strVal_other(
"left front wheel");
203 #ifdef HAVE_ZOLTAN2_LONG_LONG
211 std::cout <<
"PASS" << std::endl;
common code used by tests
Defines basic traits for user global identifiers.
int main(int argc, char *argv[])
The functions to be defined for users' global ID types.
void check_traits(Teuchos::RCP< const Teuchos::Comm< int > > &tcomm, T &val, T &higherVal)