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 | |
using | Key1 = const FactoryBase * |
using | Key2 = const std::string |
using | Value = RCP< VariableContainer > |
using | SubMap = Teuchos::map< Key2, Value > |
using | TwoKeyMap = Teuchos::map< Key1, SubMap > |
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... | |
template<class T > | |
bool | IsType (const std::string &ename, const FactoryBase *factory=NoFactory::get()) |
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 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... | |
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 63 of file MueLu_Level.hpp.
|
private |
Definition at line 362 of file MueLu_Level.hpp.
|
private |
Definition at line 363 of file MueLu_Level.hpp.
|
private |
Definition at line 364 of file MueLu_Level.hpp.
|
private |
Definition at line 365 of file MueLu_Level.hpp.
|
private |
Sub-map container (Key2 -> Value)
Definition at line 366 of file MueLu_Level.hpp.
Enumerator | |
---|---|
REQUEST | |
RELEASE | |
UNDEF |
Definition at line 321 of file MueLu_Level.hpp.
MueLu::Level::Level | ( | ) |
Definition at line 18 of file MueLu_Level.cpp.
MueLu::Level::Level | ( | RCP< FactoryManagerBase > & | factoryManager | ) |
Definition at line 22 of file MueLu_Level.cpp.
|
virtualdefault |
Destructor.
|
private |
Copy constructor.
Definition at line 29 of file MueLu_Level.cpp.
int MueLu::Level::GetLevelID | ( | ) | const |
Return level number.
Definition at line 51 of file MueLu_Level.cpp.
void MueLu::Level::SetLevelID | ( | int | levelID | ) |
Set level number.
Definition at line 53 of file MueLu_Level.cpp.
Previous level.
Definition at line 60 of file MueLu_Level.cpp.
Set previous level object \param[in] const RCP<Level>& previousLevel
Definition at line 62 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 69 of file MueLu_Level.cpp.
const RCP< const FactoryManagerBase > MueLu::Level::GetFactoryManager | ( | ) |
returns the current factory manager
Definition at line 73 of file MueLu_Level.cpp.
|
inline |
Store need label and its associated data. This does not increment the storage counter.
Definition at line 120 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 154 of file MueLu_Level.hpp.
|
inline |
Get data without decrementing associated storage counter (i.e., read-only access).
Definition at line 180 of file MueLu_Level.hpp.
|
inline |
Definition at line 185 of file MueLu_Level.hpp.
std::string MueLu::Level::GetTypeName | ( | const std::string & | ename, |
const FactoryBase * | factory = NoFactory::get() |
||
) |
GetTypeName returns type string of variable stored using ename and factory.
[in] | const | std::string& ename |
[in] | const | FactoryBase* factory |
Definition at line 77 of file MueLu_Level.cpp.
|
inline |
Request to keep variable 'ename' generated by 'factory' after the setup phase.
Definition at line 232 of file MueLu_Level.hpp.
void MueLu::Level::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).
Definition at line 89 of file MueLu_Level.cpp.
void MueLu::Level::Clear | ( | ) |
Delete all data that have been retained after the setup phase using Final flag.
Definition at line 302 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 345 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 250 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 106 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 116 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 135 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 142 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 149 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 156 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 183 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 197 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 245 of file MueLu_Level.cpp.
bool MueLu::Level::IsAvailable | ( | const std::string & | ename, |
const FactoryBase * | factory = NoFactory::get() |
||
) | const |
Test whether a need's value has been saved.
Definition at line 281 of file MueLu_Level.cpp.
bool MueLu::Level::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.
Definition at line 292 of file MueLu_Level.cpp.
|
virtual |
Return a simple one-line description of this object.
Reimplemented from MueLu::Describable.
Definition at line 378 of file MueLu_Level.cpp.
Printing method.
Definition at line 385 of file MueLu_Level.cpp.
|
inline |
Definition at line 324 of file MueLu_Level.hpp.
|
inline |
Definition at line 326 of file MueLu_Level.hpp.
|
inline |
Definition at line 327 of file MueLu_Level.hpp.
|
inline |
Definition at line 329 of file MueLu_Level.hpp.
|
inline |
Definition at line 330 of file MueLu_Level.hpp.
|
private |
If input factory == NULL, returns the default factory. Else, return input factory.
Definition at line 553 of file MueLu_Level.cpp.
|
private |
Test whether some information about (ename, factory) are stored.
Definition at line 572 of file MueLu_Level.cpp.
|
private |
Definition at line 577 of file MueLu_Level.cpp.
|
private |
Definition at line 588 of file MueLu_Level.cpp.
|
private |
Definition at line 594 of file MueLu_Level.cpp.
|
private |
Definition at line 601 of file MueLu_Level.cpp.
|
private |
Definition at line 607 of file MueLu_Level.cpp.
|
private |
Definition at line 617 of file MueLu_Level.cpp.
|
private |
Definition at line 627 of file MueLu_Level.cpp.
|
private |
Definition at line 635 of file MueLu_Level.cpp.
|
staticprivate |
Definition at line 358 of file MueLu_Level.hpp.
|
private |
Definition at line 359 of file MueLu_Level.hpp.
|
private |
Definition at line 360 of file MueLu_Level.hpp.
|
private |
Map of a map (Key1 -> SubMap)
Definition at line 368 of file MueLu_Level.hpp.
|
private |
Definition at line 369 of file MueLu_Level.hpp.
Definition at line 370 of file MueLu_Level.hpp.
|
private |
Definition at line 371 of file MueLu_Level.hpp.