67 RCP<const Comm<int> > comm = M.getComm();
68 int fail = 0, gfail=0;
73 if (M.getLocalNumRows()){
81 ArrayRCP<const zgno_t> colIds;
82 ArrayRCP<const offset_t> offsets;
91 if (nrows != M.getLocalNumRows())
108 Tpetra::ScopeGuard tscope(&narg, &arg);
109 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
111 int rank = comm->getRank();
112 int fail = 0, gfail=0;
118 RCP<UserInputForTests> uinput;
119 Teuchos::ParameterList params;
120 params.set(
"input file",
"simple");
121 params.set(
"file type",
"Chaco");
126 catch(std::exception &e){
128 std::cout << e.what() << std::endl;
135 tM = uinput->getUITpetraCrsMatrix();
136 size_t nrows = tM->getLocalNumRows();
146 typedef adapter_t::part_t
part_t;
149 memset(p, 0,
sizeof(
part_t) * nrows);
150 ArrayRCP<part_t> solnParts(p, 0, nrows,
true);
152 soln_t solution(env, comm, nWeights);
153 solution.setParts(solnParts);
159 std::cout <<
"Input adapter for Tpetra::CrsMatrix" << std::endl;
161 RCP<const tmatrix_t> ctM = rcp_const_cast<const tmatrix_t>(tM);
162 RCP<Zoltan2::XpetraCrsMatrixAdapter<tmatrix_t> > tMInput;
168 catch (std::exception &e){
170 std::cout << e.what() << std::endl;
181 tMInput->applyPartitioningSolution(*tM, mMigrate, solution);
182 newM = rcp(mMigrate);
184 catch (std::exception &e){
186 std::cout <<
"Error caught: " << e.what() << std::endl;
192 RCP<const tmatrix_t> cnewM = rcp_const_cast<const tmatrix_t>(newM);
193 RCP<Zoltan2::XpetraCrsMatrixAdapter<tmatrix_t> > newInput;
197 catch (std::exception &e){
199 std::cout << e.what() << std::endl;
205 "Input adapter for Tpetra::CrsMatrix migrated to proc 0" <<
222 std::cout <<
"Input adapter for Xpetra::CrsMatrix" << std::endl;
224 RCP<xmatrix_t> xM = uinput->getUIXpetraCrsMatrix();
225 RCP<const xmatrix_t> cxM = rcp_const_cast<const xmatrix_t>(xM);
226 RCP<Zoltan2::XpetraCrsMatrixAdapter<xmatrix_t> > xMInput;
232 catch (std::exception &e){
234 std::cout << e.what() << std::endl;
245 xMInput->applyPartitioningSolution(*xM, mMigrate, solution);
247 catch (std::exception &e){
248 std::cout <<
"Error caught: " << e.what() << std::endl;
255 RCP<const xmatrix_t> cnewM(mMigrate);
256 RCP<Zoltan2::XpetraCrsMatrixAdapter<xmatrix_t> > newInput;
261 catch (std::exception &e){
263 std::cout << e.what() << std::endl;
269 "Input adapter for Xpetra::CrsMatrix migrated to proc 0" <<
282#ifdef HAVE_EPETRA_DATA_TYPES
285 typedef Epetra_CrsMatrix ematrix_t;
288 std::cout <<
"Input adapter for Epetra_CrsMatrix" << std::endl;
290 RCP<ematrix_t> eM = uinput->getUIEpetraCrsMatrix();
291 RCP<const ematrix_t> ceM = rcp_const_cast<const ematrix_t>(eM);
292 RCP<Zoltan2::XpetraCrsMatrixAdapter<ematrix_t> > eMInput;
294 bool goodAdapter =
true;
299 catch (std::exception &e){
300 if (std::is_same<znode_t, Xpetra::EpetraNode>::value) {
303 std::cout << e.what() << std::endl;
308 std::cout <<
"Node type is not supported by Xpetra's Epetra interface;"
309 <<
" Skipping this test." << std::endl;
310 std::cout <<
"FYI: Here's the exception message: " << std::endl
311 << e.what() << std::endl;
323 ematrix_t *mMigrate =NULL;
325 eMInput->applyPartitioningSolution(*eM, mMigrate, solution);
327 catch (std::exception &e){
328 std::cout <<
"Error caught: " << e.what() << std::endl;
335 RCP<const ematrix_t> cnewM(mMigrate,
true);
336 RCP<Zoltan2::XpetraCrsMatrixAdapter<ematrix_t> > newInput;
341 catch (std::exception &e){
343 std::cout << e.what() << std::endl;
349 "Input adapter for Epetra_CrsMatrix migrated to proc 0" <<
368 std::cout <<
"PASS" << std::endl;