ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
magnetostatics/Actor.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include "config/config.hpp"
23
24#ifdef DIPOLES
25
31
32#include <memory>
33#include <string>
34
35namespace ScriptInterface {
36namespace Dipoles {
37
38/**
39 * @brief Common interface for magnetostatic actors.
40 * Several methods are defined in initialize.cpp since they
41 * depend on symbols only available in @ref dipoles.hpp, which cannot be
42 * included in this header file for separation of concerns reasons.
43 */
44template <class SIClass, class CoreClass>
45class Actor : public AutoParameters<Actor<SIClass, CoreClass>, System::Leaf> {
46protected:
48 using CoreActorClass = CoreClass;
54 std::shared_ptr<CoreActorClass> m_actor;
55
57 m_actor->bind_system(m_system.lock());
58 }
59
60public:
63 {"prefactor", AutoParameter::read_only,
64 [this]() { return actor()->prefactor; }},
65 });
66 }
67
68 Variant do_call_method(std::string const &name,
69 VariantMap const &params) override;
70
71 std::shared_ptr<CoreActorClass> actor() { return m_actor; }
72 std::shared_ptr<CoreActorClass const> actor() const { return m_actor; }
73};
74
75} // namespace Dipoles
76} // namespace ScriptInterface
77
78#endif // DIPOLES
ScriptInterface::Context decorates ScriptInterface::ObjectHandle objects with a context: a creation p...
Bind parameters in the script interface.
Common interface for magnetostatic actors.
std::shared_ptr< CoreActorClass const > actor() const
Variant do_call_method(std::string const &name, VariantMap const &params) override
std::shared_ptr< CoreActorClass > actor()
Actor< SIClass, CoreClass > ObjectClass
std::shared_ptr< CoreActorClass > m_actor
void on_bind_system(::System::System &) override
boost::string_ref name() const
Context * context() const
Responsible context.
Script interface wrapper for a component of the system class.
std::weak_ptr<::System::System > m_system
Main system class.
This file contains the defaults for ESPResSo.
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
std::unordered_map< std::string, Variant > VariantMap
Definition Variant.hpp:69
boost::make_recursive_variant< None, bool, int, std::size_t, double, std::string, ObjectRef, Utils::Vector3b, Utils::Vector3i, Utils::Vector2d, Utils::Vector3d, Utils::Vector4d, std::vector< int >, std::vector< double >, std::vector< boost::recursive_variant_ >, std::unordered_map< int, boost::recursive_variant_ >, std::unordered_map< std::string, boost::recursive_variant_ > >::type Variant
Possible types for parameters.
Definition Variant.hpp:67
static SteepestDescentParameters params
Currently active steepest descent instance.
static constexpr const ReadOnly read_only