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 |
Public Member Functions inherited from MueLu::BaseClass | |
virtual | ~BaseClass () |
Destructor. More... | |
Public Member Functions inherited from MueLu::VerboseObject | |
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... | |
Public Member Functions inherited from Teuchos::VerboseObject< VerboseObject > | |
VerboseObject (const EVerbosityLevel verbLevel=VERB_DEFAULT, const RCP< FancyOStream > &oStream=Teuchos::null) | |
virtual const VerboseObject & | setVerbLevel (const EVerbosityLevel verbLevel) const |
virtual const VerboseObject & | setOverridingVerbLevel (const EVerbosityLevel verbLevel) const |
virtual EVerbosityLevel | getVerbLevel () const |
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT RCP< const ParameterList > | getValidVerboseObjectSublist () |
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT void | setupVerboseObjectSublist (ParameterList *paramList) |
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT void | readVerboseObjectSublist (ParameterList *paramList, RCP< FancyOStream > *oStream, EVerbosityLevel *verbLevel) |
void | readVerboseObjectSublist (ParameterList *paramList, VerboseObject< ObjectType > *verboseObject) |
Public Member Functions inherited from Teuchos::VerboseObjectBase | |
virtual | ~VerboseObjectBase () |
VerboseObjectBase (const RCP< FancyOStream > &oStream=Teuchos::null) | |
virtual const VerboseObjectBase & | setOStream (const RCP< FancyOStream > &oStream) const |
virtual const VerboseObjectBase & | setOverridingOStream (const RCP< FancyOStream > &oStream) const |
virtual VerboseObjectBase & | setLinePrefix (const std::string &linePrefix) |
virtual RCP< FancyOStream > | getOStream () const |
virtual RCP< FancyOStream > | getOverridingOStream () const |
virtual std::string | getLinePrefix () const |
virtual OSTab | getOSTab (const int tabs=1, const std::string &linePrefix="") const |
Public Member Functions inherited from MueLu::Describable | |
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... | |
Public Member Functions inherited from Teuchos::Describable | |
void | describe (std::ostream &out, const EVerbosityLevel verbLevel=verbLevel_default) const |
LabeledObject () | |
virtual | ~LabeledObject () |
virtual void | setObjectLabel (const std::string &objectLabel) |
virtual std::string | getObjectLabel () const |
DescribableStreamManipulatorState | describe (const Describable &describable, const EVerbosityLevel verbLevel=Describable::verbLevel_default) |
std::ostream & | operator<< (std::ostream &os, const DescribableStreamManipulatorState &d) |
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 Public Member Functions inherited from MueLu::VerboseObject | |
static void | SetMueLuOStream (const Teuchos::RCP< Teuchos::FancyOStream > &mueluOStream) |
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... | |
Static Public Member Functions inherited from Teuchos::VerboseObject< VerboseObject > | |
static void | setDefaultVerbLevel (const EVerbosityLevel defaultVerbLevel) |
static EVerbosityLevel | getDefaultVerbLevel () |
Static Public Member Functions inherited from Teuchos::VerboseObjectBase | |
static void | setDefaultOStream (const RCP< FancyOStream > &defaultOStream) |
static RCP< FancyOStream > | getDefaultOStream () |
Static Public Attributes inherited from Teuchos::Describable | |
static const EVerbosityLevel | verbLevel_default |
Protected Member Functions inherited from Teuchos::VerboseObject< VerboseObject > | |
void | initializeVerboseObject (const EVerbosityLevel verbLevel=VERB_DEFAULT, const RCP< FancyOStream > &oStream=Teuchos::null) |
Protected Member Functions inherited from Teuchos::VerboseObjectBase | |
void | initializeVerboseObjectBase (const RCP< FancyOStream > &oStream=Teuchos::null) |
virtual void | informUpdatedVerbosityState () const |
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 414 of file MueLu_Level.hpp.
|
private |
Definition at line 415 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 |
Sub-map container (Key2 -> Value)
Definition at line 418 of file MueLu_Level.hpp.
Enumerator | |
---|---|
REQUEST | |
RELEASE | |
UNDEF |
Definition at line 374 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.
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.
Previous level.
Definition at line 132 of file MueLu_Level.hpp.
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 191 of file MueLu_Level.hpp.
|
inline |
Get data without decrementing associated storage counter (i.e., read-only access).
Definition at line 215 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 226 of file MueLu_Level.hpp.
|
inline |
Request to keep variable 'ename' generated by 'factory' after the setup phase.
Definition at line 253 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 259 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 286 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 332 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 343 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 375 of file MueLu_Level.hpp.
|
inline |
Definition at line 377 of file MueLu_Level.hpp.
|
inline |
Definition at line 378 of file MueLu_Level.hpp.
|
inline |
Definition at line 380 of file MueLu_Level.hpp.
|
inline |
Definition at line 381 of file MueLu_Level.hpp.
|
private |
If input factory == NULL, returns the default factory. Else, return input factory.
Definition at line 497 of file MueLu_Level.cpp.
|
inlineprivate |
Test whether some information about (ename, factory) are stored.
Definition at line 429 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 434 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 445 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 451 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 458 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 464 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 474 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 484 of file MueLu_Level.hpp.
|
inlineprivate |
Definition at line 492 of file MueLu_Level.hpp.
|
staticprivate |
Definition at line 410 of file MueLu_Level.hpp.
|
private |
Definition at line 411 of file MueLu_Level.hpp.
|
private |
Definition at line 412 of file MueLu_Level.hpp.
|
private |
Map of a map (Key1 -> SubMap)
Definition at line 420 of file MueLu_Level.hpp.
|
private |
Definition at line 421 of file MueLu_Level.hpp.
Definition at line 422 of file MueLu_Level.hpp.
|
private |
Definition at line 423 of file MueLu_Level.hpp.