Loading [MathJax]/extensions/tex2jax.js
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
CylindricalTransformationParameters.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
4 * Max-Planck-Institute for Polymer Research, Theory Group
5 *
6 * This file is part of ESPResSo.
7 *
8 * ESPResSo is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * ESPResSo is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef ESPRESSO_SRC_SCRIPT_INTERFACE_MATH_CYL_TRANSFORM_PARAMS_HPP
23#define ESPRESSO_SRC_SCRIPT_INTERFACE_MATH_CYL_TRANSFORM_PARAMS_HPP
24
27
28#include <utils/Vector.hpp>
30
31#include <memory>
32#include <stdexcept>
33
34namespace ScriptInterface {
35namespace Math {
36
38 : public AutoParameters<CylindricalTransformationParameters> {
39public:
42 [this]() { return m_transform_params->center(); }},
44 [this]() { return m_transform_params->axis(); }},
45 {"orientation", AutoParameter::read_only,
46 [this]() { return m_transform_params->orientation(); }}});
47 }
48
49 auto cyl_transform_params() const { return m_transform_params; }
50
51 void do_construct(VariantMap const &params) override {
52 switch (params.size()) {
53 case 0:
54 m_transform_params =
55 std::make_shared<::Utils::CylindricalTransformationParameters>();
56 break;
57 case 2:
58 m_transform_params =
59 std::make_shared<::Utils::CylindricalTransformationParameters>(
62 break;
63 case 3:
64 m_transform_params =
65 std::make_shared<::Utils::CylindricalTransformationParameters>(
68 get_value<Utils::Vector3d>(params, "orientation"));
69 break;
70 default:
71 throw std::runtime_error("Provide either no arguments, center and axis, "
72 "or center and axis and orientation");
73 }
74 }
75
76private:
77 std::shared_ptr<::Utils::CylindricalTransformationParameters>
78 m_transform_params;
79};
80
81} // namespace Math
82} // namespace ScriptInterface
83#endif
Vector implementation and trait types for boost qvm interoperability.
Bind parameters in the script interface.
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