EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_RegionNeighborhood.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Robert Marskar <robert.marskar@sintef.no>
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
11#ifndef EBGEOMETRY_REGIONNEIGHBORHOOD_HPP
12#define EBGEOMETRY_REGIONNEIGHBORHOOD_HPP
13
14// Std includes
15#include <cstdint>
16#include <vector>
17
18// Our includes
20#include "EBGeometry_Expr.hpp"
22
23namespace EBGeometry {
24
37template <class T>
39{
40public:
44 static constexpr uint32_t None = 0xFFFFFFFFU;
45
50
55 [[nodiscard]] EBGEOMETRY_HOST
56 const Expr<T>&
57 object() const noexcept;
58
63 [[nodiscard]] EBGEOMETRY_HOST
64 uint32_t
65 getNumRegions() const noexcept;
66
72 [[nodiscard]] EBGEOMETRY_HOST
73 uint32_t
74 wholeRegion(uint32_t a_region) const;
75
81 [[nodiscard]] EBGEOMETRY_HOST
82 uint32_t
83 region(uint32_t a_wholeRegion) const;
84
90 [[nodiscard]] EBGEOMETRY_HOST
91 uint32_t
92 surface(uint32_t a_wholeSurface) const;
93
99 [[nodiscard]] EBGEOMETRY_HOST
100 uint32_t
101 wholeSurface(uint32_t a_surface) const;
102
114 [[nodiscard]] EBGEOMETRY_HOST
116 setup(const DomainSetup& a_wholeSetup) const;
117
118private:
119 template <class U>
120 friend RegionNeighborhood<U>
121 regionNeighborhood(const Expr<U>& a_expr, const std::vector<uint32_t>& a_regions);
122
128 explicit RegionNeighborhood(Expr<T> a_object) : m_object(std::move(a_object))
129 {}
130
134 Expr<T> m_object;
135
139 std::vector<uint32_t> m_wholeRegion;
140
144 std::vector<uint32_t> m_region;
145
149 std::vector<uint32_t> m_wholeSurface;
150
154 std::vector<uint32_t> m_surface;
155
159 std::vector<uint32_t> m_surfaceLabel;
160
164 std::vector<uint32_t> m_material;
165};
166
186template <class T>
187[[nodiscard]] EBGEOMETRY_HOST
188RegionNeighborhood<T>
189regionNeighborhood(const Expr<T>& a_expr, const std::vector<uint32_t>& a_regions);
190
191} // namespace EBGeometry
192
193#include "EBGeometry_RegionNeighborhoodImplem.hpp"
194
195#endif
DomainSetup: how a domain is made, as an editable value on the host (see Domain).
The tape's front end: Expr, a host-side value that describes a composed object, and the free function...
#define EBGEOMETRY_HOST
Mark a function as callable from host code only (no-op on host compilers).
Definition EBGeometry_GPU.hpp:83
LabelId: the number of a label, typed by what it labels (SurfaceLabelId, MaterialLabelId).
How a domain is made: its subdomains (the regions each computes in) and its surface groups (the selec...
Definition EBGeometry_DomainSetup.hpp:39
A composed object: an immutable tree of shapes and operations, built on the host and compiled by a Ta...
Definition EBGeometry_Expr.hpp:452
Some regions of an expression with their neighbors: a smaller expression in which those regions have ...
Definition EBGeometry_RegionNeighborhood.hpp:39
uint32_t surface(uint32_t a_wholeSurface) const
Its surface that a surface of the whole expression is (ExprIndex::getFirstSurface() numbering).
uint32_t getNumRegions() const noexcept
How many regions it has, the background (region 0) included.
DomainSetup setup(const DomainSetup &a_wholeSetup) const
A setup written for the whole expression, translated to this one: regions through the map,...
const Expr< T > & object() const noexcept
The smaller expression, to compile into a tape.
uint32_t wholeRegion(uint32_t a_region) const
The whole expression's region that one of its regions is.
RegionNeighborhood()=delete
No empty neighborhood: see regionNeighborhood().
uint32_t region(uint32_t a_wholeRegion) const
Its region that a region of the whole expression is.
uint32_t wholeSurface(uint32_t a_surface) const
The whole expression's surface that one of its surfaces is.
static constexpr uint32_t None
What region() gives for a region that was dropped.
Definition EBGeometry_RegionNeighborhood.hpp:44
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26
RegionNeighborhood< T > regionNeighborhood(const Expr< T > &a_expr, const std::vector< uint32_t > &a_regions)
Some regions of an expression and their neighbors: the regions that may touch them,...