46#ifndef MUELU_FACTORYMANAGER_DEF_HPP
47#define MUELU_FACTORYMANAGER_DEF_HPP
49#include <Teuchos_ParameterList.hpp>
52#include "MueLu_AmalgamationFactory.hpp"
53#include "MueLu_CoalesceDropFactory.hpp"
54#include "MueLu_CoarseMapFactory.hpp"
55#include "MueLu_ConstraintFactory.hpp"
56#include "MueLu_AggregateQualityEstimateFactory.hpp"
57#include "MueLu_CoordinatesTransferFactory.hpp"
58#include "MueLu_DirectSolver.hpp"
59#include "MueLu_InitialBlockNumberFactory.hpp"
60#include "MueLu_LineDetectionFactory.hpp"
63#include "MueLu_NullspaceFactory.hpp"
64#include "MueLu_PatternFactory.hpp"
65#include "MueLu_RAPFactory.hpp"
66#include "MueLu_RepartitionHeuristicFactory.hpp"
67#include "MueLu_RepartitionFactory.hpp"
68#include "MueLu_SaPFactory.hpp"
69#include "MueLu_ScaledNullspaceFactory.hpp"
70#include "MueLu_SmootherFactory.hpp"
71#include "MueLu_TentativePFactory.hpp"
72#include "MueLu_TransPFactory.hpp"
73#include "MueLu_TrilinosSmoother.hpp"
74#include "MueLu_UncoupledAggregationFactory.hpp"
75#include "MueLu_StructuredAggregationFactory.hpp"
76#include "MueLu_HybridAggregationFactory.hpp"
77#include "MueLu_ZoltanInterface.hpp"
78#include "MueLu_InterfaceMappingTransferFactory.hpp"
79#include "MueLu_InterfaceAggregationFactory.hpp"
80#include "MueLu_InverseApproximationFactory.hpp"
82#include "MueLu_AmalgamationFactory_kokkos.hpp"
83#include "MueLu_CoalesceDropFactory_kokkos.hpp"
84#include "MueLu_CoarseMapFactory_kokkos.hpp"
85#include "MueLu_CoordinatesTransferFactory_kokkos.hpp"
86#include "MueLu_NullspaceFactory_kokkos.hpp"
87#include "MueLu_SaPFactory_kokkos.hpp"
88#include "MueLu_TentativePFactory_kokkos.hpp"
89#include "MueLu_UncoupledAggregationFactory_kokkos.hpp"
96#define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \
97 (!useKokkos_) ? SetAndReturnDefaultFactory(varName, rcp(new oldFactory())) : \
98 SetAndReturnDefaultFactory(varName, rcp(new newFactory()));
100 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
105 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
116 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
118 return Teuchos::rcp_const_cast<FactoryBase>(
GetFactory(varName));
121 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
127 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
137 if (varName ==
"RAP Pattern")
return GetFactory(
"A");
138 if (varName ==
"AP Pattern")
return GetFactory(
"A");
140 if (varName ==
"P") {
142 RCP<Factory> factory;
147 factory->SetFactory(
"P",
GetFactory(
"Ptent"));
150 if (varName ==
"Nullspace") {
152 RCP<Factory> factory;
157 factory->SetFactory(
"Nullspace",
GetFactory(
"Ptent"));
162 if (varName ==
"Coordinates")
return GetFactory(
"Ptent");
163 if (varName ==
"Node Comm")
return GetFactory(
"Ptent");
166 if (varName ==
"RfromPfactory")
return GetFactory(
"P");
167#if defined(HAVE_MUELU_ZOLTAN) && defined(HAVE_MPI)
171 if (varName ==
"Importer") {
178 if (varName ==
"number of partitions") {
185 if (varName ==
"repartition: heuristic target rows per process")
return GetFactory(
"number of partitions");
192 if (varName ==
"DofsPerNode")
return GetFactory(
"Graph");
193 if (varName ==
"Filtering")
return GetFactory(
"Graph");
196 if (varName ==
"LineDetection_Layers")
return GetFactory(
"LineDetection_VertLineIds");
197 if (varName ==
"CoarseNumZLayers")
return GetFactory(
"LineDetection_VertLineIds");
205 if (varName ==
"Mdiag")
return GetFactory(
"A");
206 if (varName ==
"cfl-based shift array")
return GetFactory(
"A");
209 if (varName ==
"PreSmoother")
return GetFactory(
"Smoother");
210 if (varName ==
"PostSmoother")
return GetFactory(
"Smoother");
212 if (varName ==
"Ppattern") {
219 if (varName ==
"Smoother") {
220 Teuchos::ParameterList smootherParamList;
221 smootherParamList.set(
"relaxation: type",
"Symmetric Gauss-Seidel");
222 smootherParamList.set(
"relaxation: sweeps", Teuchos::OrdinalTraits<LO>::one());
223 smootherParamList.set(
"relaxation: damping factor", Teuchos::ScalarTraits<Scalar>::one());
230#ifdef HAVE_MUELU_INTREPID2
232 if (varName ==
"pcoarsen: element to node map")
return GetFactory(
"P");
235 TEUCHOS_TEST_FOR_EXCEPTION(
true,
MueLu::Exceptions::RuntimeError,
"MueLu::FactoryManager::GetDefaultFactory(): No default factory available for building '" + varName +
"'.");
239 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
241 TEUCHOS_TEST_FOR_EXCEPTION(factory.is_null(),
Exceptions::RuntimeError,
"The default factory for building '" << varName <<
"' is null");
243 GetOStream(
Runtime1) <<
"Using default factory (" << factory->ShortClassName() <<
"["<<factory->GetID()<<
"]) for building '" << varName <<
"'." << std::endl;
250 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
252 std::map<std::string, RCP<const FactoryBase> >::const_iterator it;
257 fancy <<
"Users factory table (factoryTable_):" << std::endl;
259 fancy <<
" " << it->first <<
" -> ";
261 else if (!it->second.get()) fancy<<
"NULL";
263 fancy << it->second.get()->ShortClassName()<<
"["<<it->second.get()->GetID()<<
"]";
264#ifdef HAVE_MUELU_DEBUG
265 fancy<<
"("<<Teuchos::toString(it->second.get()) <<
")";
271 fancy <<
"Default factory table (defaultFactoryTable_):" << std::endl;
273 fancy <<
" " << it->first <<
" -> ";
275 else if (!it->second.get()) fancy<<
"NULL";
277 fancy << it->second.get()->ShortClassName()<<
"["<<it->second.get()->GetID()<<
"]";
278#ifdef HAVE_MUELU_DEBUG
279 fancy<<
"("<<Teuchos::toString(it->second.get()) <<
")";
287#ifdef HAVE_MUELU_DEBUG
288 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
290 std::map<std::string, RCP<const FactoryBase> >::const_iterator it;
292 for (it = factoryTable_.begin(); it != factoryTable_.end(); it++)
293 if (!it->second.is_null())
294 it->second->ResetDebugData();
296 for (it = defaultFactoryTable_.begin(); it != defaultFactoryTable_.end(); it++)
297 if (!it->second.is_null())
298 it->second->ResetDebugData();
303#undef MUELU_KOKKOS_FACTORY
#define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory)
An factory which assigns each aggregate a quality estimate. Originally developed by Napov and Notay i...
AmalgamationFactory_kokkos for subblocks of strided map based amalgamation data.
AmalgamationFactory for subblocks of strided map based amalgamation data.
Factory for creating a graph based on a given matrix.
Factory for creating a graph based on a given matrix.
Factory for generating coarse level map. Used by TentativePFactory.
Factory for building the constraint operator.
Class that encapsulates direct solvers. Autoselection of AmesosSmoother or Amesos2Smoother according ...
Exception throws to report errors in the internal logical of the program.
This class specifies the default factory that should generate some data on a Level if the data does n...
const RCP< const FactoryBase > GetDefaultFactory(const std::string &varName) const
const RCP< const FactoryBase > SetAndReturnDefaultFactory(const std::string &varName, const RCP< const FactoryBase > &factory) const
bool useKokkos_
Whether or not to use kokkos factories.
std::map< std::string, RCP< const FactoryBase > > defaultFactoryTable_
Table that holds default factories.
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Set Factory.
bool hasFactory(const std::string &varName) const
Check.
std::map< std::string, RCP< const FactoryBase > > factoryTable_
User-defined factories.
const RCP< const FactoryBase > GetFactory(const std::string &varName) const
Get factory associated with a particular data name.
const RCP< FactoryBase > GetFactoryNonConst(const std::string &varName)
Get factory associated with a particular data name (NONCONST version)
Class for generating an initial LocalOrdinal-type BlockNumber vector, based on an input paraemter for...
Factory for building aggregates for Lagrange multipliers in surface-coupled problems.
Transfer mapping data for interface aggregation to the coarse level.
Factory for building the approximate inverse of a matrix.
Factory for building line detection information.
static const RCP< const NoFactory > getRCP()
Static Get() functions.
static const NoFactory * get()
Factory for generating nullspace.
Factory for building nonzero patterns for energy minimization.
Factory for building coarse matrices.
Factory for building permutation matrix that can be be used to shuffle data (matrices,...
Factory for determing the number of partitions for rebalancing.
Factory for building Smoothed Aggregation prolongators.
Factory for building Smoothed Aggregation prolongators.
Factory for generating a very special nullspace.
Generic Smoother Factory for generating the smoothers of the MG hierarchy.
Factory for building aggregates on structured grids.
Factory for building tentative prolongator.
Factory for building restriction operators.
Class that encapsulates external library smoothers.
Factory for building uncoupled aggregates.
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
Interface to Zoltan library.
Namespace for MueLu classes and methods.
@ Debug
Print additional debugging information.
@ Runtime1
Description of what is happening (more verbose)