95 RCP<const Comm<int> > comm = vector.getMap()->getComm();
96 int fail = 0, gfail=0;
98 if (!
fail && ia.getNumEntriesPerID() !=1)
101 if (!
fail && ia.getNumWeightsPerID() !=wdim)
104 if (!
fail && ia.getLocalNumIDs() != vector.getLocalLength())
110 const zgno_t *vtxIds=NULL;
114 size_t nvals = ia.getLocalNumIDs();
115 if (nvals != vector.getLocalLength())
118 ia.getIDsView(vtxIds);
119 ia.getEntriesView(vals, stride);
121 if (!
fail && stride != 1)
135 for (
int w=0; !
fail && w < wdim; w++){
136 ia.getWeightsView(wgt, stride, w);
138 if (!
fail && stride != strides[w])
141 for (
size_t v=0; !
fail && v < vector.getLocalLength(); v++){
142 if (wgt[v*stride] !=
weights[w][v*stride])
156 Tpetra::ScopeGuard tscope(&narg, &arg);
157 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
159 int rank = comm->getRank();
160 int fail = 0, gfail=0;
166 RCP<UserInputForTests> uinput;
167 Teuchos::ParameterList params;
168 params.set(
"input file",
"simple");
169 params.set(
"file type",
"Chaco");
173 catch(std::exception &e){
175 std::cout << e.what() << std::endl;
182 tV = rcp(
new tvector_t(uinput->getUITpetraCrsGraph()->getRowMap()));
184 size_t vlen = tV->getLocalLength();
193 typedef adapter_t::part_t
part_t;
196 memset(p, 0,
sizeof(
part_t) * vlen);
197 ArrayRCP<part_t> solnParts(p, 0, vlen,
true);
199 std::vector<const zscalar_t *> emptyWeights;
200 std::vector<int> emptyStrides;
203 solution.setParts(solnParts);
209 std::cout <<
"Constructed with Tpetra::Vector" << std::endl;
211 RCP<const tvector_t> ctV = rcp_const_cast<const tvector_t>(tV);
212 RCP<adapter_t> tVInput;
217 emptyWeights, emptyStrides));
219 catch (std::exception &e){
221 std::cout << e.what() << std::endl;
225 fail = verifyInputAdapter<tvector_t>(*tVInput, *tV, 0, NULL, NULL);
232 tVInput->applyPartitioningSolution(*tV, vMigrate, solution);
233 newV = rcp(vMigrate);
235 catch (std::exception &e){
242 RCP<const tvector_t> cnewV = rcp_const_cast<const tvector_t>(newV);
243 RCP<Zoltan2::XpetraMultiVectorAdapter<tvector_t> > newInput;
246 emptyWeights, emptyStrides));
248 catch (std::exception &e){
250 std::cout << e.what() << std::endl;
255 std::cout <<
"Constructed with ";
256 std::cout <<
"Tpetra::Vector migrated to proc 0" << std::endl;
258 fail = verifyInputAdapter<tvector_t>(*newInput, *newV, 0, NULL, NULL);
272 std::cout <<
"Constructed with Xpetra::Vector" << std::endl;
275 rcp(
new tvector_t(uinput->getUITpetraCrsGraph()->getRowMap()));
278 RCP<const xvector_t> cxV = rcp_const_cast<const xvector_t>(xV);
279 RCP<Zoltan2::XpetraMultiVectorAdapter<xvector_t> > xVInput;
284 emptyWeights, emptyStrides));
286 catch (std::exception &e){
288 std::cout << e.what() << std::endl;
292 fail = verifyInputAdapter<xvector_t>(*xVInput, *tV, 0, NULL, NULL);
299 xVInput->applyPartitioningSolution(*xV, vMigrate, solution);
301 catch (std::exception &e){
308 RCP<const xvector_t> cnewV(vMigrate);
309 RCP<Zoltan2::XpetraMultiVectorAdapter<xvector_t> > newInput;
313 emptyWeights, emptyStrides));
315 catch (std::exception &e){
317 std::cout << e.what() << std::endl;
322 std::cout <<
"Constructed with ";
323 std::cout <<
"Xpetra::Vector migrated to proc 0" << std::endl;
325 fail = verifyInputAdapter<xvector_t>(*newInput, *newV, 0, NULL, NULL);
335#ifdef HAVE_EPETRA_DATA_TYPES
338 typedef Epetra_Vector evector_t;
341 std::cout <<
"Constructed with Epetra_Vector" << std::endl;
344 rcp(
new Epetra_Vector(uinput->getUIEpetraCrsGraph()->RowMap()));
346 RCP<const evector_t> ceV = rcp_const_cast<const evector_t>(eV);
347 RCP<Zoltan2::XpetraMultiVectorAdapter<evector_t> > eVInput;
349 bool goodAdapter =
true;
353 emptyWeights, emptyStrides));
355 catch (std::exception &e){
356 if (std::is_same<znode_t, Xpetra::EpetraNode>::value) {
359 std::cout << e.what() << std::endl;
364 std::cout <<
"Node type is not supported by Xpetra's Epetra interface;"
365 <<
" Skipping this test." << std::endl;
366 std::cout <<
"FYI: Here's the exception message: " << std::endl
367 << e.what() << std::endl;
374 fail = verifyInputAdapter<evector_t>(*eVInput, *tV, 0, NULL, NULL);
379 evector_t *vMigrate =NULL;
381 eVInput->applyPartitioningSolution(*eV, vMigrate, solution);
383 catch (std::exception &e){
390 RCP<const evector_t> cnewV(vMigrate,
true);
391 RCP<Zoltan2::XpetraMultiVectorAdapter<evector_t> > newInput;
395 emptyWeights, emptyStrides));
397 catch (std::exception &e){
399 std::cout << e.what() << std::endl;
404 std::cout <<
"Constructed with ";
405 std::cout <<
"Epetra_Vector migrated to proc 0" << std::endl;
407 fail = verifyInputAdapter<evector_t>(*newInput, *newV, 0, NULL, NULL);
423 std::cout <<
"PASS" << std::endl;