import { CellComplex, VecN, type CellGroup, type SourceCellIdN, type SourceCellReferenceN } from '@holotope/core'; import type { SimplexConstitutiveEvaluationN } from './simplex-constitutive.js'; import type { SimplexConstitutiveHessianVectorEvaluationN } from './simplex-constitutive-curvature.js'; import type { XpbdConservativeHessianBlockN, XpbdConservativeHessianVectorEvaluationN, XpbdParticleDirectionQueryN } from './xpbd-incremental-potential-analytic-curvature.js'; import { XpbdParticleN, XpbdWorldN, type XpbdConservativeForceProviderN, type XpbdForceProviderEvaluationN, type XpbdParticlePositionQueryN } from './xpbd-world.js'; /** Pure dimension-independent constitutive evaluator used by family assembly. */ export interface SimplexConstitutiveLawN> { readonly id: string; evaluate(restPositions: readonly VecN[], currentPositions: readonly VecN[], material: TMaterial): TEvaluation; /** * Optional exact matrix-free curvature capability for this law. * * Its products use the mathematical potential sign * `Hessian(U) * direction`. */ evaluateHessianVector?(restPositions: readonly VecN[], currentPositions: readonly VecN[], directions: readonly VecN[], material: TMaterial): SimplexConstitutiveHessianVectorEvaluationN; } /** Source-side identity of one compiled element, before any material is chosen. */ export interface SimplexConstitutiveFamilyElementContextN { /** Ordinal of the source cell this element was compiled from. */ readonly sourceCellIndex: number; /** Source vertex ordinals of the element, in the cell's own order. */ readonly sourceVertexIndices: readonly number[]; /** Structural source-cell identity, stable across regeneration. */ readonly sourceId: SourceCellIdN; /** Intrinsic simplex dimension `k`, one less than its vertex count. */ readonly simplexDimension: number; /** Undeformed k-measure, the reference the energy density is scaled by. */ readonly restMeasure: number; } export type SimplexConstitutiveFamilyMaterialN = TMaterial | ((element: SimplexConstitutiveFamilyElementContextN) => TMaterial); export interface CompileSimplexConstitutiveFamilyNOptions> { readonly id: string; readonly source: CellComplex; readonly simplexGroup: CellGroup; /** One live particle per source vertex, in source-vertex order. */ readonly particles: readonly XpbdParticleN[]; readonly law: SimplexConstitutiveLawN; readonly material: SimplexConstitutiveFamilyMaterialN; } /** One compiled element: its source identity together with its material. */ export interface SimplexConstitutiveFamilyElementN extends SimplexConstitutiveFamilyElementContextN { /** Provenance record tying this element back to the cell it came from. */ readonly sourceReference: SourceCellReferenceN; /** Material resolved for this element, uniform or per-element. */ readonly material: TMaterial; } /** One element paired with what its law reported at the current state. */ export interface SimplexConstitutiveFamilyElementEvaluationN> { /** The compiled element the evaluation belongs to. */ readonly element: SimplexConstitutiveFamilyElementN; /** Complete law evaluation at this element's current positions. */ readonly evaluation: TEvaluation; } export interface SimplexConstitutiveFamilyEvaluationN> extends XpbdForceProviderEvaluationN { readonly lawId: string; readonly potentialEnergy: number; /** One entry per source simplex, in source-cell order. */ readonly elements: readonly SimplexConstitutiveFamilyElementEvaluationN[]; readonly maximumStrainFrobeniusNorm: number; readonly minimumMeasureRatio: number; readonly invertedElementCount: number; readonly collapsedElementCount: number; /** Norm of the summed internal forces. */ readonly netForceResidual: number; } /** One simplex's exact contribution to a family Hessian-vector product. */ export interface SimplexConstitutiveFamilyElementHessianVectorEvaluationN> { /** Source-identified simplex whose local product was evaluated. */ readonly element: SimplexConstitutiveFamilyElementN; /** Exact law-level directional tensors and vertex products for the simplex. */ readonly evaluation: SimplexConstitutiveHessianVectorEvaluationN; } /** One source-simplex block in an exact constitutive Hessian decomposition. */ export interface SimplexConstitutiveFamilyHessianBlockN extends XpbdConservativeHessianBlockN { /** Compiled source element whose law contributes this block. */ readonly element: SimplexConstitutiveFamilyElementN; } /** Exact assembled potential curvature for one constitutive family. */ export interface SimplexConstitutiveFamilyHessianVectorEvaluationN> extends XpbdConservativeHessianVectorEvaluationN { /** Stable constitutive-law identity shared with first-order evaluation. */ readonly lawId: string; /** One exact contribution per source simplex, in source-cell order. */ readonly elements: readonly SimplexConstitutiveFamilyElementHessianVectorEvaluationN[]; /** Norm of the summed products; internal translation invariance makes it zero. */ readonly netProductResidual: number; } /** Source-identified constitutive elements assembled over shared RN particles. */ export declare class SimplexConstitutiveFamilyN> implements XpbdConservativeForceProviderN { readonly id: string; readonly dimension: number; readonly source: CellComplex; readonly sourceSimplexGroup: CellGroup; readonly particles: readonly XpbdParticleN[]; readonly law: SimplexConstitutiveLawN; readonly elements: readonly SimplexConstitutiveFamilyElementN[]; /** * Exact provider curvature when the selected law supplies it. * * The property is absent for custom first-order-only laws so the global * incremental-potential preflight can refuse incomplete provider mixtures. */ readonly evaluatePotentialHessianVectorAt: ((positionOf: XpbdParticlePositionQueryN, directionOf: XpbdParticleDirectionQueryN) => SimplexConstitutiveFamilyHessianVectorEvaluationN) | undefined; /** * One exact additive Hessian block per source simplex when curvature exists. */ readonly potentialHessianBlocks: readonly SimplexConstitutiveFamilyHessianBlockN[] | undefined; /** Exact source-simplex block evaluation, absent for first-order-only laws. */ readonly evaluatePotentialHessianBlockVectorAt: ((block: XpbdConservativeHessianBlockN, positionOf: XpbdParticlePositionQueryN, directionOf: XpbdParticleDirectionQueryN) => SimplexConstitutiveHessianVectorEvaluationN) | undefined; private readonly restPositions; private attachedWorld; private constructor(); static compile>(options: CompileSimplexConstitutiveFamilyNOptions): SimplexConstitutiveFamilyN; evaluate(): SimplexConstitutiveFamilyEvaluationN; /** Evaluates energy and force at a pure candidate position query. */ evaluateAt(positionOf: XpbdParticlePositionQueryN): SimplexConstitutiveFamilyEvaluationN; private evaluateHessianVectorAt; private evaluateHessianBlockVectorAt; /** Defensive copy of the compiled material rest simplex in source-cell order. */ restPositionsOfElement(elementIndex: number): readonly VecN[]; /** Refuses if any retained source cell has been retired or replaced. */ assertCurrentLineage(operation: 'evaluate' | 'evaluateAt' | 'evaluatePotentialHessianVectorAt' | 'evaluatePotentialHessianBlockVectorAt' | 'addToWorld'): void; /** Registers this family as a force provider; particles must already belong to the world. */ addToWorld(world: XpbdWorldN): XpbdWorldN; } export declare function compileSimplexConstitutiveFamilyN>(options: CompileSimplexConstitutiveFamilyNOptions): SimplexConstitutiveFamilyN; //# sourceMappingURL=simplex-constitutive-family.d.ts.map