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) {
135 KOKKOS_INLINE_FUNCTION Real
vertex(
int v,
int c)
const {
return vertexPos(3 * v + c); }
144 KOKKOS_INLINE_FUNCTION Real
area(
int f,
int c)
const {
return facetArea(3 * f + c); }
151Kokkos::View<T*, peclet::core::MemSpace>
viewFrom(
const std::vector<T>&
h,
152 const std::string&
label) {
155 Kokkos::View<T*, peclet::core::MemSpace> d(Kokkos::view_alloc(
label, Kokkos::WithoutInitializing),
159 Kokkos::View<const T*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >;
161 Kokkos::deep_copy(d,
hv);
175 const int nC =
static_cast<int>(h.
cellSeedId.size());
176 std::vector<int> cnt(nC);
177 for (
int i = 0; i < nC; ++i)
KOKKOS_INLINE_FUNCTION Dual< Real, K > dnum(Real c)
Definition convex_cell.hpp:52
Kokkos::View< T *, peclet::core::MemSpace > viewFrom(const std::vector< T > &h, const std::string &label)
Definition tessellation_view.hpp:151
Definition convex_cell.hpp:40
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:169
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_INLINE_FUNCTION Real vertex(int v, int c) const
Definition tessellation_view.hpp:135
KOKKOS_INLINE_FUNCTION bool hasVertices() const
Definition tessellation_view.hpp:132
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::View< Real *, peclet::core::MemSpace > facetArea
Definition tessellation_view.hpp:122
KOKKOS_INLINE_FUNCTION int vertexEnd(int i) const
Definition tessellation_view.hpp:134
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:144
KOKKOS_INLINE_FUNCTION int facetEnd(int i) const
Definition tessellation_view.hpp:140
KOKKOS_INLINE_FUNCTION gid_t facetNbr(int f) const
Definition tessellation_view.hpp:143
KOKKOS_INLINE_FUNCTION gid_t cellSeed(int i) const
Definition tessellation_view.hpp:137
KOKKOS_INLINE_FUNCTION Real connVec(int f, int c) const
Definition tessellation_view.hpp:146
Kokkos::View< Real *, peclet::core::MemSpace > cellVolume
Definition tessellation_view.hpp:120
KOKKOS_INLINE_FUNCTION int facetBegin(int i) const
Definition tessellation_view.hpp:139
KOKKOS_INLINE_FUNCTION Real volume(int i) const
Definition tessellation_view.hpp:138
KOKKOS_INLINE_FUNCTION int numFacets() const
Definition tessellation_view.hpp:136
Kokkos::View< gid_t *, peclet::core::MemSpace > cellSeedId
Definition tessellation_view.hpp:119
Kokkos::View< int *, peclet::core::MemSpace > cellFacetOffset
Definition tessellation_view.hpp:117
KOKKOS_INLINE_FUNCTION int vertexBegin(int i) const
Definition tessellation_view.hpp:133
KOKKOS_INLINE_FUNCTION int numCells() const
Definition tessellation_view.hpp:131
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:145
Kokkos::View< Real *, peclet::core::MemSpace > facetConnVec
Definition tessellation_view.hpp:124