51 #include <Teuchos_DefaultComm.hpp>
52 #include <Teuchos_RCP.hpp>
53 #include <Teuchos_CommHelpers.hpp>
55 int main(
int narg,
char *arg[]) {
56 Tpetra::ScopeGuard tscope(&narg, &arg);
57 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
59 int rank = comm->getRank();
60 int nprocs = comm->getSize();
61 int fail = 0, gfail = 0;
69 zgno_t myFirstId = rank * numLocalIds * numLocalIds;
71 for (
zlno_t i=0; i < numLocalIds; i++){
72 myIds[i] =
zgno_t(myFirstId+i);
73 weights[i*nWeights] = 1.0;
74 weights[i*nWeights + 1] = (nprocs-rank) / (i+1);
78 std::vector<const zscalar_t *> weightValues;
79 std::vector<int> strides;
81 weightValues.push_back(weights);
82 weightValues.push_back(weights + 1);
87 weightValues, strides);
98 int weightStridesIn[2];
102 for (
int w=0; !fail && w < nWeights; w++) {
108 int incr1 = weightStridesIn[0];
109 int incr2 = weightStridesIn[1];
111 for (
zlno_t i=0; !fail && i < numLocalIds; i++){
112 if (globalIdsIn[i] !=
zgno_t(myFirstId+i)) {
115 if (!fail && w1[i*incr1] != 1.0) {
118 if (!fail && w2[i*incr2] != weights[i*nWeights+1]) {
131 std::cout <<
"PASS" << std::endl;
void printFailureCode(const Comm< int > &comm, int fail)
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.
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
Provide pointer to a weight array with stride.
size_t getLocalNumIDs() const
Returns the number of objects on this process.