ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
PoissonSolverNone.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
24
25#include <field/AddToStorage.h>
26#include <field/GhostLayerField.h>
27
28#include <cstddef>
29#include <memory>
30#include <utility>
31
32namespace walberla {
33
34template <typename FloatType> class PoissonSolverNone : public PoissonSolver {
35private:
36 BlockDataID m_potential_field_id;
37
38 using PotentialField = GhostLayerField<FloatType, 1>;
39
40public:
41 explicit PoissonSolverNone(std::shared_ptr<LatticeWalberla> lattice)
42 : PoissonSolver(std::move(lattice), 0.0) {
43 m_potential_field_id = field::addToStorage<PotentialField>(
44 get_lattice().get_blocks(), "potential field", 0.0, field::fzyx,
45 get_lattice().get_ghost_layers());
46 }
47 ~PoissonSolverNone() override = default;
48
49 void reset_charge_field() override {}
50 void add_charge_to_field(std::size_t, double) override {}
51
52 [[nodiscard]] std::size_t get_potential_field_id() const noexcept override {
53 return m_potential_field_id;
54 }
55
56 std::optional<double>
58 [[maybe_unused]] bool consider_ghosts = false) override {
59 throw std::runtime_error("PoissonSolverNone has no potential field");
60 }
61
62 std::vector<double>
64 Utils::Vector3i const &) const override {
65 throw std::runtime_error("PoissonSolverNone has no potential field");
66 }
67
68 void solve() override {}
69 void setup_fft(bool) override {}
70
71 [[nodiscard]] bool is_gpu() const noexcept override { return false; }
73 return std::is_same_v<FloatType, double>;
74 }
75};
76
77} // namespace walberla
bool is_double_precision() const noexcept override
std::optional< double > get_node_potential(Utils::Vector3i const &, bool consider_ghosts=false) override
std::vector< double > get_slice_potential(Utils::Vector3i const &, Utils::Vector3i const &) const override
PoissonSolverNone(std::shared_ptr< LatticeWalberla > lattice)
~PoissonSolverNone() override=default
std::size_t get_potential_field_id() const noexcept override
bool is_gpu() const noexcept override
void add_charge_to_field(std::size_t, double) override
LatticeWalberla const & get_lattice() const noexcept override
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
STL namespace.
\file PackInfoPdfDoublePrecision.cpp \author pystencils