include/pops/runtime/context/wall_predicate.hpp Source FileΒΆ

adc_cpp: include/pops/runtime/context/wall_predicate.hpp Source File
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
wall_predicate.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <pops/core/foundation/types.hpp> // Real
4#include <pops/numerics/spatial/embedded_boundary/domain.hpp> // detail::DiscDomain (the level-set domain it lives in since ADC-327)
5
6#include <cmath> // std::hypot
7#include <functional> // std::function
8#include <stdexcept> // std::runtime_error
9#include <string>
10
20
21namespace pops {
22namespace detail {
23
30inline std::function<bool(Real, Real)> wall_predicate(const std::string& wall, double wall_radius,
31 double L, const std::string& err_context) {
32 if (wall == "none")
33 return {};
34 if (wall == "circle") {
35 const double cx = 0.5 * L, cy = 0.5 * L, R = wall_radius;
36 return [cx, cy, R](Real x, Real y) { return std::hypot(x - cx, y - cy) < R; };
37 }
38 throw std::runtime_error(err_context + ": unknown wall '" + wall + "'");
39}
40
41} // namespace detail
42} // namespace pops
Generic EMBEDDED-BOUNDARY / LEVEL-SET DOMAIN contract (ADC-327).
std::function< bool(Real, Real)> wall_predicate(const std::string &wall, double wall_radius, double L, const std::string &err_context)
Builds the "inside the conductor" predicate (embedded wall for the Poisson solver) from the wall mode...
Definition wall_predicate.hpp:30
Definition amr_hierarchy.hpp:29
double Real
Definition types.hpp:30
Base scalar types and the POPS_HD macro (host+device portability).