cellular_raza_building_blocks/
lib.rs

1//! # cellular_raza - Building Blocks
2//!
3//! Building blocks allow users to quickly construct complex cellular agents.
4//! The simplest approach is to use fully-defined cell models.
5//! However, users can also build their own complex models by combining existing ones.
6//!
7//! To create your own agent with physical mechanics and interactions, we need to include
8//! the building blocks for them as fields of our agent struct.
9//! ```rust
10//! # use cellular_raza_building_blocks::*;
11//! struct MyAgent {
12//!     mechanics: NewtonDamped2D,
13//!     interaction: BoundLennardJones,
14//! }
15//! ```
16//! Furthermore, we can derive desired concepts by using the [CellAgent](cellular_raza_concepts::CellAgent)
17//! derive macro.
18//! ```rust
19//! # use cellular_raza_concepts::*;
20//! # use cellular_raza_building_blocks::*;
21//! # use nalgebra::Vector2;
22//! # use cellular_raza_concepts::CellAgent;
23//! #[derive(CellAgent)]
24//! struct MyAgent {
25//!     #[Mechanics]
26//!     mechanics: NewtonDamped2D,
27//!     #[Interaction]
28//!     interaction: BoundLennardJones,
29//! }
30//! # let mut agent = MyAgent {
31//! #     mechanics: NewtonDamped2D {
32//! #         pos: Vector2::<f64>::from([0.0; 2]),
33//! #         vel: Vector2::<f64>::from([0.0; 2]),
34//! #         damping_constant: 0.1,
35//! #         mass: 2.0,
36//! #     },
37//! #     interaction: BoundLennardJones {
38//! #         epsilon: 1.0,
39//! #         sigma: 2.2,
40//! #         bound: 1.2,
41//! #         cutoff: 6.0,
42//! #     },
43//! # };
44//! #
45//! # agent.set_pos(&[1.0, 2.0].into());
46//! # assert_eq!(agent.pos(), Vector2::from([1.0, 2.0]));
47//! ```
48//! For technical reasons, we are required to also once more specify the types for position,
49//! velocity and force when specifying which struct field to derive from.
50//! The optional `Inf` generic parameter of the [Interaction](cellular_raza_concepts::Interaction) trait was left out and thus defaults to `()`.
51//! It can and needs to also be specified when choosing interactions with non-trivial
52//! interaction information.
53//!
54//! # Optional Features
55//! Features guard implementations which introduce additional dependencies.
56//! To simplify usability, we enable commonly used features by default.
57//!
58//! - [pyo3](https://docs.rs/pyo3/latest/pyo3/) Rust bindings to the Python interpreter
59
60#![deny(missing_docs)]
61#![cfg_attr(docsrs, feature(doc_cfg))]
62
63mod cell_building_blocks;
64mod cell_models;
65mod domains;
66
67pub use cell_building_blocks::*;
68pub use cell_models::*;
69pub use domains::*;