89 const ParameterList& pL = GetParameterList();
91 RCP< const Teuchos::Comm<int> > comm = Teuchos::DefaultComm<int>::getComm();
92 const int myRank = comm->getRank();
94 std::string fileName = pL.get<std::string>(
"filePrefix") +
toString(currentLevel.
GetLevelID()) +
"_" +
toString(myRank) +
"." + pL.get<std::string>(
"fileExt");
95 std::ifstream ifs(fileName.c_str());
98 LO numVertices, numAggregates;
101 ifs >> numAggregates;
102 TEUCHOS_TEST_FOR_EXCEPTION(numVertices <= 0, Exceptions::InvalidArgument, "Number of vertices must be > 0
");
103 TEUCHOS_TEST_FOR_EXCEPTION(numAggregates <= 0, Exceptions::InvalidArgument, "Number of aggregates must be > 0
");
105 Xpetra::UnderlyingLib lib = currentLevel.lib();
106 const int indexBase = 0;
107 RCP<Map> map = MapFactory::Build(lib, numVertices, indexBase, comm);
109 RCP<Aggregates> aggregates = rcp(new Aggregates(map));
110 aggregates->setObjectLabel("User
");
112 aggregates->SetNumAggregates(numAggregates);
114 Teuchos::ArrayRCP<LO> vertex2AggId = aggregates->GetVertex2AggId()->getDataNonConst(0);
115 Teuchos::ArrayRCP<LO> procWinner = aggregates->GetProcWinner() ->getDataNonConst(0);
117 for (LO i = 0; i < numAggregates; i++) {
121 std::vector<LO> list(aggSize);
122 for (int k = 0; k < aggSize; k++) {
123 // FIXME: File contains GIDs, we need LIDs
124 // for now, works on a single processor
128 // Mark first node as root node for the aggregate
129 aggregates->SetIsRoot(list[0]);
131 // Fill vertex2AggId and procWinner structure with information
132 for (int k = 0; k < aggSize; k++) {
133 vertex2AggId[list[k]] = i;
134 procWinner [list[k]] = myRank;
138 // FIXME: do the proper check whether aggregates cross interprocessor boundary
139 aggregates->AggregatesCrossProcessors(false);
143 GetOStream(Statistics0) << aggregates->description() << std::endl;