ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
script_interface/shapes/HollowConicalFrustum.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-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#ifndef ESPRESSO_HOLLOW_CONICAL_FRUSTUM_HPP
21#define ESPRESSO_HOLLOW_CONICAL_FRUSTUM_HPP
22
23#include "Shape.hpp"
24
26
27#include <shapes/HollowConicalFrustum.hpp>
28
29namespace ScriptInterface {
30namespace Shapes {
31
33public:
36 {{"cyl_transform_params", m_cyl_transform_params},
37 {"r1",
38 [this](Variant const &v) {
39 m_hollow_conical_frustum->set_r1(get_value<double>(v));
40 },
41 [this]() { return m_hollow_conical_frustum->radius1(); }},
42 {"r2",
43 [this](Variant const &v) {
44 m_hollow_conical_frustum->set_r2(get_value<double>(v));
45 },
46 [this]() { return m_hollow_conical_frustum->radius2(); }},
47 {"length",
48 [this](Variant const &v) {
49 m_hollow_conical_frustum->set_length(get_value<double>(v));
50 },
51 [this]() { return m_hollow_conical_frustum->length(); }},
52 {"thickness",
53 [this](Variant const &v) {
54 m_hollow_conical_frustum->set_thickness(get_value<double>(v));
55 },
56 [this]() { return m_hollow_conical_frustum->thickness(); }},
57 {"direction",
58 [this](Variant const &v) {
59 m_hollow_conical_frustum->set_direction(get_value<int>(v));
60 },
61 [this]() { return m_hollow_conical_frustum->direction(); }},
62 {"central_angle",
63 [this](Variant const &v) {
64 m_hollow_conical_frustum->set_central_angle(get_value<double>(v));
65 },
66 [this]() { return m_hollow_conical_frustum->central_angle(); }}});
67 }
68
69 void do_construct(VariantMap const &params) override {
70 set_from_args(m_cyl_transform_params, params, "cyl_transform_params");
71
72 if (m_cyl_transform_params)
73 m_hollow_conical_frustum =
74 std::make_shared<::Shapes::HollowConicalFrustum>(
75 get_value<double>(params, "r1"), get_value<double>(params, "r2"),
76 get_value<double>(params, "length"),
77 get_value_or<double>(params, "thickness", 0.),
78 get_value_or<int>(params, "direction", 1),
79 get_value_or<double>(params, "central_angle", 0.),
80 m_cyl_transform_params->cyl_transform_params()
81
82 );
83 }
84
85 std::shared_ptr<::Shapes::Shape> shape() const override {
86 return m_hollow_conical_frustum;
87 }
88
89private:
90 std::shared_ptr<::Shapes::HollowConicalFrustum> m_hollow_conical_frustum;
91 std::shared_ptr<Math::CylindricalTransformationParameters>
92 m_cyl_transform_params;
93};
94
95} /* namespace Shapes */
96} /* namespace ScriptInterface */
97
98#endif
void add_parameters(std::vector< AutoParameter > &&params)
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
void set_from_args(T &dst, VariantMap const &vals, const char *name)
static SteepestDescentParameters params
Currently active steepest descent instance.