//! Setup Hierarchy object virtual void SetupHierarchy(Hierarchy& H) const { TEUCHOS_TEST_FOR_EXCEPTION(!H.GetLevel(0)->IsAvailable("A"), Exceptions::RuntimeError, "No fine level operator"); // Setup Matrix // TODO: I should certainly undo this somewhere... RCP<Level> l = H.GetLevel(0); RCP<Matrix> Op = l->Get<RCP<Matrix> >("A"); Xpetra::UnderlyingLib lib = Op->getRowMap()->lib(); H.setlib(lib); SetupMatrix(*Op); SetupExtra(H); // Setup Hierarchy H.SetMaxCoarseSize(maxCoarseSize_); H.SetDefaultVerbLevel(verbosity_); if (graphOutputLevel_ >= 0) H.EnableGraphDumping("dep_graph.dot", graphOutputLevel_); // TODO: coarsestLevelManager H.Clear(); int levelID = 0; int lastLevelID = numDesiredLevel_ - 1; bool isLastLevel = false; while (!isLastLevel) { bool r = H.Setup(levelID, LvlMngr(levelID-1, lastLevelID), LvlMngr(levelID, lastLevelID), LvlMngr(levelID+1, lastLevelID)); isLastLevel = r || (levelID == lastLevelID); levelID++; } RCP<Teuchos::FancyOStream> fos = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); fos->setOutputToRootOnly(0); H.print(*fos,verbosity_); // When we reuse hierarchy, it is necessary that we don't // change the number of levels. We also cannot make requests // for coarser levels, because we don't construct all the // data on previous levels. For instance, let's say our first // run constructed three levels. If we try to do requests during // next setup for the fourth level, it would need Aggregates // which we didn't construct for level 3 because we reused P. // To fix this situation, we change the number of desired levels // here. numDesiredLevel_ = levelID; WriteData<Matrix>(H, matricesToPrint_, "A"); WriteData<Matrix>(H, prolongatorsToPrint_, "P"); WriteData<Matrix>(H, restrictorsToPrint_, "R"); } //SetupHierarchy
//! Setup Hierarchy object virtual void SetupHierarchy(Hierarchy & H) const { TEUCHOS_TEST_FOR_EXCEPTION(!H.GetLevel(0)->IsAvailable("A"), Exceptions::RuntimeError, "No fine level operator"); // Setup Matrix // TODO: I should certainly undo this somewhere... RCP<Level> l = H.GetLevel(0); RCP<Matrix> Op = l->Get<RCP<Matrix> >("A"); SetupMatrix(*Op); SetupExtra(H); // Setup Hierarchy H.SetMaxCoarseSize(maxCoarseSize_); H.SetDefaultVerbLevel(verbosity_); if (graphOutputLevel_ >= 0) H.EnableGraphDumping("dep_graph.dot", graphOutputLevel_); // TODO: coarsestLevelManager int levelID = 0; int lastLevelID = numDesiredLevel_ - 1; bool isLastLevel = false; while (!isLastLevel) { bool r = H.Setup(levelID, LvlMngr(levelID-1, lastLevelID), LvlMngr(levelID, lastLevelID), LvlMngr(levelID+1, lastLevelID)); isLastLevel = r || (levelID == lastLevelID); levelID++; } WriteData<Matrix>(H, matricesToPrint_, "A"); WriteData<Matrix>(H, prolongatorsToPrint_, "P"); WriteData<Matrix>(H, restrictorsToPrint_, "R"); } //SetupHierarchy