20#ifndef PECLET_VORO_SUBSET_GATHER_HPP
21#define PECLET_VORO_SUBSET_GATHER_HPP
23#include <Kokkos_Core.hpp>
26#include "peclet/core/common/view.hpp"
37 Kokkos::View<int*, peclet::core::MemSpace>
55template <
class Real,
bool Weighted = false,
bool TrackAdj = false,
class Sdf = NoSdf>
57 const TessGrid<Real>& grid,
const Kokkos::View<int*, peclet::core::MemSpace>& indices,
58 int nSubset,
const Kokkos::View<int*, peclet::core::MemSpace>& outNp,
59 const Kokkos::View<int*, peclet::core::MemSpace>& outNt,
60 const Kokkos::View<int*, peclet::core::MemSpace>& outPnbr,
61 const Kokkos::View<unsigned*, peclet::core::MemSpace>& outTri,
62 const Kokkos::View<Real*, peclet::core::MemSpace>& cellVol,
63 const Kokkos::View<unsigned char*, peclet::core::MemSpace>& outPoke4 = {}, Sdf sdf = {},
64 bool withForceGeom =
false) {
65 using peclet::core::MemSpace;
66 using Exec = peclet::core::ExecSpace;
67 using Builder = CellBuilder<Real, Weighted, Sdf, TrackAdj>;
69 using Kokkos::view_alloc;
70 using Kokkos::WithoutInitializing;
74 Real wMaxAll = Real(0);
75 if constexpr (Weighted) {
76 if (grid.
wSorted.extent(0) ==
static_cast<size_t>(N)) {
78 Kokkos::parallel_reduce(
79 "subset.wmax", Kokkos::RangePolicy<Exec>(0, N),
80 KOKKOS_LAMBDA(
int idx, Real& m) { m = ws(idx) > m ? ws(idx) : m; },
81 Kokkos::Max<Real>(wMaxAll));
85 SubsetGatherResult<Real> res;
86 res.status = Kokkos::View<int*, MemSpace>(
"subset.status", N);
92 Kokkos::View<int*, MemSpace> facetCount(
"subset.facetCount", N);
93 Kokkos::View<int*, MemSpace> cellFacetBase(
"subset.cellFacetBase", N);
94 constexpr size_t kMeanFacets = 18;
95 const size_t facetCap = (size_t)(nSubset > 0 ? nSubset : 1) * kMeanFacets;
96 Kokkos::View<int*, MemSpace> oNbr(view_alloc(std::string(
"subset.oNbr"), WithoutInitializing),
98 Kokkos::View<Real*, MemSpace> oArea(view_alloc(std::string(
"subset.oArea"), WithoutInitializing),
100 Kokkos::View<Real*, MemSpace> oDV(view_alloc(std::string(
"subset.oDV"), WithoutInitializing),
102 Kokkos::View<Real*, MemSpace> oConn(view_alloc(std::string(
"subset.oConn"), WithoutInitializing),
104 Kokkos::View<int*, MemSpace> facetCursor(
"subset.facetCursor", 1);
107 Kokkos::View<int*, MemSpace> noCand, noCandCnt;
155 auto slotOf = grid.
slotOf;
157 Kokkos::parallel_for(
158 "subset.build", Kokkos::RangePolicy<Exec>(0, nSubset), KOKKOS_LAMBDA(
const int s) {
159 const int i = idx(s);
Definition convex_cell.hpp:40
SubsetGatherResult< Real > subsetGather(const TessGrid< Real > &grid, const Kokkos::View< int *, peclet::core::MemSpace > &indices, int nSubset, const Kokkos::View< int *, peclet::core::MemSpace > &outNp, const Kokkos::View< int *, peclet::core::MemSpace > &outNt, const Kokkos::View< int *, peclet::core::MemSpace > &outPnbr, const Kokkos::View< unsigned *, peclet::core::MemSpace > &outTri, const Kokkos::View< Real *, peclet::core::MemSpace > &cellVol, const Kokkos::View< unsigned char *, peclet::core::MemSpace > &outPoke4={}, Sdf sdf={}, bool withForceGeom=false)
Definition subset_gather.hpp:56
Definition subset_gather.hpp:36
Kokkos::View< int *, peclet::core::MemSpace > status
Definition subset_gather.hpp:38
Definition tess_grid.hpp:55
int dimz
Definition tess_grid.hpp:70
int dimy
Definition tess_grid.hpp:70
Real minCsz
Definition tess_grid.hpp:69
int wlS
Definition tess_grid.hpp:70
int dimx
Definition tess_grid.hpp:70
Kokkos::View< gid_t *, MemSpace > gidSorted
Definition tess_grid.hpp:63
Kokkos::View< Real *, MemSpace > wSorted
Definition tess_grid.hpp:62
Kokkos::View< int *, MemSpace > binned
Definition tess_grid.hpp:58
Kokkos::View< int *, MemSpace > cellStart
Definition tess_grid.hpp:64
Real icz
Definition tess_grid.hpp:69
bool useMorton
Definition tess_grid.hpp:71
int sw
Definition tess_grid.hpp:70
bool haveGid
Definition tess_grid.hpp:71
Real icx
Definition tess_grid.hpp:69
int nOff
Definition tess_grid.hpp:70
Kokkos::View< Real *, MemSpace > posSorted
Definition tess_grid.hpp:61
Kokkos::View< int *, MemSpace > slotOf
Definition tess_grid.hpp:60
int N
Definition tess_grid.hpp:70
Real Ly
Definition tess_grid.hpp:69
Real icy
Definition tess_grid.hpp:69
Real Lx
Definition tess_grid.hpp:69
Real Lz
Definition tess_grid.hpp:69
Kokkos::View< Real *, MemSpace > wlRmin
Definition tess_grid.hpp:67
Kokkos::View< int *, MemSpace > wlOff
Definition tess_grid.hpp:66