Go to the documentation of this file.
35#ifndef parametermanager_h
36#define parametermanager_h
38#include <unordered_map>
43#include <shared_mutex>
56#define PM_UPDATE_PARAMETER(_val, _pm, _ir, _componentnum, _paramkey, _prio) \
58 std::size_t _indx=_paramkey.getIndex(); \
59 const char* _kwd = _paramkey.getName().c_str(); \
60 if ((_prio >= _pm.getPriority(_componentnum, _indx)) && (_ir.hasField(_kwd))) { \
61 _ir.giveField(_val, _kwd); \
62 _pm.setPriority(_componentnum, _indx, _prio); \
66#define PM_UPDATE_PARAMETER_AND_REPORT(_val, _pm, _ir, _componentnum, _paramkey, _prio, _flag) \
68 std::size_t _indx=_paramkey.getIndex(); \
69 const char* _kwd = _paramkey.getName().c_str(); \
70 if ((_prio >= _pm.getPriority(_componentnum, _indx)) && (_ir.hasField(_kwd))) { \
71 _ir.giveField(_val, _kwd); \
72 _pm.setPriority(_componentnum, _indx, _prio); \
79#define PM_UPDATE_TEMP_PARAMETER(_type, _pm, _ir, _componentnum, _paramkey, _prio) \
81 std::size_t _indx=_paramkey.getIndex(); \
82 const char* _kwd = _paramkey.getName().c_str(); \
83 if ((_prio >= _pm.getPriority(_componentnum, _indx)) && (_ir.hasField(_kwd))) { \
85 _ir.giveField(_val, _kwd); \
86 _pm.setPriority(_componentnum, _indx, _prio); \
87 _pm.setTemParam(_componentnum, _indx, _val); \
91#define PM_CHECK_FLAG_AND_REPORT(_pm, _ir, _componentnum, _paramkey, _prio, _flag) \
93 std::size_t _indx=_paramkey.getIndex(); \
94 const char* _kwd = _paramkey.getName().c_str(); \
95 if ((_prio >= _pm.getPriority(_componentnum, _indx)) && (_ir.hasField(_kwd))) { \
96 _pm.setPriority(_componentnum, _indx, _prio); \
103#define PM_ELEMENT_ERROR_IFNOTSET(_pm, _componentnum, _paramkey) \
105 if (!_pm.checkIfSet(_componentnum, _paramkey.getIndex())) { \
106 OOFEM_ERROR("Element %d: Parameter %s not set", _componentnum, _paramkey.getNameCStr());\
110#define PM_DOFMAN_ERROR_IFNOTSET(_pm, _componentnum, _paramkey) \
112 if (!_pm.checkIfSet(_componentnum, _paramkey.getIndex())) { \
113 OOFEM_ERROR("DofManager %d: Parameter %s not set", _componentnum, _paramkey.getNameCStr());\
132 using paramValue = std::variant<int, double, std::string, bool, IntArray, FloatArray, FloatMatrix>;
133 void setPriority(
size_t componentIndex,
size_t paramIndex,
int priority) {
134 std::unique_lock lock(
mtx);
138 priorities[componentIndex-1][paramIndex] = priority;
142 std::shared_lock lock(
mtx);
143 int ci1 = componentIndex - 1;
151 std::unique_lock lock(
mtx);
157 int ci1 = componentIndex - 1;
166 std::unique_lock lock(
mtx);
170 tempParams[componentIndex-1][paramIndex] = value;
172 std::optional<paramValue>
getTempParam(
size_t componentIndex,
size_t paramIndex)
const {
173 std::shared_lock lock(
mtx);
174 int ci1 = componentIndex - 1;
182 std::shared_lock lock(
mtx);
183 int ci1 = componentIndex - 1;
189 mutable std::shared_mutex
mtx;
191 std::vector<std::unordered_map<size_t, paramValue>>
tempParams;
std::vector< std::unordered_map< size_t, int > > priorities
bool checkIfSet(size_t componentIndex, size_t paramIndex)
bool hasTempParam(size_t componentIndex, size_t paramIndex) const
std::variant< int, double, std::string, bool, IntArray, FloatArray, FloatMatrix > paramValue
int getPriority(size_t componentIndex, size_t paramIndex) const
void setTemParam(size_t componentIndex, size_t paramIndex, const paramValue &value)
std::vector< std::unordered_map< size_t, paramValue > > tempParams
void setPriority(size_t componentIndex, size_t paramIndex, int priority)
std::optional< paramValue > getTempParam(size_t componentIndex, size_t paramIndex) const
This page is part of the
OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak
Bořek Patzák
Project e-mail:
oofem@fsv.cvut.cz
Generated at for OOFEM by
doxygen
1.15.0 written by Dimitri van Heesch,
© 1997-2011