pnm 1.0.3
peclet.pnm — pore-network extraction from SDF geometry (Kokkos)
Loading...
Searching...
No Matches
pnm Namespace Reference

Namespaces

namespace  detail_mpi
 
namespace  kernels
 
namespace  test
 

Classes

struct  BlockGeo
 Extended-block geometry policy (the MPI pipeline): ghost-inclusive local box <-> global periodic grid. More...
 
struct  GridGeo
 Single-rank geometry policy: the field IS the whole periodic grid, owned == field coords, gid == index. More...
 
struct  I3
 
struct  MpiPoreNetwork
 Result of one distributed extraction. More...
 
struct  NetworkFlow
 
struct  Pore
 
struct  PoreNetwork
 The full pore network from one extraction: pores, the per-voxel segmentation (flat), and the label-adjacency connections. More...
 
struct  PoreRec
 One owned pore-peak record of the distributed network-flow extraction (namespace-scope: nvcc forbids function-local types in extended-lambda captures). More...
 

Typedefs

using Exec = Kokkos::DefaultExecutionSpace
 
using Mem = Exec::memory_space
 
using Index = std::int64_t
 Global voxel / face id (== peclet::core::Index; asserted where core is included).
 

Functions

std::vector< Pore > extractPoresView (const Kokkos::View< float *, Mem > &sdf, std::array< int, 3 > resolution, std::array< float, 3 > origin, std::array< float, 3 > spacing)
 
std::vector< Pore > 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 *, Mem > segmentVolumeView (const Kokkos::View< float *, Mem > &sdf, std::array< int, 3 > resolution, std::array< float, 3 > spacing, Kokkos::View< int *, Mem > *rootsOut=nullptr)
 
std::vector< int > 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 > > extractTopologyView (const Kokkos::View< int *, Mem > &seg, std::array< int, 3 > resolution)
 
std::vector< std::pair< int, int > > extract_topology_k (const int *seg_h, std::size_t n, std::array< int, 3 > resolution)
 
std::vector< std::pair< int, int > > extract_topology_k (const std::vector< int > &seg_h, std::array< int, 3 > resolution)
 
NetworkFlow extract_network_flow_k (const std::vector< float > &sdf_h, std::array< int, 3 > resolution, std::array< float, 3 > origin, std::array< float, 3 > spacing, const std::vector< double > &u_h, const std::vector< double > &v_h, const std::vector< double > &w_h, const std::vector< double > &p_h, const std::vector< double > &ox_h, const std::vector< double > &oy_h, const std::vector< double > &oz_h, std::array< double, 3 > grad_p)
 
PoreNetwork 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)
 
void mpi_block_of (std::array< int, 3 > gdims, MPI_Comm comm, std::array< int, 3 > &offset, std::array< int, 3 > &size)
 This rank's ORB block of the global grid (deterministic; same partition as flow/dem): offset = the block's first voxel index per axis (an integer grid offset, not a physical origin), size = its voxel count per axis.
 
MpiPoreNetwork extract_pore_network_mpi (const std::vector< float > &sdf_local, std::array< int, 3 > gdims, std::array< float, 3 > origin, std::array< float, 3 > spacing, MPI_Comm comm)
 Distributed fused extraction.
 
NetworkFlow extract_network_flow_mpi (const std::vector< float > &sdf_local, std::array< int, 3 > gdims, std::array< float, 3 > origin, std::array< float, 3 > spacing, const std::vector< double > &u_h, const std::vector< double > &v_h, const std::vector< double > &w_h, const std::vector< double > &p_h, const std::vector< double > &ox_h, const std::vector< double > &oy_h, const std::vector< double > &oz_h, std::array< double, 3 > grad_p, MPI_Comm comm)
 
template<class T >
void 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.
 
template<class V >
std::vector< typename V::value_type > 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 — only moves what is used.
 
template<class V >
V::value_type readScalar (const V &d)
 Read a device scalar (the changed / counter flags) back to the host.
 
int get_idx (int x, int y, int z, I3 res)
 
