24#ifdef ESPRESSO_ELECTROSTATICS
41 std::unique_ptr<VariantMap> m_params;
45 auto &coulomb =
system.coulomb;
48 coulomb.impl->extension = std::nullopt;
49 coulomb.impl->solver = std::nullopt;
50 system.on_coulomb_change();
53 void reset_extension() {
55 auto &coulomb =
system.coulomb;
57 coulomb.impl->extension = std::nullopt;
58 system.on_coulomb_change();
62 auto const ¶ms = *m_params;
64 if (params.contains(
key)) {
77 if (
context()->is_head_node()) {
78 throw std::runtime_error(
79 "Cannot change solver when an extension is active");
87 auto leaf = std::dynamic_pointer_cast<System::Leaf>(actor);
90 actor->do_call_method(
"activate", {});
101 auto leaf = std::dynamic_pointer_cast<System::Leaf>(actor);
104 actor->do_call_method(
"activate", {});
115 m_params = std::make_unique<VariantMap>(params);
120 if (
name ==
"clear") {
Bind parameters in the script interface.
void do_set_parameter(const std::string &name, const Variant &value) final
void add_parameters(std::vector< AutoParameter > &¶ms)
auto const & get_parameter_insertion_order() const
Variant do_call_method(std::string const &name, VariantMap const &) override
void do_construct(VariantMap const ¶ms) override
void on_bind_system(::System::System &) override
Type to indicate no value in Variant.
Context * context() const
Responsible context.
std::string_view name() const
auto const & get_system() const
std::weak_ptr<::System::System > m_system
constexpr bool is_none(Variant const &v)
std::shared_ptr< ObjectHandle > ObjectRef
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
std::unordered_map< std::string, Variant > VariantMap
Recursive variant implementation.