|
OOFEM 3.0
|
#include <parametermanager.h>
Public Types | |
| using | paramValue = std::variant<int, double, std::string, bool, IntArray, FloatArray, FloatMatrix> |
Public Member Functions | |
| void | setPriority (size_t componentIndex, size_t paramIndex, int priority) |
| int | getPriority (size_t componentIndex, size_t paramIndex) const |
| void | clear () |
| bool | checkIfSet (size_t componentIndex, size_t paramIndex) |
| void | setTemParam (size_t componentIndex, size_t paramIndex, const paramValue &value) |
| std::optional< paramValue > | getTempParam (size_t componentIndex, size_t paramIndex) const |
| bool | hasTempParam (size_t componentIndex, size_t paramIndex) const |
Private Attributes | |
| std::vector< std::unordered_map< size_t, int > > | priorities |
| std::shared_mutex | mtx |
| std::vector< std::unordered_map< size_t, paramValue > > | tempParams |
ParameterPriorityManager class manages the actual priority for parameters that can be set from multiple sources, typically from component record or via set. It allows setting and getting parameters with a priority system, where higher priority values override lower priority ones. The manager manages parameters for multiple components, each identified by a unique index. The parameters are stored in a shared map, where the key is a string representing the parameter name and the value is a the parameter index. It uses a shared mutex for thread-safe access to the parameters. The class is designed to be used in a multi-threaded environment where multiple threads may attempt to set or get parameters simultaneously. The class provides methods to register parameters, set their priorities, and retrieve their priorities for a collection of components.
It also allows to manage temporary parameters for each component which can be set and retrieved. The temporary params are handy for pattern with multi-source initialization and single finalization.
Definition at line 130 of file parametermanager.h.
| using oofem::ParameterManager::paramValue = std::variant<int, double, std::string, bool, IntArray, FloatArray, FloatMatrix> |
Definition at line 132 of file parametermanager.h.
|
inline |
Definition at line 156 of file parametermanager.h.
References priorities.
Referenced by oofem::DofManager::initializeFinish(), oofem::IGAElement::initializeFinish(), oofem::InterfaceElem1d::initializeFinish(), oofem::NodalSpringElement::initializeFinish(), oofem::Beam2d::postInitialize(), oofem::Beam3d::postInitialize(), and oofem::IntElPoint::postInitialize().
|
inline |
Definition at line 150 of file parametermanager.h.
References mtx, priorities, and tempParams.
|
inline |
Definition at line 141 of file parametermanager.h.
References mtx, and priorities.
|
inline |
Definition at line 172 of file parametermanager.h.
References mtx, and tempParams.
Referenced by oofem::DofManager::initializeFinish(), oofem::GeneralSlaveNode::initializeFinish(), oofem::Beam2d::postInitialize(), and oofem::Beam3d::postInitialize().
|
inline |
Definition at line 181 of file parametermanager.h.
References mtx, and tempParams.
|
inline |
Definition at line 133 of file parametermanager.h.
References mtx, and priorities.
|
inline |
Definition at line 165 of file parametermanager.h.
References mtx, and tempParams.
|
mutableprivate |
Definition at line 189 of file parametermanager.h.
Referenced by clear(), getPriority(), getTempParam(), hasTempParam(), setPriority(), and setTemParam().
|
private |
Definition at line 188 of file parametermanager.h.
Referenced by checkIfSet(), clear(), getPriority(), and setPriority().
|
private |
Definition at line 191 of file parametermanager.h.
Referenced by clear(), getTempParam(), hasTempParam(), and setTemParam().