44#ifndef PECLET_VORO_REPAIR_HPP
45#define PECLET_VORO_REPAIR_HPP
48#include <Kokkos_Core.hpp>
51#include "peclet/core/common/view.hpp"
91 using Mem = peclet::core::MemSpace;
92 using Exec = peclet::core::ExecSpace;
93 using PlanePolicy = std::conditional_t<Weighted, Power, Voronoi>;
94 static constexpr bool kHasSdf = !std::is_same_v<Sdf, NoSdf>;
109 Real
L[3] = {1, 1, 1};
169 auto h = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace{},
lastStatus);
170 for (
int i = 0; i <
nProc; ++i) {
183 Kokkos::View<Real*, Mem>
vol;
227 int densityCount_ = -1,
int nProc_ = -1) {
229 nProc = (nProc_ < 0) ? n : nProc_;
234 for (
int k = 0; k < 3; ++k)
239 using Kokkos::view_alloc;
240 using Kokkos::WithoutInitializing;
241 vol = Kokkos::View<Real*, Mem>(
"mt.vol", n);
242 xRef = Kokkos::View<Real*, Mem>(view_alloc(std::string(
"mt.xRef"), WithoutInitializing),
244 mask = Kokkos::View<int*, Mem>(
"mt.mask", n);
245 mask2 = Kokkos::View<int*, Mem>(
"mt.mask2", n);
246 mover = Kokkos::View<int*, Mem>(
"mt.mover", n);
247 rebuilt = Kokkos::View<int*, Mem>(
"mt.rebuilt", n);
248 wl1 = Kokkos::View<int*, Mem>(view_alloc(std::string(
"mt.wl1"), WithoutInitializing), n);
249 wl2 = Kokkos::View<int*, Mem>(view_alloc(std::string(
"mt.wl2"), WithoutInitializing), n);
250 wlM = Kokkos::View<int*, Mem>(view_alloc(std::string(
"mt.wlM"), WithoutInitializing), n);
251 extraNbr = Kokkos::View<int*, Mem>(view_alloc(std::string(
"mt.extraNbr"), WithoutInitializing),
253 extraCnt = Kokkos::View<int*, Mem>(
"mt.extraCnt", n);
254 counter = Kokkos::View<int, Mem>(
"mt.counter");
259 constexpr bool host = Kokkos::SpaceAccessibility<Kokkos::HostSpace, Mem>::accessible;
262 near = Kokkos::View<int*, Mem>(view_alloc(std::string(
"mt.near"), WithoutInitializing),
264 nearCnt = Kokkos::View<int*, Mem>(
"mt.nearCnt", n);
265 nearCounter = Kokkos::View<int, Mem>(
"mt.nearCounter");
269 wallCounter = Kokkos::View<int, Mem>(
"mt.wallCounter");
276 KOKKOS_INLINE_FUNCTION
static void dispFromRef(
const Kokkos::View<Real*, Mem>& P,
277 const Kokkos::View<Real*, Mem>& XR,
int i, Real Lx,
278 Real Ly, Real Lz, Real& dx, Real& dy, Real& dz) {
279 dx = P(3 * i) - XR(3 * i);
280 dy = P(3 * i + 1) - XR(3 * i + 1);
281 dz = P(3 * i + 2) - XR(3 * i + 2);
282 const Real Lxh = Real(0.5) * Lx, Lyh = Real(0.5) * Ly, Lzh = Real(0.5) * Lz;
283 dx = dx > Lxh ? dx - Lx : (dx < -Lxh ? dx + Lx : dx);
284 dy = dy > Lyh ? dy - Ly : (dy < -Lyh ? dy + Ly : dy);
285 dz = dz > Lzh ? dz - Lz : (dz < -Lzh ? dz + Lz : dz);
296 void rebuild(
const Kokkos::View<Real*, Mem>& pos,
bool eagerAdj =
true) {
297 Kokkos::View<long*, Mem> gd;
303 auto res = buildTessellation<Real, Weighted, Sdf>(
304 pos,
weight,
N,
L,
sw,
densityCount, gd,
sdf,
false, nBuild,
store.
np,
306 nullptr,
wall,
false, emitNear ?
near : Kokkos::View<int*, Mem>{},
307 emitNear ?
nearCnt : Kokkos::View<int*, Mem>{}, emitNear ?
kNearCap : 0,
312 Kokkos::deep_copy(
vol, res.view.cellVolume);
313 Kokkos::deep_copy(
xRef, pos);
320 int compact(
const Kokkos::View<int*, Mem>& m,
const Kokkos::View<int*, Mem>& wl) {
325 Kokkos::parallel_for(
326 "mt.compact", Kokkos::RangePolicy<Exec>(0,
nProc), KOKKOS_LAMBDA(
int i) {
328 W(Kokkos::atomic_fetch_add(&c(), 1)) = i;
343 template <
bool Local>
344 void certify(
const Kokkos::View<Real*, Mem>& pos,
const Kokkos::View<int*, Mem>& outMask,
345 const Kokkos::View<int*, Mem>& outMover,
bool useSkin) {
346 Kokkos::deep_copy(outMask, 0);
348 Kokkos::deep_copy(outMover, 0);
355 const bool doExtra =
surgical && useSkin;
368 const Real Lx =
L[0], Ly =
L[1], Lz =
L[2];
369 const Real Lxh = Real(0.5) * Lx, Lyh = Real(0.5) * Ly, Lzh = Real(0.5) * Lz;
370 const Real tolL =
tol, half2 = Real(0.25) *
skin *
skin;
371 const bool skinOn = useSkin;
372 const int nP_ =
nProc;
391 Kokkos::parallel_for(
392 "mt.certify", Kokkos::RangePolicy<Exec>(0,
nProc), KOKKOS_LAMBDA(
int i) {
394 st.
load(i, c, Lx, Ly, Lz);
397 const bool wallOk = Wl.
load(i, c, dx, dy, dz);
400 int* wcPtr = WC.data();
401 const bool wallExactC = wallExactL;
402 const Real wallSkin2C = wallSkin2;
403 const Real* wPtr = Wt.data();
404 Real wSelfI = Real(0);
405 if constexpr (Weighted)
407 c.template reevalGeometry<PlanePolicy>(P(3 * i), P(3 * i + 1), P(3 * i + 2), P.data(), Lx,
416 const unsigned char* pk4 = &Pk4((
size_t)i * MAXT * 4);
417 const Real tl = tolL;
426 mover = (dx * dx + dy * dy + dz * dz) > half2;
433 const Real seed[3] = {P(3 * i), P(3 * i + 1), P(3 * i + 2)};
436 }
else if (Wl.
cnt(i) > 0) {
437 if (wallExactC || (dx * dx + dy * dy + dz * dz) > wallSkin2C) {
442 if (SdC.eval(seed[0], seed[1], seed[2]) <= Real(0))
444 for (
int t = 0; t < c.
nt && !wflag; ++t)
445 if (c.
alive[t] && SdC.eval(seed[0] + c.
vx[t], seed[1] + c.
vy[t],
446 seed[2] + c.
vz[t]) < Real(-1e-8))
449 }
else if (c.
nt == 0) {
450 wflag = SdC.eval(seed[0], seed[1], seed[2]) > Real(0);
455 Kokkos::atomic_inc(wcPtr);
460 const int nc = NC(i);
464 const Real sx = P(3 * i), sy = P(3 * i + 1), sz = P(3 * i + 2);
465 for (
int q = 0; q < nc; ++q) {
466 const int j = NR((
size_t)i * nearCapL + q);
469 Real rx = P(3 * j) - sx, ry = P(3 * j + 1) - sy, rz = P(3 * j + 2) - sz;
470 rx = rx > Lxh ? rx - Lx : (rx < -Lxh ? rx + Lx : rx);
471 ry = ry > Lyh ? ry - Ly : (ry < -Lyh ? ry + Ly : ry);
472 rz = rz > Lzh ? rz - Lz : (rz < -Lzh ? rz + Lz : rz);
473 const Real pv[3] = {rx, ry, rz};
475 if constexpr (Weighted)
477 const Real off = PlanePolicy::template offsetFromRel<Real>(pv, wSelfI, wN);
478 if (c.
planeGap(pv, off) > Real(0)) {
481 Kokkos::atomic_exchange(&M(j), 1);
486 Kokkos::atomic_inc(&NCtr());
488 if (!ok ||
mover || wflag || nflag)
492 for (
int q = 0; q < nP; ++q)
493 if (partners[q] < nP_)
494 Kokkos::atomic_exchange(&M(partners[q]), 1);
497 for (
int q = 0; q < nP; ++q) {
498 const int cell = partners[q];
499 if (cell < 0 || cell >= nP_)
501 for (
int r = 0; r < nP; ++r) {
504 const int nb = partners[r];
507 const int slot = Kokkos::atomic_fetch_add(&EC(cell), 1);
509 EN((
size_t)cell * kCap + slot) = nb;
524 template <
bool Local>
525 void certifyList(
const Kokkos::View<Real*, Mem>& pos,
const Kokkos::View<int*, Mem>& list,
int n,
526 const Kokkos::View<int*, Mem>& outMask) {
527 Kokkos::deep_copy(outMask, 0);
535 const Real Lx =
L[0], Ly =
L[1], Lz =
L[2];
536 const Real tolL =
tol;
537 const int nP_ =
nProc;
541 Kokkos::parallel_for(
542 "mt.certifyList", Kokkos::RangePolicy<Exec>(0, n), KOKKOS_LAMBDA(
int s) {
543 const int i = list(s);
545 st.
load(i, c, Lx, Ly, Lz);
549 Wl.
load(i, c, dx, dy, dz);
551 const Real* wPtr = Wt.data();
552 Real wSelfI = Real(0);
553 if constexpr (Weighted)
555 c.template reevalGeometry<PlanePolicy>(P(3 * i), P(3 * i + 1), P(3 * i + 2), P.data(), Lx,
561 const unsigned char* pk4 =
562 &Pk4((
size_t)i * MAXT * 4);
563 const Real tl = tolL;
572 for (
int q = 0; q < nP; ++q)
573 if (partners[q] < nP_)
574 Kokkos::atomic_exchange(&M(partners[q]), 1);
589 const Real Lx =
L[0], Ly =
L[1], Lz =
L[2];
593 Kokkos::parallel_for(
594 "mt.rebuildAdjAll", Kokkos::RangePolicy<Exec>(0,
nProc), KOKKOS_LAMBDA(
int i) {
596 st.
load(i, c, Lx, Ly,
601 Wl.
load(i, c, dx, dy, dz);
603 const Real* wPtr = Wt.data();
604 Real wSelfI = Real(0);
605 if constexpr (Weighted)
607 c.template reevalGeometry<PlanePolicy>(P(3 * i), P(3 * i + 1), P(3 * i + 2), P.data(), Lx,
632 const Kokkos::View<Real*, Mem>& pos) {
638 subsetGather<Real, Weighted, true, Sdf>(grid, wl, n,
store.
np,
store.
nt,
store.
pnbr,
store.
tri,
646 Kokkos::parallel_for(
647 "mt.markRebuilt", Kokkos::RangePolicy<Exec>(0, n), KOKKOS_LAMBDA(
int s) {
650 XR(3 * i) = P(3 * i);
651 XR(3 * i + 1) = P(3 * i + 1);
652 XR(3 * i + 2) = P(3 * i + 2);
659 const Kokkos::View<int*, Mem>& outMask) {
660 Kokkos::deep_copy(outMask, 0);
666 const int nP_ =
nProc;
667 Kokkos::parallel_for(
668 "mt.collectNbrs", Kokkos::RangePolicy<Exec>(0, n), KOKKOS_LAMBDA(
int s) {
670 const int np = st.
np(i), nt = st.
nt(i);
671 for (
int k = 6; k < np; ++k) {
672 const int j = st.
pnbr((
size_t)i * MAXP + k);
673 if (j < 0 || j >= nP_ || rb(j))
676 for (
int t = 0; t < nt; ++t) {
677 const unsigned w = st.
tri((
size_t)i * MAXT + t);
678 if (!((w >> 24) & 1u))
680 const int a = (int)(w & 0xffu), b = (int)((w >> 8) & 0xffu),
681 cc = (
int)((w >> 16) & 0xffu);
682 if (a == k || b == k || cc == k)
686 Kokkos::atomic_exchange(&M(j), 1);
700 const Kokkos::View<Real*, Mem>& pos) {
713 const Real Lx =
L[0], Ly =
L[1], Lz =
L[2];
714 const Real Lxh = Real(0.5) * Lx, Lyh = Real(0.5) * Ly, Lzh = Real(0.5) * Lz;
715 Kokkos::parallel_for(
716 "mt.surgical", Kokkos::RangePolicy<Exec>(0, n), KOKKOS_LAMBDA(
int s) {
720 const Real sx = P(3 * i), sy = P(3 * i + 1), sz = P(3 * i + 2);
721 const int npi = st.
np(i);
722 for (
int k = 6; k < npi && !c.
overflow; ++k) {
723 const int j = st.
pnbr((
size_t)i * MAXP + k);
726 Real rx = P(3 * j) - sx, ry = P(3 * j + 1) - sy, rz = P(3 * j + 2) - sz;
727 rx = rx > Lxh ? rx - Lx : (rx < -Lxh ? rx + Lx : rx);
728 ry = ry > Lyh ? ry - Ly : (ry < -Lyh ? ry + Ly : ry);
729 rz = rz > Lzh ? rz - Lz : (rz < -Lzh ? rz + Lz : rz);
730 const Real nrm[3] = {rx, ry, rz};
731 c.
clip(nrm, Real(0.5) * (rx * rx + ry * ry + rz * rz), j);
733 const int ne = EC(i) < kCap ? EC(i) : kCap;
734 for (
int e = 0; e < ne && !c.
overflow; ++e) {
735 const int j = EN((
size_t)i * kCap + e);
738 Real rx = P(3 * j) - sx, ry = P(3 * j + 1) - sy, rz = P(3 * j + 2) - sz;
739 rx = rx > Lxh ? rx - Lx : (rx < -Lxh ? rx + Lx : rx);
740 ry = ry > Lyh ? ry - Ly : (ry < -Lyh ? ry + Ly : ry);
741 rz = rz > Lzh ? rz - Lz : (rz < -Lzh ? rz + Lz : rz);
742 const Real nrm[3] = {rx, ry, rz};
743 c.
clip(nrm, Real(0.5) * (rx * rx + ry * ry + rz * rz), j);
749 &Pk4((
size_t)i * MAXT * 4));
765 const int dimx = grid.
dimx, dimy = grid.
dimy, dimz = grid.
dimz;
766 const int ncell = dimx * dimy * dimz;
767 if ((
int)
cellFlag.extent(0) < ncell)
769 Kokkos::view_alloc(std::string(
"mt.cellFlag"), Kokkos::WithoutInitializing), ncell);
771 const Real icx = grid.
icx, icy = grid.
icy, icz = grid.
icz;
775 Kokkos::parallel_for(
776 "mt.dilate.count", Kokkos::RangePolicy<Exec>(0,
nProc), KOKKOS_LAMBDA(
int i) {
779 const int gx = ((int)Kokkos::floor(P(3 * i) * icx) % dimx + dimx) % dimx;
780 const int gy = ((int)Kokkos::floor(P(3 * i + 1) * icy) % dimy + dimy) % dimy;
781 const int gz = ((int)Kokkos::floor(P(3 * i + 2) * icz) % dimz + dimz) % dimz;
782 Kokkos::atomic_inc(&CF(gx + gy * dimx + gz * dimx * dimy));
786 Kokkos::parallel_reduce(
787 "mt.dilate.mark", Kokkos::RangePolicy<Exec>(0,
nProc),
788 KOKKOS_LAMBDA(
int i,
long& a) {
791 const int gx = ((int)Kokkos::floor(P(3 * i) * icx) % dimx + dimx) % dimx;
792 const int gy = ((int)Kokkos::floor(P(3 * i + 1) * icy) % dimy + dimy) % dimy;
793 const int gz = ((int)Kokkos::floor(P(3 * i + 2) * icz) % dimz + dimz) % dimz;
795 for (
int dz = -1; dz <= 1; ++dz)
796 for (
int dy = -1; dy <= 1; ++dy)
797 for (
int dx = -1; dx <= 1; ++dx) {
798 const int nx = (gx + dx + dimx) % dimx, ny = (gy + dy + dimy) % dimy,
799 nz = (gz + dz + dimz) % dimz;
800 sum += CF(nx + ny * dimx + nz * dimx * dimy);
814 void certifyDispatch(
const Kokkos::View<Real*, Mem>& pos,
const Kokkos::View<int*, Mem>& outMask,
815 const Kokkos::View<int*, Mem>& outMover,
bool useSkin) {
817 certify<true>(pos, outMask, outMover, useSkin);
819 certify<false>(pos, outMask, outMover, useSkin);
822 int n,
const Kokkos::View<int*, Mem>& outMask) {
824 certifyList<true>(pos, list, n, outMask);
826 certifyList<false>(pos, list, n, outMask);
833 Kokkos::View<long*, Mem>());
896 Kokkos::parallel_for(
897 "mt.surgMask", Kokkos::RangePolicy<Exec>(0,
nProc),
898 KOKKOS_LAMBDA(
int i) { M2(i) = (Msk(i) && !Mv(i)) ? 1 : 0; });
922 for (
int vp = 0; vp <
verifyCap + 1; ++vp) {
Device-native Voronoi tessellation, geometry and finite-volume physics.
Definition convex_cell.hpp:41
@ kOverflow
Definition tessellator.hpp:50
@ kBuried
Definition tessellator.hpp:64
@ kReachExceeded
Definition tessellator.hpp:65
@ kIncomplete
Definition tessellator.hpp:52
@ kEmpty
Definition tessellator.hpp:51
KOKKOS_INLINE_FUNCTION bool sdfWouldClip(const ConvexCell< Real, MAXP, MAXT, TrackAdj > &c, const Real seed[3], const Sdf &sdf)
Definition sdf.hpp:552
constexpr int kMaxPlanes
Definition params.hpp:18
constexpr int kMaxTriangles
Definition params.hpp:19
constexpr int kSearchWindow
Definition params.hpp:28
A2a validity diagnostics of a cold (re)build (counts over the maintained cells).
Definition repair.hpp:77
long buried
power seeds outside their own cell (emptied — see kBuried)
Definition repair.hpp:78
long empty
cells with no volume (in-solid seeds + buried)
Definition repair.hpp:80
long reachExceeded
cells whose search reach passed half the box (min-image invalid)
Definition repair.hpp:79
long incomplete
cells whose coverage did not close
Definition repair.hpp:82
int overBufferRebuilds
over-buffer misses of the build (TessellatorResult)
Definition repair.hpp:83
long overflow
cells that hit a capacity (planes / triangles / facets)
Definition repair.hpp:81
Definition convex_cell.hpp:140
KOKKOS_INLINE_FUNCTION Real volumePerVertex() const
Definition convex_cell.hpp:1192
KOKKOS_INLINE_FUNCTION Real planeGap(const Real pdir[3], Real d) const
Definition convex_cell.hpp:526
KOKKOS_INLINE_FUNCTION bool isLocallyConvexPartners(const unsigned char *poke4, Real tol, int *outPartners, int maxPartners, int &nPartners) const
Definition convex_cell.hpp:456
KOKKOS_INLINE_FUNCTION void initBox(Real L0, Real L1, Real L2)
Definition convex_cell.hpp:176
bool overflow
set if MAXP/MAXT exceeded -> cell invalid, caller falls back
Definition convex_cell.hpp:157
int nt
triangle high-water mark
Definition convex_cell.hpp:156
KOKKOS_INLINE_FUNCTION void rebuildAdjacency()
Definition convex_cell.hpp:624
Real vy[MAXT]
Definition convex_cell.hpp:154
KOKKOS_INLINE_FUNCTION bool isSelfConsistentPartners(Real tol, int *outPartners, int maxPartners, int &nPartners) const
Definition convex_cell.hpp:345
Real vx[MAXT]
Definition convex_cell.hpp:154
KOKKOS_INLINE_FUNCTION bool clip(const Real pdir[3], Real d, int nbr, Real *gapOut=nullptr)
Definition convex_cell.hpp:688
KOKKOS_INLINE_FUNCTION void computePoke4(unsigned char *out) const
Definition convex_cell.hpp:394
bool alive[MAXT]
triangle live flag
Definition convex_cell.hpp:155
Real vz[MAXT]
cached dual-vertex position per triangle
Definition convex_cell.hpp:154
Kokkos::View< int, Mem > nearCounter
Definition repair.hpp:207
void gatherSet(const TessGrid< Real > &grid, const Kokkos::View< int *, Mem > &wl, int n, const Kokkos::View< Real *, Mem > &pos)
Definition repair.hpp:631
bool surgical
repair flip cells by re-clipping known candidates instead of gathering
Definition repair.hpp:144
bool wallExact
re-gather every wall-clipped cell that moved (== cold build)
Definition repair.hpp:212
Kokkos::View< int *, Mem > rebuilt
Definition repair.hpp:216
peclet::core::MemSpace Mem
Definition repair.hpp:91
Kokkos::View< int, Mem > counter
Definition repair.hpp:219
double dilateMaxChurn
Definition repair.hpp:128
void certify(const Kokkos::View< Real *, Mem > &pos, const Kokkos::View< int *, Mem > &outMask, const Kokkos::View< int *, Mem > &outMover, bool useSkin)
Definition repair.hpp:344
Kokkos::View< Real *, Mem > vol
Definition repair.hpp:183
bool useNearMiss
Definition repair.hpp:199
WallStore< Real > wall
persisted wall planes (allocated by alloc() when kHasSdf)
Definition repair.hpp:211
int nProc
Definition repair.hpp:105
Kokkos::View< int *, Mem > mask
Definition repair.hpp:216
void certifyDispatch(const Kokkos::View< Real *, Mem > &pos, const Kokkos::View< int *, Mem > &outMask, const Kokkos::View< int *, Mem > &outMover, bool useSkin)
Definition repair.hpp:814
Kokkos::View< int *, Mem > mask2
Definition repair.hpp:216
int densityCount
Definition repair.hpp:108
bool localCert
Definition repair.hpp:148
peclet::core::ExecSpace Exec
Definition repair.hpp:92
Kokkos::View< int *, Mem > cellFlag
Definition repair.hpp:217
int lastOverBufferRebuilds
of the last cold (re)build (BuildReport)
Definition repair.hpp:119
void surgicalRepair(const Kokkos::View< int *, Mem > &wl, int n, const Kokkos::View< Real *, Mem > &pos)
Definition repair.hpp:699
int N
total cells in the resident arrays (single-domain: all; MPI: owned+ghost)
Definition repair.hpp:104
Kokkos::View< int, Mem > wallCounter
Definition repair.hpp:214
void rebuild(const Kokkos::View< Real *, Mem > &pos, bool eagerAdj=true)
Definition repair.hpp:296
RepairStats step(const Kokkos::View< Real *, Mem > &pos)
One moving-point update step. Updates store + vol in place from pos.
Definition repair.hpp:830
Kokkos::View< Real *, Mem > xRef
Definition repair.hpp:184
bool profile
the cold build's timing / over-buffer report on stderr
Definition repair.hpp:118
Real L[3]
Definition repair.hpp:109
void certifyList(const Kokkos::View< Real *, Mem > &pos, const Kokkos::View< int *, Mem > &list, int n, const Kokkos::View< int *, Mem > &outMask)
Definition repair.hpp:525
int gridNcell
Definition repair.hpp:220
void alloc(int n, const Real Lbox[3], Real tol_, Real skin_, int sw_=kSearchWindow, int densityCount_=-1, int nProc_=-1)
Definition repair.hpp:226
bool adjFresh
Definition repair.hpp:156
int clusterNbhd
Definition repair.hpp:131
bool dilate(const TessGrid< Real > &grid, const Kokkos::View< Real *, Mem > &pos)
Definition repair.hpp:764
Kokkos::View< int *, Mem > extraCnt
Definition repair.hpp:218
bool useDilation
Definition repair.hpp:120
Real nearMarginFrac
margin = nearMarginFrac · skin
Definition repair.hpp:201
bool nearFresh
Definition repair.hpp:202
Kokkos::View< Real *, Mem > weight
Definition repair.hpp:185
static KOKKOS_INLINE_FUNCTION void dispFromRef(const Kokkos::View< Real *, Mem > &P, const Kokkos::View< Real *, Mem > &XR, int i, Real Lx, Real Ly, Real Lz, Real &dx, Real &dy, Real &dz)
Definition repair.hpp:276
Kokkos::View< int *, Mem > wl1
Definition repair.hpp:216
int verifyCap
max verify extra-passes before falling back to a full rebuild
Definition repair.hpp:113
static constexpr bool kHasSdf
Definition repair.hpp:94
Real skin
Verlet skin width (absolute); a particle moving > skin/2 is a Pass-1 mover.
Definition repair.hpp:112
void maybeBuildAdj(const Kokkos::View< Real *, Mem > &pos)
Definition repair.hpp:619
Kokkos::View< int *, Mem > extraNbr
Definition repair.hpp:218
Kokkos::View< int *, Mem > mover
Definition repair.hpp:216
bool useGate
high-churn → rebuild routing (the "never slower than rebuild" guard)
Definition repair.hpp:117
Kokkos::View< int *, Mem > wlM
Definition repair.hpp:216
Kokkos::View< int *, Mem > lastStatus
Definition repair.hpp:163
int compact(const Kokkos::View< int *, Mem > &m, const Kokkos::View< int *, Mem > &wl)
Compact the nonzero entries of m[0..nProc) into wl, returning the count.
Definition repair.hpp:320
bool useLocalNow
this step's certify uses the local cert (= localCert && adjFresh)
Definition repair.hpp:161
int sw
Definition repair.hpp:108
BuildReport report() const
A2a validity diagnostics of the last cold (re)build (counts over the maintained cells).
Definition repair.hpp:165
Sdf sdf
the geometry provider (replicated on every rank under MPI)
Definition repair.hpp:210
void rebuildAdjAll(const Kokkos::View< Real *, Mem > &pos)
Definition repair.hpp:583
void setWeights(const Kokkos::View< Real *, Mem > &w)
Set the per-seed power weights (Weighted only). Held by reference; the caller keeps it alive.
Definition repair.hpp:189
Kokkos::View< int *, Mem > near
Definition repair.hpp:206
Kokkos::View< int *, Mem > wl2
Definition repair.hpp:216
std::conditional_t< Weighted, Power, Voronoi > PlanePolicy
Definition repair.hpp:93
Kokkos::View< int *, Mem > nearCnt
Definition repair.hpp:206
Real tol
certificate tolerance (absolute distance); ~1e-4·spacing FP64, ~2e-3·spacing FP32
Definition repair.hpp:110
static constexpr int kExtraCap
per-cell capacity for partner-discovered new neighbours
Definition repair.hpp:146
int kNearCap
per-cell list capacity (overflow ⇒ re-gather every step)
Definition repair.hpp:200
double churnThresh
Definition repair.hpp:125
void certifyListDispatch(const Kokkos::View< Real *, Mem > &pos, const Kokkos::View< int *, Mem > &list, int n, const Kokkos::View< int *, Mem > &outMask)
Definition repair.hpp:821
Store store
Definition repair.hpp:182
Real wallSkin
skin mode (wallExact=false): re-gather a wall cell only past this
Definition repair.hpp:213
void collectNewNbrs(const Kokkos::View< int *, Mem > &wl, int n, const Kokkos::View< int *, Mem > &outMask)
Definition repair.hpp:658
Sentinel "no geometry" provider — the default; the clip stage is skipped.
Definition sdf.hpp:39
Per-step repair telemetry.
Definition repair.hpp:61
int wallFlagged
cells flagged by the SDF boundary watch (0 without an SDF)
Definition repair.hpp:70
int extra
cells gathered across the verify extra-passes
Definition repair.hpp:67
int pass1
cells gathered in Pass 1 (flagged ∪ partners ∪ skin-movers, after dilation)
Definition repair.hpp:64
int surgical
Pass-1 cells repaired surgically (Phase 4, no grid gather)
Definition repair.hpp:68
int pass2
cells gathered in Pass 2 (new face-neighbours of the movers)
Definition repair.hpp:66
bool fellBack
true if the cold-build fallback was triggered (repair did not close)
Definition repair.hpp:73
Route route
Definition repair.hpp:72
int pass1Raw
flagged count BEFORE dilation (the gate signal: pass1Raw/nProc = churn)
Definition repair.hpp:65
Route
Which path the Phase-3 adaptive gate took this step.
Definition repair.hpp:63
@ kDilated
Definition repair.hpp:63
@ kTwoPass
Definition repair.hpp:63
@ kRebuildGate
Definition repair.hpp:63
int nearFlagged
cells flagged by the near-miss (face-gain) check
Definition repair.hpp:71
int verifyPasses
number of verify iterations run
Definition repair.hpp:69
Definition tess_grid.hpp:56
int dimz
Definition tess_grid.hpp:71
int dimy
Definition tess_grid.hpp:71
int dimx
Definition tess_grid.hpp:71
Real icz
Definition tess_grid.hpp:70
Real icx
Definition tess_grid.hpp:70
Real icy
Definition tess_grid.hpp:70
Definition topology_store.hpp:39
void alloc(int n)
Definition topology_store.hpp:53
Kokkos::View< int *, MemSpace > np
Definition topology_store.hpp:42
Kokkos::View< unsigned char *, MemSpace > poke4
Definition topology_store.hpp:47
KOKKOS_INLINE_FUNCTION void load(int i, Cell &c, Real L0, Real L1, Real L2) const
Definition topology_store.hpp:93
Kokkos::View< unsigned *, MemSpace > tri
Definition topology_store.hpp:45
KOKKOS_INLINE_FUNCTION void save(int i, const Cell &c) const
Persist cell c at slot i (call after the cell is finalised — clipped + complete).
Definition topology_store.hpp:75
Kokkos::View< int *, MemSpace > nt
Definition topology_store.hpp:43
Kokkos::View< int *, MemSpace > pnbr
Definition topology_store.hpp:44
void allocPoke4()
Definition topology_store.hpp:67
Kokkos::View< int *, MemSpace > cnt
Definition sdf.hpp:356
KOKKOS_INLINE_FUNCTION bool load(int i, Cell &c, Real dx, Real dy, Real dz) const
Definition sdf.hpp:393