flow
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
pore_extraction.hpp File Reference

flow — portable (Kokkos) pore-network extraction from an SDF. More...

#include <algorithm>
#include <array>
#include <cstdint>
#include <Kokkos_Core.hpp>
#include <map>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  pnm::Pore
 
struct  pnm::I3
 
struct  pnm::PoreNetwork
 The full pore network from one extraction: pores, the per-voxel segmentation (flat), and the label-adjacency connections. More...
 

Namespaces

namespace  pnm
 

Typedefs

using pnm::Exec = Kokkos::DefaultExecutionSpace
 
using pnm::Mem = Exec::memory_space
 

Functions

template<class T >
void pnm::uploadVec (const std::vector< T > &h, const Kokkos::View< T *, Mem > &d)
 Bulk host->device upload of a whole std::vector via one deep_copy over an unmanaged host view — replaces the per-element create_mirror_view + fill loop (F3).
 
template<class V >
std::vector< typename V::value_type > pnm::downloadN (const V &d, std::size_t count)
 Download the first count elements of a device view into a fresh std::vector via one deep_copy — replaces the create_mirror_view (whole view) + element loop (S2/G1), and only moves what is used.
 
int pnm::get_idx (int x, int y, int z, I3 res)
 
std::vector< Porepnm::extractPoresView (const Kokkos::View< float *, Mem > &sdf, std::array< int, 3 > resolution, std::array< float, 3 > origin, std::array< float, 3 > spacing)
 
std::vector< Porepnm::extract_pores_k (const std::vector< float > &sdf_h, std::array< int, 3 > resolution, std::array< float, 3 > origin, std::array< float, 3 > spacing)
 
Kokkos::View< int *, Mempnm::segmentVolumeView (const Kokkos::View< float *, Mem > &sdf, std::array< int, 3 > resolution, std::array< float, 3 > spacing)
 
std::vector< int > pnm::segment_volume_k (const std::vector< float > &sdf_h, std::array< int, 3 > resolution, std::array< float, 3 > spacing)
 
std::vector< std::pair< int, int > > pnm::extractTopologyView (const Kokkos::View< int *, Mem > &seg, std::array< int, 3 > resolution)
 
std::vector< std::pair< int, int > > pnm::extract_topology_k (const std::vector< int > &seg_h, std::array< int, 3 > resolution)
 
PoreNetwork pnm::extract_pore_network_k (const std::vector< float > &sdf_h, std::array< int, 3 > resolution, std::array< float, 3 > origin, std::array< float, 3 > spacing)
 

Detailed Description

flow — portable (Kokkos) pore-network extraction from an SDF.

Kokkos port of pore_extraction.cu (the pnm_backend module): pore detection (local maxima + weighted centroid), marker-controlled watershed segmentation of the solid (init markers -> union-find CCL -> flood fill), gradient-path pore basins, and boundary-pair topology. Grid-stride global kernels -> Kokkos::parallel_for, atomicAdd/atomicMin -> Kokkos::atomic_*, cudaMalloc/Memcpy -> Kokkos::View + deep_copy. The thrust includes in the .cu were dead (sort/unique is host std::sort). Host orchestration (label renumber via std::map, topology sort/unique) stays on the host. Runs on any Kokkos backend.

Definition in file pore_extraction.hpp.