MueLu
Version of the Day
|
Class that holds all level-specific information. More...
#include <MueLu_Level.hpp>
Public Types | |
enum | RequestMode { REQUEST, RELEASE, UNDEF } |
Public Member Functions | |
RequestMode | GetRequestMode () const |
void | setlib (Xpetra::UnderlyingLib lib2) |
Xpetra::UnderlyingLib | lib () |
void | SetComm (RCP< const Teuchos::Comm< int > > const &comm) |
RCP< const Teuchos::Comm< int > > | GetComm () const |
![]() | |
virtual | ~BaseClass () |
Destructor. More... | |
![]() | |
VerbLevel | GetVerbLevel () const |
Get the verbosity level. More... | |
void | SetVerbLevel (const VerbLevel verbLevel) |
Set the verbosity level of this object. More... | |
int | GetProcRankVerbose () const |
Get proc rank used for printing. Do not use this information for any other purpose. More... | |
int | SetProcRankVerbose (int procRank) const |
Set proc rank used for printing. More... | |
bool | IsPrint (MsgType type, int thisProcRankOnly=-1) const |
Find out whether we need to print out information for a specific message type. More... | |
Teuchos::FancyOStream & | GetOStream (MsgType type, int thisProcRankOnly=0) const |
Get an output stream for outputting the input message type. More... | |
Teuchos::FancyOStream & | GetBlackHole () const |
VerboseObject () | |
virtual | ~VerboseObject () |
Destructor. More... | |
![]() | |
virtual | ~Describable () |
Destructor. More... | |
virtual std::string | ShortClassName () const |
Return the class name of the object, without template parameters and without namespace. More... | |
virtual void | describe (Teuchos::FancyOStream &out_arg, const VerbLevel verbLevel=Default) const |
void | describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const |
Print the object with some verbosity level to an FancyOStream object. More... | |
Private Types | |
typedef const FactoryBase * | Key1 |
typedef const std::string | Key2 |
typedef RCP< VariableContainer > | Value |
typedef Teuchos::map< Key2, Value > | SubMap |
typedef Teuchos::map< Key1, SubMap > | TwoKeyMap |
Sub-map container (Key2 -> Value) More... | |
Private Member Functions | |
Level (const Level &source) | |
Copy constructor. More... | |
const FactoryBase * | GetFactory (const std::string &varname, const FactoryBase *factory) const |
If input factory == NULL, returns the default factory. Else, return input factory. More... | |
Private Attributes | |
Xpetra::UnderlyingLib | lib_ |
RCP< const Teuchos::Comm< int > > | comm_ |
int | levelID_ |
Map of a map (Key1 -> SubMap) More... | |
RCP< const FactoryManagerBase > | factoryManager_ |
RCP< Level > | previousLevel_ |
TwoKeyMap | map_ |
Static Private Attributes | |
static RequestMode | requestMode_ = UNDEF |
Constructors / Destructors | |
Level () | |
Level (RCP< FactoryManagerBase > &factoryManager) | |
virtual | ~Level () |
Destructor. More... | |
Build methods | |
RCP< Level > | Build () |
Level handling | |
int | GetLevelID () const |
Return level number. More... | |
void | SetLevelID (int levelID) |
Set level number. More... | |
RCP< Level > & | GetPreviousLevel () |
Previous level. More... | |
void | SetPreviousLevel (const RCP< Level > &previousLevel) |
Set/Get factory manager | |
void | SetFactoryManager (const RCP< const FactoryManagerBase > &factoryManager) |
Set default factories (used internally by Hierarchy::SetLevel()). More... | |
const RCP< const FactoryManagerBase > | GetFactoryManager () |
returns the current factory manager More... | |
Set functions | |
template<class T > | |
void | Set (const std::string &ename, const T &entry, const FactoryBase *factory=NoFactory::get()) |
Get functions | |
template<class T > | |
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. More... | |
template<class T > | |
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). More... | |
std::string | GetTypeName (const std::string &ename, const FactoryBase *factory=NoFactory::get()) |
GetTypeName returns type string of variable stored using ename and factory. More... | |
Permanent storage | |
void | Keep (const std::string &ename, const FactoryBase *factory) |
Request to keep variable 'ename' generated by 'factory' after the setup phase. More... | |
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). More... | |
void | Clear () |
Delete all data that have been retained after the setup phase using Final flag. More... | |
void | ExpertClear () |
bool | IsKept (const std::string &ename, const FactoryBase *factory, KeepType keep) const |
void | AddKeepFlag (const std::string &ename, const FactoryBase *factory=NoFactory::get(), KeepType keep=MueLu::Keep) |
void | RemoveKeepFlag (const std::string &ename, const FactoryBase *factory, KeepType keep=MueLu::All) |
KeepType | GetKeepFlag (const std::string &ename, const FactoryBase *factory) const |
Get the flag combination set for variable 'ename' generated by 'factory'. More... | |
Request/Release functions | |
Request and Release for incrementing/decrementing the reference count pointer for a specific variable. | |
void | Request (const FactoryBase &factory) |
Increment the storage counter for all the inputs of a factory. More... | |
void | Release (const FactoryBase &factory) |
Decrement the storage counter for all the inputs of a factory. More... | |
void | DeclareInput (const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get()) |
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput() More... | |
void | DeclareDependencies (const FactoryBase *factory, bool bRequestOnly=false, bool bReleaseOnly=false) |
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput() to declare factory dependencies. More... | |
void | Request (const std::string &ename, const FactoryBase *factory=NoFactory::get(), const FactoryBase *requestedBy=NoFactory::get()) |
Indicate that an object is needed. This increments the storage counter. More... | |
void | Release (const std::string &ename, const FactoryBase *factory=NoFactory::get(), const FactoryBase *requestedBy=NoFactory::get()) |
Decrement the storage counter. More... | |
Utility functions | |
bool | IsAvailable (const std::string &ename, const FactoryBase *factory=NoFactory::get()) const |
Test whether a need's value has been saved. More... | |
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 exists. More... | |
bool | IsKey (const FactoryBase *factory, const std::string &ename) const |
Test whether some information about (ename, factory) are stored. More... | |
bool | IsAvailableFactory (const FactoryBase *factory) const |
bool | IsRequested (const Value &v) const |
bool | IsRequestedBy (const FactoryBase *factory, const std::string &ename, const FactoryBase *requestedBy) const |
bool | IsRequestedBy (const Value &v, const FactoryBase *requestedBy) const |
bool | IsRequestedFactory (const FactoryBase *factory) const |
const Value & | Get (const FactoryBase *factory, const std::string &ename) const |
int | NumRequests (const FactoryBase *factory, const std::string &ename) const |
int | CountRequestedFactory (const FactoryBase *factory) const |
I/O Functions | |
std::string | description () const |
Return a simple one-line description of this object. More... | |
void | print (std::ostream &out, const VerbLevel verbLevel=Default) const |
Printing method. More... | |
Additional Inherited Members | |
![]() | |
static void | SetMueLuOStream (const Teuchos::RCP< Teuchos::FancyOStream > &mueluOStream) |
static void | SetMueLuOFileStream (const std::string &filename) |
static Teuchos::RCP< Teuchos::FancyOStream > | GetMueLuOStream () |
static void | SetDefaultVerbLevel (const VerbLevel defaultVerbLevel) |
Set the default (global) verbosity level. More... | |
static VerbLevel | GetDefaultVerbLevel () |
Get the default (global) verbosity level. More... | |
Class that holds all level-specific information.
All data that is stored in the Level
class need a variable name (e.g. "A", "P", ...) and a pointer to the generating factory. Only with both the variable name and the generating factory the data can be accessed.
If no pointer to the generating factory is provided (or it is NULL) then the Level class uses the information from a factory manager, which stores default factories for different variable names.
We use a "two key" map for storage of data, with the pointer to the generating factory as primary key and the variable name as secondary key. The pointer to the generating factory is only used as primary "key". It doesn't matter if the given factory pointer is valid or not. So the NULL pointer can also be used.
The data itself is stored within a VariableContainer object. A reference counter keeps track of the storage and automatically frees the memory if the data is not needed any more. In the standard mode, the data first has to be requested by calling the Request function. Then the data can be set by calling Set. With Get the user can fetch data when needed. Release decrements the reference counter for the given variable.
Definition at line 99 of file MueLu_Level.hpp.
|
private |
Definition at line 416 of file MueLu_Level.hpp.
|
private |
Definition at line 417 of file MueLu_Level.hpp.
|
private |
Definition at line 418 of file MueLu_Level.hpp.
|
private |
Definition at line 419 of file MueLu_Level.hpp.
|
private |
Sub-map container (Key2 -> Value)
Definition at line 420 of file MueLu_Level.hpp.
Enumerator | |
---|---|
REQUEST | |
RELEASE | |
UNDEF |
Definition at line 376 of file MueLu_Level.hpp.
|
inline |
Definition at line 106 of file MueLu_Level.hpp.
|
inline |
Definition at line 108 of file MueLu_Level.hpp.
|
inlinevirtual |
Destructor.
Definition at line 111 of file MueLu_Level.hpp.
|
private |
Copy constructor.
RCP< Level > MueLu::Level::Build | ( | ) |
Definition at line 54 of file MueLu_Level.cpp.
int MueLu::Level::GetLevelID | ( | ) | const |
Return level number.
Definition at line 76 of file MueLu_Level.cpp.
void MueLu::Level::SetLevelID | ( | int | levelID | ) |
Set level number.
Definition at line 78 of file MueLu_Level.cpp.
|
inline |
Previous level.
Definition at line 132 of file MueLu_Level.hpp.
void MueLu::Level::SetPreviousLevel | ( | const RCP< Level > & | previousLevel | ) |
Set previous level object \param[in] const RCP<Level>& previousLevel
Definition at line 85 of file MueLu_Level.cpp.
void MueLu::Level::SetFactoryManager | ( | const RCP< const FactoryManagerBase > & | factoryManager | ) |
Set default factories (used internally by Hierarchy::SetLevel()).
Definition at line 92 of file MueLu_Level.cpp.
const RCP< const FactoryManagerBase > MueLu::Level::GetFactoryManager | ( | ) |
returns the current factory manager
Definition at line 96 of file MueLu_Level.cpp.
|
inline |
Store need label and its associated data. This does not increment the storage counter.
Definition at line 157 of file MueLu_Level.hpp.
|
inline |
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.
[in] | const | std::string& ename |
[in] | const | FactoryBase* factory |
Definition at line 192 of file MueLu_Level.hpp.
|
inline |
Get data without decrementing associated storage counter (i.e., read-only access).
Definition at line 217 of file MueLu_Level.hpp.
|
inline |
GetTypeName returns type string of variable stored using ename and factory.
[in] | const | std::string& ename |
[in] | const | FactoryBase* factory |
Definition at line 228 of file MueLu_Level.hpp.
|
inline |
Request to keep variable 'ename' generated by 'factory' after the setup phase.
Definition at line 255 of file MueLu_Level.hpp.
|
inline |
Delete data that have been retained after the setup phase (using Keep(), AddKeepFlag(), or internal MueLu logic).
Definition at line 261 of file MueLu_Level.hpp.
void MueLu::Level::Clear | ( | ) |
Delete all data that have been retained after the setup phase using Final flag.
Definition at line 276 of file MueLu_Level.cpp.
void MueLu::Level::ExpertClear | ( | ) |
Delete all data from level that has no Keep flag set. This is a function for experts only
Definition at line 319 of file MueLu_Level.cpp.
|
inline |
Test if a keep flag is set for variable 'ename' generated by 'factory' The input parameter keep can be a combination of flags. IsKept() will then return true if at least one of the flag is set. Note: There is no default parameter for IsKept() because it might be confusing (user generally wants to test IsKept with keep=MueLu::Keep but classes Level and Needs generally use keep = All)
Definition at line 288 of file MueLu_Level.hpp.
void MueLu::Level::AddKeepFlag | ( | const std::string & | ename, |
const FactoryBase * | factory = NoFactory::get() , |
||
KeepType | keep = MueLu::Keep |
||
) |
Add a keep flag for variable 'ename' generated by 'factory' A variable can cumulate several keep flags (UserData+Final for example). This function just add a flag to the current flag combination. By default, the flag 'Keep' is added. So Keep(ename, factory) is the same as AddKeepFlag(ename, factory). See also the description of KeepEnum for more information.
Definition at line 100 of file MueLu_Level.cpp.
void MueLu::Level::RemoveKeepFlag | ( | const std::string & | ename, |
const FactoryBase * | factory, | ||
KeepType | keep = MueLu::All |
||
) |
Remove a keep flag for variable 'ename' generated by 'factory' A variable can cumulate several keep flags (UserData+Final for example). This function just add a flag to the current flag combination. By default, all the flags are removed.
Definition at line 110 of file MueLu_Level.cpp.
KeepType MueLu::Level::GetKeepFlag | ( | const std::string & | ename, |
const FactoryBase * | factory | ||
) | const |
Get the flag combination set for variable 'ename' generated by 'factory'.
Definition at line 129 of file MueLu_Level.cpp.
void MueLu::Level::Request | ( | const FactoryBase & | factory | ) |
Increment the storage counter for all the inputs of a factory.
Definition at line 136 of file MueLu_Level.cpp.
void MueLu::Level::Release | ( | const FactoryBase & | factory | ) |
Decrement the storage counter for all the inputs of a factory.
Definition at line 143 of file MueLu_Level.cpp.
void MueLu::Level::DeclareInput | ( | const std::string & | ename, |
const FactoryBase * | factory, | ||
const FactoryBase * | requestedBy = NoFactory::get() |
||
) |
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()
Definition at line 150 of file MueLu_Level.cpp.
void MueLu::Level::DeclareDependencies | ( | const FactoryBase * | factory, |
bool | bRequestOnly = false , |
||
bool | bReleaseOnly = false |
||
) |
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput() to declare factory dependencies.
Definition at line 177 of file MueLu_Level.cpp.
void MueLu::Level::Request | ( | const std::string & | ename, |
const FactoryBase * | factory = NoFactory::get() , |
||
const FactoryBase * | requestedBy = NoFactory::get() |
||
) |
Indicate that an object is needed. This increments the storage counter.
Definition at line 192 of file MueLu_Level.cpp.
void MueLu::Level::Release | ( | const std::string & | ename, |
const FactoryBase * | factory = NoFactory::get() , |
||
const FactoryBase * | requestedBy = NoFactory::get() |
||
) |
Decrement the storage counter.
Definition at line 240 of file MueLu_Level.cpp.
|
inline |
Test whether a need's value has been saved.
Definition at line 334 of file MueLu_Level.hpp.
|
inline |
Test whether a need has been requested. Note: this tells nothing about whether the need's value exists.
Definition at line 345 of file MueLu_Level.hpp.
|
virtual |
Return a simple one-line description of this object.
Reimplemented from MueLu::Describable.
Definition at line 352 of file MueLu_Level.cpp.
Printing method.
Definition at line 359 of file MueLu_Level.cpp.
|
inline |
Definition at line 377 of file MueLu_Level.hpp.
|
inline |
Definition at line 379 of file MueLu_Level.hpp.
|
inline |
Definition at line 380 of file MueLu_Level.hpp.
|
inline |
Definition at line 382 of file MueLu_Level.hpp.
|
inline |
Definition at line 383 of file MueLu_Level.hpp.
|
private |
If input factory == NULL, returns the default factory. Else, return input factory.
Definition at line 509 of file MueLu_Level.cpp.
|
inlineprivate |
Test whether some information about (ename, factory) are stored.
Definition at line 431 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 436 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 447 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 453 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 460 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 466 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 476 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 486 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 494 of file MueLu_Level.hpp.
|
staticprivate |
Definition at line 412 of file MueLu_Level.hpp.
|
private |
Definition at line 413 of file MueLu_Level.hpp.
|
private |
Definition at line 414 of file MueLu_Level.hpp.
|
private |
Map of a map (Key1 -> SubMap)
Definition at line 422 of file MueLu_Level.hpp.
|
private |
Definition at line 423 of file MueLu_Level.hpp.
|
private |
Definition at line 424 of file MueLu_Level.hpp.
|
private |
Definition at line 425 of file MueLu_Level.hpp.