26#ifndef PECLET_VORO_TESSELLATION_VIEW_HPP
27#define PECLET_VORO_TESSELLATION_VIEW_HPP
31#include <Kokkos_Core.hpp>
35#include "peclet/core/common/view.hpp"
44 return static_cast<gid_t>(
static_cast<std::int32_t
>(id));
73 std::map<gid_t, int> seedToCell;
74 for (
int i = 0; i < t.
nCells; ++i)
76 std::vector<int> recip(t.
nFacets, -1);
77 for (
int i = 0; i < t.
nCells; ++i) {
83 auto it = seedToCell.find(j);
84 if (it == seedToCell.end())
86 const int cj = it->second;
88 Real bestErr = Real(1e300);
93 for (
int c = 0; c < 3; ++c) {
177 KOKKOS_INLINE_FUNCTION Real
vertex(
int v,
int c)
const {
return vertexPos(3 * v + c); }
186 KOKKOS_INLINE_FUNCTION Real
area(
int f,
int c)
const {
return facetArea(3 * f + c); }
193Kokkos::View<T*, peclet::core::MemSpace>
viewFrom(
const std::vector<T>& h,
194 const std::string&
label) {
197 Kokkos::View<T*, peclet::core::MemSpace> d(Kokkos::view_alloc(
label, Kokkos::WithoutInitializing),
201 Kokkos::View<const T*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >;
202 Host hv(h.data(), h.size());
203 Kokkos::deep_copy(d,
hv);
217 const int nC =
static_cast<int>(h.
cellSeedId.size());
218 std::vector<int> cnt(nC);
219 for (
int i = 0; i < nC; ++i)
KOKKOS_INLINE_FUNCTION Dual< Real, K > dnum(Real c)
Definition convex_cell.hpp:53
Kokkos::View< T *, peclet::core::MemSpace > viewFrom(const std::vector< T > &h, const std::string &label)
Definition tessellation_view.hpp:193
Device-native Voronoi tessellation, geometry and finite-volume physics.
Definition convex_cell.hpp:41
std::int32_t gid_t
Definition tessellation_view.hpp:41
TessellationView< Real > upload(const HostTessellation< Real > &h)
Upload a HostTessellation to device Views.
Definition tessellation_view.hpp:211
std::vector< int > buildReciprocalMap(const HostTessellation< Real > &t)
Definition tessellation_view.hpp:72
gid_t toGid(std::uint32_t id)
Definition tessellation_view.hpp:43
Host-side CSR buffers — the conversion target and the round-trip oracle.
Definition tessellation_view.hpp:49
std::vector< Real > facetConnect
size 3*nFacets, dV (volume gradient)
Definition tessellation_view.hpp:57
std::vector< Real > facetConnVec
size 3*nFacets, connecting vector to neighbour seed
Definition tessellation_view.hpp:58
std::vector< int > cellFacetOffset
size nCells+1, exclusive scan of facet counts
Definition tessellation_view.hpp:52
std::vector< Real > cellVolume
size nCells
Definition tessellation_view.hpp:54
int nFacets
Definition tessellation_view.hpp:51
int nCells
Definition tessellation_view.hpp:50
std::vector< gid_t > facetNeighbor
size nFacets (negative => boundary/none)
Definition tessellation_view.hpp:55
std::vector< Real > facetArea
size 3*nFacets, area vectors (3*f + c)
Definition tessellation_view.hpp:56
std::vector< gid_t > cellSeedId
size nCells, stable seed id per cell
Definition tessellation_view.hpp:53
Definition tessellation_view.hpp:111
Kokkos::View< Real *, peclet::core::MemSpace > cellWallDV
Definition tessellation_view.hpp:151
KOKKOS_INLINE_FUNCTION Real vertex(int v, int c) const
Definition tessellation_view.hpp:177
KOKKOS_INLINE_FUNCTION bool hasVertices() const
Definition tessellation_view.hpp:174
Kokkos::View< Real *, peclet::core::MemSpace > vertexPos
Definition tessellation_view.hpp:129
Kokkos::View< Real *, peclet::core::MemSpace > facetConnect
Definition tessellation_view.hpp:123
KOKKOS_INLINE_FUNCTION Real moment2(int f) const
Definition tessellation_view.hpp:162
KOKKOS_INLINE_FUNCTION Real wallDA(int i, int c) const
Definition tessellation_view.hpp:155
Kokkos::View< Real *, peclet::core::MemSpace > facetArea
Definition tessellation_view.hpp:122
Kokkos::View< int *, peclet::core::MemSpace > facetEdgeOffset
Definition tessellation_view.hpp:138
KOKKOS_INLINE_FUNCTION int vertexEnd(int i) const
Definition tessellation_view.hpp:176
Kokkos::View< int *, peclet::core::MemSpace > cellVertexOffset
Definition tessellation_view.hpp:128
KOKKOS_INLINE_FUNCTION Real area(int f, int c) const
Definition tessellation_view.hpp:186
KOKKOS_INLINE_FUNCTION int facetEnd(int i) const
Definition tessellation_view.hpp:182
KOKKOS_INLINE_FUNCTION gid_t facetNbr(int f) const
Definition tessellation_view.hpp:185
Kokkos::View< int *, peclet::core::MemSpace > facetEdgeCount
Definition tessellation_view.hpp:139
KOKKOS_INLINE_FUNCTION gid_t cellSeed(int i) const
Definition tessellation_view.hpp:179
KOKKOS_INLINE_FUNCTION int edgePartner(int e) const
Definition tessellation_view.hpp:168
KOKKOS_INLINE_FUNCTION Real connVec(int f, int c) const
Definition tessellation_view.hpp:188
KOKKOS_INLINE_FUNCTION bool hasMoments() const
Definition tessellation_view.hpp:161
KOKKOS_INLINE_FUNCTION int numEdges() const
Definition tessellation_view.hpp:165
Kokkos::View< Real *, peclet::core::MemSpace > cellVolume
Definition tessellation_view.hpp:120
Kokkos::View< Real *, peclet::core::MemSpace > facetMoment2
Definition tessellation_view.hpp:160
KOKKOS_INLINE_FUNCTION bool hasAreaGrad() const
Definition tessellation_view.hpp:164
KOKKOS_INLINE_FUNCTION int facetBegin(int i) const
Definition tessellation_view.hpp:181
KOKKOS_INLINE_FUNCTION Real volume(int i) const
Definition tessellation_view.hpp:180
KOKKOS_INLINE_FUNCTION int numFacets() const
Definition tessellation_view.hpp:178
KOKKOS_INLINE_FUNCTION Real edgeLen(int e) const
Definition tessellation_view.hpp:170
Kokkos::View< Real *, peclet::core::MemSpace > edgeAreaGrad
Definition tessellation_view.hpp:141
Kokkos::View< gid_t *, peclet::core::MemSpace > cellSeedId
Definition tessellation_view.hpp:119
KOKKOS_INLINE_FUNCTION bool hasWallFD() const
Definition tessellation_view.hpp:153
Kokkos::View< Real *, peclet::core::MemSpace > cellWallDA
Definition tessellation_view.hpp:152
KOKKOS_INLINE_FUNCTION int edgeBegin(int f) const
Definition tessellation_view.hpp:166
Kokkos::View< int *, peclet::core::MemSpace > cellFacetOffset
Definition tessellation_view.hpp:117
KOKKOS_INLINE_FUNCTION int vertexBegin(int i) const
Definition tessellation_view.hpp:175
Kokkos::View< int *, peclet::core::MemSpace > edgeFacet
Definition tessellation_view.hpp:140
KOKKOS_INLINE_FUNCTION int numCells() const
Definition tessellation_view.hpp:173
KOKKOS_INLINE_FUNCTION Real wallDV(int i, int c) const
Definition tessellation_view.hpp:154
KOKKOS_INLINE_FUNCTION int edgeEnd(int f) const
Definition tessellation_view.hpp:167
KOKKOS_INLINE_FUNCTION bool hasEdgeLength() const
Definition tessellation_view.hpp:171
Kokkos::View< Real *, peclet::core::MemSpace > edgeLength
Definition tessellation_view.hpp:145
KOKKOS_INLINE_FUNCTION Real areaGrad(int e, int c) const
Definition tessellation_view.hpp:169
Kokkos::View< gid_t *, peclet::core::MemSpace > facetNeighbor
Definition tessellation_view.hpp:121
Kokkos::View< int *, peclet::core::MemSpace > cellFacetCount
Definition tessellation_view.hpp:118
KOKKOS_INLINE_FUNCTION Real connect(int f, int c) const
Definition tessellation_view.hpp:187
Kokkos::View< Real *, peclet::core::MemSpace > facetConnVec
Definition tessellation_view.hpp:124