ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
EKSpeciesNode.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021-2023 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 WALBERLA
25
26#include "EKSpecies.hpp"
27#include "LatticeIndices.hpp"
28
31
33
34#include <utils/Vector.hpp>
35
36#include <cassert>
37#include <memory>
38#include <stdexcept>
39#include <string>
40
42
43class EKSpeciesNode : public AutoParameters<EKSpeciesNode, LatticeIndices> {
44 std::shared_ptr<::EKinWalberlaBase> m_ek_species;
45 Utils::Vector3i m_index;
46 Utils::Vector3i m_grid_size;
47 double m_conv_dens;
48 double m_conv_flux;
49
50public:
53 {{"_index", AutoParameter::read_only, [this]() { return m_index; }}});
54 }
55
56 void do_construct(VariantMap const &params) override {
57 auto const ek_sip =
58 get_value<std::shared_ptr<EKSpecies>>(params, "parent_sip");
59 m_ek_species = ek_sip->get_ekinstance();
60 assert(m_ek_species);
61 m_conv_dens = ek_sip->get_conversion_factor_density();
62 m_conv_flux = ek_sip->get_conversion_factor_flux();
63 m_grid_size = m_ek_species->get_lattice().get_grid_dimensions();
64 m_index = get_mapped_index(get_value<Utils::Vector3i>(params, "index"),
65 m_grid_size);
66 }
67
68 Variant do_call_method(std::string const &name,
69 VariantMap const &params) override;
70};
71} // namespace ScriptInterface::walberla
72
73#endif // WALBERLA
Vector implementation and trait types for boost qvm interoperability.
Bind parameters in the script interface.
void add_parameters(std::vector< AutoParameter > &&params)
Utils::Vector3i get_mapped_index(Utils::Vector3i const &index, Utils::Vector3i const &shape) const
boost::string_ref name() const
void do_construct(VariantMap const &params) override
Variant do_call_method(std::string const &name, VariantMap const &params) override
This file contains the defaults for ESPResSo.
std::unordered_map< std::string, Variant > VariantMap
Definition Variant.hpp:82
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:80
static SteepestDescentParameters params
Currently active steepest descent instance.
static constexpr const ReadOnly read_only