int wrapc (int a, int n)
 

Typedef Documentation

◆ Exec

using pnm::Exec = typedef Kokkos::DefaultExecutionSpace

Definition at line 51 of file pore_kernels.hpp.

◆ Mem

using pnm::Mem = typedef Exec::memory_space

Definition at line 52 of file pore_kernels.hpp.

◆ Index

using pnm::Index = typedef std::int64_t

Global voxel / face id (== peclet::core::Index; asserted where core is included).

Definition at line 54 of file pore_kernels.hpp.

Function Documentation

◆ extractPoresView()

std::vector< Pore > pnm::extractPoresView ( const Kokkos::View< float *, Mem > &  sdf,
std::array< int, 3 >  resolution,
std::array< float, 3 >  origin,
std::array< float, 3 >  spacing 
)
inline

◆ extract_pores_k()

std::vector< Pore > pnm::extract_pores_k ( const std::vector< float > &  sdf_h,
std::array< int, 3 >  resolution,
std::array< float, 3 >  origin,
std::array< float, 3 >  spacing 
)
inline

Definition at line 45 of file pore_extraction.hpp.

References extractPoresView(), and uploadVec().

Referenced by NB_MODULE().

◆ segmentVolumeView()

Kokkos::View< int *, Mem > pnm::segmentVolumeView ( const Kokkos::View< float *, Mem > &  sdf,
std::array< int, 3 >  resolution,
std::array< float, 3 >  spacing,
Kokkos::View< int *, Mem > *  rootsOut = nullptr 
)
inline

◆ segment_volume_k()

std::vector< int > pnm::segment_volume_k ( const std::vector< float > &  sdf_h,
std::array< int, 3 >  resolution,
std::array< float, 3 >  spacing 
)
inline

Definition at line 169 of file pore_extraction.hpp.

References downloadN(), segmentVolumeView(), and uploadVec().

Referenced by NB_MODULE().

◆ extractTopologyView()

std::vector< std::pair< int, int > > pnm::extractTopologyView ( const Kokkos::View< int *, Mem > &  seg,
std::array< int, 3 >  resolution 
)
inline

◆ extract_topology_k() [1/2]

std::vector< std::pair< int, int > > pnm::extract_topology_k ( const int *  seg_h,
std::size_t  n,
std::array< int, 3 >  resolution 
)
inline

Definition at line 198 of file pore_extraction.hpp.

References extractTopologyView().

Referenced by extract_topology_k(), and NB_MODULE().

◆ extract_topology_k() [2/2]

std::vector< std::pair< int, int > > pnm::extract_topology_k ( const std::vector< int > &  seg_h,
std::array< int, 3 >  resolution 
)
inline

Definition at line 209 of file pore_extraction.hpp.

References extract_topology_k().

◆ extract_network_flow_k()

NetworkFlow pnm::extract_network_flow_k ( const std::vector< float > &  sdf_h,
std::array< int, 3 >  resolution,
std::array< float, 3 >  origin,
std::array< float, 3 >  spacing,
const std::vector< double > &  u_h,
const std::vector< double > &  v_h,
const std::vector< double > &  w_h,
const std::vector< double > &  p_h,
const std::vector< double > &  ox_h,
const std::vector< double > &  oy_h,
const std::vector< double > &  oz_h,
std::array< double, 3 >  grad_p 
)
inline

◆ extract_pore_network_k()

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 
)
inline

◆ mpi_block_of()

void pnm::mpi_block_of ( std::array< int, 3 >  gdims,
MPI_Comm  comm,
std::array< int, 3 > &  offset,
std::array< int, 3 > &  size 
)
inline

This rank's ORB block of the global grid (deterministic; same partition as flow/dem): offset = the block's first voxel index per axis (an integer grid offset, not a physical origin), size = its voxel count per axis.

Definition at line 327 of file pore_extraction_mpi.hpp.

Referenced by NB_MODULE().

◆ extract_pore_network_mpi()

