oxiphysics_python/lib.rs
1// Copyright 2026 COOLJAPAN OU (Team KitaSan)
2// SPDX-License-Identifier: Apache-2.0
3
4//! Python-friendly wrapper/bridge layer for the OxiPhysics engine.
5//!
6//! This crate provides Python-friendly types and a high-level API surface
7//! designed for future PyO3/pyo3 FFI integration. All types use simple
8//! owned data (no lifetimes) and derive Serialize/Deserialize for easy
9//! JSON interchange.
10//!
11//! ## Quick start
12//!
13//! ```no_run
14//! use oxiphysics_python::world_api::PyPhysicsWorld;
15//! use oxiphysics_python::types::{PySimConfig, PyRigidBodyConfig};
16//!
17//! let mut world = PyPhysicsWorld::new(PySimConfig::earth_gravity());
18//! let h = world.add_rigid_body(PyRigidBodyConfig::dynamic(1.0, [0.0, 10.0, 0.0]));
19//! world.step(1.0 / 60.0);
20//! let pos = world.get_position(h).expect("body exists");
21//! assert!(pos[1] < 10.0); // body has fallen under gravity
22//! ```
23
24#![allow(missing_docs)]
25
26mod error;
27pub mod fem_api;
28pub mod lbm_api;
29pub mod md_api;
30pub mod serialization;
31pub mod sph_api;
32pub mod types;
33pub mod world_api;
34
35pub use error::*;
36pub use fem_api::{
37 PyFemDirichletBC, PyFemElement, PyFemMaterial, PyFemMesh, PyFemNodalForce, PyFemNode,
38 PyFemSolveResult, PyFemSolver,
39};
40pub use lbm_api::{LbmBoundary, PyLbmConfig, PyLbmSimulation};
41pub use md_api::{PyMdAtom, PyMdConfig, PyMdSimulation};
42pub use sph_api::{PySphConfig, PySphSimulation};
43pub use types::*;
44pub use world_api::PyPhysicsWorld;
45pub mod analytics_api;
46pub mod constraints_api;
47pub mod geometry_api;
48pub mod io_api;
49pub mod materials_api;
50pub mod rigid_api;
51pub mod vehicle_api;
52pub mod viz_api;