29#include "system/System.hpp"
48static auto is_solver_set(std::unique_ptr<Solver::Implementation>
const &ptr) {
49 return ptr !=
nullptr and ptr->solver.has_value();
52static void check_solver(std::unique_ptr<Solver::Implementation>
const &ptr) {
62 std::visit([
this](
auto &ptr) { ptr->detach_system(
m_system.lock()); },
64 impl->solver = std::nullopt;
70 std::visit([](
auto &ptr) {
return ptr->is_ready_for_propagation(); },
76 std::visit([](
auto &ptr) { ptr->propagate(); }, *impl->solver);
82 std::visit([&](
auto &ptr) { ptr->sanity_checks(system); }, *impl->solver);
88 std::visit([=](
auto &ptr) { ptr->veto_time_step(time_step); },
95 std::visit([=](
auto &ptr) { ptr->veto_kT(kT); }, *impl->solver);
101 std::visit([](
auto const &ptr) { ptr->veto_boxl_change(); }, *impl->solver);
107 auto &solver = *impl->solver;
108 std::visit([](
auto &ptr) { ptr->on_cell_structure_change(); }, solver);
114 std::visit([](
auto &ptr) { ptr->on_boxl_change(); }, *impl->solver);
120 std::visit([](
auto &ptr) { ptr->on_node_grid_change(); }, *impl->solver);
126 std::visit([](
auto &ptr) { ptr->on_timestep_change(); }, *impl->solver);
132 std::visit([](
auto &ptr) { ptr->on_temperature_change(); }, *impl->solver);
138 return std::visit([](
auto &ptr) {
return ptr->is_gpu(); }, *impl->solver);
143 return std::visit([](
auto &ptr) {
return ptr->get_tau(); }, *impl->solver);
146template <>
void Solver::set<EKNone>(std::shared_ptr<EKNone> ek_instance) {
148 assert(not impl->solver.has_value());
149 ek_instance->bind_system(
m_system.lock());
150 impl->solver = ek_instance;
153#ifdef ESPRESSO_WALBERLA
155void Solver::set<EKWalberla>(std::shared_ptr<EKWalberla> ek_instance) {
157 assert(not impl->solver.has_value());
159 ek_instance->bind_system(
m_system.lock());
160 ek_instance->sanity_checks(system);
161 impl->solver = ek_instance;
Vector implementation and trait types for boost qvm interoperability.
std::weak_ptr< System > m_system
static auto is_solver_set(std::unique_ptr< Solver::Implementation > const &ptr)
static void check_solver(std::unique_ptr< Solver::Implementation > const &ptr)
void veto_time_step(double time_step) const
Check if a MD time step is compatible with the EK tau.
void on_node_grid_change()
void propagate()
Propagate the EK species.
void sanity_checks() const
Perform EK parameter checks.
void on_cell_structure_change()
void veto_boxl_change() const
bool is_ready_for_propagation() const
Return true if an EK solver can be propagated.
double get_tau() const
Get the EK time step.
void on_timestep_change()
void on_temperature_change()
void veto_kT(double kT) const
Check if a thermostat is compatible with the EK temperature.
void reset()
Remove the EK solver.
bool is_solver_set() const
Return true if an EK solver is active.