16 #include <Teuchos_DefaultComm.hpp>
17 #include <Teuchos_RCP.hpp>
18 #include <Teuchos_CommHelpers.hpp>
20 int main(
int narg,
char *arg[]) {
21 Tpetra::ScopeGuard tscope(&narg, &arg);
22 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
24 int rank = comm->getRank();
25 int nprocs = comm->getSize();
26 int fail = 0, gfail = 0;
34 zgno_t myFirstId = rank * numLocalIds * numLocalIds;
36 for (
zlno_t i=0; i < numLocalIds; i++){
37 myIds[i] =
zgno_t(myFirstId+i);
38 weights[i*nWeights] = 1.0;
39 weights[i*nWeights + 1] = (nprocs-rank) / (i+1);
43 std::vector<const zscalar_t *> weightValues;
44 std::vector<int> strides;
46 weightValues.push_back(weights);
47 weightValues.push_back(weights + 1);
52 weightValues, strides);
63 int weightStridesIn[2];
67 for (
int w=0; !fail && w < nWeights; w++) {
73 int incr1 = weightStridesIn[0];
74 int incr2 = weightStridesIn[1];
76 for (
zlno_t i=0; !fail && i < numLocalIds; i++){
77 if (globalIdsIn[i] !=
zgno_t(myFirstId+i)) {
80 if (!fail && w1[i*incr1] != 1.0) {
83 if (!fail && w2[i*incr2] != weights[i*nWeights+1]) {
96 std::cout <<
"PASS" << std::endl;
void printFailureCode(const Comm< int > &comm, int fail)
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > userTypes_t
void getIDsView(const gno_t *&Ids) const
Provide a pointer to this process' identifiers.
int main(int narg, char **arg)
common code used by tests
This class represents a collection of global Identifiers and their associated weights, if any.
Tpetra::Map::local_ordinal_type zlno_t
static const std::string fail
Defines the BasicIdentifierAdapter class.
int globalFail(const Comm< int > &comm, int fail)
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater...
void getWeightsView(const scalar_t *&weights, int &stride, int idx) const
Tpetra::Map::global_ordinal_type zgno_t
size_t getLocalNumIDs() const
Returns the number of objects on this process.