Solver

class Solver : public rr::Registrable

Base class for all integrators and steady state solvers.

Author

JKM

Subclassed by rr::Integrator, rr::SensitivitySolver, rr::SteadyStateSolver

Public Types

using SettingsList = std::vector<std::string>
using SettingsMap = std::unordered_map<std::string, Setting>
using DisplayNameMap = std::unordered_map<std::string, std::string>
using HintMap = std::unordered_map<std::string, std::string>
using DescriptionMap = std::unordered_map<std::string, std::string>

Public Functions

Solver() = default
explicit Solver(ExecutableModel *model)
~Solver() override = default
void updateSettings(Dictionary *inputSettings)

Update settings values.

update the values of keys in

Parameters:

inputSettings – with the values. Keys that are not in Solver are ignored

std::vector<std::string> getSettings() const

Get a list of all settings for this solver.

Author

JKM

std::unordered_map<std::string, Setting> &getSettingsMap()

get settings for this solver

See also

getSettings

Returns:

mapping of keys which are setting names to values stored as Variants.

virtual void resetSettings()

Reset all settings to their respective default values.

virtual Setting getValue(const std::string &key) const

Get the value of an integrator setting.

Author

JKM, WBC

Note

Use one of the type-concrete versions like getValueAsInt to avoid type conversion gotchas

virtual Setting hasValue(const std::string &key) const

Return true if this setting is supported by the integrator.

Author

JKM

virtual size_t getNumParams() const

Get the number of parameters.

Author

JKM

virtual std::string getParamName(size_t n) const

Get the name of the parameter at index n.

Author

JKM

virtual std::string getParamDisplayName(int n) const

Get the display name of the parameter at index n.

Author

JKM

virtual std::string getParamHint(int n) const

Get the hint of the parameter at index n.

Author

JKM

virtual std::string getParamDesc(int n) const

Get the description of the parameter at index n.

Author

JKM

virtual std::string getValueAsString(const std::string &key)

Wrapper for getValue which converts output to a specific type.

Author

WBC, JKM

virtual void setValue(const std::string &key, Setting value)
virtual std::string getSettingsRepr() const

Get the solver settings as a std::string.

Author

JKM

virtual std::string settingsPyDictRepr() const

Python dictionary-style std::string representation of settings.

Author

JKM

virtual std::string toString() const

Return a std::string representation of the solver.

Author

JKM

virtual std::string toRepr() const

Return std::string representation a la Python repr method.

Author

JKM

const std::string &getDisplayName(const std::string &key) const

Gets the hint associated with a given key.

Author

WBC

const std::string &getHint(const std::string &key) const

Gets the hint associated with a given key.

Author

WBC

const std::string &getDescription(const std::string &key) const

Gets the description associated with a given key.

Author

WBC

Setting::TypeId getType(const std::string &key) const

Gets the type associated with a given key.

Author

WBC

virtual void syncWithModel(ExecutableModel *m) = 0

Called whenever a new model is loaded to allow integrator to reset internal state.

Author

JKM

virtual ExecutableModel *getModel() const

returns the pointer to the ExecutableModel

std::string getName() const = 0

Gets the name associated with this Solver type.

Author

JKM, WBC

std::string getHint() const = 0

Gets the hint associated with this Solver type.

Author

JKM, WBC

std::string getDescription() const = 0

Gets the description associated with this Solver type.

Author

JKM, WBC

Public Members

SettingsList sorted_settings
SettingsMap settings
DisplayNameMap display_names_
HintMap hints
DescriptionMap descriptions

Protected Functions

void addSetting(const std::string &name, const Setting &val, const std::string &display_name, const std::string &hint, const std::string &description)

Protected Attributes

ExecutableModel *mModel = nullptr

non-owning pointer to model