|
pure-cpp 1.0.0
A C++ physics simulation benchmark comparing performance with Python implementations
|
Structure-of-Arrays (SoA) container for all bodies in the simulation. More...
#include <body.hpp>

Public Member Functions | |
| void | reserve (std::size_t n) |
| Reserve memory space for the data structure. More... | |
| void | emplaceBack (double in_m, double in_r, const Vector3d &in_x0, const Vector3d &in_v0, const Vector3d &in_omega0) |
| Add a new body at the back of the data structure. More... | |
| void | integratePart1 (double dt, double dt_pos) |
| Vectorized Velocity Verlet: Part 1. More... | |
| void | integratePart2 (double dt) |
| Vectorized Velocity Verlet: Part 2. More... | |
| std::size_t | size () const |
| Get number of bodies in the simulation. More... | |
| BodyProxy | operator[] (std::size_t index) |
| A proxy to access a given body. More... | |
| ConstBodyProxy | operator[] (std::size_t index) const |
| Array like access to given body. More... | |
Private Member Functions | |
| void | updateRotationsRK2 (double dt) |
| Vectorized update of orientations for all bodies using a 2nd-order Runge-Kutta method (RK2). More... | |
Static Private Member Functions | |
| static Vector4d | getQuaternionDerivative (const Vector3d &omega, const Vector4d &q_coeffs) |
| Calculates the time derivative of a quaternion. More... | |
Private Attributes | |
| std::vector< double > | m_ |
| Bodies’ masses. More... | |
| std::vector< double > | invM_ |
| Bodies inverse masses. More... | |
| std::vector< double > | r_ |
| Bodies radii. More... | |
| std::vector< double > | iInv_ |
| Bodies inverse moments of inertia. More... | |
| std::vector< Vector3d > | x_ |
| Bodies' positions. More... | |
| std::vector< Vector3d > | v_ |
| Bodies' velocities. More... | |
| std::vector< Vector3d > | a_ |
| Bodies' accelerations. More... | |
| std::vector< Quaterniond > | q_ |
| Bodies' orientations (quaternions). More... | |
| std::vector< Vector3d > | omega_ |
| Bodies' angular velocities. More... | |
| std::vector< Vector3d > | alpha_ |
| Bodies' angular accelerations. More... | |
| std::vector< Vector3d > | torque_ |
| Net torque applied to each body in a frame. More... | |
Friends | |
| template<typename T > | |
| class | BodyProxyBase |
| class | BodyProxy |
| class | Space |
| class | ConstBodyProxy |
| class | BodiesAdaptor |
Structure-of-Arrays (SoA) container for all bodies in the simulation.
This layout improves cache performance by storing related data contiguously.
Structure of Arrays container for all simulation bodies.
|
inline |
|
inlinestaticprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
Vectorized update of orientations for all bodies using a 2nd-order Runge-Kutta method (RK2).
This method mirrors the efficient, vectorized approach of the Python implementation, operating on all bodies at once.
| dt | The time step for the integration. |
Definition at line 427 of file body.hpp.


|
friend |
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |