跳转至

原生绑定参考

本页由 src/style3d_sim/_core.pyi 静态生成,不需要加载 CUDA 扩展。 属性表列出当前存根中的类型与说明;如果本地二进制版本较旧,以它实际支持的接口为准。 完整的调用流程见 底层原生 API 示例。

AffineBodyRigidityModel

Members:

CO_ROTATED

ABD_ORTHOGONALITY

SIX_SPRINGS

SO3_AUGMENTED_LAGRANGIAN

成员:ABD_ORTHOGONALITY, CO_ROTATED, SIX_SPRINGS, SO3_AUGMENTED_LAGRANGIAN

属性 类型 说明
name str
value int

__init__

__init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None

Config

Runtime configuration for a Style3D Sim solver.

Changes made through solver.config affect subsequent direct step calls. Previously captured CUDA graphs must be rebuilt after a configuration change.

属性 类型 说明
affine_body_rigidity_model AffineBodyRigidityModel Rigidity law used for affine bodies: co-rotated, original ABD orthogonality, six springs, or SO(3) AL.
affine_body_rigidity_primal_iterations int Primal Newton iterations performed with a fixed affine-body SO(3) AL state before each update.
air_density float Ambient air density in kg/m^3; zero disables aerodynamic drag.
constraint_alpha float Shared dimensionless mass-normalized penalty for affine rigidity, generated joint constraints, and hard distance constraints. Zero disables all three.
enable_collision_hessian_non_diagonal bool Include coupled contact tangents for rigid, particle-shape, and all self-collision contacts. False keeps their diagonal approximation; full-surface and angular-friction tangents remain coupled.
enable_self_collision bool Whether deformable self-collision is enabled.
fluid_max_step_ratio float Bound fluid Newton increments relative to kernel radius; zero disables.
fluid_relaxation float Global Newton step scale in fluid scenes, in (0, 1].
inertia_mode InertiaMode ABD inertia construction and velocity recovery mode; NONE selects the free-particle path.
joint_constraint_mode JointConstraintMode Joint-constraint enforcement method; PENALTY preserves the legacy behavior.
joint_constraint_primal_iterations int Primal Newton iterations performed with a fixed augmented-Lagrangian dual before each multiplier update.
linear_iterations int PCG iterations per nonlinear iteration.
nonlinear_iterations int Nonlinear iterations per step.
nonlinear_solver NonlinearSolver Implicit-Euler nonlinear method: NEWTON or the legacy PD_NEWTON method.
rolling_friction_velocity_epsilon float Positive contact angular-speed regularization for rolling and torsional friction [rad/s].
self_collision_edge_edge_stiffness float Dimensionless stiffness scale for edge-edge self-collision penalties.
self_collision_edge_face_stiffness float Dimensionless stiffness scale for edge-face untangling penalties.
self_collision_particle_particle_stiffness float Dimensionless stiffness scale for free-particle pair collision penalties.
self_collision_radius float Radius used to thicken deformable collision primitives.
self_collision_vertex_face_stiffness float Dimensionless stiffness scale for vertex-face self-collision penalties.
wind_velocity tuple[float, float, float] Ambient air velocity as a world-coordinate (x, y, z) tuple in m/s.

__init__

__init__(self) -> None

Create the default solver configuration.

Contact

Non-owning views of Newton rigid- and soft-contact buffers consumed by the native solver.

属性 类型 说明
count Span Device span containing the active rigid-contact count.
margin0 Span Device span containing the first shape contact margin.
margin1 Span Device span containing the second shape contact margin.
max_count int Maximum number of rigid contacts stored in the arrays.
normal Span Device span containing world-space normals from shape zero to shape one.
point0 Span Device span containing body-frame points on the first shape.
point1 Span Device span containing body-frame points on the second shape.
shape0 Span Device span containing the first shape index.
shape1 Span Device span containing the second shape index.
soft_barycentric Span Optional barycentric weights for soft_indices; replaces the single-particle contact view.
soft_body_pos Span Device span containing body-local contact points on collision shapes.
soft_body_vel Span Device span containing body-local surface velocities at soft contacts.
soft_count Span Device span containing the active soft-contact count.
soft_indices Span Optional particle, edge, or face contact ids as -1-padded triples; paired with soft_barycentric.
soft_max_count int Maximum number of soft contacts stored in the arrays.
soft_normal Span Device span containing world-space normals from shapes to particles.
soft_particle Span Device span containing the particle index of each soft contact.
soft_particle_only_shapes Span Optional per-original-shape flags selecting legacy particle contacts instead of full-surface contacts.
soft_shape Span Device span containing the shape index of each soft contact.

__init__

__init__(self) -> None

Create an empty contact view.

