MueLu
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
MueLu_Factory.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// MueLu: A package for multigrid based preconditioning
4
//
5
// Copyright 2012 NTESS and the MueLu contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef MUELU_FACTORY_HPP
11
#define MUELU_FACTORY_HPP
12
13
#include <string>
14
#include <deque>
// for _Deque_iterator, operator!=
15
#include <ostream>
// for operator<<, etc
16
#include "Teuchos_ENull.hpp"
// for ENull::null
17
#include "Teuchos_FilteredIterator.hpp"
// for FilteredIterator, etc
18
#include "Teuchos_ParameterEntry.hpp"
// for ParameterEntry
19
#include "Teuchos_ParameterList.hpp"
// for ParameterList, etc
20
#include "Teuchos_RCPDecl.hpp"
// for RCP
21
#include "Teuchos_RCPNode.hpp"
// for operator<<
22
#include "Teuchos_StringIndexedOrderedValueObjectContainer.hpp"
23
#include "Teuchos_RCP.hpp"
24
25
#include "
MueLu_ConfigDefs.hpp
"
26
#include "
MueLu_FactoryBase.hpp
"
27
#include "
MueLu_FactoryAcceptor.hpp
"
28
#include "
MueLu_ParameterListAcceptor.hpp
"
29
#include "
MueLu_Level.hpp
"
30
31
namespace
MueLu
{
32
33
class
Factory
:
public
FactoryBase
,
public
FactoryAcceptor
,
public
ParameterListAcceptorImpl
{
34
public
:
36
38
Factory
();
39
41
virtual
~Factory
();
43
45
46
48
virtual
void
SetFactory
(
const
std::string& varName,
const
RCP<const FactoryBase>& factory);
49
51
const
RCP<const FactoryBase>
GetFactory
(
const
std::string& varName)
const
;
52
53
RCP<ParameterList>
RemoveFactoriesFromList
(
const
ParameterList& list)
const
;
54
55
// SetParameterList(...);
56
57
// GetParameterList(...);
58
60
61
virtual
RCP<const ParameterList>
GetValidParameterList
()
const
;
62
63
protected
:
64
void
Input
(
Level
& level,
const
std::string& varName)
const
;
65
// Similar to the other Input, but we have an alias (varParamName) to the generated data name (varName)
66
void
Input
(
Level
& level,
const
std::string& varName,
const
std::string& varParamName)
const
;
67
68
template
<
class
T>
69
T
Get
(
Level
& level,
const
std::string& varName)
const
{
70
return
level.
Get
<T>(varName,
GetFactory
(varName).get());
71
}
72
73
// Similar to the other Get, but we have an alias (varParamName) to the generated data name (varName)
74
template
<
class
T>
75
T
Get
(
Level
& level,
const
std::string& varName,
const
std::string& varParamName)
const
{
76
return
level.
Get
<T>(varName,
GetFactory
(varParamName).get());
77
}
78
79
template
<
class
T>
80
void
Set
(
Level
& level,
const
std::string& varName,
const
T& data)
const
{
81
return
level.
Set
<T>(varName, data,
this
);
82
}
83
84
template
<
class
T>
85
bool
IsType
(
Level
& level,
const
std::string& varName)
const
{
86
return
level.
IsType
<T>(varName,
GetFactory
(varName).get());
87
}
88
89
bool
IsAvailable
(
Level
& level,
const
std::string& varName)
const
;
90
91
public
:
92
static
void
EnableTimerSync
();
93
static
void
DisableTimerSync
();
94
95
protected
:
96
static
bool
timerSync_
;
97
98
#ifdef HAVE_MUELU_DEBUG
99
public
:
100
enum
multipleCallCheckEnum{ENABLED, DISABLED, FIRSTCALL};
101
102
void
EnableMultipleCallCheck
()
const
;
103
void
DisableMultipleCallCheck
()
const
;
104
void
ResetDebugData
()
const
;
105
106
static
void
EnableMultipleCheckGlobally
();
107
static
void
DisableMultipleCheckGlobally
();
108
109
protected
:
110
mutable
multipleCallCheckEnum multipleCallCheck_;
111
static
multipleCallCheckEnum multipleCallCheckGlobal_;
112
mutable
int
lastLevelID_;
113
#else
114
public
:
115
void
EnableMultipleCallCheck
()
const
;
116
void
DisableMultipleCallCheck
()
const
;
117
void
ResetDebugData
()
const
;
118
static
void
EnableMultipleCheckGlobally
();
119
static
void
DisableMultipleCheckGlobally
();
120
#endif
121
};
// class Factory
122
123
}
// namespace MueLu
124
125
#define MUELU_FACTORY_SHORT
126
#endif
// ifndef MUELU_FACTORY_HPP
MueLu_ConfigDefs.hpp
MueLu_FactoryAcceptor.hpp
MueLu_FactoryBase.hpp
MueLu_Level.hpp
MueLu_ParameterListAcceptor.hpp
MueLu::FactoryAcceptor
Definition
MueLu_FactoryAcceptor.hpp:21
MueLu::FactoryBase::FactoryBase
FactoryBase()
Constructor.
Definition
MueLu_FactoryBase.hpp:29
MueLu::Factory::Input
void Input(Level &level, const std::string &varName) const
Definition
MueLu_Factory.cpp:72
MueLu::Factory::SetFactory
virtual void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Configuration.
Definition
MueLu_Factory.cpp:25
MueLu::Factory::timerSync_
static bool timerSync_
Definition
MueLu_Factory.hpp:96
MueLu::Factory::~Factory
virtual ~Factory()
Destructor.
MueLu::Factory::ResetDebugData
void ResetDebugData() const
Definition
MueLu_Factory.cpp:122
MueLu::Factory::DisableMultipleCallCheck
void DisableMultipleCallCheck() const
Definition
MueLu_Factory.cpp:121
MueLu::Factory::Get
T Get(Level &level, const std::string &varName) const
Definition
MueLu_Factory.hpp:69
MueLu::Factory::IsType
bool IsType(Level &level, const std::string &varName) const
Definition
MueLu_Factory.hpp:85
MueLu::Factory::EnableTimerSync
static void EnableTimerSync()
Definition
MueLu_Factory.cpp:84
MueLu::Factory::Set
void Set(Level &level, const std::string &varName, const T &data) const
Definition
MueLu_Factory.hpp:80
MueLu::Factory::GetValidParameterList
virtual RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
Definition
MueLu_Factory.cpp:68
MueLu::Factory::IsAvailable
bool IsAvailable(Level &level, const std::string &varName) const
Definition
MueLu_Factory.cpp:80
MueLu::Factory::EnableMultipleCheckGlobally
static void EnableMultipleCheckGlobally()
Definition
MueLu_Factory.cpp:123
MueLu::Factory::Factory
Factory()
Constructor.
Definition
MueLu_Factory.cpp:14
MueLu::Factory::GetFactory
const RCP< const FactoryBase > GetFactory(const std::string &varName) const
Default implementation of FactoryAcceptor::GetFactory().
Definition
MueLu_Factory.cpp:30
MueLu::Factory::RemoveFactoriesFromList
RCP< ParameterList > RemoveFactoriesFromList(const ParameterList &list) const
Definition
MueLu_Factory.cpp:47
MueLu::Factory::DisableMultipleCheckGlobally
static void DisableMultipleCheckGlobally()
Definition
MueLu_Factory.cpp:124
MueLu::Factory::EnableMultipleCallCheck
void EnableMultipleCallCheck() const
Definition
MueLu_Factory.cpp:120
MueLu::Factory::DisableTimerSync
static void DisableTimerSync()
Definition
MueLu_Factory.cpp:86
MueLu::Factory::Get
T Get(Level &level, const std::string &varName, const std::string &varParamName) const
Definition
MueLu_Factory.hpp:75
MueLu::Level
Class that holds all level-specific information.
Definition
MueLu_Level.hpp:63
MueLu::Level::IsType
bool IsType(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Definition
MueLu_Level.hpp:185
MueLu::Level::Get
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access)....
Definition
MueLu_Level.hpp:154
MueLu::Level::Set
void Set(const std::string &ename, const T &entry, const FactoryBase *factory=NoFactory::get())
Definition
MueLu_Level.hpp:120
MueLu::ParameterListAcceptorImpl::ParameterListAcceptorImpl
ParameterListAcceptorImpl()
Definition
MueLu_ParameterListAcceptor.cpp:25
MueLu
Namespace for MueLu classes and methods.
Definition
MueLu_BrickAggregationFactory_decl.hpp:42
src
MueCentral
MueLu_Factory.hpp
Generated by
1.17.0