51 #include <Teuchos_GlobalMPISession.hpp> 52 #include <Teuchos_DefaultComm.hpp> 53 #include <Teuchos_RCP.hpp> 54 #include <Teuchos_CommHelpers.hpp> 58 using Teuchos::DefaultComm;
60 int main(
int argc,
char *argv[])
62 Teuchos::GlobalMPISession session(&argc, &argv);
63 RCP<const Comm<int> > comm = DefaultComm<int>::getComm();
64 int rank = comm->getRank();
65 int nprocs = comm->getSize();
66 int fail = 0, gfail=0;
75 zgno_t base = rank * numLocalIds * numLocalIds;
77 for (
zlno_t i=0; i < numLocalIds; i++){
80 weights[i*nWeights + 1] = (nprocs-rank) / (i+1);
87 std::vector<const zscalar_t *> weightValues;
88 std::vector<int> strides;
90 weightValues.push_back(
weights);
91 weightValues.push_back(
weights + 1);
96 weightValues, strides);
105 const zgno_t *globalIdsIn;
107 int weightStridesIn[2];
111 for (
int w=0; !
fail && w < nWeights; w++)
116 int incr1 = weightStridesIn[0];
117 int incr2 = weightStridesIn[1];
119 for (
zlno_t i=0; !
fail && i < numLocalIds; i++){
121 if (globalIdsIn[i] !=
zgno_t(base+i))
124 if (!
fail && w1[i*incr1] != 1.0)
139 std::cout <<
"PASS" << std::endl;
int globalFail(const RCP< const Comm< int > > &comm, int fail)
A simple class that can be the User template argument for an InputAdapter.
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater...
common code used by tests
This class represents a collection of global Identifiers and their associated weights, if any.
size_t getLocalNumIDs() const
Returns the number of objects on this process.
void getIDsView(const gno_t *&Ids) const
Provide a pointer to this process' identifiers.
static const std::string fail
Defines the BasicIdentifierAdapter class.
void printFailureCode(const RCP< const Comm< int > > &comm, int fail)
void getWeightsView(const scalar_t *&weights, int &stride, int idx) const
Provide pointer to a weight array with stride.