MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node > Class Template Reference

This class specifies the default factory that should generate some data on a Level if the data does not exist and the generating factory has not been specified. More...

#include <MueLu_FactoryManager_decl.hpp>

Inheritance diagram for MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >:
MueLu::FactoryManagerBase MueLu::BaseClass MueLu::VerboseObject MueLu::Describable Teuchos::VerboseObject< VerboseObject > Teuchos::Describable Teuchos::VerboseObjectBase Teuchos::LabeledObject

Public Member Functions

void Clean () const
 
void Print () const
 
- Public Member Functions inherited from MueLu::FactoryManagerBase
bool IgnoreUserData () const
 get IgnoreUserData flag More...
 
void SetIgnoreUserData (bool bIgnoreUserData=false)
 set IgnoreUserData flag More...
 
 FactoryManagerBase ()
 
virtual ~FactoryManagerBase ()
 Destructor. More...
 
- 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::FancyOStreamGetOStream (MsgType type, int thisProcRankOnly=0) const
 Get an output stream for outputting the input message type. More...
 
Teuchos::FancyOStreamGetBlackHole () 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 VerboseObjectsetVerbLevel (const EVerbosityLevel verbLevel) const
 
virtual const VerboseObjectsetOverridingVerbLevel (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 VerboseObjectBasesetOStream (const RCP< FancyOStream > &oStream) const
 
virtual const VerboseObjectBasesetOverridingOStream (const RCP< FancyOStream > &oStream) const
 
virtual VerboseObjectBasesetLinePrefix (const std::string &linePrefix)
 
virtual RCP< FancyOStreamgetOStream () const
 
virtual RCP< FancyOStreamgetOverridingOStream () 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
 
virtual std::string description () const
 Return a simple one-line description of this object. More...
 
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 Attributes

std::map< std::string, RCP
< const FactoryBase > > 
factoryTable_
 User-defined factories. More...
 
std::map< std::string, RCP
< const FactoryBase > > 
defaultFactoryTable_
 Table that holds default factories. More...
 
bool useKokkos_
 Whether or not to use kokkos factories. More...
 

Constructor/Destructors

 FactoryManager ()
 Constructor. More...
 
 FactoryManager (const std::map< std::string, RCP< const FactoryBase > > &factoryTable)
 Constructor used by HierarchyFactory (temporary, will be removed) More...
 
virtual ~FactoryManager ()
 Destructor. More...
 

Get/Set functions.

void SetFactory (const std::string &varName, const RCP< const FactoryBase > &factory)
 Set Factory. More...
 
const RCP< const FactoryBaseGetFactory (const std::string &varName) const
 Get factory associated with a particular data name. More...
 
const RCP< FactoryBaseGetFactoryNonConst (const std::string &varName)
 Get factory associated with a particular data name (NONCONST version) More...
 
bool hasFactory (const std::string &varName) const
 Check. More...
 
const RCP< const FactoryBaseGetDefaultFactory (const std::string &varName) const
 
void SetKokkosRefactor (const bool useKokkos)
 
bool GetKokkosRefactor () const
 

Helper functions

const RCP< const FactoryBaseSetAndReturnDefaultFactory (const std::string &varName, const RCP< const FactoryBase > &factory) const
 

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< FancyOStreamgetDefaultOStream ()
 
- 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
 

Detailed Description

template<class Scalar = DefaultScalar, class LocalOrdinal = DefaultLocalOrdinal, class GlobalOrdinal = DefaultGlobalOrdinal, class Node = DefaultNode>
class MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >

This class specifies the default factory that should generate some data on a Level if the data does not exist and the generating factory has not been specified.

Consider the following example.

RCP<SingleLevelFactory> Afact;
Level currentLevel;
RCP<Matrix> thisLevelA;
thisLevelA = currentLevel.Get<Matrix>("A", Afact.get());
Todo:
If Afact is null (actually, Teuchos::null), then the FactoryManager associated with currentLevel will determine whether a default factory has been specified for creating A. If "yes", then that factory will be called, A will be stored in currentLevel, and an RCP will be returned by the Get call. If "no", then the FactoryManager will throw an exception indicating that it does not know how to generate A.

Definition at line 70 of file MueLu_FactoryManager_decl.hpp.

Constructor & Destructor Documentation

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::FactoryManager ( )

Constructor.

Definition at line 55 of file MueLu_FactoryManager_def.hpp.

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::FactoryManager ( const std::map< std::string, RCP< const FactoryBase > > &  factoryTable)

Constructor used by HierarchyFactory (temporary, will be removed)

Definition at line 61 of file MueLu_FactoryManager_def.hpp.

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::~FactoryManager ( )
virtualdefault

Destructor.

Member Function Documentation

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::SetFactory ( const std::string &  varName,
const RCP< const FactoryBase > &  factory 
)

Set Factory.

Register the factory that should generate data if said factory is not specified in the request.

Parameters
[in]nameof variable
[in]factorythat generates the data

Definition at line 71 of file MueLu_FactoryManager_def.hpp.

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
const RCP< const FactoryBase > MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::GetFactory ( const std::string &  varName) const
virtual

Get factory associated with a particular data name.

Parameters
[in]varNamename of variable.

Implements MueLu::FactoryManagerBase.

Definition at line 76 of file MueLu_FactoryManager_def.hpp.

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
const RCP< FactoryBase > MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::GetFactoryNonConst ( const std::string &  varName)

Get factory associated with a particular data name (NONCONST version)

Parameters
[in]varNamename of variable.

Definition at line 87 of file MueLu_FactoryManager_def.hpp.

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
bool MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::hasFactory ( const std::string &  varName) const
virtual

Check.

Implements MueLu::FactoryManagerBase.

Definition at line 92 of file MueLu_FactoryManager_def.hpp.

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
const RCP< const FactoryBase > MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::GetDefaultFactory ( const std::string &  varName) const

Definition at line 98 of file MueLu_FactoryManager_def.hpp.

template<class Scalar = DefaultScalar, class LocalOrdinal = DefaultLocalOrdinal, class GlobalOrdinal = DefaultGlobalOrdinal, class Node = DefaultNode>
void MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::SetKokkosRefactor ( const bool  useKokkos)
inline

Definition at line 122 of file MueLu_FactoryManager_decl.hpp.

template<class Scalar = DefaultScalar, class LocalOrdinal = DefaultLocalOrdinal, class GlobalOrdinal = DefaultGlobalOrdinal, class Node = DefaultNode>
bool MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::GetKokkosRefactor ( ) const
inline

Definition at line 126 of file MueLu_FactoryManager_decl.hpp.

template<class Scalar = DefaultScalar, class LocalOrdinal = DefaultLocalOrdinal, class GlobalOrdinal = DefaultGlobalOrdinal, class Node = DefaultNode>
void MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Clean ( ) const
inlinevirtual

Reimplemented from MueLu::FactoryManagerBase.

Definition at line 130 of file MueLu_FactoryManager_decl.hpp.

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Print ( ) const

Definition at line 218 of file MueLu_FactoryManager_def.hpp.

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
const RCP< const FactoryBase > MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::SetAndReturnDefaultFactory ( const std::string &  varName,
const RCP< const FactoryBase > &  factory 
) const
private

Add a factory to the default factory list and return it. This helper function is used by GetDefaultFactory()

Todo:
TODO factory->setObjectLabel("Default " + varName + "Factory");

Definition at line 207 of file MueLu_FactoryManager_def.hpp.

Member Data Documentation

template<class Scalar = DefaultScalar, class LocalOrdinal = DefaultLocalOrdinal, class GlobalOrdinal = DefaultGlobalOrdinal, class Node = DefaultNode>
std::map<std::string, RCP<const FactoryBase> > MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::factoryTable_
private

User-defined factories.

User may overwrite default behaviour. The user provided factories are stored in a separate table. When we try to determine which factory generates the data, this table is searched first.

Note: we distinguish 'user defined factory' and 'default factory' to allow the deallocation of default factories separately.

Definition at line 157 of file MueLu_FactoryManager_decl.hpp.

template<class Scalar = DefaultScalar, class LocalOrdinal = DefaultLocalOrdinal, class GlobalOrdinal = DefaultGlobalOrdinal, class Node = DefaultNode>
std::map<std::string, RCP<const FactoryBase> > MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::defaultFactoryTable_
mutableprivate

Table that holds default factories.

  1. We distinguish 'user defined factory' and 'default factory' to allow the deallocation of default factories separately.
  2. defaultFactoryTable_ is mutable because default factories are only added to the list when they are requested to avoid allocation of unused factories.

Definition at line 165 of file MueLu_FactoryManager_decl.hpp.

template<class Scalar = DefaultScalar, class LocalOrdinal = DefaultLocalOrdinal, class GlobalOrdinal = DefaultGlobalOrdinal, class Node = DefaultNode>
bool MueLu::FactoryManager< Scalar, LocalOrdinal, GlobalOrdinal, Node >::useKokkos_
private

Whether or not to use kokkos factories.

Definition at line 168 of file MueLu_FactoryManager_decl.hpp.


The documentation for this class was generated from the following files: