51 const ParameterList& pL = GetParameterList();
53 RCP<const Teuchos::Comm<int> > comm = Teuchos::DefaultComm<int>::getComm();
54 const int myRank = comm->getRank();
56 std::string fileName = pL.get<std::string>(
"filePrefix") +
toString(currentLevel.
GetLevelID()) +
"_" +
toString(myRank) +
"." + pL.get<std::string>(
"fileExt");
57 std::ifstream ifs(fileName.c_str());
60 LO numVertices, numAggregates;
64 TEUCHOS_TEST_FOR_EXCEPTION(numVertices <= 0, Exceptions::InvalidArgument, "Number of vertices must be > 0
");
65 TEUCHOS_TEST_FOR_EXCEPTION(numAggregates <= 0, Exceptions::InvalidArgument, "Number of aggregates must be > 0
");
67 Xpetra::UnderlyingLib lib = currentLevel.lib();
68 const int indexBase = 0;
69 RCP<Map> map = MapFactory::Build(lib, numVertices, indexBase, comm);
71 RCP<Aggregates> aggregates = rcp(new Aggregates(map));
72 aggregates->setObjectLabel("User
");
74 aggregates->SetNumAggregates(numAggregates);
76 Teuchos::ArrayRCP<LO> vertex2AggId = aggregates->GetVertex2AggId()->getDataNonConst(0);
77 Teuchos::ArrayRCP<LO> procWinner = aggregates->GetProcWinner()->getDataNonConst(0);
79 for (LO i = 0; i < numAggregates; i++) {
83 std::vector<LO> list(aggSize);
84 for (int k = 0; k < aggSize; k++) {
85 // FIXME: File contains GIDs, we need LIDs
86 // for now, works on a single processor
90 // Mark first node as root node for the aggregate
91 aggregates->SetIsRoot(list[0]);
93 // Fill vertex2AggId and procWinner structure with information
94 for (int k = 0; k < aggSize; k++) {
95 vertex2AggId[list[k]] = i;
96 procWinner[list[k]] = myRank;
100 // FIXME: do the proper check whether aggregates cross interprocessor boundary
101 aggregates->AggregatesCrossProcessors(false);
105 GetOStream(Statistics0) << aggregates->description() << std::endl;