24#ifndef PECLET_VORO_FV_DEC_HPP
25#define PECLET_VORO_FV_DEC_HPP
27#include <Kokkos_Core.hpp>
40 using Mem = peclet::core::MemSpace;
51 using Exec = peclet::core::ExecSpace;
52 using Mem = peclet::core::MemSpace;
56 Kokkos::View<int*, Mem> facetFace(
"dec.facetFace", nF);
57 Kokkos::View<Real*, Mem> facetSign(
"dec.facetSign", nF);
58 Kokkos::deep_copy(facetFace, -1);
64 "dec.inv", Kokkos::RangePolicy<Exec>(0, nI), KOKKOS_LAMBDA(
const int f) {
67 facetSign(g) = Real(1);
69 const int b = B(f), a = A(f);
73 for (
int h = beg; h < end; ++h)
76 facetSign(h) = Real(-1);
82 Kokkos::View<int*, Mem> cnt(
"dec.cnt", nI + 1);
86 "dec.cnt", Kokkos::RangePolicy<Exec>(0, nI), KOKKOS_LAMBDA(
const int f) {
91 d.
offset = Kokkos::View<int*, Mem>(
"dec.offset", nI + 1);
94 Kokkos::parallel_scan(
95 "dec.scan", Kokkos::RangePolicy<Exec>(0, nI + 1),
96 KOKKOS_LAMBDA(
const int f,
int& upd,
const bool fin) {
99 upd += f < nI ? cnt(f) : 0;
103 Kokkos::deep_copy(nE, Kokkos::subview(d.
offset, nI));
105 d.
weight = Kokkos::View<Real*, Mem>(
"dec.weight", nE);
106 d.
face2 = Kokkos::View<int*, Mem>(
"dec.face2", nE);
107 d.
face3 = Kokkos::View<int*, Mem>(
"dec.face3", nE);
108 d.
sign2 = Kokkos::View<Real*, Mem>(
"dec.sign2", nE);
109 d.
sign3 = Kokkos::View<Real*, Mem>(
"dec.sign3", nE);
120 const int nCells = m.
nCells;
121 Kokkos::parallel_reduce(
122 "dec.fill", Kokkos::RangePolicy<Exec>(0, nI),
123 KOKKOS_LAMBDA(
const int f,
int& sk) {
124 const int g = FF(f), b = B(f);
129 for (
int e = eb + 1; e < eb + ec; ++e, ++out) {
133 F2(out) = F3(out) = -1;
134 S2(out) = S3(out) = Real(0);
135 if (k < 0 || k >= nCells || b < 0 || b >= nCells) {
141 const Real cx = rAB[1] * rAk[2] - rAB[2] * rAk[1],
142 cy = rAB[2] * rAk[0] - rAB[0] * rAk[2],
143 cz = rAB[0] * rAk[1] - rAB[1] * rAk[0];
144 const Real tArea = Real(0.5) * Kokkos::sqrt(cx * cx + cy * cy + cz * cz);
145 const Real len = view.
edgeLen(e);
148 const int f3 = facetFace(g3);
149 if (f3 < 0 || tArea <= Real(0)) {
153 const Real s3 = -facetSign(g3);
158 for (
int h = bb; h < be; ++h)
168 W(out) = len / tArea;
187 using Exec = peclet::core::ExecSpace;
191 Kokkos::parallel_for(
192 "dec.curlcurl", Kokkos::RangePolicy<Exec>(0, nI), KOKKOS_LAMBDA(
const int f) {
194 const Real g1 = u(f) * m.
faceDist(f);
196 if (d.
weight(e) <= Real(0))
201 cc += d.
weight(e) * gamma;
Track C, rung C1 (Voronoi methods plan): the FACE mesh of a published tessellation — one record per g...
Definition collocated.hpp:38
Kokkos::View< Real *, peclet::core::MemSpace > DV
Definition operators.hpp:26
DecEdges< Real > buildDecEdges(const TessellationView< Real > &view, const FaceMesh< Real > &m)
Build the DEC edge structure. facetOfFace-style inverse maps are built here from the mesh.
Definition dec.hpp:50
void divergence(const FaceMesh< Real > &m, const DV< Real > &u, const DV< Real > &out)
(div u)_i from face-normal fluxes u (nFaces; boundary faces included, along the outward normal).
Definition operators.hpp:30
void faceGradient(const FaceMesh< Real > &m, const DV< Real > &p, const DV< Real > &out, const DV< Real > &pb=DV< Real >{})
Definition operators.hpp:46
void decLaplacian(const FaceMesh< Real > &m, const DecEdges< Real > &d, const DV< Real > &u, const DV< Real > &divScratch, const DV< Real > &out)
Definition dec.hpp:185
Track C, rung C1: the discrete operators of the staggered COVOLUME scheme on a face mesh (plan verdic...
Definition tessellation_view.hpp:111
Kokkos::View< int *, peclet::core::MemSpace > facetEdgeOffset
Definition tessellation_view.hpp:138
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 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 int numFacets() const
Definition tessellation_view.hpp:178
KOKKOS_INLINE_FUNCTION Real edgeLen(int e) const
Definition tessellation_view.hpp:170
Kokkos::View< int *, peclet::core::MemSpace > cellFacetOffset
Definition tessellation_view.hpp:117
KOKKOS_INLINE_FUNCTION int numCells() const
Definition tessellation_view.hpp:173
Kokkos::View< int *, peclet::core::MemSpace > cellFacetCount
Definition tessellation_view.hpp:118
Kokkos::View< Real *, Mem > weight
Definition dec.hpp:42
Kokkos::View< Real *, Mem > sign2
Definition dec.hpp:44
int nSkipped
Definition dec.hpp:45
peclet::core::MemSpace Mem
Definition dec.hpp:40
Kokkos::View< int *, Mem > face2
Definition dec.hpp:43
Kokkos::View< Real *, Mem > sign3
Definition dec.hpp:44
Kokkos::View< int *, Mem > face3
Definition dec.hpp:43
int nEdges
Definition dec.hpp:45
Kokkos::View< int *, Mem > offset
Definition dec.hpp:41
int nInterior
Definition mesh.hpp:35
Kokkos::View< int *, Mem > faceFacet
Definition mesh.hpp:41
Kokkos::View< int *, Mem > faceCellB
Definition mesh.hpp:40
Kokkos::View< Real *, Mem > faceDist
Definition mesh.hpp:44
Kokkos::View< int *, Mem > faceCellA
Definition mesh.hpp:40
int nCells
Definition mesh.hpp:35
Kokkos::View< Real *, Mem > faceArea
Definition mesh.hpp:42
Published, read-only device data layer for the tessellation (migration §2.1, §3).