include/pops/numerics/spatial/embedded_boundary/domain.hpp File ReferenceΒΆ

adc_cpp: include/pops/numerics/spatial/embedded_boundary/domain.hpp File Reference
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
domain.hpp File Reference

Generic EMBEDDED-BOUNDARY / LEVEL-SET DOMAIN contract (ADC-327). More...

#include <pops/core/foundation/types.hpp>
#include <cmath>
#include <concepts>
+ Include dependency graph for domain.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pops::detail::DiscDomain
 CIRCLE / DISC level-set domain: the canonical instance of the contract and the SINGLE SOURCE of truth for the active circular domain (a disc of radius R; see docs/HOFFART_FIDELITY.md for the reference scenario it was validated against). More...
 
struct  pops::detail::HalfPlaneDomain
 HALF-PLANE level-set domain: ls(x, y) = a*x + b*y - c, ACTIVE on the side a*x + b*y < c. More...
 

Namespaces

namespace  pops
 
namespace  pops::detail
 

Concepts

concept  pops::LevelSetDomain
 

Detailed Description

Generic EMBEDDED-BOUNDARY / LEVEL-SET DOMAIN contract (ADC-327).

A level-set domain restricts the transport to a SUB-REGION of the fixed 2D Cartesian plane (it masks cells; it adds NO third index, cf. ADR-0001 Decision 1: ADC-327 is boundary geometry at fixed dimension, not dimensionality). The cut-cell / embedded-boundary numerics (numerics/elliptic/cut_fraction.hpp, numerics/spatial_operator_eb.hpp) and the staircase mask path (numerics/spatial_operator.hpp) are ALREADY generic over any device-safe level-set callable; this header gives that contract a NAME and the two built-in instances:

  • detail::DiscDomain : the circle, the historical/canonical instance;
  • detail::HalfPlaneDomain : a linear half-plane, the simplest NON-disc instance.

CONTRACT (duck-typed; a domain type provides):

  • POPS_HD Real level_set(Real x, Real y) const : signed level set, < 0 INSIDE the active domain, 0 on the boundary, > 0 outside (the conducting-wall convention of GeometricMG);
  • POPS_HD Real operator()(Real x, Real y) const : the CALLABLE form consumed by cut_fraction / assemble_rhs_eb (forwards to level_set); a domain is therefore directly usable as the LevelSet template argument, with no adapter;
  • POPS_HD bool cell_active(Real x, Real y) const : a cell is ACTIVE when its CENTER is inside (level_set < 0), the same activity criterion as GeometricMG and the staircase mask.

DEVICE-CLEAN: instances are PODs captured BY VALUE into the kernels (no std::function, no runtime polymorphism, no heap), so they cross the host/device boundary like any other kernel argument.

The LevelSetDomain concept below is for DIAGNOSTICS ONLY (static_assert on the built-in instances, clearer template errors). It deliberately does NOT constrain the hot-path operator signatures (assemble_rhs_eb, cut_fraction): those stay plain templates so a bare callable (e.g. a local test functor or a future device lambda) keeps working and so the Kokkos/CUDA overload resolution is unchanged.