import type { TSLFloatNode, TSLIntNode, TSLNode, TSLStorageNode, TSLUintNode, TSLUVec2Node, TSLVec3Node, TSLVec4Node } from '../../types/tsl.js'; export type MPMIVec3Node = TSLNode<'ivec3'>; export type MPMIVec4Node = TSLNode<'ivec4'>; export type MPMGridIndexNode = TSLIntNode | TSLUintNode; export type MPMGridContributionMode = 'atomic' | 'subgroup'; export type MPMPackedGridMirrorStorageNode = TSLStorageNode<'uvec2'>; export type MPMUnpackedGridMirrorStorageNode = TSLStorageNode<'vec4'>; export type MPMGridMirrorStorageNode = MPMPackedGridMirrorStorageNode | MPMUnpackedGridMirrorStorageNode; /** Array-like vec3 weights retained after naming the TSL array expression. */ export interface MPMStencilWeightsNode { readonly isNode: true; element(index: TSLIntNode | number): TSLVec3Node; } export interface MPMQuadraticBSplineResult { cellIndex: MPMIVec3Node; weights: MPMStencilWeightsNode; } export interface MPMStencilTap { x: TSLIntNode; y: TSLIntNode; z: TSLIntNode; weight: TSLFloatNode; cell: MPMIVec3Node; distance: TSLVec3Node; } export type MPMStencilCallback = (tap: MPMStencilTap) => void; /** Atomic grid struct member access used by P2G accumulation. */ export interface MPMGridAtomicTargetNode { get(field: 'x' | 'y' | 'z' | 'mass'): TSLIntNode; } /** Quadratic B-spline base cell and the three axis weights used by MLS-MPM. */ export declare function mpmQuadraticBSpline(gridPosition: TSLVec3Node): MPMQuadraticBSplineResult; /** Flatten an XYZ grid coordinate using the solver's X-major layout. */ export declare function mpmCellPointer(cell: MPMIVec3Node, gridSize: TSLVec3Node): TSLIntNode; /** Decode an X-major flattened grid pointer back to XYZ coordinates. */ export declare function mpmDecodeCellPointer(pointer: MPMGridIndexNode, gridSize: TSLVec3Node): MPMIVec3Node; /** * Emit the 27 quadratic-stencil taps. The prefix is part of generated variable * names, so one kernel may safely invoke this helper more than once. */ export declare function forEachMPMStencil(prefix: string, weights: MPMStencilWeightsNode, cellIndex: MPMIVec3Node, gridPosition: TSLVec3Node, callback: MPMStencilCallback): void; /** * @param {import('../../types/tsl.js').TSLVec4Node} value * @returns {import('../../types/tsl.js').TSLUVec2Node} */ export declare function packMPMGridMirror(value: TSLVec4Node): TSLUVec2Node; /** * @param {import('../../types/tsl.js').TSLUVec2Node} value * @returns {import('../../types/tsl.js').TSLVec4Node} */ export declare function unpackMPMGridMirror(value: TSLUVec2Node): TSLVec4Node; export declare function readMPMGridMirror(buffer: MPMPackedGridMirrorStorageNode, index: MPMGridIndexNode, packed: true): TSLVec4Node; export declare function readMPMGridMirror(buffer: MPMUnpackedGridMirrorStorageNode, index: MPMGridIndexNode, packed: false): TSLVec4Node; export declare function readMPMGridMirror(buffer: MPMGridMirrorStorageNode, index: MPMGridIndexNode, packed: boolean): TSLVec4Node; export declare function writeMPMGridMirror(buffer: MPMPackedGridMirrorStorageNode, index: MPMGridIndexNode, value: TSLVec4Node, packed: true): void; export declare function writeMPMGridMirror(buffer: MPMUnpackedGridMirrorStorageNode, index: MPMGridIndexNode, value: TSLVec4Node, packed: false): void; export declare function writeMPMGridMirror(buffer: MPMGridMirrorStorageNode, index: MPMGridIndexNode, value: TSLVec4Node, packed: boolean): void; /** * Add one P2G contribution. In subgroup mode, adjacent equal-cell lanes form a * segmented inclusive scan and only the segment tail performs global atomics. * The operation remains exact because the scan combines already-encoded i32s. */ export declare function addMPMGridContribution(target: MPMGridAtomicTargetNode, targetIndex: MPMGridIndexNode, momentum: MPMIVec3Node, mass: TSLIntNode, mode?: MPMGridContributionMode): void;