ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
EKPoissonSolverNode.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 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#include <config/config.hpp>
21
22#ifdef ESPRESSO_WALBERLA
23
25
26#include "LatticeIndices.hpp"
27
29
30#include <utils/Vector.hpp>
32
33#include <string>
34
36
38 VariantMap const &params) {
39 if (name == "override_index") {
40 // this hidden feature is used to iterate an EK slice without
41 // rebuilding an EKPoissonSolverNode for each node in the slice
42 auto const index = get_value<Utils::Vector3i>(params, "index");
43 if (not is_index_valid(index, m_grid_size)) {
44 return 1;
45 }
46 m_index = index;
47 return 0;
48 }
49 if (name == "get_potential") {
50 auto const result = m_ek_poisson_solver->get_node_potential(m_index);
51 return Utils::Mpi::reduce_optional(context()->get_comm(), result);
52 }
53
54 return {};
55}
56
57} // namespace ScriptInterface::walberla
58
59#endif // ESPRESSO_WALBERLA
Vector implementation and trait types for boost qvm interoperability.
bool is_index_valid(Utils::Vector3i const &index, Utils::Vector3i const &shape) const
Context * context() const
Responsible context.
std::string_view name() const
Variant do_call_method(std::string const &name, VariantMap const &params) 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
T reduce_optional(boost::mpi::communicator const &comm, std::optional< T > const &result)
Reduce an optional on the head node.
static SteepestDescentParameters params
Currently active steepest descent instance.
Recursive variant implementation.
Definition Variant.hpp:84