50 RCP<Matrix> A = Get<RCP<Matrix> >(fineLevel,
"A");
51 RCP<MultiVector> fineNullspace = Get<RCP<MultiVector> >(fineLevel,
"Nullspace");
53 TEUCHOS_TEST_FOR_EXCEPTION(A->GetFixedBlockSize() != 1,
Exceptions::RuntimeError,
"Block size > 1 has not been implemented");
55 const Teuchos::ParameterList& pL = GetParameterList();
57 std::string mapFile = pL.get<std::string>(
"mapFileName");
58 RCP<const Map> rowMap = A->getRowMap();
59 RCP<const Map> coarseMap = Xpetra::IO<Scalar, LocalOrdinal, GlobalOrdinal, Node>::ReadMap(mapFile, rowMap->lib(), rowMap->getComm());
60 Set(coarseLevel,
"CoarseMap", coarseMap);
62 std::string matrixFile = pL.get<std::string>(
"matrixFileName");
63 RCP<Matrix> P = Xpetra::IO<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Read(matrixFile, rowMap, coarseMap, coarseMap, rowMap);
65 Set(coarseLevel,
"P", P);
68 RCP<Matrix> P1 = Xpetra::MatrixMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Multiply(*A,
false, *P,
false);
69 P = Xpetra::IO<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Read(matrixFile, rowMap, P1->getColMap(), coarseMap, rowMap);
70 Set(coarseLevel,
"P", P);
73 RCP<MultiVector> coarseNullspace = MultiVectorFactory::Build(coarseMap, fineNullspace->getNumVectors());
74 P->apply(*fineNullspace, *coarseNullspace, Teuchos::TRANS, Teuchos::ScalarTraits<SC>::one(), Teuchos::ScalarTraits<SC>::zero());
75 Set(coarseLevel,
"Nullspace", coarseNullspace);
78 size_t n = Teuchos::as<size_t>(sqrt(coarseMap->getGlobalNumElements()));
79 TEUCHOS_TEST_FOR_EXCEPTION(n * n != coarseMap->getGlobalNumElements(),
Exceptions::RuntimeError,
"Unfortunately, this is not the case, don't know what to do");
81 RCP<MultiVector> coarseCoords = MultiVectorFactory::Build(coarseMap, 2);
82 ArrayRCP<Scalar> x = coarseCoords->getDataNonConst(0), y = coarseCoords->getDataNonConst(1);
83 for (
size_t LID = 0; LID < coarseMap->getLocalNumElements(); ++LID) {
84 GlobalOrdinal GID = coarseMap->getGlobalElement(LID) - coarseMap->getIndexBase();
89 Set(coarseLevel,
"Coordinates", coarseCoords);
92 RCP<ParameterList> params = rcp(
new ParameterList());
93 params->set(
"printLoadBalancingInfo",
true);