Go to the documentation of this file.
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);
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;
int globalFail(const RCP< const Comm< int > > &comm, int fail)
void printFailureCode(const RCP< const Comm< int > > &comm, int fail)
void getIDsView(const gno_t *&Ids) const
Provide a pointer to this process' identifiers.
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater....
This class represents a collection of global Identifiers and their associated weights,...
void getWeightsView(const scalar_t *&weights, int &stride, int idx) const
size_t getLocalNumIDs() const
Returns the number of objects on this process.
A simple class that can be the User template argument for an InputAdapter.
static const std::string fail
common code used by tests
Defines the BasicIdentifierAdapter class.