Control

Non-owning views of Newton joint-control buffers consumed by the native solver.

属性 类型 说明
joint_f Span Device span containing generalized feedforward joint forces.
joint_drive_velocities Span Optional beginning-of-step scalar joint velocities, indexed by drive state.
joint_target_q Span Device span containing generalized joint-position targets.
joint_target_qd Span Device span containing generalized joint-velocity targets.
tetrahedron_activations Span Device span containing optional per-tetrahedron volumetric activations.

__init__

__init__(self) -> None

Create an empty control view.

InertiaMode

Members:

EXPLICIT_EULER

IMPLICIT_EULER

LIE_GROUP_MIDPOINT

MIDPOINT_CAYLEY

NONE

成员:EXPLICIT_EULER, IMPLICIT_EULER, LIE_GROUP_MIDPOINT, MIDPOINT_CAYLEY, NONE

属性 类型 说明
name str
value int

__init__

__init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None

JointConstraintMode

Members:

PENALTY

AUGMENTED_LAGRANGIAN

成员:AUGMENTED_LAGRANGIAN, PENALTY

属性 类型 说明
name str
value int

__init__

__init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None

LogLevel

Members:

INFO

ERROR

DEBUG

WARNING

成员:DEBUG, ERROR, INFO, WARNING

属性 类型 说明
name str
value int

__init__

__init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None

Model

Simulation topology and physical parameters consumed by a Solver.

All array properties are non-owning views of CUDA device memory. Their device allocations must remain valid while the solver uses this model.

