// @HEADER // ***************************************************************************** // MueLu: A package for multigrid based preconditioning // // Copyright 2012 NTESS and the MueLu contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef MUELU_PATTERNFACTORY_DEF_HPP #define MUELU_PATTERNFACTORY_DEF_HPP #include #include #include "MueLu_PatternFactory_decl.hpp" #include "MueLu_MasterList.hpp" #include "MueLu_Monitor.hpp" //#include "MueLu_Utilities.hpp" namespace MueLu { template RCP PatternFactory::GetValidParameterList() const { RCP validParamList = rcp(new ParameterList()); #define SET_VALID_ENTRY(name) validParamList->setEntry(name, MasterList::getEntry(name)) SET_VALID_ENTRY("emin: pattern order"); #undef SET_VALID_ENTRY validParamList->set >("A", Teuchos::null, "Generating factory for the matrix"); validParamList->set >("P", Teuchos::null, "Generating factory for the matrix providing nonzero graph"); return validParamList; } template void PatternFactory::DeclareInput(Level& fineLevel, Level& coarseLevel) const { Input(coarseLevel, "P"); const ParameterList& pL = GetParameterList(); if (pL.get("emin: pattern order") > 0) Input(fineLevel, "A"); } template void PatternFactory::Build(Level& fineLevel, Level& coarseLevel) const { FactoryMonitor m(*this, "Ppattern", coarseLevel); RCP P = Get >(coarseLevel, "P"); const ParameterList& pL = GetParameterList(); int k = pL.get("emin: pattern order"); if (k > 0) { RCP A = Get >(fineLevel, "A"); RCP AP; bool doFillComplete = true; bool optimizeStorage = true; for (int i = 0; i < k; i++) { AP = Xpetra::MatrixMatrix::Multiply(*A, false, *P, false, GetOStream(Statistics2), doFillComplete, optimizeStorage); P.swap(AP); } } Set(coarseLevel, "Ppattern", P->getCrsGraph()); } } // namespace MueLu #endif // MUELU_PATTERNFACTORY_DEF_HPP