peclet.voro 1.0.0
Device-native moving-particle Voronoi dynamics
Loading...
Searching...
No Matches
Namespaces | Enumerations | Functions
mesh_optimizer.hpp File Reference

Energy-minimisation mesh optimiser over seed positions (pure Voronoi) and, optionally, the power WEIGHTS (Laguerre) — moves the DOFs so the cells minimise a geometry energy. A Surface-Evolver-style tool on the differentiable (power-)Voronoi geometry. More...

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <Kokkos_Core.hpp>
#include <limits>
#include <numeric>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include "peclet/core/amr/momentum.hpp"
#include "peclet/core/solver/graph_amg.hpp"
#include "peclet/voro/ot_optimizer.hpp"
#include "peclet/voro/sdf.hpp"
#include "peclet/voro/tessellator.hpp"
Include dependency graph for mesh_optimizer.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
 

Enumerations

enum class  peclet::voro::Precond { peclet::voro::Jacobi , peclet::voro::ColoredGS , peclet::voro::GraphAMG , peclet::voro::SteepestDescent }
 

Functions

template<class Real , bool Weighted = false, class Sdf = NoSdf>
OtResult peclet::voro::meshVolumeOptimize (std::vector< Real > &pos, std::vector< Real > &weight, const std::vector< Real > &vsetIn, const Real L[3], int N, int sw, const Sdf &sdf, int maxNewton, Real tol, int cgIters=300, Precond prec=Precond::Jacobi, bool verbose=false, Real muBarrier=0, Real muDecay=(Real) 0.7, bool freeEnergy=false)
 
template<class Real , class Sdf = NoSdf>
OtResult peclet::voro::interfaceMinimize (std::vector< Real > &pos, const std::vector< int > &type, double sigma, const Real L[3], int N, int sw, const Sdf &sdf, int maxIter, Real tol, bool verbose=false)
 
template<class Real , class Sdf = NoSdf>
OtResult peclet::voro::meshVolumeOptimizeDevice (std::vector< Real > &posHost, const std::vector< Real > &vsetIn, const Real L[3], int N, int sw, const Sdf &sdf, int maxNewton, Real tol, int cgIters=300, bool verbose=false)
 

Detailed Description

Energy-minimisation mesh optimiser over seed positions (pure Voronoi) and, optionally, the power WEIGHTS (Laguerre) — moves the DOFs so the cells minimise a geometry energy. A Surface-Evolver-style tool on the differentiable (power-)Voronoi geometry.

Energy (this file): E = Σ_i γ (V_i − V_set,i)², driving cells to target volumes (V_set from an SDF ⇒ refinement near solids). DOFs = seed positions x (3N) and, when Weighted, the power weights w (N more). Pure Voronoi (Weighted=false) partitions space exactly ⇒ Σ V = box, so the energy is well-posed with no floor; adding weights gives FULLER volume control (positions alone can only partially reach a target).

Gradient (published facet CSR — no cell rebuilds): ∂V_c/∂x_j = facetConnect_k , ∂V_c/∂x_c = −Σ_k facetConnect_k (r_k = x_j − x_i), ∂V_c/∂w_c = Σ_k A_k/(2 d_k) , ∂V_c/∂w_j = −A_k/(2 d_k). Newton–Raphson with the Gauss-Newton Hessian H = 2γ Σ_c (∇V_c)(∇V_c)ᵀ, ASSEMBLED as a scalar CSR over the flattened DOFs, solved by CG with a Jacobi OR multicolour Gauss–Seidel preconditioner (peclet::core::amr::greedyColoring); an Armijo line search on E completes the step.