//! 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
/* * Set up all elements of the scene using [importer] to load any assets from disk. * * [ambientLightObject] - Global scene object that contains the global ambient light. * [directLightObject] - Global scene object that contains the global directional light. * [playerObject] - Scene object that contains the player mesh & renderer. */ void PoolScene::Setup(GTE::AssetImporter& importer, GTE::SceneObjectSharedPtr ambientLightObject, GTE::SceneObjectSharedPtr directionalLightObject, GTE::SceneObjectSharedPtr playerObject) { importer.SetBoolProperty(GTE::AssetImporterBoolProperty::PreserveFBXPivots, false); // get reference to the engine's object manager GTE::EngineObjectManager * objectManager = GTE::Engine::Instance()->GetEngineObjectManager(); sceneRoot = objectManager->CreateSceneObject(); ASSERT(sceneRoot.IsValid(), "Could not create scene root for pool scene!\n"); SetupTerrain(importer); SetupStructures(importer); SetupPlants(importer); SetupExtra(importer); SetupWaterSurface(importer); SetupLights(importer, playerObject); this->directionalLightObject = directionalLightObject; this->playerObject = playerObject; }
//! 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