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

Track B, rung B3: the internal polyhedral mesh (PolyMesh) of a resident tessellation — shared vertices, ordered face polygons, owner/neighbour, wall patches — assembled on the host from the topology store, plus a VTU (VTK_POLYHEDRON) writer for viewing. This is what track C consumes beyond the face mesh (vertices are needed for output and for the cell-vertex quantities of later rungs); the solver itself runs on fv::FaceMesh. More...

#include <cmath>
#include <cstdio>
#include <functional>
#include <Kokkos_Core.hpp>
#include <string>
#include <unordered_map>
#include <vector>
#include "peclet/core/common/view.hpp"
#include "peclet/voro/convex_cell.hpp"
#include "peclet/voro/sdf.hpp"
#include "peclet/voro/topology_store.hpp"
Include dependency graph for polymesh.hpp:

Go to the source code of this file.

Classes

struct  peclet::voro::fv::PolyMesh< Real >
 
struct  peclet::voro::fv::detail::VertexKey
 
struct  peclet::voro::fv::detail::VertexKeyHash
 
struct  peclet::voro::fv::detail::PeriodicVertexIds< Real >
 
struct  peclet::voro::fv::detail::PolyFaceList
 The faces of a PolyMesh as they are emitted cell by cell, before the interior-first order. More...
 

Namespaces

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

Functions

int peclet::voro::fv::detail::unionFindRoot (std::vector< int > &parent, int a)
 Root of a in a union–find forest, halving the path on the way (mergeWallVertices).
 
template<class Real >
std::vector< int > peclet::voro::fv::detail::wallVertexIds (const PolyMesh< Real > &m)
 The vertices of the wall faces (patch 1), ascending.
 
template<class Real >
void peclet::voro::fv::detail::unionWithinTolerance (const PolyMesh< Real > &m, const Real L[3], Real tol2, int p, const std::vector< int > &candidates, std::vector< int > &parent)
 Join vertex p with every candidate q > p within the min-image distance sqrt(tol2).
 
template<class Real >
void peclet::voro::fv::detail::unionNearWallVertices (const PolyMesh< Real > &m, const Real L[3], Real tol, const std::vector< int > &ids, std::vector< int > &parent)
 
template<class Real >
int peclet::voro::fv::detail::moveRootsToGroupMean (PolyMesh< Real > &m, const Real L[3], const std::vector< int > &ids, std::vector< int > &parent)
 
template<class Real >
void peclet::voro::fv::detail::rewriteMergedFaces (PolyMesh< Real > &m, std::vector< int > &parent)
 
template<class Real >
int peclet::voro::fv::mergeWallVertices (PolyMesh< Real > &m, const Real L[3], Real tol)
 
template<class Real , class Cell , class PosM , class RefM , class RecM , class CntM >
void peclet::voro::fv::detail::restoreWallPlanesHost (Cell &c, int i, const PosM &ph, const RefM &xrM, const RecM &wrecM, const CntM &wcntM, const Real L[3])
 
template<class Real , class Cell >
Real peclet::voro::fv::detail::emitCellFaces (const Cell &c, int i, Real sx, Real sy, Real sz, PeriodicVertexIds< Real > &vertexId, PolyMesh< Real > &m, PolyFaceList &faces)
 
template<class Real >
void peclet::voro::fv::detail::storeInteriorFirst (PolyMesh< Real > &m, const PolyFaceList &faces, int N)
 Copy the emitted faces into m, interior faces first, and the cell face lists renumbered.
 
template<class Real , int MAXP, int MAXT>
PolyMesh< Real > peclet::voro::fv::buildPolyMesh (const TopologyStore< MAXP, MAXT > &store, const Kokkos::View< Real *, peclet::core::MemSpace > &pos, int N, const Real L[3], WallStore< Real > wall={}, Kokkos::View< Real *, peclet::core::MemSpace > xRef={}, Real quantum=Real(1e-9))
 Assemble the polyhedral mesh of a store at positions posHost (3N, world, in [0,L)).
 
template<class Real >
bool peclet::voro::fv::writeVtu (const std::string &path, const PolyMesh< Real > &m, const std::vector< Real > *cellScalar=nullptr, const char *scalarName="scalar")
 

Detailed Description

Track B, rung B3: the internal polyhedral mesh (PolyMesh) of a resident tessellation — shared vertices, ordered face polygons, owner/neighbour, wall patches — assembled on the host from the topology store, plus a VTU (VTK_POLYHEDRON) writer for viewing. This is what track C consumes beyond the face mesh (vertices are needed for output and for the cell-vertex quantities of later rungs); the solver itself runs on fv::FaceMesh.

Assembly: every cell is reloaded from the store and re-evaluated at the current positions (ConvexCell::reevalGeometry — the same geometry the solver saw), each face polygon is walked CCW (faceOrdered), and vertices are shared by quantised world position (the four cells around a Voronoi vertex compute it from the same three planes to round-off, so a 1e-9·L bucket merges them; a genuinely degenerate configuration with two vertices closer than that would be merged too — recorded, not handled). Interior faces are emitted once (from the lower cell) with the outward orientation of the owner; wall faces (kBoundaryFacet) go to patch 1, box faces to patch 2 (a periodic box has none).