8#ifndef PECLET_VORO_ENERGY_TENSION_HPP
9#define PECLET_VORO_ENERGY_TENSION_HPP
11#include <Kokkos_Core.hpp>
18template <
class Real,
class Policy = Voronoi,
class Sdf = NoSdf>
20 const Kokkos::View<Real*, peclet::core::MemSpace>& pos,
21 const Kokkos::View<Real*, peclet::core::MemSpace>& weight, Real L,
22 const Kokkos::View<Real*, peclet::core::MemSpace>& force,
23 const Kokkos::View<Real*, peclet::core::MemSpace>& forceW = {},
24 const Sdf& sdf = Sdf{}) {
25 using Exec = peclet::core::ExecSpace;
28 Kokkos::parallel_reduce(
29 "energy.tension", Kokkos::RangePolicy<Exec>(0, N),
30 KOKKOS_LAMBDA(
const int i, Real& acc) {
35 for (
int k = 0; k < 3 * nf; ++k)
37 const Real half = Real(0.5) * sigma;
39 for (
int f = b; f < b + nf; ++f) {
44 const Real ax = view.
area(f, 0), ay = view.
area(f, 1), az = view.
area(f, 2);
45 acc += half * Kokkos::sqrt(ax * ax + ay * ay + az * az);
48 for (
int c = 0; c < 3; ++c)
49 gl[3 * p + c] += half * view.
areaGrad(e, c);
53 detail::routeCellGradient<Real, Policy>(view, i, gl, nf, pos, weight, L, sdf, force,
KOKKOS_INLINE_FUNCTION Dual< Real, K > dnum(Real c)
Definition convex_cell.hpp:53
constexpr int kMaxLocalFacets
Facets one cell may publish (CellBuilder::MAXF_TMP); bounds the per-thread gradient array.
Definition route.hpp:29
Definition interface.hpp:23
Real facetTensionEnergyForce(const TessellationView< Real > &view, Real sigma, const Kokkos::View< Real *, peclet::core::MemSpace > &pos, const Kokkos::View< Real *, peclet::core::MemSpace > &weight, Real L, const Kokkos::View< Real *, peclet::core::MemSpace > &force, const Kokkos::View< Real *, peclet::core::MemSpace > &forceW={}, const Sdf &sdf=Sdf{})
Definition tension.hpp:19
Rung A3: route a cell's per-facet geometry gradient to the seed DOFs on the PUBLISHED view — the one ...
Definition tessellation_view.hpp:111
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_INLINE_FUNCTION int edgePartner(int e) const
Definition tessellation_view.hpp:168
KOKKOS_INLINE_FUNCTION int facetBegin(int i) const
Definition tessellation_view.hpp:181
KOKKOS_INLINE_FUNCTION int edgeBegin(int f) const
Definition tessellation_view.hpp:166
KOKKOS_INLINE_FUNCTION int numCells() const
Definition tessellation_view.hpp:173
KOKKOS_INLINE_FUNCTION int edgeEnd(int f) const
Definition tessellation_view.hpp:167
KOKKOS_INLINE_FUNCTION Real areaGrad(int e, int c) const
Definition tessellation_view.hpp:169
Published, read-only device data layer for the tessellation (migration §2.1, §3).