ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
electrostatics/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_ELECTROSTATICS
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
Coulomb
{
37
38
/**
39
* @brief Common interface for electrostatic actors.
40
* Several methods are defined in initialize.cpp since they
41
* depend on symbols only available in @ref coulomb.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
AutoParameters
<
ObjectClass
,
System::Leaf
>
::do_set_parameter
;
53
using
System::Leaf::get_system
;
54
using
System::Leaf::m_system
;
55
std::shared_ptr<CoreActorClass>
m_actor
;
56
57
void
on_bind_system
(
::System::System
&)
override
{
58
m_actor
->bind_system(
m_system
.lock());
59
}
60
61
private
:
62
friend
SIClass;
63
Actor
();
64
65
public
:
66
Variant
do_call_method
(std::string
const
&
name
,
67
VariantMap
const
&
params
)
override
;
68
69
std::shared_ptr<CoreActorClass>
actor
() {
return
m_actor
; }
70
std::shared_ptr<CoreActorClass const>
actor
()
const
{
return
m_actor
; }
71
72
protected
:
73
void
set_charge_neutrality_tolerance
(
VariantMap
const
&
params
) {
74
auto
const
key_chk
= std::string(
"check_neutrality"
);
75
auto
const
key_tol
= std::string(
"charge_neutrality_tolerance"
);
76
if
(
params
.contains(
key_tol
)) {
77
do_set_parameter
(
key_tol
,
params
.at(
key_tol
));
78
}
79
do_set_parameter
(
key_chk
,
params
.at(
key_chk
));
80
}
81
};
82
83
}
// namespace Coulomb
84
}
// namespace ScriptInterface
85
86
#endif
// ESPRESSO_ELECTROSTATICS
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 >::do_set_parameter
void do_set_parameter(const std::string &name, const Variant &value) final
Definition
AutoParameters.hpp:154
ScriptInterface::AutoParameters< Actor< SIClass, CoreClass >, System::Leaf >::add_parameters
void add_parameters(std::vector< AutoParameter > &¶ms)
Definition
AutoParameters.hpp:123
ScriptInterface::Coulomb::Actor
Common interface for electrostatic actors.
Definition
electrostatics/Actor.hpp:45
ScriptInterface::Coulomb::Actor::CoreActorClass
CoreClass CoreActorClass
Definition
electrostatics/Actor.hpp:48
ScriptInterface::Coulomb::Actor::on_bind_system
void on_bind_system(::System::System &) override
Definition
electrostatics/Actor.hpp:57
ScriptInterface::Coulomb::Actor::m_actor
std::shared_ptr< CoreActorClass > m_actor
Definition
electrostatics/Actor.hpp:55
ScriptInterface::Coulomb::Actor::actor
std::shared_ptr< CoreActorClass > actor()
Definition
electrostatics/Actor.hpp:69
ScriptInterface::Coulomb::Actor::ObjectClass
Actor< SIClass, CoreClass > ObjectClass
Definition
electrostatics/Actor.hpp:49
ScriptInterface::Coulomb::Actor::do_call_method
Variant do_call_method(std::string const &name, VariantMap const ¶ms) override
Definition
electrostatics/Actor.impl.hpp:88
ScriptInterface::Coulomb::Actor::SIActorClass
SIClass SIActorClass
Definition
electrostatics/Actor.hpp:47
ScriptInterface::Coulomb::Actor::actor
std::shared_ptr< CoreActorClass const > actor() const
Definition
electrostatics/Actor.hpp:70
ScriptInterface::Coulomb::Actor::set_charge_neutrality_tolerance
void set_charge_neutrality_tolerance(VariantMap const ¶ms)
Definition
electrostatics/Actor.hpp:73
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
stream
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
Definition
common_cuda.cu:34
config.hpp
get_value.hpp
Coulomb
Definition
electrostatics/actor.hpp:30
ScriptInterface
Definition
script_interface/accumulators/AccumulatorBase.hpp:33
ScriptInterface::VariantMap
std::unordered_map< std::string, Variant > VariantMap
Definition
Variant.hpp:133
Leaf.hpp
params
static SteepestDescentParameters params
Currently active steepest descent instance.
Definition
steepest_descent.cpp:44
ScriptInterface::impl::recursive_variant
Recursive variant implementation.
Definition
Variant.hpp:84
src
script_interface
electrostatics
Actor.hpp
Generated on Mon Dec 8 2025 02:32:29 for ESPResSo by
1.9.8