diff --git a/packages/muelu/src/Graph/MatrixTransformation/MueLu_CoalesceDropFactory_def.hpp b/packages/muelu/src/Graph/MatrixTransformation/MueLu_CoalesceDropFactory_def.hpp index 11aa186788b3..d848a823743c 100644 --- a/packages/muelu/src/Graph/MatrixTransformation/MueLu_CoalesceDropFactory_def.hpp +++ b/packages/muelu/src/Graph/MatrixTransformation/MueLu_CoalesceDropFactory_def.hpp @@ -348,6 +348,10 @@ void CoalesceDropFactory::Build(Level } else GetOStream(Runtime0) << "algorithm = \"" << algo << "\": threshold = " << threshold << ", blocksize = " << A->GetFixedBlockSize() << std::endl; + + if (((algo == "classical") && (classicalAlgoStr.find("scaled") != std::string::npos)) || ((algo == "distance laplacian") && (distanceLaplacianAlgoStr.find("scaled") != std::string::npos))) + TEUCHOS_TEST_FOR_EXCEPTION(realThreshold > 1.0, Exceptions::RuntimeError, "For cut-drop algorithms, \"aggregation: drop tol\" = " << threshold << ", needs to be <= 1.0"); + Set(currentLevel, "Filtering", (threshold != STS::zero())); const typename STS::magnitudeType dirichletThreshold = STS::magnitude(as(pL.get("aggregation: Dirichlet threshold"))); diff --git a/packages/muelu/src/Headers/LO-GO-NO.tmpl b/packages/muelu/src/Headers/LO-GO-NO.tmpl index a02cc88af6fe..279e44678a32 100644 --- a/packages/muelu/src/Headers/LO-GO-NO.tmpl +++ b/packages/muelu/src/Headers/LO-GO-NO.tmpl @@ -1,12 +1,3 @@ -// @HEADER -// ***************************************************************************** -// MueLu: A package for multigrid based preconditioning -// -// Copyright 2012 NTESS and the MueLu contributors. -// SPDX-License-Identifier: BSD-3-Clause -// ***************************************************************************** -// @HEADER - #ifdef MUELU_$TMPL_UPPERCASECLASS_SHORT using $TMPL_CLASS [[maybe_unused]] = MueLu::$TMPL_CLASS; #endif diff --git a/packages/muelu/src/Headers/MueLu_UseShortNamesScalar.hpp b/packages/muelu/src/Headers/MueLu_UseShortNamesScalar.hpp index 6418213b359c..a5bf3f68b544 100644 --- a/packages/muelu/src/Headers/MueLu_UseShortNamesScalar.hpp +++ b/packages/muelu/src/Headers/MueLu_UseShortNamesScalar.hpp @@ -209,9 +209,6 @@ using MergedBlockedMatrixFactory [[maybe_unused]] = MueLu::MergedBlockedMatrixFa #ifdef MUELU_MERGEDSMOOTHER_SHORT using MergedSmoother [[maybe_unused]] = MueLu::MergedSmoother; #endif -#ifdef MUELU_MLPARAMETERLISTINTERPRETER_SHORT -using MLParameterListInterpreter [[maybe_unused]] = MueLu::MLParameterListInterpreter; -#endif #ifdef MUELU_MULTIVECTORTRANSFERFACTORY_SHORT using MultiVectorTransferFactory [[maybe_unused]] = MueLu::MultiVectorTransferFactory; #endif @@ -221,9 +218,6 @@ using NotayAggregationFactory [[maybe_unused]] = MueLu::NotayAggregationFactory< #ifdef MUELU_NULLSPACEFACTORY_SHORT using NullspaceFactory [[maybe_unused]] = MueLu::NullspaceFactory; #endif -#ifdef MUELU_NULLSPACEFACTORY_KOKKOS_SHORT -using NullspaceFactory_kokkos [[maybe_unused]] = MueLu::NullspaceFactory_kokkos; -#endif #ifdef MUELU_NULLSPACEPRESMOOTHFACTORY_SHORT using NullspacePresmoothFactory [[maybe_unused]] = MueLu::NullspacePresmoothFactory; #endif diff --git a/packages/muelu/src/Headers/Non-Templated.tmpl b/packages/muelu/src/Headers/Non-Templated.tmpl index 6b7294ffa2df..c0993b86a4d5 100644 --- a/packages/muelu/src/Headers/Non-Templated.tmpl +++ b/packages/muelu/src/Headers/Non-Templated.tmpl @@ -1,12 +1,3 @@ -// @HEADER -// ***************************************************************************** -// MueLu: A package for multigrid based preconditioning -// -// Copyright 2012 NTESS and the MueLu contributors. -// SPDX-License-Identifier: BSD-3-Clause -// ***************************************************************************** -// @HEADER - #ifdef MUELU_$TMPL_UPPERCASECLASS_SHORT using $TMPL_CLASS [[maybe_unused]] = MueLu::$TMPL_CLASS; #endif diff --git a/packages/muelu/src/Headers/SC-LO-GO-NO.tmpl b/packages/muelu/src/Headers/SC-LO-GO-NO.tmpl index 2004b62dfbfa..86161dee5add 100644 --- a/packages/muelu/src/Headers/SC-LO-GO-NO.tmpl +++ b/packages/muelu/src/Headers/SC-LO-GO-NO.tmpl @@ -1,12 +1,3 @@ -// @HEADER -// ***************************************************************************** -// MueLu: A package for multigrid based preconditioning -// -// Copyright 2012 NTESS and the MueLu contributors. -// SPDX-License-Identifier: BSD-3-Clause -// ***************************************************************************** -// @HEADER - #ifdef MUELU_$TMPL_UPPERCASECLASS_SHORT using $TMPL_CLASS [[maybe_unused]] = MueLu::$TMPL_CLASS; #endif diff --git a/packages/muelu/src/Headers/gen_UseShortNames.sh b/packages/muelu/src/Headers/gen_UseShortNames.sh index 49a723c4a424..7bbe12dc5e1e 100755 --- a/packages/muelu/src/Headers/gen_UseShortNames.sh +++ b/packages/muelu/src/Headers/gen_UseShortNames.sh @@ -6,7 +6,16 @@ classListDir=../Utils/ClassList/ -echo "// Type definitions for templated classes (generally graph-related) that do not require a scalar." > MueLu_UseShortNamesOrdinal.hpp +echo "// @HEADER" > MueLu_UseShortNamesOrdinal.hpp +echo "// *****************************************************************************" >> MueLu_UseShortNamesOrdinal.hpp +echo "// MueLu: A package for multigrid based preconditioning" >> MueLu_UseShortNamesOrdinal.hpp +echo "//" >> MueLu_UseShortNamesOrdinal.hpp +echo "// Copyright 2012 NTESS and the MueLu contributors." >> MueLu_UseShortNamesOrdinal.hpp +echo "// SPDX-License-Identifier: BSD-3-Clause" >> MueLu_UseShortNamesOrdinal.hpp +echo "// *****************************************************************************" >> MueLu_UseShortNamesOrdinal.hpp +echo "// @HEADER" >> MueLu_UseShortNamesOrdinal.hpp +echo "" >> MueLu_UseShortNamesOrdinal.hpp +echo "// Type definitions for templated classes (generally graph-related) that do not require a scalar." >> MueLu_UseShortNamesOrdinal.hpp echo >> MueLu_UseShortNamesOrdinal.hpp echo "#include " >> MueLu_UseShortNamesOrdinal.hpp echo >> MueLu_UseShortNamesOrdinal.hpp @@ -27,8 +36,16 @@ done # # Scalar # - -echo "// New definition of types using the types Scalar, LocalOrdinal, GlobalOrdinal, Node of the current context." > MueLu_UseShortNamesScalar.hpp +echo "// @HEADER" > MueLu_UseShortNamesScalar.hpp +echo "// *****************************************************************************" >> MueLu_UseShortNamesScalar.hpp +echo "// MueLu: A package for multigrid based preconditioning" >> MueLu_UseShortNamesScalar.hpp +echo "//" >> MueLu_UseShortNamesScalar.hpp +echo "// Copyright 2012 NTESS and the MueLu contributors." >> MueLu_UseShortNamesScalar.hpp +echo "// SPDX-License-Identifier: BSD-3-Clause" >> MueLu_UseShortNamesScalar.hpp +echo "// *****************************************************************************" >> MueLu_UseShortNamesScalar.hpp +echo "// @HEADER" >> MueLu_UseShortNamesScalar.hpp +echo "" >> MueLu_UseShortNamesScalar.hpp +echo "// New definition of types using the types Scalar, LocalOrdinal, GlobalOrdinal, Node of the current context." >> MueLu_UseShortNamesScalar.hpp echo >> MueLu_UseShortNamesScalar.hpp echo "#include " >> MueLu_UseShortNamesScalar.hpp echo >> MueLu_UseShortNamesScalar.hpp diff --git a/packages/muelu/src/Interface/MueLu_FactoryFactory_decl.hpp b/packages/muelu/src/Interface/MueLu_FactoryFactory_decl.hpp index a6c6add07da2..5176bc2fb677 100644 --- a/packages/muelu/src/Interface/MueLu_FactoryFactory_decl.hpp +++ b/packages/muelu/src/Interface/MueLu_FactoryFactory_decl.hpp @@ -126,7 +126,6 @@ #include "MueLu_CoalesceDropFactory_kokkos_fwd.hpp" #include "MueLu_GeometricInterpolationPFactory_kokkos_fwd.hpp" #ifdef HAVE_MUELU_DEPRECATED_CODE -#include "MueLu_NullspaceFactory_kokkos_fwd.hpp" #include "MueLu_SaPFactory_kokkos_fwd.hpp" #endif #include "MueLu_SemiCoarsenPFactory_kokkos_fwd.hpp" diff --git a/packages/muelu/src/Interface/MueLu_FactoryFactory_def.hpp b/packages/muelu/src/Interface/MueLu_FactoryFactory_def.hpp index cc144b4366fe..0694928ceceb 100644 --- a/packages/muelu/src/Interface/MueLu_FactoryFactory_def.hpp +++ b/packages/muelu/src/Interface/MueLu_FactoryFactory_def.hpp @@ -105,7 +105,6 @@ #include "MueLu_CoalesceDropFactory_kokkos.hpp" #include "MueLu_GeometricInterpolationPFactory_kokkos.hpp" #ifdef HAVE_MUELU_DEPRECATED_CODE -#include "MueLu_NullspaceFactory_kokkos.hpp" #include "MueLu_SaPFactory_kokkos.hpp" #endif #include "MueLu_SemiCoarsenPFactory_kokkos.hpp" @@ -216,7 +215,6 @@ RCP FactoryFactory if (factoryName == "CoalesceDropFactory_kokkos") return Build2(paramList, factoryMapIn, factoryManagersIn); if (factoryName == "GeometricInterpolationPFactory_kokkos") return Build2(paramList, factoryMapIn, factoryManagersIn); #ifdef HAVE_MUELU_DEPRECATED_CODE - if (factoryName == "NullspaceFactory_kokkos") return Build2(paramList, factoryMapIn, factoryManagersIn); if (factoryName == "SaPFactory_kokkos") return Build2(paramList, factoryMapIn, factoryManagersIn); #endif if (factoryName == "SemiCoarsenPFactory_kokkos") return Build2(paramList, factoryMapIn, factoryManagersIn); diff --git a/packages/muelu/src/Interface/MueLu_MLParameterListInterpreter_decl.hpp b/packages/muelu/src/Interface/MueLu_MLParameterListInterpreter_decl.hpp deleted file mode 100644 index 8b22c8fc7f90..000000000000 --- a/packages/muelu/src/Interface/MueLu_MLParameterListInterpreter_decl.hpp +++ /dev/null @@ -1,202 +0,0 @@ -// @HEADER -// ***************************************************************************** -// MueLu: A package for multigrid based preconditioning -// -// Copyright 2012 NTESS and the MueLu contributors. -// SPDX-License-Identifier: BSD-3-Clause -// ***************************************************************************** -// @HEADER - -#ifndef MUELU_MLPARAMETERLISTINTERPRETER_DECL_HPP -#define MUELU_MLPARAMETERLISTINTERPRETER_DECL_HPP - -#include - -#include -#include -#include - -#include "MueLu_ConfigDefs.hpp" -#include "MueLu_HierarchyManager.hpp" -#include "MueLu_MLParameterListInterpreter_fwd.hpp" - -#include "MueLu_Hierarchy_fwd.hpp" -#include "MueLu_SmootherFactory_fwd.hpp" - -#include "MueLu_TentativePFactory_fwd.hpp" -#include "MueLu_SaPFactory_fwd.hpp" -#include "MueLu_PgPFactory_fwd.hpp" -#include "MueLu_AmalgamationFactory_fwd.hpp" -#include "MueLu_TransPFactory_fwd.hpp" -#include "MueLu_GenericRFactory_fwd.hpp" -#include "MueLu_SmootherPrototype_fwd.hpp" -#include "MueLu_TrilinosSmoother_fwd.hpp" -#include "MueLu_IfpackSmoother_fwd.hpp" -#include "MueLu_DirectSolver_fwd.hpp" -#include "MueLu_RAPFactory_fwd.hpp" -#include "MueLu_CoalesceDropFactory_fwd.hpp" -#include "MueLu_UncoupledAggregationFactory_fwd.hpp" -#include "MueLu_NullspaceFactory_fwd.hpp" -#include "MueLu_FactoryBase_fwd.hpp" - -#if defined(HAVE_MUELU_ISORROPIA) && defined(HAVE_MPI) -#include "MueLu_RepartitionHeuristicFactory_fwd.hpp" -#include "MueLu_RepartitionFactory_fwd.hpp" -#include "MueLu_RebalanceTransferFactory_fwd.hpp" -#include "MueLu_IsorropiaInterface_fwd.hpp" -#include "MueLu_RebalanceAcFactory_fwd.hpp" -#include "MueLu_RebalanceMapFactory_fwd.hpp" -#endif - -#ifdef HAVE_MUELU_DEPRECATED_CODE -#ifdef MueLu_SHOW_DEPRECATED_WARNINGS -#warning "The header file MueLu_MLParameterListInterpreter.hpp is deprecated" -#endif -#else -#error "The header file MueLu_MLParameterListInterpreter.hpp is deprecated" -#endif - -namespace MueLu { - -/* - Utility that from an existing Teuchos::ParameterList creates a new list, in - which level-specific parameters are replaced with sublists. - - Currently, level-specific parameters that begin with "smoother:" - or "aggregation:" are placed in sublists. Coarse options are also placed - in a coarse list. - - Example: - Input: - smoother: type (level 0) = symmetric Gauss-Seidel - smoother: sweeps (level 0) = 1 - Output: - smoother: list (level 0) -> - smoother: type = symmetric Gauss-Seidel - smoother: sweeps = 1 -*/ -// This function is a copy of ML_CreateSublists to avoid dependency on ML -// Throw exception on error instead of exit() -void CreateSublists(const ParameterList& List, ParameterList& newList); - -/*! - @class MLParameterListInterpreter class. - @brief Class that accepts ML-style parameters and builds a MueLu preconditioner. - This interpreter uses the same default values as ML. This allows to compare ML/MueLu results - - The parameter list is validated only if the package ML is available and parameter "ML validate parameter list" is true. - TODO: A warning is issued if ML is not available -*/ - -template -class MLParameterListInterpreter : public HierarchyManager { -#undef MUELU_MLPARAMETERLISTINTERPRETER_SHORT -#include "MueLu_UseShortNames.hpp" - - public: - //! @name Constructors/Destructors. - //@{ - - //! Constructor. - MLParameterListInterpreter() - : nullspace_(NULL) - , blksize_(1) {} - - //! Constructor. - //! @param paramList: parameter list with ML parameters - //! @param[in] comm (RCP >): Optional RCP of a Teuchos communicator (default: Teuchos::null) - //! @param factoryList: vector with RCP of FactoryBase objects - //! - //! The factories in factoryList allow the user to add user-specific factories to the MueLu Hierarchy. - //! The idea is to be able to add some factories that write out some debug information etc. which are not handled by the ML - //! Parameter List itself. See information about the RAPFactory::AddTransferFactory method, too! - MLParameterListInterpreter(Teuchos::ParameterList& paramList, Teuchos::RCP > comm = Teuchos::null, std::vector > factoryList = std::vector >(0)); - - //! Constructor. - //! @param xmlFileName: file name for XML file with ML parameters - //! @param factoryList: vector with RCP of FactoryBase objects - //! - //! The factories in factoryList allow the user to add user-specific factories to the MueLu Hierarchy. - //! The idea is to be able to add some factories that write out some debug information etc. which are not handled by the ML - //! Parameter List itself. See information about the RAPFactory::AddTransferFactory method, too! - MLParameterListInterpreter(const std::string& xmlFileName, std::vector > factoryList = std::vector >(0)); - - //! Destructor. - virtual ~MLParameterListInterpreter() = default; - - //@} - - //@{ - - void SetParameterList(const Teuchos::ParameterList& paramList); - - //@} - - //@{ - - //! Setup Hierarchy object - virtual void SetupHierarchy(Hierarchy& H) const; - - //@} - - //@{ - - //! @name static helper functions translating parameter list to factories - //! @brief static helper functions that also can be used from outside for translating ML parameters into MueLu objects - //@{ - - //! Read smoother options and build the corresponding smoother factory - // @param AFact: Factory used by smoother to find 'A' - static RCP GetSmootherFactory(const Teuchos::ParameterList& paramList, const RCP& AFact = Teuchos::null); - - //@} - - //! @name Handling of additional user-specific transfer factories - //@{ - /*! @brief Add transfer factory in the end of list of transfer factories for RAPFactory. - - This allows the user to add user-specific factories to the MueLu Hierarchy. The idea is to be able - to add some factories that write out some debug information etc. which are not handled by the ML - Parameter List itself. See information about the RAPFactory::AddTransferFactory method, too! - */ - void AddTransferFactory(const RCP& factory); - - //! Returns number of transfer factories. - size_t NumTransferFactories() const; - //@} - - private: - //! nullspace can be embedded in the ML parameter list - int nullspaceDim_; - double* nullspace_; // TODO: replace by Teuchos::ArrayRCP<> - - //! coordinates can be embedded in the ML parameter list - double* xcoord_; - double* ycoord_; - double* zcoord_; - - //! list of user-defined transfer Factories - //! We use this vector to add some special user-given factories to the Hierarchy (RAPFactory) - //! This way the user can extend the standard functionality of the MLParameterListInterpreter beyond the - //! capabibilities of ML. - std::vector > TransferFacts_; - - //@{ Matrix configuration - - //! Setup Operator object - virtual void SetupOperator(Operator& Op) const; - - //! Matrix configuration storage - int blksize_; - - //@} - -}; // class MLParameterListInterpreter - -} // namespace MueLu - -#define MUELU_MLPARAMETERLISTINTERPRETER_SHORT -#endif /* MUELU_MLPARAMETERLISTINTERPRETER_DECL_HPP */ diff --git a/packages/muelu/src/Interface/MueLu_MLParameterListInterpreter_def.hpp b/packages/muelu/src/Interface/MueLu_MLParameterListInterpreter_def.hpp deleted file mode 100644 index 09eb4bc28e60..000000000000 --- a/packages/muelu/src/Interface/MueLu_MLParameterListInterpreter_def.hpp +++ /dev/null @@ -1,728 +0,0 @@ -// @HEADER -// ***************************************************************************** -// MueLu: A package for multigrid based preconditioning -// -// Copyright 2012 NTESS and the MueLu contributors. -// SPDX-License-Identifier: BSD-3-Clause -// ***************************************************************************** -// @HEADER - -#ifndef MUELU_MLPARAMETERLISTINTERPRETER_DEF_HPP -#define MUELU_MLPARAMETERLISTINTERPRETER_DEF_HPP - -#include - -#include "MueLu_ConfigDefs.hpp" -#if defined(HAVE_MUELU_ML) -#include -#endif - -#include -#include -#include -#include -#include - -#include "MueLu_MLParameterListInterpreter_decl.hpp" - -#include "MueLu_Level.hpp" -#include "MueLu_Hierarchy.hpp" -#include "MueLu_FactoryManager.hpp" - -#include "MueLu_TentativePFactory.hpp" -#include "MueLu_SaPFactory.hpp" -#include "MueLu_PgPFactory.hpp" -#include "MueLu_AmalgamationFactory.hpp" -#include "MueLu_TransPFactory.hpp" -#include "MueLu_GenericRFactory.hpp" -#include "MueLu_SmootherPrototype.hpp" -#include "MueLu_SmootherFactory.hpp" -#include "MueLu_TrilinosSmoother.hpp" -#include "MueLu_IfpackSmoother.hpp" -#include "MueLu_DirectSolver.hpp" -#include "MueLu_HierarchyUtils.hpp" -#include "MueLu_RAPFactory.hpp" -#include "MueLu_CoalesceDropFactory.hpp" -#include "MueLu_UncoupledAggregationFactory.hpp" -#include "MueLu_NullspaceFactory.hpp" -#include "MueLu_ParameterListUtils.hpp" - -#include "MueLu_CoalesceDropFactory_kokkos.hpp" -// #include "MueLu_CoordinatesTransferFactory_kokkos.hpp" -#include "MueLu_TentativePFactory_kokkos.hpp" - -#if defined(HAVE_MUELU_ISORROPIA) && defined(HAVE_MPI) -#include "MueLu_IsorropiaInterface.hpp" -#include "MueLu_RepartitionHeuristicFactory.hpp" -#include "MueLu_RepartitionFactory.hpp" -#include "MueLu_RebalanceTransferFactory.hpp" -#include "MueLu_RepartitionInterface.hpp" -#include "MueLu_RebalanceAcFactory.hpp" -//#include "MueLu_RebalanceMapFactory.hpp" -#endif - -// Note: do not add options that are only recognized by MueLu. - -// TODO: this parameter list interpreter should force MueLu to use default ML parameters -// - Ex: smoother sweep=2 by default for ML - -// Read a parameter value from a parameter list and store it into a variable named 'varName' -#define MUELU_READ_PARAM(paramList, paramStr, varType, defaultValue, varName) \ - varType varName = defaultValue; \ - if (paramList.isParameter(paramStr)) varName = paramList.get(paramStr); - -// Read a parameter value from a paraeter list and copy it into a new parameter list (with another parameter name) -#define MUELU_COPY_PARAM(paramList, paramStr, varType, defaultValue, outParamList, outParamStr) \ - if (paramList.isParameter(paramStr)) \ - outParamList.set(outParamStr, paramList.get(paramStr)); \ - else \ - outParamList.set(outParamStr, static_cast(defaultValue)); - -namespace MueLu { - -template -MLParameterListInterpreter::MLParameterListInterpreter(Teuchos::ParameterList& paramList, Teuchos::RCP > comm, std::vector > factoryList) - : nullspace_(NULL) - , xcoord_(NULL) - , ycoord_(NULL) - , zcoord_(NULL) - , TransferFacts_(factoryList) - , blksize_(1) { - if (paramList.isParameter("xml parameter file")) { - std::string filename = paramList.get("xml parameter file", ""); - if (filename.length() != 0) { - TEUCHOS_TEST_FOR_EXCEPTION(comm.is_null(), Exceptions::RuntimeError, "xml parameter file requires a valid comm"); - Teuchos::ParameterList paramList2 = paramList; - Teuchos::updateParametersFromXmlFileAndBroadcast(filename, Teuchos::Ptr(¶mList2), *comm); - paramList2.remove("xml parameter file"); - SetParameterList(paramList2); - } else - SetParameterList(paramList); - } else - SetParameterList(paramList); -} - -template -MLParameterListInterpreter::MLParameterListInterpreter(const std::string& xmlFileName, std::vector > factoryList) - : nullspace_(NULL) - , TransferFacts_(factoryList) - , blksize_(1) { - Teuchos::RCP paramList = Teuchos::getParametersFromXmlFile(xmlFileName); - SetParameterList(*paramList); -} - -template -void MLParameterListInterpreter::SetParameterList(const Teuchos::ParameterList& paramList_in) { - Teuchos::ParameterList paramList = paramList_in; - - // - // Read top-level of the parameter list - // - - // hard-coded default values == ML defaults according to the manual - MUELU_READ_PARAM(paramList, "ML output", int, 0, verbosityLevel); - MUELU_READ_PARAM(paramList, "max levels", int, 10, maxLevels); - MUELU_READ_PARAM(paramList, "PDE equations", int, 1, nDofsPerNode); - - MUELU_READ_PARAM(paramList, "coarse: max size", int, 128, maxCoarseSize); - - MUELU_READ_PARAM(paramList, "aggregation: type", std::string, "Uncoupled", agg_type); - // MUELU_READ_PARAM(paramList, "aggregation: threshold", double, 0.0, agg_threshold); - MUELU_READ_PARAM(paramList, "aggregation: damping factor", double, (double)4 / (double)3, agg_damping); - // MUELU_READ_PARAM(paramList, "aggregation: smoothing sweeps", int, 1, agg_smoothingsweeps); - MUELU_READ_PARAM(paramList, "aggregation: nodes per aggregate", int, 1, minPerAgg); - MUELU_READ_PARAM(paramList, "aggregation: keep Dirichlet bcs", bool, false, bKeepDirichletBcs); // This is a MueLu specific extension that does not exist in ML - MUELU_READ_PARAM(paramList, "aggregation: max neighbours already aggregated", int, 0, maxNbrAlreadySelected); // This is a MueLu specific extension that does not exist in M - MUELU_READ_PARAM(paramList, "aggregation: aux: enable", bool, false, agg_use_aux); - MUELU_READ_PARAM(paramList, "aggregation: aux: threshold", double, false, agg_aux_thresh); - - MUELU_READ_PARAM(paramList, "null space: type", std::string, "default vectors", nullspaceType); - MUELU_READ_PARAM(paramList, "null space: dimension", int, -1, nullspaceDim); // TODO: ML default not in documentation - MUELU_READ_PARAM(paramList, "null space: vectors", double*, NULL, nullspaceVec); // TODO: ML default not in documentation - - MUELU_READ_PARAM(paramList, "energy minimization: enable", bool, false, bEnergyMinimization); - - MUELU_READ_PARAM(paramList, "RAP: fix diagonal", bool, false, bFixDiagonal); // This is a MueLu specific extension that does not exist in ML - - MUELU_READ_PARAM(paramList, "x-coordinates", double*, NULL, xcoord); - MUELU_READ_PARAM(paramList, "y-coordinates", double*, NULL, ycoord); - MUELU_READ_PARAM(paramList, "z-coordinates", double*, NULL, zcoord); - - // - // Move smoothers/aggregation/coarse parameters to sublists - // - - // ML allows to have level-specific smoothers/aggregation/coarse parameters at the top level of the list or/and defined in sublists: - // See also: ML Guide section 6.4.1, MueLu::CreateSublists, ML_CreateSublists - ParameterList paramListWithSubList; - MueLu::CreateSublists(paramList, paramListWithSubList); - paramList = paramListWithSubList; // swap - - // pull out "use kokkos refactor" - bool setKokkosRefactor = false; - bool useKokkosRefactor = !Node::is_serial; - if (paramList.isType("use kokkos refactor")) { - useKokkosRefactor = paramList.get("use kokkos refactor"); - setKokkosRefactor = true; - paramList.remove("use kokkos refactor"); - } - - // - // Validate parameter list - // - - { - bool validate = paramList.get("ML validate parameter list", true); /* true = default in ML */ - if (validate) { -#if defined(HAVE_MUELU_ML) && defined(HAVE_MUELU_EPETRA) - // Validate parameter list using ML validator - int depth = paramList.get("ML validate depth", 5); /* 5 = default in ML */ - TEUCHOS_TEST_FOR_EXCEPTION(!ML_Epetra::ValidateMLPParameters(paramList, depth), Exceptions::RuntimeError, - "ERROR: ML's Teuchos::ParameterList contains incorrect parameter!"); -#else - // If no validator available: issue a warning and set parameter value to false in the output list - this->GetOStream(Warnings0) << "Warning: MueLu_ENABLE_ML=OFF. The parameter list cannot be validated." << std::endl; - paramList.set("ML validate parameter list", false); - -#endif // HAVE_MUELU_ML - } // if(validate) - } // scope - - // Matrix option - blksize_ = nDofsPerNode; - - // Translate verbosity parameter - - // Translate verbosity parameter - MsgType eVerbLevel = None; - if (verbosityLevel == 0) eVerbLevel = None; - if (verbosityLevel >= 1) eVerbLevel = Low; - if (verbosityLevel >= 5) eVerbLevel = Medium; - if (verbosityLevel >= 10) eVerbLevel = High; - if (verbosityLevel >= 11) eVerbLevel = Extreme; - if (verbosityLevel >= 42) eVerbLevel = Test; - if (verbosityLevel >= 43) eVerbLevel = InterfaceTest; - this->verbosity_ = eVerbLevel; - - TEUCHOS_TEST_FOR_EXCEPTION(agg_type != "Uncoupled", Exceptions::RuntimeError, - "MueLu::MLParameterListInterpreter::SetParameterList(): parameter \"aggregation: type\": only 'Uncoupled' aggregation is supported."); - - // Create MueLu factories - RCP dropFact; - if (useKokkosRefactor) - dropFact = rcp(new CoalesceDropFactory_kokkos()); - else - dropFact = rcp(new CoalesceDropFactory()); - - if (agg_use_aux) { - dropFact->SetParameter("aggregation: drop scheme", Teuchos::ParameterEntry(std::string("distance laplacian"))); - dropFact->SetParameter("aggregation: drop tol", Teuchos::ParameterEntry(agg_aux_thresh)); - } - - // Uncoupled aggregation - RCP AggFact = Teuchos::null; - AggFact = rcp(new UncoupledAggregationFactory()); - - AggFact->SetFactory("Graph", dropFact); - AggFact->SetFactory("DofsPerNode", dropFact); - AggFact->SetParameter("aggregation: preserve Dirichlet points", Teuchos::ParameterEntry(bKeepDirichletBcs)); - AggFact->SetParameter("aggregation: ordering", Teuchos::ParameterEntry(std::string("natural"))); - AggFact->SetParameter("aggregation: max selected neighbors", Teuchos::ParameterEntry(maxNbrAlreadySelected)); - AggFact->SetParameter("aggregation: min agg size", Teuchos::ParameterEntry(minPerAgg)); - - if (verbosityLevel > 3) { - std::ostringstream oss; - oss << "========================= Aggregate option summary  =========================" << std::endl; - oss << "min Nodes per aggregate :              " << minPerAgg << std::endl; - oss << "min # of root nbrs already aggregated : " << maxNbrAlreadySelected << std::endl; - oss << "aggregate ordering :                    natural" << std::endl; - oss << "=============================================================================" << std::endl; - this->GetOStream(Runtime1) << oss.str(); - } - - RCP PFact; - RCP RFact; - RCP PtentFact; - if (useKokkosRefactor) - PtentFact = rcp(new TentativePFactory_kokkos()); - else - PtentFact = rcp(new TentativePFactory()); - if (agg_damping == 0.0 && bEnergyMinimization == false) { - // tentative prolongation operator (PA-AMG) - PFact = PtentFact; - RFact = rcp(new TransPFactory()); - } else if (agg_damping != 0.0 && bEnergyMinimization == false) { - // smoothed aggregation (SA-AMG) - RCP SaPFact = rcp(new SaPFactory()); - SaPFact->SetParameter("sa: damping factor", ParameterEntry(agg_damping)); - PFact = SaPFact; - RFact = rcp(new TransPFactory()); - } else if (bEnergyMinimization == true) { - // Petrov Galerkin PG-AMG smoothed aggregation (energy minimization in ML) - PFact = rcp(new PgPFactory()); - RFact = rcp(new GenericRFactory()); - } - - RCP AcFact = rcp(new RAPFactory()); - AcFact->SetParameter("RepairMainDiagonal", Teuchos::ParameterEntry(bFixDiagonal)); - for (size_t i = 0; i < TransferFacts_.size(); i++) { - AcFact->AddTransferFactory(TransferFacts_[i]); - } - - // - // introduce rebalancing - // -#if defined(HAVE_MUELU_ISORROPIA) && defined(HAVE_MPI) - Teuchos::RCP RebalancedPFact = Teuchos::null; - Teuchos::RCP RebalancedRFact = Teuchos::null; - Teuchos::RCP RepartitionFact = Teuchos::null; - Teuchos::RCP RebalancedAFact = Teuchos::null; - - MUELU_READ_PARAM(paramList, "repartition: enable", int, 0, bDoRepartition); - if (bDoRepartition == 1) { - // The Factory Manager will be configured to return the rebalanced versions of P, R, A by default. - // Everytime we want to use the non-rebalanced versions, we need to explicitly define the generating factory. - RFact->SetFactory("P", PFact); - // - AcFact->SetFactory("P", PFact); - AcFact->SetFactory("R", RFact); - - // define rebalancing factory for coarse matrix - Teuchos::RCP > rebAmalgFact = Teuchos::rcp(new MueLu::AmalgamationFactory()); - rebAmalgFact->SetFactory("A", AcFact); - - MUELU_READ_PARAM(paramList, "repartition: max min ratio", double, 1.3, maxminratio); - MUELU_READ_PARAM(paramList, "repartition: min per proc", int, 512, minperproc); - - // Repartitioning heuristic - RCP RepartitionHeuristicFact = Teuchos::rcp(new RepartitionHeuristicFactory()); - { - Teuchos::ParameterList paramListRepFact; - paramListRepFact.set("repartition: min rows per proc", minperproc); - paramListRepFact.set("repartition: max imbalance", maxminratio); - RepartitionHeuristicFact->SetParameterList(paramListRepFact); - } - RepartitionHeuristicFact->SetFactory("A", AcFact); - - // create "Partition" - Teuchos::RCP > isoInterface = Teuchos::rcp(new MueLu::IsorropiaInterface()); - isoInterface->SetFactory("A", AcFact); - isoInterface->SetFactory("number of partitions", RepartitionHeuristicFact); - isoInterface->SetFactory("UnAmalgamationInfo", rebAmalgFact); - - // create "Partition" by unamalgamtion - Teuchos::RCP > repInterface = Teuchos::rcp(new MueLu::RepartitionInterface()); - repInterface->SetFactory("A", AcFact); - repInterface->SetFactory("number of partitions", RepartitionHeuristicFact); - repInterface->SetFactory("AmalgamatedPartition", isoInterface); - // repInterface->SetFactory("UnAmalgamationInfo", rebAmalgFact); // not necessary? - - // Repartitioning (creates "Importer" from "Partition") - RepartitionFact = Teuchos::rcp(new RepartitionFactory()); - RepartitionFact->SetFactory("A", AcFact); - RepartitionFact->SetFactory("number of partitions", RepartitionHeuristicFact); - RepartitionFact->SetFactory("Partition", repInterface); - - // Reordering of the transfer operators - RebalancedPFact = Teuchos::rcp(new RebalanceTransferFactory()); - RebalancedPFact->SetParameter("type", Teuchos::ParameterEntry(std::string("Interpolation"))); - RebalancedPFact->SetFactory("P", PFact); - RebalancedPFact->SetFactory("Nullspace", PtentFact); - RebalancedPFact->SetFactory("Importer", RepartitionFact); - - RebalancedRFact = Teuchos::rcp(new RebalanceTransferFactory()); - RebalancedRFact->SetParameter("type", Teuchos::ParameterEntry(std::string("Restriction"))); - RebalancedRFact->SetFactory("R", RFact); - RebalancedRFact->SetFactory("Importer", RepartitionFact); - - // Compute Ac from rebalanced P and R - RebalancedAFact = Teuchos::rcp(new RebalanceAcFactory()); - RebalancedAFact->SetFactory("A", AcFact); - } -#else // #ifdef HAVE_MUELU_ISORROPIA - // Get rid of [-Wunused] warnings - //(void) - // - // ^^^ FIXME (mfh 17 Nov 2013) That definitely doesn't compile. -#endif - - // - // Nullspace factory - // - - // Set fine level nullspace - // extract pre-computed nullspace from ML parameter list - // store it in nullspace_ and nullspaceDim_ - if (nullspaceType != "default vectors") { - TEUCHOS_TEST_FOR_EXCEPTION(nullspaceType != "pre-computed", Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: no valid nullspace (no pre-computed null space). error."); - TEUCHOS_TEST_FOR_EXCEPTION(nullspaceDim == -1, Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: no valid nullspace (nullspace dim == -1). error."); - TEUCHOS_TEST_FOR_EXCEPTION(nullspaceVec == NULL, Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: no valid nullspace (nullspace == NULL). You have to provide a valid fine-level nullspace in \'null space: vectors\'"); - - nullspaceDim_ = nullspaceDim; - nullspace_ = nullspaceVec; - } - - Teuchos::RCP nspFact = Teuchos::rcp(new NullspaceFactory("Nullspace")); - nspFact->SetFactory("Nullspace", PtentFact); - - // Stash coordinates - xcoord_ = xcoord; - ycoord_ = ycoord; - zcoord_ = zcoord; - - // - // Hierarchy + FactoryManager - // - - // Hierarchy options - this->numDesiredLevel_ = maxLevels; - this->maxCoarseSize_ = maxCoarseSize; - - // - // Coarse Smoother - // - ParameterList& coarseList = paramList.sublist("coarse: list"); - // check whether coarse solver is set properly. If not, set default coarse solver. - if (!coarseList.isParameter("smoother: type")) - coarseList.set("smoother: type", "Amesos-KLU"); // set default coarse solver according to ML 5.0 guide - RCP coarseFact = GetSmootherFactory(coarseList, Teuchos::null); - - // Smoothers Top Level Parameters - - RCP topLevelSmootherParam = ExtractSetOfParameters(paramList, "smoother"); - - // - - // Prepare factory managers - // TODO: smootherFact can be reuse accross level if same parameters/no specific parameterList - - for (int levelID = 0; levelID < maxLevels; levelID++) { - // - // Level FactoryManager - // - - RCP manager = rcp(new FactoryManager()); - if (setKokkosRefactor) - manager->SetKokkosRefactor(useKokkosRefactor); - - // - // Smoothers - // - - { - // Merge level-specific parameters with global parameters. level-specific parameters takes precedence. - // TODO: unit-test this part alone - - ParameterList levelSmootherParam = GetMLSubList(paramList, "smoother", levelID); // copy - MergeParameterList(*topLevelSmootherParam, levelSmootherParam, false); /* false = do no overwrite levelSmootherParam parameters by topLevelSmootherParam parameters */ - // std::cout << std::endl << "Merged List for level " << levelID << std::endl; - // std::cout << levelSmootherParam << std::endl; - - RCP smootherFact = GetSmootherFactory(levelSmootherParam, Teuchos::null); // TODO: missing AFact input arg. - - manager->SetFactory("Smoother", smootherFact); - } - - // - // Misc - // - - manager->SetFactory("CoarseSolver", coarseFact); // TODO: should not be done in the loop - manager->SetFactory("Graph", dropFact); - manager->SetFactory("Aggregates", AggFact); - manager->SetFactory("DofsPerNode", dropFact); - manager->SetFactory("Ptent", PtentFact); - -#if defined(HAVE_MUELU_ISORROPIA) && defined(HAVE_MPI) - if (bDoRepartition == 1) { - manager->SetFactory("A", RebalancedAFact); - manager->SetFactory("P", RebalancedPFact); - manager->SetFactory("R", RebalancedRFact); - manager->SetFactory("Nullspace", RebalancedPFact); - manager->SetFactory("Importer", RepartitionFact); - } else { -#endif // #ifdef HAVE_MUELU_ISORROPIA - manager->SetFactory("Nullspace", nspFact); // use same nullspace factory throughout all multigrid levels - manager->SetFactory("A", AcFact); // same RAP factory for all levels - manager->SetFactory("P", PFact); // same prolongator and restrictor factories for all levels - manager->SetFactory("R", RFact); // same prolongator and restrictor factories for all levels -#if defined(HAVE_MUELU_ISORROPIA) && defined(HAVE_MPI) - } -#endif - - this->AddFactoryManager(levelID, 1, manager); - } // for (level loop) -} - -template -void MLParameterListInterpreter::SetupHierarchy(Hierarchy& H) const { - // if nullspace_ has already been extracted from ML parameter list - // make nullspace available for MueLu - if (nullspace_ != NULL) { - RCP fineLevel = H.GetLevel(0); - RCP Op = fineLevel->Get >("A"); - RCP A = rcp_dynamic_cast(Op); - if (!A.is_null()) { - const RCP rowMap = fineLevel->Get >("A")->getRowMap(); - RCP nullspace = MultiVectorFactory::Build(rowMap, nullspaceDim_, true); - - for (size_t i = 0; i < Teuchos::as(nullspaceDim_); i++) { - Teuchos::ArrayRCP nullspacei = nullspace->getDataNonConst(i); - const size_t myLength = nullspace->getLocalLength(); - - for (size_t j = 0; j < myLength; j++) { - nullspacei[j] = nullspace_[i * myLength + j]; - } - } - - fineLevel->Set("Nullspace", nullspace); - } - } - - // Do the same for coordinates - size_t num_coords = 0; - double* coordPTR[3]; - if (xcoord_) { - coordPTR[0] = xcoord_; - num_coords++; - if (ycoord_) { - coordPTR[1] = ycoord_; - num_coords++; - if (zcoord_) { - coordPTR[2] = zcoord_; - num_coords++; - } - } - } - if (num_coords) { - Teuchos::RCP fineLevel = H.GetLevel(0); - Teuchos::RCP Op = fineLevel->Get >("A"); - Teuchos::RCP A = rcp_dynamic_cast(Op); - if (!A.is_null()) { - const Teuchos::RCP rowMap = fineLevel->Get >("A")->getRowMap(); - Teuchos::RCP coordinates = MultiVectorFactory::Build(rowMap, num_coords, true); - - for (size_t i = 0; i < num_coords; i++) { - Teuchos::ArrayRCP coordsi = coordinates->getDataNonConst(i); - const size_t myLength = coordinates->getLocalLength(); - for (size_t j = 0; j < myLength; j++) { - coordsi[j] = coordPTR[i][j]; - } - } - fineLevel->Set("Coordinates", coordinates); - } - } - - HierarchyManager::SetupHierarchy(H); -} - -// TODO: code factorization with MueLu_ParameterListInterpreter. -template -RCP > -MLParameterListInterpreter:: - GetSmootherFactory(const Teuchos::ParameterList& paramList, - const RCP& AFact) { - typedef Teuchos::ScalarTraits STS; - SC one = STS::one(); - - std::string type = "symmetric Gauss-Seidel"; // default - - // - // Get 'type' - // - - // //TODO: fix defaults!! - - // // Default coarse grid smoother - // std::string type; - // if ("smoother" == "coarse") { - // #if (defined(HAVE_MUELU_EPETRA) && defined( HAVE_MUELU_AMESOS)) || (defined(HAVE_MUELU_AMESOS2)) // FIXME: test is wrong (ex: compiled with Epetra&&Tpetra&&Amesos2 but without Amesos => error running Epetra problem) - // type = ""; // use default defined by AmesosSmoother or Amesos2Smoother - // #else - // type = "symmetric Gauss-Seidel"; // use a sym Gauss-Seidel (with no damping) as fallback "coarse solver" (TODO: needs Ifpack(2)) - // #endif - // } else { - // // TODO: default smoother? - // type = ""; - // } - - if (paramList.isParameter("smoother: type")) type = paramList.get("smoother: type"); - TEUCHOS_TEST_FOR_EXCEPTION(type.empty(), Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: no \"smoother: type\" in the smoother parameter list" << std::endl - << paramList); - - // - // Create the smoother prototype - // - - RCP smooProto; - std::string ifpackType; - Teuchos::ParameterList smootherParamList; - - if (type == "Jacobi" || type == "Gauss-Seidel" || type == "symmetric Gauss-Seidel") { - if (type == "symmetric Gauss-Seidel") type = "Symmetric Gauss-Seidel"; // FIXME - - ifpackType = "RELAXATION"; - smootherParamList.set("relaxation: type", type); - - MUELU_COPY_PARAM(paramList, "smoother: sweeps", int, 2, smootherParamList, "relaxation: sweeps"); - MUELU_COPY_PARAM(paramList, "smoother: damping factor", Scalar, one, smootherParamList, "relaxation: damping factor"); - - smooProto = rcp(new TrilinosSmoother(ifpackType, smootherParamList, 0)); - smooProto->SetFactory("A", AFact); - - } else if (type == "Chebyshev" || type == "MLS") { - ifpackType = "CHEBYSHEV"; - - MUELU_COPY_PARAM(paramList, "smoother: sweeps", int, 2, smootherParamList, "chebyshev: degree"); - if (paramList.isParameter("smoother: MLS alpha")) { - MUELU_COPY_PARAM(paramList, "smoother: MLS alpha", double, 20, smootherParamList, "chebyshev: ratio eigenvalue"); - } else { - MUELU_COPY_PARAM(paramList, "smoother: Chebyshev alpha", double, 20, smootherParamList, "chebyshev: ratio eigenvalue"); - } - - smooProto = rcp(new TrilinosSmoother(ifpackType, smootherParamList, 0)); - smooProto->SetFactory("A", AFact); - - } else if (type == "Hiptmair") { - ifpackType = "HIPTMAIR"; - std::string subSmootherType = "Chebyshev"; - if (paramList.isParameter("subsmoother: type")) - subSmootherType = paramList.get("subsmoother: type"); - std::string subSmootherIfpackType; - if (subSmootherType == "Chebyshev") - subSmootherIfpackType = "CHEBYSHEV"; - else if (subSmootherType == "Jacobi" || subSmootherType == "Gauss-Seidel" || subSmootherType == "symmetric Gauss-Seidel") { - if (subSmootherType == "symmetric Gauss-Seidel") subSmootherType = "Symmetric Gauss-Seidel"; // FIXME - subSmootherIfpackType = "RELAXATION"; - } else - TEUCHOS_TEST_FOR_EXCEPTION(true, Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: unknown smoother type. '" << subSmootherType << "' not supported by MueLu."); - - smootherParamList.set("hiptmair: smoother type 1", subSmootherIfpackType); - smootherParamList.set("hiptmair: smoother type 2", subSmootherIfpackType); - - auto smoother1ParamList = smootherParamList.sublist("hiptmair: smoother list 1"); - auto smoother2ParamList = smootherParamList.sublist("hiptmair: smoother list 2"); - - if (subSmootherType == "Chebyshev") { - MUELU_COPY_PARAM(paramList, "subsmoother: edge sweeps", int, 2, smoother1ParamList, "chebyshev: degree"); - MUELU_COPY_PARAM(paramList, "subsmoother: node sweeps", int, 2, smoother2ParamList, "chebyshev: degree"); - - MUELU_COPY_PARAM(paramList, "subsmoother: Chebyshev", double, 20, smoother1ParamList, "chebyshev: ratio eigenvalue"); - MUELU_COPY_PARAM(paramList, "subsmoother: Chebyshev", double, 20, smoother2ParamList, "chebyshev: ratio eigenvalue"); - } else { - MUELU_COPY_PARAM(paramList, "subsmoother: edge sweeps", int, 2, smoother1ParamList, "relaxation: sweeps"); - MUELU_COPY_PARAM(paramList, "subsmoother: node sweeps", int, 2, smoother2ParamList, "relaxation: sweeps"); - - MUELU_COPY_PARAM(paramList, "subsmoother: SGS damping factor", double, 0.8, smoother2ParamList, "relaxation: damping factor"); - } - - smooProto = rcp(new TrilinosSmoother(ifpackType, smootherParamList, 0)); - smooProto->SetFactory("A", AFact); - - } else if (type == "IFPACK") { // TODO: this option is not described in the ML Guide v5.0 - -#if defined(HAVE_MUELU_EPETRA) && defined(HAVE_MUELU_IFPACK) - ifpackType = paramList.get("smoother: ifpack type"); - - if (ifpackType == "ILU") { - // TODO fix this (type mismatch double vs. int) - // MUELU_COPY_PARAM(paramList, "smoother: ifpack level-of-fill", double /*int*/, 0.0 /*2*/, smootherParamList, "fact: level-of-fill"); - if (paramList.isParameter("smoother: ifpack level-of-fill")) - smootherParamList.set("fact: level-of-fill", Teuchos::as(paramList.get("smoother: ifpack level-of-fill"))); - else - smootherParamList.set("fact: level-of-fill", as(0)); - - MUELU_COPY_PARAM(paramList, "smoother: ifpack overlap", int, 2, smootherParamList, "partitioner: overlap"); - - // TODO change to TrilinosSmoother as soon as Ifpack2 supports all preconditioners from Ifpack - smooProto = - MueLu::GetIfpackSmoother(ifpackType, - smootherParamList, - paramList.get("smoother: ifpack overlap")); - smooProto->SetFactory("A", AFact); - } else { - TEUCHOS_TEST_FOR_EXCEPTION(true, Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: unknown ML smoother type " + type + " (IFPACK) not supported by MueLu. Only ILU is supported."); - } -#else - TEUCHOS_TEST_FOR_EXCEPTION(true, Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: MueLu compiled without Ifpack support"); -#endif - - } else if (type.length() > strlen("Amesos") && type.substr(0, strlen("Amesos")) == "Amesos") { /* catch Amesos-* */ - std::string solverType = type.substr(strlen("Amesos") + 1); /* ("Amesos-KLU" -> "KLU") */ - - // Validator: following upper/lower case is what is allowed by ML - bool valid = false; - const int validatorSize = 5; - std::string validator[validatorSize] = {"Superlu", "Superludist", "KLU", "UMFPACK", "MUMPS"}; /* TODO: should "" be allowed? */ - for (int i = 0; i < validatorSize; i++) { - if (validator[i] == solverType) valid = true; - } - TEUCHOS_TEST_FOR_EXCEPTION(!valid, Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: unknown smoother type. '" << type << "' not supported."); - - // FIXME: MueLu should accept any Upper/Lower case. Not the case for the moment - std::transform(solverType.begin() + 1, solverType.end(), solverType.begin() + 1, ::tolower); - - smooProto = Teuchos::rcp(new DirectSolver(solverType, Teuchos::ParameterList())); - smooProto->SetFactory("A", AFact); - - } else { - TEUCHOS_TEST_FOR_EXCEPTION(true, Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: unknown smoother type. '" << type << "' not supported by MueLu."); - } - TEUCHOS_TEST_FOR_EXCEPTION(smooProto == Teuchos::null, Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: no smoother prototype. fatal error."); - - // - // Create the smoother factory - // - - RCP SmooFact = rcp(new SmootherFactory()); - - // Set parameters of the smoother factory - MUELU_READ_PARAM(paramList, "smoother: pre or post", std::string, "both", preOrPost); - if (preOrPost == "both") { - SmooFact->SetSmootherPrototypes(smooProto, smooProto); - } else if (preOrPost == "pre") { - SmooFact->SetSmootherPrototypes(smooProto, Teuchos::null); - } else if (preOrPost == "post") { - SmooFact->SetSmootherPrototypes(Teuchos::null, smooProto); - } - - return SmooFact; -} - -template -void MLParameterListInterpreter::AddTransferFactory(const RCP& factory) { - // check if it's a TwoLevelFactoryBase based transfer factory - TEUCHOS_TEST_FOR_EXCEPTION(Teuchos::rcp_dynamic_cast(factory) == Teuchos::null, Exceptions::BadCast, "Transfer factory is not derived from TwoLevelFactoryBase. Since transfer factories will be handled by the RAPFactory they have to be derived from TwoLevelFactoryBase!"); - TransferFacts_.push_back(factory); -} - -template -size_t MLParameterListInterpreter::NumTransferFactories() const { - return TransferFacts_.size(); -} - -template -void MLParameterListInterpreter::SetupOperator(Operator& Op) const { - try { - Matrix& A = dynamic_cast(Op); - if (A.IsFixedBlockSizeSet() && (A.GetFixedBlockSize() != blksize_)) - this->GetOStream(Warnings0) << "Setting matrix block size to " << blksize_ << " (value of the parameter in the list) " - << "instead of " << A.GetFixedBlockSize() << " (provided matrix)." << std::endl; - - A.SetFixedBlockSize(blksize_); - -#ifdef HAVE_MUELU_DEBUG - MatrixUtils::checkLocalRowMapMatchesColMap(A); -#endif // HAVE_MUELU_DEBUG - - } catch (std::bad_cast&) { - this->GetOStream(Warnings0) << "Skipping setting block size as the operator is not a matrix" << std::endl; - } -} - -} // namespace MueLu - -#define MUELU_MLPARAMETERLISTINTERPRETER_SHORT -#endif /* MUELU_MLPARAMETERLISTINTERPRETER_DEF_HPP */ - -// TODO: see if it can be factorized with ML interpreter (ex: generation of Ifpack param list) diff --git a/packages/muelu/src/Transfers/Smoothed-Aggregation/MueLu_NullspaceFactory_kokkos_decl.hpp b/packages/muelu/src/Transfers/Smoothed-Aggregation/MueLu_NullspaceFactory_kokkos_decl.hpp deleted file mode 100644 index 82fd49a91699..000000000000 --- a/packages/muelu/src/Transfers/Smoothed-Aggregation/MueLu_NullspaceFactory_kokkos_decl.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// @HEADER -// ***************************************************************************** -// MueLu: A package for multigrid based preconditioning -// -// Copyright 2012 NTESS and the MueLu contributors. -// SPDX-License-Identifier: BSD-3-Clause -// ***************************************************************************** -// @HEADER - -#ifndef MUELU_NULLSPACEFACTORY_KOKKOS_DECL_HPP -#define MUELU_NULLSPACEFACTORY_KOKKOS_DECL_HPP - -#include "MueLu_NullspaceFactory.hpp" - -namespace MueLu { - -template -class [[deprecated]] NullspaceFactory_kokkos : public NullspaceFactory {}; - -} // namespace MueLu - -#define MUELU_NULLSPACEFACTORY_KOKKOS_SHORT -#endif // MUELU_NULLSPACEFACTORY_KOKKOS_DECL_HPP diff --git a/packages/muelu/src/Transfers/Smoothed-Aggregation/MueLu_NullspaceFactory_kokkos_def.hpp b/packages/muelu/src/Transfers/Smoothed-Aggregation/MueLu_NullspaceFactory_kokkos_def.hpp deleted file mode 100644 index bad8376962c7..000000000000 --- a/packages/muelu/src/Transfers/Smoothed-Aggregation/MueLu_NullspaceFactory_kokkos_def.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// @HEADER -// ***************************************************************************** -// MueLu: A package for multigrid based preconditioning -// -// Copyright 2012 NTESS and the MueLu contributors. -// SPDX-License-Identifier: BSD-3-Clause -// ***************************************************************************** -// @HEADER - -#ifndef MUELU_NULLSPACEFACTORY_KOKKOS_DEF_HPP -#define MUELU_NULLSPACEFACTORY_KOKKOS_DEF_HPP - -#include "MueLu_NullspaceFactory_kokkos_decl.hpp" - -#endif // MUELU_NULLSPACEFACTORY_KOKKOS_DEF_HPP diff --git a/packages/muelu/src/Utils/ClassList/SC-LO-GO-NO.classList b/packages/muelu/src/Utils/ClassList/SC-LO-GO-NO.classList index fb5f2e6315cd..c606287c8edf 100644 --- a/packages/muelu/src/Utils/ClassList/SC-LO-GO-NO.classList +++ b/packages/muelu/src/Utils/ClassList/SC-LO-GO-NO.classList @@ -64,11 +64,9 @@ MapTransferFactory MatrixAnalysisFactory MergedBlockedMatrixFactory MergedSmoother -MLParameterListInterpreter - #if defined(HAVE_MUELU_DEPRECATED_CODE) MultiVectorTransferFactory NotayAggregationFactory NullspaceFactory -NullspaceFactory_kokkos - #if defined(HAVE_MUELU_DEPRECATED_CODE) NullspacePresmoothFactory ParameterListInterpreter PatternFactory diff --git a/packages/muelu/src/Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake b/packages/muelu/src/Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake index 6ce2a712f4fb..20dc4095f4f0 100644 --- a/packages/muelu/src/Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake +++ b/packages/muelu/src/Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake @@ -63,11 +63,9 @@ APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::MapTransferFactory ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::MatrixAnalysisFactory ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::MergedBlockedMatrixFactory ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::MergedSmoother ) -APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::MLParameterListInterpreter-.?if.defined[HAVE_MUELU_DEPRECATED_CODE] ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::MultiVectorTransferFactory ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::NotayAggregationFactory ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::NullspaceFactory ) -APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::NullspaceFactory_kokkos-.?if.defined[HAVE_MUELU_DEPRECATED_CODE] ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::NullspacePresmoothFactory ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::ParameterListInterpreter ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::PatternFactory ) diff --git a/packages/muelu/src/Utils/ForwardDeclaration/MueLu_MLParameterListIntepreter_fwd.hpp b/packages/muelu/src/Utils/ForwardDeclaration/MueLu_MLParameterListIntepreter_fwd.hpp deleted file mode 100644 index 004cb8991843..000000000000 --- a/packages/muelu/src/Utils/ForwardDeclaration/MueLu_MLParameterListIntepreter_fwd.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// @HEADER -// ***************************************************************************** -// MueLu: A package for multigrid based preconditioning -// -// Copyright 2012 NTESS and the MueLu contributors. -// SPDX-License-Identifier: BSD-3-Clause -// ***************************************************************************** -// @HEADER - -#ifndef MUELU_MLPARAMETERLISTINTEPRETER_FWD_HPP -#define MUELU_MLPARAMETERLISTINTEPRETER_FWD_HPP - -#include "MueLu_ConfigDefs.hpp" -#if defined(HAVE_MUELU_DEPRECATED_CODE) - -namespace MueLu { -template -class MLParameterListIntepreter; -} - -#ifndef MUELU_MLPARAMETERLISTINTEPRETER_SHORT -#define MUELU_MLPARAMETERLISTINTEPRETER_SHORT -#endif - -#endif - -#endif // MUELU_MLPARAMETERLISTINTEPRETER_FWD_HPP diff --git a/packages/muelu/src/Utils/ForwardDeclaration/MueLu_MLParameterListInterpreter_fwd.hpp b/packages/muelu/src/Utils/ForwardDeclaration/MueLu_MLParameterListInterpreter_fwd.hpp deleted file mode 100644 index a30343f06ed3..000000000000 --- a/packages/muelu/src/Utils/ForwardDeclaration/MueLu_MLParameterListInterpreter_fwd.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// @HEADER -// ***************************************************************************** -// MueLu: A package for multigrid based preconditioning -// -// Copyright 2012 NTESS and the MueLu contributors. -// SPDX-License-Identifier: BSD-3-Clause -// ***************************************************************************** -// @HEADER - -#ifndef MUELU_MLPARAMETERLISTINTERPRETER_FWD_HPP -#define MUELU_MLPARAMETERLISTINTERPRETER_FWD_HPP - -#include "MueLu_ConfigDefs.hpp" -#if defined(HAVE_MUELU_DEPRECATED_CODE) - -namespace MueLu { -template -class MLParameterListInterpreter; -} - -#ifndef MUELU_MLPARAMETERLISTINTERPRETER_SHORT -#define MUELU_MLPARAMETERLISTINTERPRETER_SHORT -#endif - -#endif - -#endif // MUELU_MLPARAMETERLISTINTERPRETER_FWD_HPP diff --git a/packages/muelu/src/Utils/ForwardDeclaration/MueLu_NullspaceFactory_kokkos_fwd.hpp b/packages/muelu/src/Utils/ForwardDeclaration/MueLu_NullspaceFactory_kokkos_fwd.hpp deleted file mode 100644 index 805c7ee1970f..000000000000 --- a/packages/muelu/src/Utils/ForwardDeclaration/MueLu_NullspaceFactory_kokkos_fwd.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// @HEADER -// ***************************************************************************** -// MueLu: A package for multigrid based preconditioning -// -// Copyright 2012 NTESS and the MueLu contributors. -// SPDX-License-Identifier: BSD-3-Clause -// ***************************************************************************** -// @HEADER - -#ifndef MUELU_NULLSPACEFACTORY_KOKKOS_FWD_HPP -#define MUELU_NULLSPACEFACTORY_KOKKOS_FWD_HPP - -#include "MueLu_ConfigDefs.hpp" -#if defined(HAVE_MUELU_DEPRECATED_CODE) - -namespace MueLu { -template -class NullspaceFactory_kokkos; -} - -#ifndef MUELU_NULLSPACEFACTORY_KOKKOS_SHORT -#define MUELU_NULLSPACEFACTORY_KOKKOS_SHORT -#endif - -#endif - -#endif // MUELU_NULLSPACEFACTORY_KOKKOS_FWD_HPP