peclet.voro 1.0.4
Device-native moving-particle Voronoi dynamics
Loading...
Searching...
No Matches
lloyd.hpp File Reference

Track B, rung B1: the CENTROIDAL (Lloyd / CVT) energy on the published view. More...

#include <Kokkos_Core.hpp>
#include "peclet/voro/energy/route.hpp"
#include "peclet/voro/tessellation_view.hpp"
Include dependency graph for lloyd.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  peclet
 
namespace  peclet::voro
 Device-native Voronoi tessellation, geometry and finite-volume physics.
 
namespace  peclet::voro::energy
 

Functions

template<class Real >
void peclet::voro::energy::cellCentroids (const TessellationView< Real > &view, const Kokkos::View< Real *, peclet::core::MemSpace > &pos, const Kokkos::View< Real *, peclet::core::MemSpace > &out)
 Cell centroids (3N, world = seed + relative) from the facet CSR. pos supplies the seeds.
 
template<class Real >
Real peclet::voro::energy::lloydEnergyForce (const TessellationView< Real > &view, const Kokkos::View< Real *, peclet::core::MemSpace > &pos, Real gamma, const Kokkos::View< Real *, peclet::core::MemSpace > &force)
 

Detailed Description

Track B, rung B1: the CENTROIDAL (Lloyd / CVT) energy on the published view.

E = Σ_i ∫_{V_i} |y − x_i|² dy

Its gradient is exact and needs no shape derivative: because |y − x_i|² = |y − x_j|² on the bisector between i and j, the boundary terms of the shape variation cancel pairwise (Du–Faber–Gunzburger), leaving ∂E/∂x_i = 2 V_i (x_i − c_i), c_i the cell centroid. Minimising it moves every seed to its cell's centroid — the Lloyd iteration — which is exactly what removes the SKEWNESS (face centroid off the seed connector) that limits the two-point operators of track C (fv/operators.hpp): grid generation and solver accuracy are one problem.

The centroid comes from the facet CSR alone: the cell is the union of pyramids from the seed over its faces, pyramid f has volume h_f A_f / 3 and centroid ¾ c_f (c_f the face centroid, seed-relative, c_f = r_f − dV_f |r_f| / |A_f| from the published dV/dr). The ENERGY value needs the faces' second moments ∫_face |s|² dA about the foot point (a pyramid's ∫|y|² = h (h² A + M2)/5), published as facetMoment2 when the build is asked for it (withMoments); without it only the gradient is available (enough for descent, not for a line search on E).