16 #ifndef SURGSIM_PHYSICS_PHYSICSMANAGERSTATE_H 17 #define SURGSIM_PHYSICS_PHYSICSMANAGERSTATE_H 21 #include <unordered_map> 23 #include "SurgSim/Collision/CollisionPair.h" 24 #include "SurgSim/Collision/ContactFilter.h" 25 #include "SurgSim/Collision/Representation.h" 26 #include "SurgSim/Particles/Representation.h" 27 #include "SurgSim/Physics/Constraint.h" 28 #include "SurgSim/Physics/MlcpMapping.h" 29 #include "SurgSim/Physics/MlcpPhysicsProblem.h" 30 #include "SurgSim/Physics/MlcpPhysicsSolution.h" 31 #include "SurgSim/Physics/Representation.h" 39 class ConstraintComponent;
41 enum ConstraintGroupType
43 CONSTRAINT_GROUP_TYPE_CONTACT = 0,
44 CONSTRAINT_GROUP_TYPE_SCENE,
45 CONSTRAINT_GROUP_TYPE_COUNT
115 const std::unordered_map<std::shared_ptr<SurgSim::Collision::Representation>,
121 void setCollisionPairs(
const std::vector<std::shared_ptr<SurgSim::Collision::CollisionPair>>& val);
125 const std::vector<std::shared_ptr<SurgSim::Collision::CollisionPair>>&
getCollisionPairs();
129 void setContactFilters(
const std::vector<std::shared_ptr<SurgSim::Collision::ContactFilter>>& val);
132 std::vector<std::shared_ptr<SurgSim::Collision::ContactFilter>>
getContactFilters()
const;
139 void setConstraintGroup(ConstraintGroupType type,
const std::vector<std::shared_ptr<Constraint>>& constraints);
208 std::vector<std::shared_ptr<Representation>> m_representations;
211 std::vector<std::shared_ptr<Representation>> m_activeRepresentations;
214 std::vector<std::shared_ptr<SurgSim::Collision::Representation>> m_collisionRepresentations;
217 std::vector<std::shared_ptr<SurgSim::Collision::Representation>> m_activeCollisionRepresentations;
220 std::vector <std::shared_ptr<Collision::ContactFilter>> m_contactFilters;
223 std::vector<std::shared_ptr<SurgSim::Particles::Representation>> m_particleRepresentations;
226 std::vector<std::shared_ptr<SurgSim::Particles::Representation>> m_activeParticleRepresentations;
229 std::vector<std::shared_ptr<ConstraintComponent>> m_constraintComponents;
232 std::unordered_map<std::shared_ptr<SurgSim::Collision::Representation>,
233 std::shared_ptr<SurgSim::Physics::Representation>> m_collisionsToPhysicsMap;
236 std::vector<std::shared_ptr<SurgSim::Collision::CollisionPair>> m_collisionPairs;
239 std::unordered_map<int, std::vector<std::shared_ptr<Constraint>>> m_constraints;
242 std::vector<std::shared_ptr<Constraint>> m_activeConstraints;
261 double m_timeOfImpact;
const std::vector< std::shared_ptr< Representation > > & getRepresentations()
Gets the physics representations.
Definition: PhysicsManagerState.cpp:59
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
const MlcpMapping< Representation > & getRepresentationsMapping() const
Gets the representations mapping.
Definition: PhysicsManagerState.cpp:220
void setRepresentationsMapping(const MlcpMapping< Representation > &representationsMapping)
Set the representations mapping.
Definition: PhysicsManagerState.cpp:225
A description of a physical mixed LCP system to be solved.
Definition: MlcpPhysicsProblem.h:43
void setAbortGroup(bool val)
Set whether to abort the current grouped computation.
Definition: PhysicsManagerState.cpp:255
void setCollisionRepresentations(const std::vector< std::shared_ptr< SurgSim::Collision::Representation >> &val)
Sets the collision representations for the state.
Definition: PhysicsManagerState.cpp:83
const std::unordered_map< std::shared_ptr< SurgSim::Collision::Representation >, std::shared_ptr< SurgSim::Physics::Representation > > & getCollisionToPhysicsMap() const
Definition: PhysicsManagerState.cpp:78
const std::vector< std::shared_ptr< SurgSim::Particles::Representation > > & getParticleRepresentations()
Gets the particle representations.
Definition: PhysicsManagerState.cpp:112
const std::vector< std::shared_ptr< SurgSim::Collision::CollisionPair > > & getCollisionPairs()
Gets collision pairs.
Definition: PhysicsManagerState.cpp:157
void setActiveConstraints(const std::vector< std::shared_ptr< Constraint >> &activeConstraints)
Filter the map of constraints into the active constraints list.
Definition: PhysicsManagerState.cpp:189
void setActiveCollisionRepresentations(const std::vector< std::shared_ptr< SurgSim::Collision::Representation >> &val)
Sets the active collision representations for the state.
Definition: PhysicsManagerState.cpp:95
const std::vector< std::shared_ptr< Representation > > & getActiveRepresentations() const
Gets the active physics representations.
Definition: PhysicsManagerState.cpp:70
void setContactFilters(const std::vector< std::shared_ptr< SurgSim::Collision::ContactFilter >> &val)
Set the list of contact filters.
Definition: PhysicsManagerState.cpp:162
bool shouldAbortGroup() const
Definition: PhysicsManagerState.cpp:250
void setRepresentations(const std::vector< std::shared_ptr< Representation >> &val)
Sets the physics representations for the state, these are the basis for all the computations.
Definition: PhysicsManagerState.cpp:41
double getTimeOfImpact()
Definition: PhysicsManagerState.cpp:245
const std::vector< std::shared_ptr< SurgSim::Collision::Representation > > & getCollisionRepresentations()
Gets the collision representations.
Definition: PhysicsManagerState.cpp:90
PhysicsManagerState()
Constructor.
Definition: PhysicsManagerState.cpp:29
std::vector< std::shared_ptr< SurgSim::Collision::ContactFilter > > getContactFilters() const
Definition: PhysicsManagerState.cpp:167
void setConstraintGroup(ConstraintGroupType type, const std::vector< std::shared_ptr< Constraint >> &constraints)
Sets the group of constraints to a given value, the grouping indicates what type of constraint we are...
Definition: PhysicsManagerState.cpp:172
const std::vector< std::shared_ptr< ConstraintComponent > > & getConstraintComponents()
Gets the constraint components.
Definition: PhysicsManagerState.cpp:147
MlcpPhysicsSolution & getMlcpSolution()
Gets the Mlcp solution.
Definition: PhysicsManagerState.cpp:210
MlcpPhysicsProblem & getMlcpProblem()
Gets the Mlcp problem.
Definition: PhysicsManagerState.cpp:200
void setTimeOfImpact(double timeOfImpact)
Set the time of impact.
Definition: PhysicsManagerState.cpp:240
The description of a solution to a physical MLCP problem.
Definition: MlcpPhysicsSolution.h:34
void setCollisionPairs(const std::vector< std::shared_ptr< SurgSim::Collision::CollisionPair >> &val)
Sets collision pairs that should be considered, while this is not being verified the collision pairs ...
Definition: PhysicsManagerState.cpp:152
const std::vector< std::shared_ptr< Constraint > > & getActiveConstraints() const
Definition: PhysicsManagerState.cpp:195
const std::vector< std::shared_ptr< SurgSim::Collision::Representation > > & getActiveCollisionRepresentations()
Gets the list of active collision representations.
Definition: PhysicsManagerState.cpp:102
void setActiveRepresentations(const std::vector< std::shared_ptr< Representation >> &activeRepresentations)
Set the list of representations into the active representations list.
Definition: PhysicsManagerState.cpp:64
void setConstraintsMapping(const MlcpMapping< Constraint > &constraintsMapping)
Set the constraints mapping.
Definition: PhysicsManagerState.cpp:235
const std::vector< std::shared_ptr< Constraint > > & getConstraintGroup(int type) const
Gets constraint group.
Definition: PhysicsManagerState.cpp:179
void setActiveParticleRepresentations(const std::vector< std::shared_ptr< SurgSim::Particles::Representation >> &val)
Sets the active particle representations for the state.
Definition: PhysicsManagerState.cpp:117
Definition: PhysicsManagerState.h:48
void setParticleRepresentations(const std::vector< std::shared_ptr< SurgSim::Particles::Representation >> &val)
Sets the particle representations for the state.
Definition: PhysicsManagerState.cpp:107
Definition: MlcpMapping.h:27
void setConstraintComponents(const std::vector< std::shared_ptr< ConstraintComponent >> &val)
Sets the list of constraint components.
Definition: PhysicsManagerState.cpp:128
const MlcpMapping< Constraint > & getConstraintsMapping() const
Gets the constraints mapping.
Definition: PhysicsManagerState.cpp:230
const std::vector< std::shared_ptr< SurgSim::Particles::Representation > > & getActiveParticleRepresentations()
Gets the list of active particle representations.
Definition: PhysicsManagerState.cpp:123
~PhysicsManagerState()
Destructor.
Definition: PhysicsManagerState.cpp:36