ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
script_interface/observables/PidObservable.hpp
Go to the documentation of this file.
1
2/*
3 * Copyright (C) 2010-2022 The ESPResSo project
4 * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
5 * Max-Planck-Institute for Polymer Research, Theory Group
6 *
7 * This file is part of ESPResSo.
8 *
9 * ESPResSo is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * ESPResSo is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#ifndef SCRIPT_INTERFACE_OBSERVABLES_PIDOBSERVABLE_HPP
24#define SCRIPT_INTERFACE_OBSERVABLES_PIDOBSERVABLE_HPP
25
28
29#include "Observable.hpp"
31
32#include <memory>
33#include <type_traits>
34#include <vector>
35
36namespace ScriptInterface {
37namespace Observables {
38
39/** Base class for script interfaces to particle-based observables
40 * @tparam CorePidObs Any core class derived from @ref
41 * ::Observables::PidObservable "Observables::PidObservable"
42 */
43template <typename CorePidObs>
45 : public AutoParameters<PidObservable<CorePidObs>, Observable> {
46public:
47 static_assert(std::is_base_of_v<::Observables::PidObservable, CorePidObs>);
48
51 [this]() { return m_observable->ids(); }}});
52 }
53
54 void do_construct(VariantMap const &params) override {
56 m_observable =
58 });
59 }
60
61 std::shared_ptr<::Observables::Observable> observable() const override {
62 return m_observable;
63 }
64
65private:
66 std::shared_ptr<CorePidObs> m_observable;
67};
68
69} /* namespace Observables */
70} /* namespace ScriptInterface */
71
72#endif
Bind parameters in the script interface.
virtual void parallel_try_catch(std::function< void()> const &cb) const =0
Context * context() const
Responsible context.
Base class for script interfaces to particle-based observables.
std::shared_ptr<::Observables::Observable > observable() const override
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
static SteepestDescentParameters params
Currently active steepest descent instance.
static constexpr const ReadOnly read_only