Momentum Scripting v1
Loading...
Searching...
No Matches
MOMENTUM_NAMESPACE::Simulation Class Reference

#include <Simulation.h>

Public Types

enum  ContactType { IMPACT = 1 , RESTING = 2 , IMPACT_AND_RESTING = (IMPACT & RESTING) }
 

Public Member Functions

void addDisabledCollisionGroupPair (const std::string &name1, const std::string &name2)
 
std::shared_ptr< RigidBodycreateRigidBodyFromBodyModel (const BodyModel *bodymodel, const Vec3 &position, const Quat &rotation, const Vec3 &velocity)
 
RigidBodyVector filterRigidBodiesInGeometry (const Geometry *geometry, const RigidBodyVector &rigidBodies, bool onlyCheckForMidPoint) const
 
std::shared_ptr< BallJointgetBallJoint (const std::string &name) const
 
BallJointVector getBallJoints () const
 
Vec3 getContactForces (const Geometry *geometry1, const Geometry *geometry2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getContactForces (const RigidBody *body1, const RigidBody *body2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getContactForces (const RigidBody *rb, const Geometry *geo, ContactType type=IMPACT_AND_RESTING)
 
ContactPointVector getContacts (const Geometry *geometry1=nullptr, const Geometry *geometry2=nullptr) const
 
ContactPointVector getContacts (const RigidBody *body1, const RigidBody *body2=nullptr) const
 
std::shared_ptr< ConveyorBeltgetConveyorBelt (const std::string &name) const
 
ConveyorBeltVector getConveyorBelts () const
 
std::shared_ptr< CylindricalJointgetCylindricalJoint (const std::string &name) const
 
CylindricalJointVector getCylindricalJoints () const
 
std::vector< std::pair< std::string, std::string > > getDisabledCollisionGroupPairs () const
 
RigidBodyVector getEmittedBodies () const
 
std::shared_ptr< EmittergetEmitter (const std::string &name) const
 
EmitterVector getEmitters () const
 
Vec3 getFrictionContactForces (const Geometry *geometry1, const Geometry *geometry2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getFrictionContactForces (const RigidBody *body1, const RigidBody *body2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getFrictionContactForces (const RigidBody *rb, const Geometry *geo, ContactType type=IMPACT_AND_RESTING)
 
GeometryVector getGeometries () const
 
std::shared_ptr< GeometrygetGeometry (const std::string &name) const
 
std::shared_ptr< GeometrygetGeometry (unsigned int id) const
 
std::shared_ptr< GranularBodySystemgetGranularBodySystem () const
 
GranularGranularContactVector getGranularContacts (const GranularBody *granularBody=nullptr) const
 
Vec3 getGranularGeometryContactForces (const Geometry *geometry=nullptr)
 
GranularRigidBodyContactVector getGranularGeometryContacts (const Geometry *geometry=nullptr) const
 
Vec3 getGranularGeometryFrictionContactForces (const Geometry *geometry=nullptr)
 
Vec3 getGranularGeometryNormalContactForces (const Geometry *geometry=nullptr)
 
Vec3 getGranularGeometrySumAbsoluteContactForces (const Geometry *geometry=nullptr)
 
Vec3 getGranularGeometrySumAbsoluteFrictionContactForces (const Geometry *geometry=nullptr)
 
Vec3 getGranularGeometrySumAbsoluteNormalContactForces (const Geometry *geometry=nullptr)
 
Vec3 getGranularRigidBodyContactForces (const RigidBody *body=nullptr)
 
GranularRigidBodyContactVector getGranularRigidBodyContacts (const RigidBody *rigidBody=nullptr) const
 
Vec3 getGranularRigidBodyFrictionContactForces (const RigidBody *body=nullptr)
 
Vec3 getGranularRigidBodyNormalContactForces (const RigidBody *body=nullptr)
 
Vec3 getGranularRigidBodySumAbsoluteContactForces (const RigidBody *body=nullptr)
 
Vec3 getGranularRigidBodySumAbsoluteFrictionContactForces (const RigidBody *body=nullptr)
 
Vec3 getGranularRigidBodySumAbsoluteNormalContactForces (const RigidBody *body=nullptr)
 
Vec3 getGravity () const
 
std::shared_ptr< HingeJointgetHingeJoint (const std::string &name) const
 
HingeJointVector getHingeJoints () const
 
double getImpactSpeedThreshold () const
 
std::shared_ptr< JointgetJoint (const std::string &name) const
 
JointVector getJoints () const
 
std::shared_ptr< LockJointgetLockJoint (const std::string &name) const
 
LockJointVector getLockJoints () const
 
std::shared_ptr< MaterialgetMaterial (const std::string &name) const
 
std::shared_ptr< MaterialPairgetMaterialPair (const std::string &firstName, const std::string &secondName) const
 
std::shared_ptr< MaterialPairgetMaterialPair (Material *firstMaterial, Material *secondMaterial) const
 
MaterialPairVector getMaterialPairs () const
 
MaterialVector getMaterials () const
 
Vec3 getNormalContactForces (const Geometry *geometry1, const Geometry *geometry2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getNormalContactForces (const RigidBody *body1, const RigidBody *body2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getNormalContactForces (const RigidBody *rb, const Geometry *geo, ContactType type=IMPACT_AND_RESTING)
 
unsigned int getNumImpactIterations () const
 
unsigned int getNumParallelRestingIterations () const
 
unsigned int getNumRestingIterations () const
 
std::shared_ptr< ObservergetObserver (const std::string &name) const
 
ObserverVector getObservers () const
 
std::shared_ptr< PrismaticJointgetPrismaticJoint (const std::string &name) const
 
PrismaticJointVector getPrismaticJoints () const
 
RigidBodyVector getRigidBodies () const
 
std::shared_ptr< RigidBodygetRigidBody (const std::string &name) const
 
std::shared_ptr< SensorgetSensor (const std::string &name) const
 
SensorVector getSensors () const
 
std::shared_ptr< SpringJointgetSpringJoint (const std::string &name) const
 
SpringJointVector getSpringJoints () const
 
Vec3 getSumAbsoluteContactForces (const Geometry *geometry1, const Geometry *geometry2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getSumAbsoluteContactForces (const RigidBody *body1, const RigidBody *body2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getSumAbsoluteContactForces (const RigidBody *rb, const Geometry *geo, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getSumAbsoluteFrictionContactForces (const Geometry *geometry1, const Geometry *geometry2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getSumAbsoluteFrictionContactForces (const RigidBody *body1, const RigidBody *body2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getSumAbsoluteFrictionContactForces (const RigidBody *rb, const Geometry *geo, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getSumAbsoluteNormalContactForces (const Geometry *geometry1, const Geometry *geometry2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getSumAbsoluteNormalContactForces (const RigidBody *body1, const RigidBody *body2=nullptr, ContactType type=IMPACT_AND_RESTING)
 
Vec3 getSumAbsoluteNormalContactForces (const RigidBody *rb, const Geometry *geo, ContactType type=IMPACT_AND_RESTING)
 
double getTimeStep () const
 
bool loadGranularFile (const std::string &filename, Material *initMaterial, const AffineMatrix4x4 &offset=AffineMatrix4x4())
 
bool operator== (const Simulation &other) const
 
bool removeDisabledCollisionGroupPair (const std::string &name1, const std::string &name2)
 
void removeEmittedBodiesInGeometry (const Geometry *geometry)
 
void setGravity (const Vec3 &gravity)
 
void setImpactSpeedThreshold (double threshold)
 
size_t write (const std::string &filename)
 
bool writeGranularFile (const std::string &filename, const GranularBodyVector &granularBodies, const RigidBodyVector &rigidBodies) const
 

Friends

SimulationgetSimulation ()
 

Detailed Description

This class is used to access an existing simulation with all its contents including joints, rigid bodies and contacts.

Member Enumeration Documentation

◆ ContactType

Enumerator
IMPACT 
RESTING 
IMPACT_AND_RESTING 

Member Function Documentation

◆ addDisabledCollisionGroupPair()

void MOMENTUM_NAMESPACE::Simulation::addDisabledCollisionGroupPair ( const std::string &  name1,
const std::string &  name2 
)

Add a pair of geometry collision groups which will be disabled for contact generation.

Order of names is not important.

Parameters
name1- Name of first geometry collision group
name2- Name of second geometry collision group

◆ createRigidBodyFromBodyModel()

std::shared_ptr< RigidBody > MOMENTUM_NAMESPACE::Simulation::createRigidBodyFromBodyModel ( const BodyModel bodymodel,
const Vec3 position,
const Quat rotation,
const Vec3 velocity 
)

Create a rigid body from a distribution model.

Note
- A distribution model is accessed from a body distribution that is in turn accessed from an emitter in the simulation.

Only available in simulation mode

◆ filterRigidBodiesInGeometry()

RigidBodyVector MOMENTUM_NAMESPACE::Simulation::filterRigidBodiesInGeometry ( const Geometry geometry,
const RigidBodyVector rigidBodies,
bool  onlyCheckForMidPoint 
) const

Return a subset of specified rigid bodies that intersect with a specified geometry.

Parameters
geometry- The geometry that will be used in the intersection test.
onlyCheckForMidPoint- True if only the midpoint of the body should be used in the intersection test, false all the shapes should be included in a collision test.
rigidBodies- vector containing all rigid bodies that should be tested against the specified geometry.
Returns
vector containing the subset of the specified rigid bodies that intersect with the specified geometry.

◆ getBallJoint()

std::shared_ptr< BallJoint > MOMENTUM_NAMESPACE::Simulation::getBallJoint ( const std::string &  name) const

Get a specific named BallJoint.

Returns nullptr if it could not be found.

Parameters
name- the name of the joint
Returns
the joint

◆ getBallJoints()

BallJointVector MOMENTUM_NAMESPACE::Simulation::getBallJoints ( ) const

Get all ball joints associated with the simulation.

Returns
all ball joints in the simulation

◆ getContactForces() [1/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getContactForces ( const Geometry geometry1,
const Geometry geometry2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all contact (Normal and Friction) forces in world coordinate system between two geometries.

Parameters
geometry1- First matching geometry
geometry2- Second matching geometry (null matches any geometry)
type- Specifies which type of contact force to be returned
Returns
Sum of contact forces in world coordinate system

◆ getContactForces() [2/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getContactForces ( const RigidBody body1,
const RigidBody body2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all contact (Normal and Friction) forces in world coordinate system between two rigid bodies.

Parameters
body1- First rigid body
body2- Second rigid body (null matches any rigid body)
type- Specifies which type of contact force to be returned
Returns
Sum of contact forces in world coordinate system

◆ getContactForces() [3/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getContactForces ( const RigidBody rb,
const Geometry geo,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all contact (Normal and Friction) forces in world coordinate system between a rigid body and a geometry.

Parameters
rb- Matching rigid body
geo- Matching geometry
type- Specifies which type of contact force to be returned
Returns
Sum of contact forces in world coordinate system

◆ getContacts() [1/2]

ContactPointVector MOMENTUM_NAMESPACE::Simulation::getContacts ( const Geometry geometry1 = nullptr,
const Geometry geometry2 = nullptr 
) const

Get all contacts in the simulation for the current timestep that involves two specified geometries.

Parameters
geometry1- the first geometry involved in the matching contact. nullptr matches all geometries.
geometry- the second geometry involved in the matching contact. nullptr matches all geometries.
Returns
all contacts related to the geometries

◆ getContacts() [2/2]

ContactPointVector MOMENTUM_NAMESPACE::Simulation::getContacts ( const RigidBody body1,
const RigidBody body2 = nullptr 
) const

Get all contacts in the simulation for the current timestep that involves two specified RigidBodies.

Parameters
body1- the first body involved in the matching contact. nullptr matches all rigid bodies.
body2- the second body involved in the matching contact. nullptr matches all rigid bodies.
Returns
all contacts related to the bodies

◆ getConveyorBelt()

std::shared_ptr< ConveyorBelt > MOMENTUM_NAMESPACE::Simulation::getConveyorBelt ( const std::string &  name) const

Get a specific named Conveyor Belt.

Returns nullptr if it could not be found.

Parameters
name- the name of the conveyor belt
Returns
the conveyor belt

◆ getConveyorBelts()

ConveyorBeltVector MOMENTUM_NAMESPACE::Simulation::getConveyorBelts ( ) const

Get all conveyor belts associated with the simulation.

Returns
all observers in the simulation

◆ getCylindricalJoint()

std::shared_ptr< CylindricalJoint > MOMENTUM_NAMESPACE::Simulation::getCylindricalJoint ( const std::string &  name) const

Get a specific named CylindricalJoint.

Returns nullptr if it could not be found.

Parameters
name- the name of the joint
Returns
the joint

◆ getCylindricalJoints()

CylindricalJointVector MOMENTUM_NAMESPACE::Simulation::getCylindricalJoints ( ) const

Get all cylindrical joints associated with the simulation.

Returns
all cylindrical joints in the simulation

◆ getDisabledCollisionGroupPairs()

std::vector< std::pair< std::string, std::string > > MOMENTUM_NAMESPACE::Simulation::getDisabledCollisionGroupPairs ( ) const

Get a list of all disabled collision group pairs.

Returns
a list of pair of strings

◆ getEmittedBodies()

RigidBodyVector MOMENTUM_NAMESPACE::Simulation::getEmittedBodies ( ) const
Returns
a vector containing all emitted rigid bodies in the simulation.

◆ getEmitter()

std::shared_ptr< Emitter > MOMENTUM_NAMESPACE::Simulation::getEmitter ( const std::string &  name) const

Get a specific named Emitter.

Returns nullptr if it could not be found.

Parameters
namethe name of the emitter
Returns
the emitter

◆ getEmitters()

EmitterVector MOMENTUM_NAMESPACE::Simulation::getEmitters ( ) const

Get all emitters associated with the simulation.

Returns
all emitters in the simulation

◆ getFrictionContactForces() [1/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getFrictionContactForces ( const Geometry geometry1,
const Geometry geometry2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all Friction contact forces in world coordinate system between two geometries.

Parameters
geometry1- First matching geometry
geometry2- Second matching geometry (null matches any geometry)
type- Specifies which type of contact force to be returned
Returns
Sum of friction contact forces in world coordinate system

◆ getFrictionContactForces() [2/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getFrictionContactForces ( const RigidBody body1,
const RigidBody body2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all Friction contact forces in world coordinate system between two rigid bodies.

Parameters
body1- first matching rigid body
body2- second matching rigid body (null matches any rigid body)
type- Specifies which type of contact force to be returned
Returns
Sum of friction contact forces in world coordinate system

◆ getFrictionContactForces() [3/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getFrictionContactForces ( const RigidBody rb,
const Geometry geo,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all Friction contact forces in world coordinate system between a rigid body and a geometry.

Parameters
rb- matching rigid body
geo- matching geometry
type- Specifies which type of contact force to be returned
Returns
Sum of friction contact forces in world coordinate system

◆ getGeometries()

GeometryVector MOMENTUM_NAMESPACE::Simulation::getGeometries ( ) const

Get all geometries associated with the simulation.

Returns
all geometries in the simulation

◆ getGeometry() [1/2]

std::shared_ptr< Geometry > MOMENTUM_NAMESPACE::Simulation::getGeometry ( const std::string &  name) const

Get a specific named Geometry .

Returns nullptr if it could not be found.

Parameters
name- the name of the geometry
Returns
the geometry

◆ getGeometry() [2/2]

std::shared_ptr< Geometry > MOMENTUM_NAMESPACE::Simulation::getGeometry ( unsigned int  id) const

Get a specific Geometry given an id.

Returns nullptr if it could not be found.

Parameters
id- the name of the geometry
Returns
the geometry

◆ getGranularBodySystem()

std::shared_ptr< GranularBodySystem > MOMENTUM_NAMESPACE::Simulation::getGranularBodySystem ( ) const

Get the GranularBodySystem coupled to the active Simulation.

Returns
The GranularBodySystem of the active simulation

◆ getGranularContacts()

GranularGranularContactVector MOMENTUM_NAMESPACE::Simulation::getGranularContacts ( const GranularBody granularBody = nullptr) const

Get granular contacts against a GranularBody.

Returns
all granular contacts with the GranularBody

◆ getGranularGeometryContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularGeometryContactForces ( const Geometry geometry = nullptr)

Get sum of all contact (Normal and Friction) forces in world coordinate system between a geometry and the granular bodies in the simulation.

Parameters
geometry- The geometry
Returns
Sum of contact forces in world coordinate system

◆ getGranularGeometryContacts()

GranularRigidBodyContactVector MOMENTUM_NAMESPACE::Simulation::getGranularGeometryContacts ( const Geometry geometry = nullptr) const

Get granular contacts against a Geometry.

Returns
all granular contacts with the Geometry

◆ getGranularGeometryFrictionContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularGeometryFrictionContactForces ( const Geometry geometry = nullptr)

Get sum of all Friction contact forces in world coordinate system between a geometry and the granular bodies in the simulation.

Parameters
geometry- matching geometry
Returns
Sum of friction contact forces in world coordinate system

◆ getGranularGeometryNormalContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularGeometryNormalContactForces ( const Geometry geometry = nullptr)

Get sum of all Normal contact forces in world coordinate system between a geometry and granular bodies in the simulation.

Parameters
geometry- matching geometry
Returns
Sum of normal contact forces in world coordinate system

◆ getGranularGeometrySumAbsoluteContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularGeometrySumAbsoluteContactForces ( const Geometry geometry = nullptr)

Get sum of all absolute contact forces between a geometry.

Parameters
geometry- matching geometry
Returns
Sum of absolute contact forces

◆ getGranularGeometrySumAbsoluteFrictionContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularGeometrySumAbsoluteFrictionContactForces ( const Geometry geometry = nullptr)

Get sum of all absolute friction contact forces between a geometry and the granular bodies in the simulation.

Parameters
geometry- matching geometry
Returns
Sum of absolute friction contact forces

◆ getGranularGeometrySumAbsoluteNormalContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularGeometrySumAbsoluteNormalContactForces ( const Geometry geometry = nullptr)

Get sum of all absolute normal contact forces between a geometry and the granular bodies in the simulation.

Parameters
geometry- First matching geometry
Returns
Sum of absolute normal contact forces

◆ getGranularRigidBodyContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularRigidBodyContactForces ( const RigidBody body = nullptr)

Get sum of all contact (Normal and Friction) forces in world coordinate system between a rigid bodies and granular bodies in the simulation.

Parameters
body- The rigid body
Returns
Sum of contact forces in world coordinate system

◆ getGranularRigidBodyContacts()

GranularRigidBodyContactVector MOMENTUM_NAMESPACE::Simulation::getGranularRigidBodyContacts ( const RigidBody rigidBody = nullptr) const

Get granular contacts against a RigidBody.

Returns
all granular contacts with the GranularBody

◆ getGranularRigidBodyFrictionContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularRigidBodyFrictionContactForces ( const RigidBody body = nullptr)

Get sum of all Friction contact forces in world coordinate system between a rigid body and the granular bodies in the simulation.

Parameters
body- The rigid body
Returns
Sum of friction contact forces in world coordinate system

◆ getGranularRigidBodyNormalContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularRigidBodyNormalContactForces ( const RigidBody body = nullptr)

Get sum of all Normal contact forces in world coordinate system between a rigid body and the granular bodies in the simulation.

Parameters
body- The rigid body
Returns
Sum of normal contact forces in world coordinate system

◆ getGranularRigidBodySumAbsoluteContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularRigidBodySumAbsoluteContactForces ( const RigidBody body = nullptr)

Get sum of all absolute contact forces between a rigid body and the granular bodies in the simulation.

Parameters
body- First matching rigid body
Returns
Sum of absolute contact forces

◆ getGranularRigidBodySumAbsoluteFrictionContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularRigidBodySumAbsoluteFrictionContactForces ( const RigidBody body = nullptr)

Get sum of all absolute friction contact forces between a rigid body and the granular bodies in the simulation.

Parameters
body- First matching rigid body
Returns
Sum of absolute friction contact forces

◆ getGranularRigidBodySumAbsoluteNormalContactForces()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGranularRigidBodySumAbsoluteNormalContactForces ( const RigidBody body = nullptr)

Get sum of all absolute normal contact forces between a rigid body and the granular bodies in the simulation.

Parameters
body- matching rigid body
Returns
Sum of absolute normal contact forces

◆ getGravity()

Vec3 MOMENTUM_NAMESPACE::Simulation::getGravity ( ) const

Get the uniform gravity in m/s^2.

Returns
the gravity vector

◆ getHingeJoint()

std::shared_ptr< HingeJoint > MOMENTUM_NAMESPACE::Simulation::getHingeJoint ( const std::string &  name) const

Get a specific named HingeJoint.

Returns nullptr if it could not be found.

Parameters
name- the name of the joint
Returns
the joint

◆ getHingeJoints()

HingeJointVector MOMENTUM_NAMESPACE::Simulation::getHingeJoints ( ) const

Get all hinge joints associated with the simulation.

Returns
all hinge joints in the simulation

◆ getImpactSpeedThreshold()

double MOMENTUM_NAMESPACE::Simulation::getImpactSpeedThreshold ( ) const
Returns
the speed threshold for when to trigger impacts in contacts according to Newton's impact law.

◆ getJoint()

std::shared_ptr< Joint > MOMENTUM_NAMESPACE::Simulation::getJoint ( const std::string &  name) const

Get a specific named Joint.

Returns nullptr if it could not be found.

Parameters
name- the name of the joint
Returns
the joint

◆ getJoints()

JointVector MOMENTUM_NAMESPACE::Simulation::getJoints ( ) const

Get all joints associated with the simulation.

Returns
all joints in the simulation

◆ getLockJoint()

std::shared_ptr< LockJoint > MOMENTUM_NAMESPACE::Simulation::getLockJoint ( const std::string &  name) const

Get a specific named LockJoint.

Returns nullptr if it could not be found.

Parameters
name- the name of the joint
Returns
the joint

◆ getLockJoints()

LockJointVector MOMENTUM_NAMESPACE::Simulation::getLockJoints ( ) const

Get all lock joints associated with the simulation.

Returns
all lock joints in the simulation

◆ getMaterial()

std::shared_ptr< Material > MOMENTUM_NAMESPACE::Simulation::getMaterial ( const std::string &  name) const

Get a specific named Material.

Returns nullptr if it could not be found.

Parameters
name- the name of the material
Returns
the material

◆ getMaterialPair() [1/2]

std::shared_ptr< MaterialPair > MOMENTUM_NAMESPACE::Simulation::getMaterialPair ( const std::string &  firstName,
const std::string &  secondName 
) const

Get a specific MaterialPair between two named materials.

Returns nullptr if it could not be found.

Parameters
firstName- the name of the first material
secondName- the name of the second material
Returns
the contact material

◆ getMaterialPair() [2/2]

std::shared_ptr< MaterialPair > MOMENTUM_NAMESPACE::Simulation::getMaterialPair ( Material firstMaterial,
Material secondMaterial 
) const

Get a specific MaterialPair between two materials.

Returns nullptr if it could not be found.

Parameters
firstMaterial- the first material
secondMaterial- the second material
Returns
the contact material

◆ getMaterialPairs()

MaterialPairVector MOMENTUM_NAMESPACE::Simulation::getMaterialPairs ( ) const

Get all contact materials associated with the simulation.

Returns
all contact materials in the simulation

◆ getMaterials()

MaterialVector MOMENTUM_NAMESPACE::Simulation::getMaterials ( ) const

Get all materials associated with the simulation.

Returns
all materials in the simulation

◆ getNormalContactForces() [1/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getNormalContactForces ( const Geometry geometry1,
const Geometry geometry2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all Normal contact forces in world coordinate system between two geometries.

Parameters
geometry1- first matching geometry
geometry2- second matching geometry (null matches any geometry)
type- Specifies which type of contact force to be returned
Returns
Sum of normal contact forces in world coordinate system

◆ getNormalContactForces() [2/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getNormalContactForces ( const RigidBody body1,
const RigidBody body2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all Normal contact forces in world coordinate system between two rigid bodies.

Parameters
body1- First matching rigid body
body2- Second matching rigid body (null matches any rigid body)
type- Specifies which type of contact force to be returned
Returns
Sum of normal contact forces in world coordinate system

◆ getNormalContactForces() [3/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getNormalContactForces ( const RigidBody rb,
const Geometry geo,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all Normal contact forces in world coordinate system between a rigid body and a geometry.

Parameters
rb- matching rigid body
geo- matching geometry
type- Specifies which type of contact force to be returned
Returns
Sum of normal contact forces in world coordinate system

◆ getNumImpactIterations()

unsigned int MOMENTUM_NAMESPACE::Simulation::getNumImpactIterations ( ) const
Returns
the number of impact iterations used in the impact stage of the solver.
Note
- The impact stage is only enabled if a Granular license is used and a GranularBodySystem is added to the scene.

◆ getNumParallelRestingIterations()

unsigned int MOMENTUM_NAMESPACE::Simulation::getNumParallelRestingIterations ( ) const
Returns
the number of resting iterations used in the iterative Parallel Projected Gauss-Seidel (PPGS) solver.
Note
- This only affects contacts that has MaterialPair solve type ITERATIVE OR contacts involving GranularBodies. It is only enabled if a Granular license is used and a GranularBodySystem is added to the scene.

◆ getNumRestingIterations()

unsigned int MOMENTUM_NAMESPACE::Simulation::getNumRestingIterations ( ) const
Returns
the number of resting iterations used in the iterative Serial Projected Gauss-Seidel (PGS) solver.
Note
- This only affects contacts that has a MaterialPair solve type ITERATIVE OR contacts involving GranularBodies. This is the default iterative solver that is used when the parallel solver (PPGS) is disabled.

◆ getObserver()

std::shared_ptr< Observer > MOMENTUM_NAMESPACE::Simulation::getObserver ( const std::string &  name) const

Get a specific named ObserverFrame.

Returns nullptr if it could not be found.

Parameters
name- the name of the observer
Returns
the observer

◆ getObservers()

ObserverVector MOMENTUM_NAMESPACE::Simulation::getObservers ( ) const

Get all observers associated with the simulation.

Returns
all observers in the simulation

◆ getPrismaticJoint()

std::shared_ptr< PrismaticJoint > MOMENTUM_NAMESPACE::Simulation::getPrismaticJoint ( const std::string &  name) const

Get a specific named PrismaticJoint.

Returns nullptr if it could not be found.

Parameters
name- the name of the joint
Returns
the joint

◆ getPrismaticJoints()

PrismaticJointVector MOMENTUM_NAMESPACE::Simulation::getPrismaticJoints ( ) const

Get all prismatic joints associated with the simulation.

Returns
all prismatic joints in the simulation

◆ getRigidBodies()

RigidBodyVector MOMENTUM_NAMESPACE::Simulation::getRigidBodies ( ) const

Get all rigid bodies associated with the simulation.

Returns
all rigid bodies in the simulation

◆ getRigidBody()

std::shared_ptr< RigidBody > MOMENTUM_NAMESPACE::Simulation::getRigidBody ( const std::string &  name) const

Get a specific named RigidBody.

Returns nullptr if it could not be found.

Parameters
name- the name of the rigid body
Returns
the rigid body

◆ getSensor()

std::shared_ptr< Sensor > MOMENTUM_NAMESPACE::Simulation::getSensor ( const std::string &  name) const

Get a specific named Sensor.

Returns nullptr if it could not be found.

Parameters
namethe name of the Sensor
Returns
the Sensor

◆ getSensors()

SensorVector MOMENTUM_NAMESPACE::Simulation::getSensors ( ) const

Get all Sensors associated with the simulation.

Returns
all Sensors in the simulation

◆ getSpringJoint()

std::shared_ptr< SpringJoint > MOMENTUM_NAMESPACE::Simulation::getSpringJoint ( const std::string &  name) const

Get a specific named SpringJoint.

Returns nullptr if it could not be found.

Parameters
name- the name of the joint
Returns
the joint

◆ getSpringJoints()

SpringJointVector MOMENTUM_NAMESPACE::Simulation::getSpringJoints ( ) const

Get all spring joints associated with the simulation.

Returns
all spring joints in the simulation

◆ getSumAbsoluteContactForces() [1/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getSumAbsoluteContactForces ( const Geometry geometry1,
const Geometry geometry2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all absolute contact forces between two geometries.

Parameters
geometry1- First matching geometry
geometry2- Second matching geometry (null matches any geometry)
type- Specifies which type of contact force to be returned
Returns
Sum of absolute contact forces

◆ getSumAbsoluteContactForces() [2/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getSumAbsoluteContactForces ( const RigidBody body1,
const RigidBody body2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all absolute contact forces between two rigid bodies.

Parameters
body1- First matching rigid body
body2- Second matching rigid body (null matches any rigid body)
type- Specifies which type of contact force to be returned
Returns
Sum of absolute contact forces

◆ getSumAbsoluteContactForces() [3/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getSumAbsoluteContactForces ( const RigidBody rb,
const Geometry geo,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all absolute contact forces between a rigid body and a geometry.

Parameters
rb- matching rigid body
geo- matching geometry
type- Specifies which type of contact force to be returned
Returns
Sum of absolute contact forces

◆ getSumAbsoluteFrictionContactForces() [1/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getSumAbsoluteFrictionContactForces ( const Geometry geometry1,
const Geometry geometry2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all absolute friction contact forces between two geometries.

Parameters
geometry1- First matching geometries
geometry2- Second matching geometry (null matches any geometry)
type- Specifies which type of contact force to be returned
Returns
Sum of absolute friction contact forces

◆ getSumAbsoluteFrictionContactForces() [2/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getSumAbsoluteFrictionContactForces ( const RigidBody body1,
const RigidBody body2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all absolute friction contact forces between two rigid bodies.

Parameters
body1- First matching rigid body
body2- Second matching rigid body (null matches any rigid body)
type- Specifies which type of contact force to be returned
Returns
Sum of absolute friction contact forces

◆ getSumAbsoluteFrictionContactForces() [3/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getSumAbsoluteFrictionContactForces ( const RigidBody rb,
const Geometry geo,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all absolute friction contact forces between a rigid body and a geometry.

Parameters
rb- matching rigid body
geo- matching geometry
type- Specifies which type of contact force to be returned
Returns
Sum of absolute friction contact forces

◆ getSumAbsoluteNormalContactForces() [1/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getSumAbsoluteNormalContactForces ( const Geometry geometry1,
const Geometry geometry2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all absolute normal contact forces between two geometries.

Parameters
geometry1- First matching geometry
geometry2- Second matching geometry (null matches any geometry)
type- Specifies which type of contact force to be returned
Returns
Sum of absolute normal contact forces

◆ getSumAbsoluteNormalContactForces() [2/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getSumAbsoluteNormalContactForces ( const RigidBody body1,
const RigidBody body2 = nullptr,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all absolute normal contact forces between two rigid bodies.

Parameters
body1- First matching rigid body
body2- Second matching rigid body (null matches any rigid body)
type- Specifies which type of contact force to be returned
Returns
Sum of absolute normal contact forces

◆ getSumAbsoluteNormalContactForces() [3/3]

Vec3 MOMENTUM_NAMESPACE::Simulation::getSumAbsoluteNormalContactForces ( const RigidBody rb,
const Geometry geo,
ContactType  type = IMPACT_AND_RESTING 
)

Get sum of all absolute normal contact forces between two rigid bodies.

Parameters
rb- matching rigid body
geo- matching geometry
type- Specifies which type of contact force to be returned
Returns
Sum of absolute normal contact forces

◆ getTimeStep()

double MOMENTUM_NAMESPACE::Simulation::getTimeStep ( ) const

Get the current length of the time step in seconds.

Returns
the current time step of the simulation

◆ loadGranularFile()

bool MOMENTUM_NAMESPACE::Simulation::loadGranularFile ( const std::string &  filename,
Material initMaterial,
const AffineMatrix4x4 offset = AffineMatrix4x4() 
)

Load an .agx file that contains both granular and Non-Spherical-Shapes(NSS) bodies into the simulation.

Parameters
filename- The specified file in .agx format that should be loaded
initMaterial- the material that will be set on the objects loaded into the simulation.
offset- an offset matrix that will be applied to the object's initial position and velocity.
Returns
true if the file was loaded successfully, false otherwise.

◆ operator==()

bool MOMENTUM_NAMESPACE::Simulation::operator== ( const Simulation other) const

◆ removeDisabledCollisionGroupPair()

bool MOMENTUM_NAMESPACE::Simulation::removeDisabledCollisionGroupPair ( const std::string &  name1,
const std::string &  name2 
)

Remove a pair of geometry collision groups to re-enable contact generation between two named geometry collision groups Order of names is not important.

Parameters
name1- Name of first geometry collision group
name2- Name of second geometry collision group
Returns
true if pair existed and is now removed

◆ removeEmittedBodiesInGeometry()

void MOMENTUM_NAMESPACE::Simulation::removeEmittedBodiesInGeometry ( const Geometry geometry)

Utility method for quickly removing emitted Non-Spherical-Shapes(NSS) bodies currently inside the specified geometry.

Parameters
geometry- the specified geometry that will be used to remove the bodies.

◆ setGravity()

void MOMENTUM_NAMESPACE::Simulation::setGravity ( const Vec3 gravity)

Set the uniform gravity of the simulation in m/s^2.

Parameters
gravity- the new gravity vector

Only available in simulation mode

◆ setImpactSpeedThreshold()

void MOMENTUM_NAMESPACE::Simulation::setImpactSpeedThreshold ( double  threshold)

Set the speed threshold for when to trigger impacts in contacts according to Newton's impact law.

Parameters
threshold- the speed threshold to trigger impacts.

Only available in simulation mode

◆ write()

size_t MOMENTUM_NAMESPACE::Simulation::write ( const std::string &  filename)

Write current simulation state to a file in native .aagx/.agx format, depending on specified file ending.

( Default: .aagx )

Parameters
filename- the name of the .agx file that will be created from the current simulation state.
Returns
the number of objects that was written to the file, else return 0 if the write failed.

◆ writeGranularFile()

bool MOMENTUM_NAMESPACE::Simulation::writeGranularFile ( const std::string &  filename,
const GranularBodyVector granularBodies,
const RigidBodyVector rigidBodies 
) const

Write granular and Non-Spherical-Shapes(NSS) bodies that intersect with a specified geometry to an .agx file.

Parameters
filename- The specified file in .agx format that the specified granular data should be stored to.
granularBodies- A vector containing the granular bodies will be stored in in the specified file.
rigidBodies- A vector containing the Non-Spherical-Shapes rigid bodies will be stored in in the specified file.
Returns
true if the granular data could be written to the specified file, false otherwise.

Friends And Related Function Documentation

◆ getSimulation

Simulation * getSimulation ( )
friend

Return a pointer to the simulation object which can be used to access all joints, bodies, contacts etc.

Returns
the active simulation