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