ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
script_interface/walberla/EKNone.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022-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 ESPRESSO_WALBERLA
25
26#include "EKPoissonSolver.hpp"
27
30
33
34#include <memory>
35
37
38class EKNone : public EKPoissonSolver {
39 std::shared_ptr<::walberla::PoissonSolver> m_instance;
40 std::shared_ptr<LatticeWalberla> m_lattice;
41 bool m_single_precision;
42
43public:
44 void make_instance(VariantMap const &) override {}
45
46 void do_construct(VariantMap const &args) override {
47 m_single_precision = get_value_or<bool>(args, "single_precision", false);
48 m_lattice = get_value<std::shared_ptr<LatticeWalberla>>(args, "lattice");
49
50 m_instance = ::walberla::new_ek_poisson_none(m_lattice->lattice(),
51 m_single_precision);
52
54 {"single_precision", AutoParameter::read_only,
55 [this]() { return m_single_precision; }},
56 {"lattice", AutoParameter::read_only, [this]() { return m_lattice; }},
57 });
58 }
59
60 [[nodiscard]] std::shared_ptr<::walberla::PoissonSolver>
62 return m_instance;
63 }
64};
65
66} // namespace ScriptInterface::walberla
67
68#endif // ESPRESSO_WALBERLA
void add_parameters(std::vector< AutoParameter > &&params)
void do_construct(VariantMap const &args) override
void make_instance(VariantMap const &) override
std::shared_ptr<::walberla::PoissonSolver > get_instance() const noexcept 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:133
std::shared_ptr< walberla::PoissonSolver > new_ek_poisson_none(std::shared_ptr< LatticeWalberla > const &lattice, bool single_precision)
static constexpr const ReadOnly read_only