10 #ifndef MUELU_TOGGLECOORDINATESTRANSFER_FACTORY_DEF_HPP
11 #define MUELU_TOGGLECOORDINATESTRANSFER_FACTORY_DEF_HPP
20 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
24 validParamList->
set<
RCP<const FactoryBase> >(
"Chosen P", Teuchos::null,
"Name of TogglePFactory this ToggleCoordinatesTransferFactory is connected to. Parameter provides information which execution path (prolongator) has been chosen.");
26 return validParamList;
29 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
32 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!");
33 Input(coarseLevel,
"Chosen P");
34 for (std::vector<
RCP<const FactoryBase> >::const_iterator it = coordFacts_.begin(); it != coordFacts_.end(); ++it) {
35 coarseLevel.
DeclareInput(
"Coordinates", (*it).get(),
this);
36 (*it)->CallDeclareInput(coarseLevel);
38 hasDeclaredInput_ =
true;
41 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
43 FactoryMonitor m(*
this,
"Coordinate transfer toggle", coarseLevel);
49 int chosenP = Get<int>(coarseLevel,
"Chosen P");
50 GetOStream(
Runtime1) <<
"Transfer Coordinates" << chosenP <<
" to coarse level" << std::endl;
51 RCP<xdMV> coarseCoords = coarseLevel.Get<
RCP<xdMV> >(
"Coordinates", (coordFacts_[chosenP]).
get());
52 Set(coarseLevel,
"Coordinates", coarseCoords);
69 for (
size_t t = 0; t < coordFacts_.size(); ++t) {
70 coarseLevel.Release(*(coordFacts_[t]));
76 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
80 "MueLu::ToggleCoordinatesTransferFactory::AddCoordTransferFactory: Transfer factory is not derived from TwoLevelFactoryBase. Make sure you provide the factory which generates the coarse coordinates. Usually this is a coordinate transfer factory."
81 "This is very strange. (Note: you can remove this exception if there's a good reason for)");
83 coordFacts_.push_back(factory);
87 #endif // MUELU_TOGGLECOORDINATESTRANSFER_FACTORY_DEF_HPP
Exception indicating invalid cast attempted.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
Timer to be used in factories. Similar to Monitor but with additional timers.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
void AddCoordTransferFactory(const RCP< const FactoryBase > &factory)
Add a coordinate transfer factory in the end of list of coordinate transfer factories.
bool isParameter(const std::string &name) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
Exception throws to report errors in the internal logical of the program.
Description of what is happening (more verbose)
void DeclareInput(Level &finelevel, Level &coarseLevel) const
Specifies the data that this class needs, and the factories that generate that data.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.