110 Tpetra::ScopeGuard tscope(&narg, &arg);
111 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
113 int rank = comm->getRank();
114 int fail = 0, gfail=0;
120 RCP<UserInputForTests> uinput;
121 Teuchos::ParameterList params;
122 params.set(
"input file",
"simple");
123 params.set(
"file type",
"Chaco");
128 catch(std::exception &e){
130 std::cout << e.what() << std::endl;
137 tG = uinput->getUITpetraCrsGraph();
138 size_t nvtx = tG->getLocalNumRows();
149 typedef adapter_t::part_t
part_t;
152 memset(p, 0,
sizeof(
part_t) * nvtx);
153 ArrayRCP<part_t> solnParts(p, 0, nvtx,
true);
155 soln_t solution(env, comm, nWeights);
156 solution.setParts(solnParts);
162 std::cout <<
"Input adapter for Tpetra::CrsGraph" << std::endl;
164 RCP<const tgraph_t> ctG = rcp_const_cast<const tgraph_t>(tG);
165 RCP<Zoltan2::XpetraCrsGraphAdapter<tgraph_t> > tGInput;
171 catch (std::exception &e){
173 std::cout << e.what() << std::endl;
177 fail = verifyInputAdapter<tgraph_t>(*tGInput, *tG);
184 tGInput->applyPartitioningSolution( *tG, mMigrate, solution);
185 newG = rcp(mMigrate);
187 catch (std::exception &e){
194 RCP<const tgraph_t> cnewG = rcp_const_cast<const tgraph_t>(newG);
195 RCP<Zoltan2::XpetraCrsGraphAdapter<tgraph_t> > newInput;
199 catch (std::exception &e){
201 std::cout << e.what() << std::endl;
207 "Input adapter for Tpetra::CrsGraph migrated to proc 0" <<
210 fail = verifyInputAdapter<tgraph_t>(*newInput, *newG);
224 std::cout <<
"Input adapter for Xpetra::CrsGraph" << std::endl;
226 RCP<xgraph_t> xG = uinput->getUIXpetraCrsGraph();
227 RCP<const xgraph_t> cxG = rcp_const_cast<const xgraph_t>(xG);
228 RCP<Zoltan2::XpetraCrsGraphAdapter<xgraph_t> > xGInput;
234 catch (std::exception &e){
236 std::cout << e.what() << std::endl;
240 fail = verifyInputAdapter<xgraph_t>(*xGInput, *tG);
247 xGInput->applyPartitioningSolution( *xG, mMigrate, solution);
249 catch (std::exception &e){
256 RCP<const xgraph_t> cnewG(mMigrate);
257 RCP<Zoltan2::XpetraCrsGraphAdapter<xgraph_t> > newInput;
262 catch (std::exception &e){
264 std::cout << e.what() << std::endl;
270 "Input adapter for Xpetra::CrsGraph migrated to proc 0" <<
273 fail = verifyInputAdapter<xgraph_t>(*newInput, *newG);
283#ifdef HAVE_EPETRA_DATA_TYPES
286 typedef Epetra_CrsGraph egraph_t;
289 std::cout <<
"Input adapter for Epetra_CrsGraph" << std::endl;
291 RCP<egraph_t> eG = uinput->getUIEpetraCrsGraph();
292 RCP<const egraph_t> ceG = rcp_const_cast<const egraph_t>(eG);
293 RCP<Zoltan2::XpetraCrsGraphAdapter<egraph_t> > eGInput;
295 bool goodAdapter =
true;
300 catch (std::exception &e){
301 if (std::is_same<znode_t, Xpetra::EpetraNode>::value) {
304 std::cout << e.what() << std::endl;
309 std::cout <<
"Node type is not supported by Xpetra's Epetra interface;"
310 <<
" Skipping this test." << std::endl;
311 std::cout <<
"FYI: Here's the exception message: " << std::endl
312 << e.what() << std::endl;
319 fail = verifyInputAdapter<egraph_t>(*eGInput, *tG);
324 egraph_t *mMigrate =NULL;
326 eGInput->applyPartitioningSolution( *eG, mMigrate, solution);
328 catch (std::exception &e){
335 RCP<const egraph_t> cnewG(mMigrate,
true);
336 RCP<Zoltan2::XpetraCrsGraphAdapter<egraph_t> > newInput;
341 catch (std::exception &e){
343 std::cout << e.what() << std::endl;
349 "Input adapter for Epetra_CrsGraph migrated to proc 0" <<
352 fail = verifyInputAdapter<egraph_t>(*newInput, *newG);
368 std::cout <<
"PASS" << std::endl;