pure-cpp 1.0.0
A C++ physics simulation benchmark comparing performance with Python implementations
Model::BodyProxyBase< T > Class Template Reference

A template base class for body proxies to reduce code duplication. More...

#include <body.hpp>

Collaboration diagram for Model::BodyProxyBase< T >:
Collaboration graph

Public Member Functions

 BodyProxyBase (T &in_bodies, std::size_t in_index)
 Construct a new Body Proxy Base object. More...
 
double m () const noexcept
 Access to body masses. More...
 
double getInverseMass () const
 Access to the inverse of the body masses. More...
 
double r () const noexcept
 Access to body radii. More...
 
double getInverseInertia () const
 Access to the inverse of the body's moment of inertia. More...
 
const Vector3d & x () const noexcept
 Access to body positions. More...
 
const Vector3d & v () const noexcept
 Access to body velocities. More...
 
const Quaterniond & q () const noexcept
 Access to body orientation. More...
 
const Vector3d & omega () const noexcept
 Access to body angular velocities. More...
 

Protected Attributes

T & bodies_
 Reference to the main SoA container. More...
 
std::size_t index_
 The index of the body this proxy refers to. More...
 

Detailed Description

template<typename T>
class Model::BodyProxyBase< T >

A template base class for body proxies to reduce code duplication.

Template Parameters
TEither Bodies or const Bodies.

Definition at line 43 of file body.hpp.

Constructor & Destructor Documentation

◆ BodyProxyBase()

template<typename T >
Model::BodyProxyBase< T >::BodyProxyBase ( T &  in_bodies,
std::size_t  in_index 
)
inline

Construct a new Body Proxy Base object.

Parameters
in_bodiesThe Bodies container to be referenced.
in_indexThe index of the body this proxy will access.

Definition at line 51 of file body.hpp.

Member Function Documentation

◆ getInverseInertia()

template<typename T >
double Model::BodyProxyBase< T >::getInverseInertia ( ) const
inline

Access to the inverse of the body's moment of inertia.

Returns
The inverse of the current body's moment of inertia.

Definition at line 83 of file body.hpp.

Here is the caller graph for this function:

◆ getInverseMass()

template<typename T >
double Model::BodyProxyBase< T >::getInverseMass ( ) const
inline

Access to the inverse of the body masses.

Returns
The inverse of the current body's mass.

Definition at line 67 of file body.hpp.

Here is the caller graph for this function:

◆ m()

template<typename T >
double Model::BodyProxyBase< T >::m ( ) const
inlinenoexcept

Access to body masses.

Returns
Mass of the current body.

Definition at line 60 of file body.hpp.

◆ omega()

template<typename T >
const Vector3d & Model::BodyProxyBase< T >::omega ( ) const
inlinenoexcept

Access to body angular velocities.

Returns
A const reference to the current body's angular velocity vector.

Definition at line 121 of file body.hpp.

◆ q()

template<typename T >
const Quaterniond & Model::BodyProxyBase< T >::q ( ) const
inlinenoexcept

Access to body orientation.

Returns
A const reference to the current body's orientation quaternion.

Definition at line 111 of file body.hpp.

◆ r()

template<typename T >
double Model::BodyProxyBase< T >::r ( ) const
inlinenoexcept

Access to body radii.

Returns
The radius of the current body.

Definition at line 76 of file body.hpp.

Here is the caller graph for this function:

◆ v()

template<typename T >
const Vector3d & Model::BodyProxyBase< T >::v ( ) const
inlinenoexcept

Access to body velocities.

Returns
A const reference to the current body's velocity vector.

Definition at line 101 of file body.hpp.

Here is the caller graph for this function:

◆ x()

template<typename T >
const Vector3d & Model::BodyProxyBase< T >::x ( ) const
inlinenoexcept

Access to body positions.

Returns
A const reference to the current body's position vector.

Definition at line 92 of file body.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ bodies_

template<typename T >
T& Model::BodyProxyBase< T >::bodies_
protected

Reference to the main SoA container.

Definition at line 127 of file body.hpp.

◆ index_

template<typename T >
std::size_t Model::BodyProxyBase< T >::index_
protected

The index of the body this proxy refers to.

Definition at line 130 of file body.hpp.


The documentation for this class was generated from the following file: