void PermutingSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level ¤tLevel) const { currentLevel.DeclareInput("permP", permFact_.get()); currentLevel.DeclareInput("permQT", permFact_.get()); currentLevel.DeclareInput("A", permFact_.get()); // this is the permuted and scaled A!!! currentLevel.DeclareInput("permScaling", permFact_.get()); }
void PermutingSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level& currentLevel) const { currentLevel.DeclareInput("permP", permFact_.get()); currentLevel.DeclareInput("permQT", permFact_.get()); currentLevel.DeclareInput("permScaling", permFact_.get()); s_->DeclareInput(currentLevel); }
void RebalanceBlockRestrictionFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level &fineLevel, Level &coarseLevel) const { Input(coarseLevel, "R"); std::vector<Teuchos::RCP<const FactoryManagerBase> >::const_iterator it; for(it = FactManager_.begin(); it!=FactManager_.end(); ++it) { SetFactoryManager fineSFM (rcpFromRef(fineLevel), *it); SetFactoryManager coarseSFM(rcpFromRef(coarseLevel), *it); coarseLevel.DeclareInput("Importer",(*it)->GetFactory("Importer").get(), this); coarseLevel.DeclareInput("Nullspace",(*it)->GetFactory("Nullspace").get(), this); } }
void SimpleSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level ¤tLevel) const { currentLevel.DeclareInput("A",this->GetFactory("A").get()); TEUCHOS_TEST_FOR_EXCEPTION(FactManager_.size() != 2, Exceptions::RuntimeError,"MueLu::SimpleSmoother::DeclareInput: You have to declare two FactoryManagers with a \"Smoother\" object: One for predicting the primary variable and one for the SchurComplement system. The smoother for the SchurComplement system needs a SchurComplementFactory as input for variable \"A\". make sure that you use the same proper damping factors for omega both in the SchurComplementFactory and in the SIMPLE smoother!"); // loop over all factory managers for the subblocks of blocked operator A std::vector<Teuchos::RCP<const FactoryManagerBase> >::const_iterator it; for(it = FactManager_.begin(); it!=FactManager_.end(); ++it) { SetFactoryManager currentSFM (rcpFromRef(currentLevel), *it); // request "Smoother" for current subblock row. currentLevel.DeclareInput("PreSmoother",(*it)->GetFactory("Smoother").get()); } }
void MultiVectorTransferFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level &fineLevel, Level &coarseLevel) const { const ParameterList & pL = GetParameterList(); std::string vectorName = pL.get<std::string>("Vector name"); fineLevel.DeclareInput(vectorName, GetFactory("Vector factory").get(), this); Input(coarseLevel, "R"); }
void BlockedGaussSeidelSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node>::DeclareInput(Level ¤tLevel) const { //this->Input(currentLevel, "A"); // TODO: check me: why is this->Input not freeing properly A in release mode? currentLevel.DeclareInput("A",this->GetFactory("A").get()); // loop over all factory managers for the subblocks of blocked operator A std::vector<Teuchos::RCP<const FactoryManagerBase> >::const_iterator it; for(it = FactManager_.begin(); it!=FactManager_.end(); ++it) { SetFactoryManager currentSFM (rcpFromRef(currentLevel), *it); // request "Smoother" for current subblock row. currentLevel.DeclareInput("PreSmoother",(*it)->GetFactory("Smoother").get()); } //RCP<Teuchos::FancyOStream> out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); }
void UncoupledAggregationFactory<LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level& currentLevel) const { Input(currentLevel, "Graph"); Input(currentLevel, "DofsPerNode"); const ParameterList& pL = GetParameterList(); std::string mapOnePtName = pL.get<std::string>("OnePt aggregate map name"), mapSmallAggName = pL.get<std::string>("SmallAgg aggregate map name"); if (mapOnePtName.length() > 0) { RCP<const FactoryBase> mapOnePtFact = GetFactory("OnePt aggregate map factory"); currentLevel.DeclareInput(mapOnePtName, mapOnePtFact.get()); } if (mapSmallAggName.length() > 0) { RCP<const FactoryBase> mapSmallAggFact = GetFactory("SmallAgg aggregate map factory"); currentLevel.DeclareInput(mapSmallAggName, mapSmallAggFact.get()); } }
void RebalanceMapFactory<LocalOrdinal, GlobalOrdinal, Node>::DeclareInput(Level & currentLevel) const { const Teuchos::ParameterList & pL = GetParameterList(); std::string mapName = pL.get<std::string> ("Map name"); Teuchos::RCP<const FactoryBase> mapFactory = GetFactory ("Map factory"); currentLevel.DeclareInput(mapName,mapFactory.get(),this); Input(currentLevel, "Importer"); } //DeclareInput()
void BlockedCoarseMapFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::DeclareInput(Level ¤tLevel) const { this->Input(currentLevel, "Aggregates"); this->Input(currentLevel, "Nullspace"); // Get CoarseMap from previously defined block RCP<const FactoryBase> prevCoarseMapFact = this->GetFactory("CoarseMap"); TEUCHOS_TEST_FOR_EXCEPTION(prevCoarseMapFact==Teuchos::null, Exceptions::RuntimeError, "MueLu::BlockedCoarseMapFactory::getDomainMapOffset: user did not specify CoarseMap of previous block. Do not forget to set the CoarseMap factory."); currentLevel.DeclareInput("CoarseMap", prevCoarseMapFact.get(), this); // -- }
void BlockedPFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level &fineLevel, Level &coarseLevel) const { Input(fineLevel, "A"); //fineLevel.DeclareInput("A",AFact_.get(),this); //Teuchos::RCP<Teuchos::FancyOStream> fos = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout)); std::vector<Teuchos::RCP<const FactoryManagerBase> >::const_iterator it; for(it = FactManager_.begin(); it!=FactManager_.end(); ++it) { SetFactoryManager fineSFM (rcpFromRef(fineLevel), *it); SetFactoryManager coarseSFM(rcpFromRef(coarseLevel), *it); if (!restrictionMode_) coarseLevel.DeclareInput("P",(*it)->GetFactory("P").get(), this); else coarseLevel.DeclareInput("R",(*it)->GetFactory("R").get(), this); } }
void SaPFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::DeclareInput(Level &fineLevel, Level &coarseLevel) const { Input(fineLevel, "A"); // Get default tentative prolongator factory // Getting it that way ensure that the same factory instance will be used for both SaPFactory and NullspaceFactory. RCP<const FactoryBase> initialPFact = GetFactory("P"); if (initialPFact == Teuchos::null) { initialPFact = coarseLevel.GetFactoryManager()->GetFactory("Ptent"); } coarseLevel.DeclareInput("P", initialPFact.get(), this); // -- }
void RigidBodyModeFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level ¤tLevel) const { if (currentLevel.IsAvailable(nspName_, NoFactory::get()) == false && currentLevel.GetLevelID() == 0) { Input(currentLevel, "A"); //Input(currentLevel,"Coordinates"); } if (currentLevel.GetLevelID() !=0) { currentLevel.DeclareInput("Nullspace", GetFactory(nspName_).get(), this); /* ! "Nullspace" and nspName_ mismatch possible here */ } }
void BraessSarazinSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node>::DeclareInput(Level& currentLevel) const { this->Input(currentLevel, "A"); TEUCHOS_TEST_FOR_EXCEPTION(FactManager_.is_null(), Exceptions::RuntimeError, "MueLu::BraessSarazinSmoother::DeclareInput: FactManager_ must not be null! " "Introduce a FactoryManager for the SchurComplement equation."); // carefully call DeclareInput after switching to internal FactoryManager { SetFactoryManager currentSFM(rcpFromRef(currentLevel), FactManager_); // request "Smoother" for current subblock row. currentLevel.DeclareInput("PreSmoother", FactManager_->GetFactory("Smoother").get()); // request Schur matrix just in case currentLevel.DeclareInput("A", FactManager_->GetFactory("A").get()); } }
void UncoupledAggregationFactory_kokkos<LocalOrdinal, GlobalOrdinal, Node>::DeclareInput(Level& currentLevel) const { Input(currentLevel, "Graph"); Input(currentLevel, "DofsPerNode"); const ParameterList& pL = GetParameterList(); // request special data necessary for OnePtAggregationAlgorithm std::string mapOnePtName = pL.get<std::string>("OnePt aggregate map name"); if (mapOnePtName.length() > 0) { std::string mapOnePtFactName = pL.get<std::string>("OnePt aggregate map factory"); if (mapOnePtFactName == "" || mapOnePtFactName == "NoFactory") { currentLevel.DeclareInput(mapOnePtName, NoFactory::get()); } else { RCP<const FactoryBase> mapOnePtFact = GetFactory(mapOnePtFactName); currentLevel.DeclareInput(mapOnePtName, mapOnePtFact.get()); } } }
void ToggleCoordinatesTransferFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::DeclareInput(Level& fineLevel, Level& coarseLevel) const { const ParameterList& pL = GetParameterList(); TEUCHOS_TEST_FOR_EXCEPTION(!pL.isParameter("Chosen P"), Exceptions::RuntimeError, "MueLu::ToggleCoordinatesTransferFactory::DeclareInput: You have to set the 'Chosen P' parameter to a factory name of type TogglePFactory. The ToggleCoordinatesTransferFactory must be used together with a TogglePFactory!"); Input(coarseLevel,"Chosen P"); for (std::vector<RCP<const FactoryBase> >::const_iterator it = coordFacts_.begin(); it != coordFacts_.end(); ++it) { coarseLevel.DeclareInput("Coordinates", (*it).get(), this); // request/release coarse coordinates (*it)->CallDeclareInput(coarseLevel); // request dependencies } hasDeclaredInput_ = true; }
void PermutationFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level ¤tLevel) const { Input(currentLevel, "A"); const ParameterList & pL = GetParameterList(); std::string mapName = pL.get<std::string> ("PermutationRowMapName"); Teuchos::RCP<const FactoryBase> mapFactory = GetFactory ("PermutationRowMapFactory"); if(mapName.length() > 0 ) { currentLevel.DeclareInput(mapName,mapFactory.get(),this); } }
void TogglePFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::DeclareInput(Level &fineLevel, Level &coarseLevel) const { // request/release "P" and coarse level "Nullspace" for (std::vector<RCP<const FactoryBase> >::const_iterator it = prolongatorFacts_.begin(); it != prolongatorFacts_.end(); ++it) { coarseLevel.DeclareInput("P", (*it).get(), this); // request/release "P" (dependencies are not affected) (*it)->CallDeclareInput(coarseLevel); // request dependencies } for (std::vector<RCP<const FactoryBase> >::const_iterator it = nspFacts_.begin(); it != nspFacts_.end(); ++it) { coarseLevel.DeclareInput("Nullspace", (*it).get(), this); // request/release coarse "Nullspace" (dependencies are not affected) (*it)->CallDeclareInput(coarseLevel); // request dependencies } // The factory needs the information about the number of z-layers. While this information is // provided by the user for the finest level, the factory itself is responsible to provide the // corresponding information on the coarser levels. Since a factory cannot be dependent on itself // we use the NoFactory class as generator class, but remove the UserData keep flag, such that // "NumZLayers" is part of the request/release mechanism. // Please note, that this prevents us from having several (independent) CoarsePFactory instances! // TODO: allow factory to dependent on self-generated data for TwoLevelFactories -> introduce ExpertRequest/Release in Level fineLevel.DeclareInput("NumZLayers", NoFactory::get(), this); fineLevel.RemoveKeepFlag("NumZLayers", NoFactory::get(), MueLu::UserData); hasDeclaredInput_ = true; }
void GenericRFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::DeclareInput(Level &fineLevel, Level &coarseLevel) const { RCP<const FactoryBase> PFact1 = GetFactory("P"); if (PFact1 == Teuchos::null) { PFact1 = coarseLevel.GetFactoryManager()->GetFactory("P"); } RCP<PFactory> PFact = Teuchos::rcp_const_cast<PFactory>(rcp_dynamic_cast<const PFactory>(PFact1));; bool rmode = PFact->isRestrictionModeSet(); PFact->setRestrictionMode(true); // set restriction mode // force request call for PFact // in general, Request is only called once for each factory, // since we can reuse data generated by the factory // however, here we have to run the code in PFact.Build again, // so we have to request the dependencies of PFact first! // The dependencies are (automatically) cleaned up after the second // run of PFact.Build in coarseLevel.Get<RCP<Matrix> >("R",PFact.get())! coarseLevel.DeclareDependencies(PFact.get()); coarseLevel.DeclareInput("R", PFact.get(), this); // we expect the prolongation operator factory to produce "R" as output // call declareInput is called within DeclareInput call PFact->setRestrictionMode(rmode); // reset restriciton mode flag }
void FilteredAFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level& currentLevel) const { Input(currentLevel, "A"); Input(currentLevel, "Graph"); // NOTE: we do this DeclareInput in such complicated fashion because this is not a part of the parameter list currentLevel.DeclareInput("Filtering", currentLevel.GetFactoryManager()->GetFactory("Filtering").get()); }
void TopRAPFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::DeclareInput(Level & fineLevel, Level & coarseLevel) const { if (PFact_ != Teuchos::null) coarseLevel.DeclareInput("P", PFact_.get()); if (RFact_ != Teuchos::null) coarseLevel.DeclareInput("R", RFact_.get()); if ((AcFact_ != Teuchos::null) && (AcFact_ != NoFactory::getRCP())) coarseLevel.DeclareInput("A", AcFact_.get()); }
void TopSmootherFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::DeclareInput(Level & level) const { if (preSmootherFact_ != Teuchos::null) level.DeclareInput("PreSmoother", preSmootherFact_.get()); if (postSmootherFact_ != Teuchos::null) level.DeclareInput("PostSmoother", postSmootherFact_.get()); }
// Similar to Input, but we have an alias (varParamName) to the generated data name (varName) void Input(Level & level, const std::string& varName, const std::string& varParamName) const { level.DeclareInput(varName, GetFactory(varParamName).get(), this); }
void MapTransferFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level &fineLevel, Level &coarseLevel) const { fineLevel.DeclareInput(mapName_,mapFact_.get(),this); Teuchos::RCP<const FactoryBase> tentPFact = GetFactory("P"); if (tentPFact == Teuchos::null) { tentPFact = coarseLevel.GetFactoryManager()->GetFactory("Ptent"); } coarseLevel.DeclareInput("P", tentPFact.get(), this); }
void TrilinosSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps>::DeclareInput(Level ¤tLevel) const { currentLevel.DeclareInput("A", AFact_.get()); // TODO: also call Ifpack or Ifpack2::DeclareInput? }