属性 类型 说明
affine_body_ids Span Device span mapping affine bodies to Newton body indices.
affine_body_indices Span Device span containing the four direct-ABD coordinate indices of each affine body.
body_centers_of_mass Span Device span containing each affine body's body-frame center of mass.
body_count int Number of affine bodies in one static world template.
body_distance_constraint_count int Number of augmented-Lagrangian hard distance constraints between affine bodies.
body_distance_constraint_indices Span Device span containing the two affine-body indices of each hard distance constraint.
body_distance_constraint_mass_scales Span Device span containing one mass-normalization scale per hard distance constraint.
body_distance_constraint_points0 Span Device span containing the first body-local point of each hard distance constraint.
body_distance_constraint_points1 Span Device span containing the second body-local point of each hard distance constraint.
body_distance_constraint_rest_lengths Span Device span containing one rest length per hard distance constraint.
body_distance_constraint_weights0 Span Device span containing the first affine-body interpolation weights of each hard distance constraint.
body_distance_constraint_weights1 Span Device span containing the second affine-body interpolation weights of each hard distance constraint.
body_inertia_tensors Span Device span containing one inertia tensor per affine body.
body_local_transforms Span Device span containing one local transform per affine body.
body_masses Span Device span containing one mass value per affine body.
body_point_line_count int Number of point-to-line-segment constraints between affine bodies.
body_point_line_dampings Span Device span containing one damping value per point-line constraint.
body_point_line_endpoints0 Span Device span containing the first body-local line endpoint of each point-line constraint.
body_point_line_endpoints1 Span Device span containing the second body-local line endpoint of each point-line constraint.
body_point_line_indices Span Device span containing the point-body and line-body indices of each point-line constraint.
body_point_line_points Span Device span containing the constrained body-local point of each point-line constraint.
body_point_line_stiffnesses Span Device span containing one stiffness value per point-line constraint.
body_spring_count int Number of point-to-point springs between affine bodies.
body_spring_indices Span Device span containing the two affine-body indices of each body spring.
body_spring_points0 Span Device span containing the first body-local point of each body spring.
body_spring_points1 Span Device span containing the second body-local point of each body spring.
body_spring_rest_lengths Span Device span containing one rest length per body spring.
body_spring_stiffnesses Span Device span containing one stiffness value per body spring.
body_state_count int Number of affine bodies in all dynamic world states.
collision_edge_count int Number of collision surface edges in one static world template.
collision_edge_indices Span Device span containing collision edge adjacency and endpoint particle indices.
collision_particle_count int Number of active free particles in one static world template.
collision_particle_indices Span Device span containing active unconstrained particle indices.
collision_triangle_count int Number of collision surface triangles in one static world template.
collision_triangle_indices Span Device span containing collision surface triangle particle indices.
edge_bending_cots Span Device span containing four rest-pose cotangents per bending edge.
edge_bending_properties Span Device span containing stiffness and damping for each bending edge.
edge_count int Number of Style3D bending edges in the model.
edge_indices Span Device span containing one four-particle bending stencil per edge.
edge_rest_areas Span Device span containing the summed rest area adjacent to each bending edge.
fluid_boundary_count int
fluid_boundary_positions Span Fixed boundary quadrature positions; these are not collision shapes.
fluid_boundary_volumes Span Positive boundary quadrature volumes in cubic meters.
fluid_bulk_modulus float
fluid_particle_count int
fluid_particle_indices Span Active fluid particle indices; distinct from elastic and affine topology.
fluid_rest_density float
fluid_smoothing_radius float
fluid_viscosity float
granular_adhesion float
granular_bond_count int
granular_bond_damping float
granular_bond_formation_gap float
granular_bond_formation_speed float
granular_bond_indices Span Initial cohesive bond endpoint particle indices; fracture is irreversible within a solver.
granular_bond_rest_lengths Span Initial bond rest lengths in meters; plastic history is owned by the solver.
granular_break_strain float
granular_cohesion float
granular_contact_stiffness float
granular_friction float
granular_friction_damping float
granular_max_compaction float
granular_max_dynamic_bonds int
granular_particle_count int
granular_particle_indices Span Granular particle indices; disjoint from fluid, elastic, and affine selections.
granular_yield_strain float
gravity Span Device span containing one gravity vector per world.
hinge_count int Number of bending hinges in the model.
hinge_indices Span Device span containing the four particle indices of each hinge.
hinge_rest_angles Span Device span containing one rest angle per hinge.
hinge_stiffnesses Span Device span containing one bending stiffness value per hinge.
joint_body_point_line_count int Number of joint-generated constraints at the end of the point-line arrays.
joint_body_spring_count int Number of joint-generated springs at the end of the body spring arrays.
joint_constraint_mass_scale float Mass-normalization scale shared by generated joint constraints.
joint_dof_count int Number of generalized joint-velocity coordinates.
joint_drive_body_indices Span Device span containing each drive's parent and child affine-body indices.
joint_drive_child_origins Span Device span containing child-frame joint origins.
joint_drive_child_reference_points Span Device span containing child-frame angular reference points.
joint_drive_count int Number of single-axis joint drives.
joint_drive_dof_indices Span Device span mapping drives to generalized force and velocity coordinates.
joint_drive_parent_axis_points Span Device span containing parent-frame unit-axis points.
joint_drive_parent_origins Span Device span containing parent-frame joint origins.
joint_drive_parent_reference_points Span Device span containing parent-frame angular reference points.
joint_drive_target_indices Span Device span mapping drives to generalized position targets.
joint_drive_types Span Device span containing each joint drive type.
joint_effort_limits Span Device span containing symmetric joint effort magnitude limits.
joint_target_count int Number of generalized joint-position targets.
joint_target_dampings Span Device span containing joint target damping values.
joint_target_modes Span Optional Newton target mode per DOF (0 through 4).
joint_passive_dampings Span Optional passive viscous damping per DOF, independent of actuator limits.
joint_armature Span Optional reflected inertia per scalar relative joint coordinate.
joint_target_stiffnesses Span Device span containing joint target stiffness values.
particle_count int Number of particles in one static world template.
particle_flags Span Device span containing Newton particle flags.
particle_indices Span Device span containing the index of each particle.
particle_mass_non_diagonal_count int Number of symmetric off-diagonal particle mass entries.
particle_mass_non_diagonal_indices Span Device span containing one particle-index pair per symmetric off-diagonal mass entry.
particle_mass_non_diagonal_values Span Device span containing symmetric off-diagonal particle mass values.
particle_masses Span Device span containing diagonal entries of the particle mass matrix.
particle_radii Span Device span containing particle collision radii.
particle_rest_positions Span Device span containing initial particle positions for all dynamic world states.
particle_state_count int Number of particles in all dynamic world states.
particle_world Span Device span containing the world index of each particle.
shape_bodies Span Device span mapping collision shapes to Newton body indices.
shape_contact_dampings Span Device span containing shape contact damping values.
shape_contact_friction_gains Span Device span containing tangential friction gains [N s/m].
shape_contact_stiffnesses Span Device span containing shape contact stiffness values.
shape_count int Number of collision shapes in the model.
shape_frictions Span Device span containing shape Coulomb-friction coefficients.
shape_margins Span Device span containing shape collision margins.
shape_replicated_count int Number of collision shapes replicated in each world.
shape_rolling_frictions Span Optional dimensionless rolling-resistance coefficients; an empty span disables rolling resistance.
shape_scales Span Device span containing collision geometry scales.
shape_torsional_frictions Span Optional dimensionless contact spin-resistance coefficients; an empty span disables torsional friction.
shape_transforms Span Device span containing body-local or world collision shape transforms.
shape_types Span Device span containing Newton collision geometry types.
soft_contact_damping float Particle contact damping.
soft_contact_friction float Particle contact Coulomb-friction coefficient.
soft_contact_friction_gain float Particle tangential friction gain [N s/m].
soft_contact_stiffness float Particle contact stiffness.
spring_count int Number of distance springs in the model.
spring_indices Span Device span containing the two particle indices of each spring.
spring_rest_lengths Span Device span containing one rest length per spring.
spring_stiffnesses Span Device span containing one stiffness value per spring.
tetrahedron_count int Number of volumetric tetrahedra in one static world template.
tetrahedron_indices Span Device span containing the four particle indices of each tetrahedron.
tetrahedron_inverse_dms Span Device span containing one inverse rest-shape matrix per tetrahedron.
tetrahedron_materials Span Device span containing k_mu, k_lambda, and k_damp per tetrahedron.
triangle_aniso_stiffnesses Span Device span containing one Style3D anisotropic stiffness vector per triangle.
triangle_count int Number of surface triangles in the model.
triangle_drag_coefficients Span Optional nonnegative normal-drag Cd per collision triangle, or elastic triangle when collision topology is absent.
triangle_indices Span Device span containing the three particle indices of each triangle.
triangle_inv_dms Span Device span containing one inverse rest-shape matrix per triangle.
triangle_masses Span Device span containing one mass value per triangle.
triangle_rest_areas Span Device span containing one rest-area value per triangle.
world_count int Number of simulation worlds in the model.