MpiPoreNetwork pnm::extract_pore_network_mpi ( const std::vector< float > &  sdf_local,
std::array< int, 3 >  gdims,
std::array< float, 3 >  origin,
std::array< float, 3 >  spacing,
MPI_Comm  comm 
)
inline

Distributed fused extraction.

sdf_local is this rank's INNER block (x-fastest, no ghosts), sized to the ORB block from mpi_block_of. Bit-exact to the single-rank extract_pore_network_k on the gathered grid (pores as a set; seg per voxel; connections).

Definition at line 343 of file pore_extraction_mpi.hpp.

References pnm::MpiPoreNetwork::block_origin, pnm::MpiPoreNetwork::block_size, downloadN(), pnm::BlockGeo::ex, pnm::BlockGeo::ey, pnm::BlockGeo::ez, pnm::BlockGeo::numExt(), pnm::BlockGeo::numOwned(), pnm::BlockGeo::nx, pnm::BlockGeo::ny, pnm::BlockGeo::nz, pnm::BlockGeo::ox, pnm::BlockGeo::oy, pnm::BlockGeo::oz, pnm::MpiPoreNetwork::pores, readScalar(), and uploadVec().

Referenced by extract_network_flow_mpi(), NB_MODULE(), and state_hash::run_case_mpi().

◆ extract_network_flow_mpi()

NetworkFlow pnm::extract_network_flow_mpi ( const std::vector< float > &  sdf_local,
std::array< int, 3 >  gdims,
std::array< float, 3 >  origin,
std::array< float, 3 >  spacing,
const std::vector< double > &  u_h,
const std::vector< double > &  v_h,
const std::vector< double > &  w_h,
const std::vector< double > &  p_h,
const std::vector< double > &  ox_h,
const std::vector< double > &  oy_h,
const std::vector< double > &  oz_h,
std::array< double, 3 >  grad_p,
MPI_Comm  comm 
)
inline

◆ uploadVec()

template<class T >
void pnm::uploadVec ( const std::vector< T > &  h,
const Kokkos::View< T *, Mem > &  d 
)
inline

Bulk host->device upload of a whole std::vector via one deep_copy over an unmanaged host view.

d must already be sized to h.

Definition at line 59 of file pore_kernels.hpp.

Referenced by extract_network_flow_k(), extract_network_flow_mpi(), extract_pore_network_k(), extract_pore_network_mpi(), extract_pores_k(), pnm::detail_mpi::globalMerge(), segment_volume_k(), and pnm::detail_mpi::stageInner().

◆ downloadN()

template<class V >
std::vector< typename V::value_type > pnm::downloadN ( const V &  d,
std::size_t  count 
)
inline

Download the first count elements of a device view into a fresh std::vector via one deep_copy — only moves what is used.

Definition at line 70 of file pore_kernels.hpp.

Referenced by extract_network_flow_k(), extract_network_flow_mpi(), extract_pore_network_k(), extract_pore_network_mpi(), extractPoresView(), pnm::detail_mpi::localPairs(), pnm::detail_mpi::minByKey(), pnm::detail_mpi::packInner(), segment_volume_k(), and pnm::kernels::uniquePairs().

◆ readScalar()

template<class V >
V::value_type pnm::readScalar ( const V &  d)
inline

Read a device scalar (the changed / counter flags) back to the host.

Definition at line 81 of file pore_kernels.hpp.

Referenced by pnm::kernels::cclFixpoint(), extract_network_flow_k(), extract_network_flow_mpi(), extract_pore_network_mpi(), extractPoresView(), extractTopologyView(), and pnm::kernels::floodFixpoint().

◆ get_idx()

int pnm::get_idx ( int  x,
int  y,
int  z,
I3  res 
)

Definition at line 87 of file pore_kernels.hpp.

◆ wrapc()

int pnm::wrapc ( int  a,
int  n 
)

Definition at line 94 of file pore_kernels.hpp.

Referenced by pnm::GridGeo::cell(), pnm::GridGeo::gcoord(), and pnm::BlockGeo::wrapc().