44 const zgno_t *primaryIds,
const offset_t *offsets,
const zgno_t *secondaryIds,
Type type)
46 const auto rank = comm->getRank();
47 const auto nprocs = comm->getSize();
48 const std::string primaryIdName = type ==
Type::CRS ?
"row" :
"col";
52 for (
int p=0; p < nprocs; p++){
54 std::cout << rank <<
":" << std::endl;
55 for (
zlno_t i=0; i < nPrimaryIds; i++){
56 std::cout <<
" " << primaryIdName <<
" " << primaryIds[i] <<
": ";
57 for (offset_t j=offsets[i]; j < offsets[i+1]; j++){
58 std::cout << secondaryIds[j] <<
" ";
60 std::cout << std::endl;
75 RCP<const Comm<int> > comm = M.getComm();
76 int fail = 0, gfail=0;
81 if (M.getLocalNumRows()){
89 ArrayRCP<const zgno_t> colIds;
90 ArrayRCP<const offset_t> offsets;
99 if (nrows != M.getLocalNumRows())
105 printMatrix<offset_t>(comm, nrows, rowIds, offsets.getRawPtr(),
113 const zgno_t *colIds2=
nullptr;
116 ArrayRCP<const zgno_t> ccsRowIds;
117 ArrayRCP<const offset_t> ccsOffsets;
120 printMatrix<offset_t>(comm, nCols, colIds2, ccsOffsets.getRawPtr(),
128 Tpetra::ScopeGuard tscope(&narg, &arg);
129 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
131 int rank = comm->getRank();
132 int fail = 0, gfail=0;
138 RCP<UserInputForTests> uinput;
139 Teuchos::ParameterList params;
140 params.set(
"input file",
"simple");
141 params.set(
"file type",
"Chaco");
146 catch(std::exception &e){
148 std::cout << e.what() << std::endl;
155 tM = uinput->getUITpetraCrsMatrix();
156 size_t nrows = tM->getLocalNumRows();
166 typedef adapter_t::part_t
part_t;
169 memset(p, 0,
sizeof(
part_t) * nrows);
170 ArrayRCP<part_t> solnParts(p, 0, nrows,
true);
172 soln_t solution(env, comm, nWeights);
173 solution.setParts(solnParts);
179 std::cout <<
"Input adapter for Tpetra::CrsMatrix" << std::endl;
181 RCP<const tmatrix_t> ctM = rcp_const_cast<const tmatrix_t>(tM);
182 RCP<Zoltan2::XpetraCrsMatrixAdapter<tmatrix_t> > tMInput;
188 catch (std::exception &e){
190 std::cout << e.what() << std::endl;
194 fail = verifyInputAdapter<tmatrix_t>(*tMInput, *tM);
201 tMInput->applyPartitioningSolution(*tM, mMigrate, solution);
202 newM = rcp(mMigrate);
204 catch (std::exception &e){
206 std::cout <<
"Error caught: " << e.what() << std::endl;
212 RCP<const tmatrix_t> cnewM = rcp_const_cast<const tmatrix_t>(newM);
213 RCP<Zoltan2::XpetraCrsMatrixAdapter<tmatrix_t> > newInput;
217 catch (std::exception &e){
219 std::cout << e.what() << std::endl;
225 "Input adapter for Tpetra::CrsMatrix migrated to proc 0" <<
228 fail = verifyInputAdapter<tmatrix_t>(*newInput, *newM);
243 std::cout <<
"Input adapter for Xpetra::CrsMatrix" << std::endl;
245 RCP<xmatrix_t> xM = uinput->getUIXpetraCrsMatrix();
246 RCP<const xmatrix_t> cxM = rcp_const_cast<const xmatrix_t>(xM);
247 RCP<Zoltan2::XpetraCrsMatrixAdapter<xmatrix_t> > xMInput;
253 catch (std::exception &e){
255 std::cout << e.what() << std::endl;
259 fail = verifyInputAdapter<xmatrix_t>(*xMInput, *tM);
266 xMInput->applyPartitioningSolution(*xM, mMigrate, solution);
268 catch (std::exception &e){
269 std::cout <<
"Error caught: " << e.what() << std::endl;
276 RCP<const xmatrix_t> cnewM(mMigrate);
277 RCP<Zoltan2::XpetraCrsMatrixAdapter<xmatrix_t> > newInput;
282 catch (std::exception &e){
284 std::cout << e.what() << std::endl;
290 "Input adapter for Xpetra::CrsMatrix migrated to proc 0" <<
293 fail = verifyInputAdapter<xmatrix_t>(*newInput, *newM);
307 std::cout <<
"PASS" << std::endl;