__init__

__init__(self) -> None

Create an empty model with no referenced device data.

NonlinearSolver

Members:

NEWTON

PD_NEWTON

成员:NEWTON, PD_NEWTON

属性 类型 说明
name str
value int

__init__

__init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None

Solver

Time-step solver for a Style3D Sim simulation model.

Call initialize() once with a configured Model before calling step().

属性 类型 说明
config Config Mutable runtime solver configuration. Captured CUDA graphs must be rebuilt after changes.

__init__

__init__(self) -> None

Create the default solver implementation.

initialize

initialize(self, model: Model) -> None

Initialize the solver for a model.

The model's device allocations must remain valid while the solver uses them. Call this method before the first call to step().

reset_joint_drive_state

reset_joint_drive_state(self, stream: typing.Any=None) -> None

Reset persistent joint-coordinate branches after an external state reset.

step

step(self, state_in: State, state_out: State, dt: typing.SupportsFloat | typing.SupportsIndex, stream: typing.Any=None) -> None

Advance without collision contacts or joint controls.

step(self, state_in: State, state_out: State, contact: Contact, dt: typing.SupportsFloat | typing.SupportsIndex, stream: typing.Any=None) -> None

Advance with collision contacts but without joint controls.

step(self, state_in: State, state_out: State, control: Control, contact: Contact, dt: typing.SupportsFloat | typing.SupportsIndex, stream: typing.Any=None) -> None

Advance the simulation by one time step.

Parameters: state_in: State containing the input particle data. state_out: State whose referenced device memory receives the output data. control: Non-owning views of Newton's generalized joint-control buffers. contact: Non-owning views of the active Newton rigid-contact buffers. dt: Time-step duration. stream: CUDA Stream Protocol object, integer CUDA stream handle, or None for the default stream. All asynchronous work is submitted to this stream.

initialize() must be called before this method. All referenced device allocations must remain valid until the solver work finishes.

Span

A non-owning view of a contiguous CUDA device-memory range.

Span stores an opaque device address and an element count. It does not allocate, free, or dereference the referenced memory. Construction and field assignment reject a null address paired with a nonzero element count.

属性 类型 说明
ptr int Integer address of the first element in CUDA device memory.
size int Number of elements in the range, not its size in bytes.

__init__

__init__(self) -> None

Create an empty span with a null address and zero elements.

__init__(self, ptr: typing.SupportsInt | typing.SupportsIndex, size: typing.SupportsInt | typing.SupportsIndex) -> None

Create a non-owning span from a device address and an element count.

State

Particle positions and velocities used as solver input or output.

Both properties are non-owning views of mutable CUDA device memory. Their device allocations must remain valid until the associated solver work finishes.

属性 类型 说明
particle_f Span Device span containing one external-force vector per particle.
particle_q Span Device span containing one position vector per particle.
particle_qd Span Device span containing one velocity vector per particle.

__init__

__init__(self) -> None

Create an empty state with no referenced device data.

is_logged_in

is_logged_in() -> bool

Return whether the session is authenticated.

login

login(name: str, password: str, force_signin: bool) -> bool

Authenticate the Style3D Sim client.

set_log_callback

set_log_callback(callback: collections.abc.Callable[[str, str, int, LogLevel, str], None]) -> None

Register a callback invoked for each native log message.