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 ESPRESSO_DIPOLES
25
26
#include "
script_interface/Context.hpp
"
27
#include "
script_interface/Variant.hpp
"
28
#include "
script_interface/auto_parameters/AutoParameters.hpp
"
29
#include "
script_interface/get_value.hpp
"
30
#include "
script_interface/system/Leaf.hpp
"
31
32
#include <memory>
33
#include <string>
34
35
namespace
ScriptInterface
{
36
namespace
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
*/
44
template
<
class
SIClass,
class
CoreClass>
45
class
Actor
:
public
AutoParameters
<Actor<SIClass, CoreClass>, System::Leaf> {
46
protected
:
47
using
SIActorClass
= SIClass;
48
using
CoreActorClass
= CoreClass;
49
using
ObjectClass
=
Actor<SIClass, CoreClass>
;
50
using
AutoParameters
<
ObjectClass
,
System::Leaf
>
::context
;
51
using
AutoParameters
<
ObjectClass
,
System::Leaf
>
::add_parameters
;
52
using
System::Leaf::get_system
;
53
using
System::Leaf::m_system
;
54
std::shared_ptr<CoreActorClass>
m_actor
;
55
56
void
on_bind_system
(
::System::System
&)
override
{
57
m_actor
->bind_system(
m_system
.lock());
58
}
59
60
private
:
61
friend
SIClass;
62
Actor
() {
63
add_parameters
({
64
{
"prefactor"
,
AutoParameter::read_only
,
65
[
this
]() {
return
actor
()->prefactor; }},
66
});
67
}
68
69
public
:
70
Variant
do_call_method
(std::string
const
&
name
,
71
VariantMap
const
&
params
)
override
;
72
73
std::shared_ptr<CoreActorClass>
actor
() {
return
m_actor
; }
74
std::shared_ptr<CoreActorClass const>
actor
()
const
{
return
m_actor
; }
75
};
76
77
}
// namespace Dipoles
78
}
// namespace ScriptInterface
79
80
#endif
// ESPRESSO_DIPOLES
AutoParameters.hpp
Context.hpp
ScriptInterface::Context decorates ScriptInterface::ObjectHandle objects with a context: a creation p...
Variant.hpp
ScriptInterface::AutoParameters
Bind parameters in the script interface.
Definition
AutoParameters.hpp:94
ScriptInterface::AutoParameters< Actor< SIClass, CoreClass >, System::Leaf >::add_parameters
void add_parameters(std::vector< AutoParameter > &¶ms)
Definition
AutoParameters.hpp:123
ScriptInterface::Dipoles::Actor
Common interface for magnetostatic actors.
Definition
magnetostatics/Actor.hpp:45
ScriptInterface::Dipoles::Actor::CoreActorClass
CoreClass CoreActorClass
Definition
magnetostatics/Actor.hpp:48
ScriptInterface::Dipoles::Actor::actor
std::shared_ptr< CoreActorClass const > actor() const
Definition
magnetostatics/Actor.hpp:74
ScriptInterface::Dipoles::Actor::do_call_method
Variant do_call_method(std::string const &name, VariantMap const ¶ms) override
Definition
magnetostatics/Actor.impl.hpp:40
ScriptInterface::Dipoles::Actor::actor
std::shared_ptr< CoreActorClass > actor()
Definition
magnetostatics/Actor.hpp:73
ScriptInterface::Dipoles::Actor::ObjectClass
Actor< SIClass, CoreClass > ObjectClass
Definition
magnetostatics/Actor.hpp:49
ScriptInterface::Dipoles::Actor::SIActorClass
SIClass SIActorClass
Definition
magnetostatics/Actor.hpp:47
ScriptInterface::Dipoles::Actor::m_actor
std::shared_ptr< CoreActorClass > m_actor
Definition
magnetostatics/Actor.hpp:54
ScriptInterface::Dipoles::Actor::on_bind_system
void on_bind_system(::System::System &) override
Definition
magnetostatics/Actor.hpp:56
ScriptInterface::ObjectHandle::context
Context * context() const
Responsible context.
Definition
ObjectHandle.hpp:57
ScriptInterface::ObjectHandle::name
std::string_view name() const
Definition
ObjectHandle.cpp:117
ScriptInterface::System::Leaf
Script interface wrapper for a component of the system class.
Definition
script_interface/system/Leaf.hpp:44
ScriptInterface::System::Leaf::get_system
auto const & get_system() const
Definition
script_interface/system/Leaf.hpp:53
ScriptInterface::System::Leaf::m_system
std::weak_ptr<::System::System > m_system
Definition
script_interface/system/Leaf.hpp:51
System::System
Main system class.
Definition
core/system/System.hpp:79
config.hpp
get_value.hpp
Dipoles
Definition
magnetostatics/actor.hpp:30
ScriptInterface
Definition
script_interface/accumulators/AccumulatorBase.hpp:33
ScriptInterface::VariantMap
std::unordered_map< std::string, Variant > VariantMap
Definition
Variant.hpp:133
ScriptInterface::Variant
make_recursive_variant< ObjectRef > Variant
Possible types for parameters.
Definition
Variant.hpp:131
Leaf.hpp
params
static SteepestDescentParameters params
Currently active steepest descent instance.
Definition
steepest_descent.cpp:44
ScriptInterface::AutoParameter::read_only
static constexpr const ReadOnly read_only
Definition
AutoParameter.hpp:42
src
script_interface
magnetostatics
Actor.hpp
Generated on Mon Dec 8 2025 02:32:29 for ESPResSo by
1.9.8