10 #ifndef MUELU_LEVEL_HPP
11 #define MUELU_LEVEL_HPP
19 #include <Teuchos_Describable.hpp>
20 #include <Teuchos_FancyOStream.hpp>
25 #include <Xpetra_Map.hpp>
32 #include "MueLu_Utilities.hpp"
131 map_[factory][ename]->SetData(entry);
134 GetOStream(
Runtime1) <<
"Level::Set: Not storing \"" << ename <<
"\" generated by factory " << factory->ShortClassName() <<
"[" << factory->GetID() <<
"]"
135 <<
" on level " <<
toString(
GetLevelID()) <<
", as it has not been requested and no keep flags were set for it" << std::endl;
163 "\"" << ename <<
"\" has not been requested (counter = " <<
NumRequests(fac, ename) <<
", "
166 <<
"Generating factory:" << *fac <<
" NoFactory = " <<
NoFactory::get());
172 "MueLu::Level::Get(): factory did not produce expected output on level " <<
GetLevelID()
173 <<
". The data \"" << ename <<
"\" has not been generated by " << *fac);
175 return map_[fac][ename]->template GetData<T>();
181 rValue = Get<T>(ename, factory);
192 "\"" << ename <<
"\" has not been requested (counter = " <<
NumRequests(fac, ename) <<
", "
195 <<
"Generating factory:" << *fac <<
" NoFactory = " <<
NoFactory::get());
201 "MueLu::Level::Get(): factory did not produce expected output on level " <<
GetLevelID()
202 <<
". The data \"" << ename <<
"\" has not been generated by " << *fac);
204 return map_[fac][ename]->template CheckType<T>();
312 #if defined(HAVE_MUELU_BOOST) && defined(HAVE_MUELU_BOOST_FOR_REAL) && defined(BOOST_VERSION) && (BOOST_VERSION >= 104400)
313 void UpdateGraph(std::map<const FactoryBase*, BoostVertex>& vindices,
314 std::map<std::pair<BoostVertex, BoostVertex>, std::string>& edges,
316 BoostGraph& graph)
const;
363 using Key2 =
const std::string;
403 #endif // MUELU_LEVEL_HPP
void Keep(const std::string &ename, const FactoryBase *factory)
Request to keep variable 'ename' generated by 'factory' after the setup phase.
virtual ~Level()
Destructor.
RCP< const Teuchos::Comm< int > > comm_
KeepType GetKeepFlag(const std::string &ename, const FactoryBase *factory) const
Get the flag combination set for variable 'ename' generated by 'factory'.
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access). Usage: Level->Get< RCP<Matrix> >("A", factory) if factory == NULL => use default factory.
virtual void CallBuild(Level &requestedLevel) const =0
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
bool IsKept(const std::string &ename, const FactoryBase *factory, KeepType keep) const
void DeclareDependencies(const FactoryBase *factory, bool bRequestOnly=false, bool bReleaseOnly=false)
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput() to declare factory depe...
void Release(const FactoryBase &factory)
Decrement the storage counter for all the inputs of a factory.
Xpetra::UnderlyingLib lib_
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
RCP< Level > previousLevel_
User data are always kept. This flag is set automatically when Level::Set("data", data) is used...
void SetPreviousLevel(const RCP< Level > &previousLevel)
void SetFactoryManager(const RCP< const FactoryManagerBase > &factoryManager)
Set default factories (used internally by Hierarchy::SetLevel()).
int CountRequestedFactory(const FactoryBase *factory) const
static const NoFactory * get()
void setlib(Xpetra::UnderlyingLib lib2)
RequestMode GetRequestMode() const
Base class for factories (e.g., R, P, and A_coarse).
void Clear()
Delete all data that have been retained after the setup phase using Final flag.
bool IsRequestedBy(const FactoryBase *factory, const std::string &ename, const FactoryBase *requestedBy) const
const FactoryBase * GetFactory(const std::string &varname, const FactoryBase *factory) const
If input factory == NULL, returns the default factory. Else, return input factory.
Class that holds all level-specific information.
static RequestMode requestMode_
void Delete(const std::string &ename, const FactoryBase *factory)
Delete data that have been retained after the setup phase (using Keep(), AddKeepFlag(), or internal MueLu logic).
int levelID_
Map of a map (Key1 -> SubMap)
std::string GetTypeName(const std::string &ename, const FactoryBase *factory=NoFactory::get())
GetTypeName returns type string of variable stored using ename and factory.
void RemoveKeepFlag(const std::string &ename, const FactoryBase *factory, KeepType keep=MueLu::All)
std::string description() const
Return a simple one-line description of this object.
Xpetra::UnderlyingLib lib()
Always keep data, even accross run. This flag is set by Level::Keep(). This flag is propagated to coa...
int NumRequests(const FactoryBase *factory, const std::string &ename) const
void AddKeepFlag(const std::string &ename, const FactoryBase *factory=NoFactory::get(), KeepType keep=MueLu::Keep)
void Set(const std::string &ename, const T &entry, const FactoryBase *factory=NoFactory::get())
bool IsAvailableFactory(const FactoryBase *factory) const
Base class for MueLu classes.
RCP< Level > & GetPreviousLevel()
Previous level.
void print(std::ostream &out, const VerbLevel verbLevel=Default) const
Printing method.
bool IsType(const std::string &ename, const FactoryBase *factory=NoFactory::get())
void SetLevelID(int levelID)
Set level number.
RCP< const FactoryManagerBase > factoryManager_
bool IsRequestedFactory(const FactoryBase *factory) const
const RCP< const FactoryManagerBase > GetFactoryManager()
returns the current factory manager
int GetLevelID() const
Return level number.
Exception throws to report errors in the internal logical of the program.
void SetComm(RCP< const Teuchos::Comm< int > > const &comm)
Description of what is happening (more verbose)
bool IsRequested(const std::string &ename, const FactoryBase *factory=NoFactory::get()) const
Test whether a need has been requested. Note: this tells nothing about whether the need's value exist...
bool IsKey(const FactoryBase *factory, const std::string &ename) const
Test whether some information about (ename, factory) are stored.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()
RCP< const Teuchos::Comm< int > > GetComm() const
void Get(const std::string &ename, T &rValue, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access).
virtual std::string description() const
Return a simple one-line description of this object.
bool IsAvailable(const std::string &ename, const FactoryBase *factory=NoFactory::get()) const
Test whether a need's value has been saved.
void Request(const FactoryBase &factory)
Increment the storage counter for all the inputs of a factory.