// @HEADER // ***************************************************************************** // MueLu: A package for multigrid based preconditioning // // Copyright 2012 NTESS and the MueLu contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef MUELU_MERGEDBLOCKEDMATRIXFACTORY_DEF_HPP_ #define MUELU_MERGEDBLOCKEDMATRIXFACTORY_DEF_HPP_ #include #include "MueLu_Level.hpp" #include "MueLu_Monitor.hpp" #include "MueLu_PerfUtils.hpp" #include "MueLu_MergedBlockedMatrixFactory_decl.hpp" namespace MueLu { template MergedBlockedMatrixFactory::MergedBlockedMatrixFactory() {} template RCP MergedBlockedMatrixFactory::GetValidParameterList() const { RCP validParamList = rcp(new ParameterList()); validParamList->set >("A", MueLu::NoFactory::getRCP() /*Teuchos::null*/, "Generating factory of the matrix A used for building SchurComplement (must be a 2x2 blocked operator, default = MueLu::NoFactory::getRCP())"); return validParamList; } template void MergedBlockedMatrixFactory::DeclareInput(Level ¤tLevel) const { Input(currentLevel, "A"); } template void MergedBlockedMatrixFactory::Build(Level ¤tLevel) const { FactoryMonitor m(*this, "MergedBlockedMatrix", currentLevel); Teuchos::RCP A = Get >(currentLevel, "A"); RCP bA = Teuchos::rcp_dynamic_cast(A); TEUCHOS_TEST_FOR_EXCEPTION(bA == Teuchos::null, Exceptions::BadCast, "MueLu::MergedBlockedMatrixFactory::Build: input matrix A is not of type BlockedCrsMatrix! A generated by AFact_ must be a 2x2 block operator. error."); Teuchos::RCP mergedA = bA->Merge(); { GetOStream(Statistics1) << PerfUtils::PrintMatrixInfo(*mergedA, "A (merged)"); // note: variable "A" generated by this MergedBlockedMatrix factory is in fact the a merged version // of the blocked matrix A (from the input) Set(currentLevel, "A", mergedA); } } } // namespace MueLu #endif /* MUELU_MERGEDBLOCKEDMATRIXFACTORY_DEF_HPP_ */