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

Functions

 sha (a)
 
 grid_xyz (gd_xyz)
 
 sphere_lattice_sdf (gd)
 
 mac_fields (gd, offset_xyz=(0, 0, 0), shape_xyz=None)
 
 pores_array (pores, sort=True)
 
 as_i32 (x, shape)
 
 report_network (tag, net)
 
 run_case (tag, sdf, origin_zyx, spacing_zyx, grad_p_zyx)
 
 run_case_mpi (tag, sdf, origin_zyx, spacing_zyx, grad_p_zyx)
 
 cases (vti, quiet)
 
 main (argv)
 

Variables

 HERE = os.path.dirname(os.path.abspath(__file__))
 
 PACKING_RING = os.path.join(HERE, "..", "..", "..", "flow", "data", "packing_ring.vti")
 
tuple LATTICE_GD_XYZ = (36, 30, 24)
 
tuple LATTICE_ORG_XYZ = (0.5, -1.0, 2.0)
 
tuple LATTICE_SPC_XYZ = (0.5, 1.0, 1.5)
 
tuple LATTICE_GP_XYZ = (1.0e-3, -2.0e-3, 0.5e-3)
 

Detailed Description

Byte gate for the peclet.pnm public surface: SHA-256 of every output of every entry path.

Run:  PYTHONPATH=<pnm build dir> python tests/regression/state_hash.py [packing_ring.vti]
(single-threaded: the script pins OMP_NUM_THREADS=1 before the module is imported; with an MPI
build it also re-launches itself under `mpirun -np 2` for the `*_mpi` collectives).

Two inputs: (i) the 2x2x2 periodic solid-sphere lattice of tests/synthetic_sdf.hpp
(regenerated in numpy, grid 36x30x24, non-unit origin/spacing/grad_p exactly as in
tests/kokkos_mpi/test_pnm_flow_mpi.cpp) and (ii) ../flow/data/packing_ring.vti (256^3; skipped
with a message when absent). The MAC fields fed to extract_network_flow are the deterministic
trigonometric fields of that MPI test — not a physical flow, the bookkeeping only needs
consistency, and the gate only needs reproducibility.

Hashed, per entry path: the pores as an (N, 4) float64 array [x, y, z, radius] sorted by
(z, y, x) (extract_pores returns device-completion order), the segmentation as int32 bytes,
the connections as an (M, 2) int32 array in the returned order, and every array of the
network-flow dict (pores in label order, throats (M, 2) int32, the five float64 arrays).
A refactor of the bindings or the kernels must reproduce every line of this output bitwise
(QUALITY_PLAN §6: "a byte-comparison of the outputs against the pre-refactor build, not just
a green battery"). Hashes recorded at each gate live in the commit messages.

Function Documentation

◆ sha()

state_hash.sha (   a)

Definition at line 45 of file state_hash.py.

◆ grid_xyz()

state_hash.grid_xyz (   gd_xyz)

Definition at line 49 of file state_hash.py.

Referenced by mac_fields(), and sphere_lattice_sdf().

◆ sphere_lattice_sdf()

state_hash.sphere_lattice_sdf (   gd)
tests/synthetic_sdf.hpp sphereLatticeSdf, in float32 like the C++.

Definition at line 55 of file state_hash.py.

References grid_xyz().

Referenced by cases().

◆ mac_fields()

state_hash.mac_fields (   gd,
  offset_xyz = (0, 0, 0),
  shape_xyz = None 
)
The seven deterministic float64 fields (u, v, w, p, ox, oy, oz) of test_pnm_flow_mpi.cpp
on the global grid `gd`, evaluated on the block [offset, offset + shape) (x-y-z).

Definition at line 72 of file state_hash.py.

References grid_xyz().

Referenced by run_case(), and run_case_mpi().

◆ pores_array()

state_hash.pores_array (   pores,
  sort = True 
)

Definition at line 96 of file state_hash.py.

Referenced by run_case_mpi().

◆ as_i32()

state_hash.as_i32 (   x,
  shape 
)

Definition at line 103 of file state_hash.py.

Referenced by run_case(), and run_case_mpi().

◆ report_network()

state_hash.report_network (   tag,
  net 
)

Definition at line 107 of file state_hash.py.

Referenced by run_case(), and run_case_mpi().

◆ run_case()

state_hash.run_case (   tag,
  sdf,
  origin_zyx,
  spacing_zyx,
  grad_p_zyx 
)

Definition at line 117 of file state_hash.py.

References as_i32(), mac_fields(), and report_network().

Referenced by main().

◆ run_case_mpi()

state_hash.run_case_mpi (   tag,
  sdf,
  origin_zyx,
  spacing_zyx,
  grad_p_zyx 
)

◆ cases()

state_hash.cases (   vti,
  quiet 
)

Definition at line 172 of file state_hash.py.

References sphere_lattice_sdf().

Referenced by main().

◆ main()

state_hash.main (   argv)

Definition at line 182 of file state_hash.py.

References cases(), main(), run_case(), and run_case_mpi().

Referenced by main().

Variable Documentation

◆ HERE

state_hash.HERE = os.path.dirname(os.path.abspath(__file__))

Definition at line 35 of file state_hash.py.

◆ PACKING_RING

state_hash.PACKING_RING = os.path.join(HERE, "..", "..", "..", "flow", "data", "packing_ring.vti")

Definition at line 36 of file state_hash.py.

◆ LATTICE_GD_XYZ

tuple state_hash.LATTICE_GD_XYZ = (36, 30, 24)

Definition at line 39 of file state_hash.py.

◆ LATTICE_ORG_XYZ

tuple state_hash.LATTICE_ORG_XYZ = (0.5, -1.0, 2.0)

Definition at line 40 of file state_hash.py.

◆ LATTICE_SPC_XYZ

tuple state_hash.LATTICE_SPC_XYZ = (0.5, 1.0, 1.5)

Definition at line 41 of file state_hash.py.

◆ LATTICE_GP_XYZ

tuple state_hash.LATTICE_GP_XYZ = (1.0e-3, -2.0e-3, 0.5e-3)

Definition at line 42 of file state_hash.py.