All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PhysicsManagerState.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_PHYSICS_PHYSICSMANAGERSTATE_H
17 #define SURGSIM_PHYSICS_PHYSICSMANAGERSTATE_H
18 
19 #include <memory>
20 #include <vector>
21 #include <unordered_map>
22 
28 
31 
32 namespace SurgSim
33 {
34 namespace Physics
35 {
36 
37 class ConstraintComponent;
38 
40 {
44 };
45 
47 {
48 public:
51 
54 
57  void setRepresentations(const std::vector<std::shared_ptr<Representation>>& val);
58 
61  const std::vector<std::shared_ptr<Representation>>& getRepresentations();
62 
65  void setActiveRepresentations(const std::vector<std::shared_ptr<Representation>>& activeRepresentations);
66 
69  const std::vector<std::shared_ptr<Representation>>& getActiveRepresentations() const;
70 
73  void setCollisionRepresentations(const std::vector<std::shared_ptr<SurgSim::Collision::Representation>>& val);
74 
77  const std::vector<std::shared_ptr<SurgSim::Collision::Representation>>& getCollisionRepresentations();
78 
81  void setConstraintComponents(const std::vector<std::shared_ptr<ConstraintComponent>>& val);
82 
85  const std::vector<std::shared_ptr<ConstraintComponent>>& getConstraintComponents();
86 
89  const std::unordered_map<std::shared_ptr<SurgSim::Collision::Representation>,
90  std::shared_ptr<SurgSim::Physics::Representation>>& getCollisionToPhysicsMap() const;
91 
95  void setCollisionPairs(std::vector<std::shared_ptr<SurgSim::Collision::CollisionPair>> val);
96 
99  const std::vector<std::shared_ptr<SurgSim::Collision::CollisionPair>>& getCollisionPairs();
100 
103  void setExcludedCollisionPairs(const std::vector<std::shared_ptr<SurgSim::Collision::CollisionPair>>& val);
104 
107  const std::vector<std::shared_ptr<SurgSim::Collision::CollisionPair>>& getExcludedCollisionPairs() const;
108 
113  void setConstraintGroup(ConstraintGroupType type, const std::vector<std::shared_ptr<Constraint>>& constraints);
114 
118  const std::vector<std::shared_ptr<Constraint>>& getConstraintGroup(int type) const;
119 
122  void setActiveConstraints(const std::vector<std::shared_ptr<Constraint>>& activeConstraints);
123 
125  const std::vector<std::shared_ptr<Constraint>>& getActiveConstraints() const;
126 
130 
133  const MlcpPhysicsProblem& getMlcpProblem() const;
134 
138 
141  const MlcpPhysicsSolution& getMlcpSolution() const;
142 
147 
150  void setRepresentationsMapping(const MlcpMapping<Representation>& representationsMapping);
151 
156 
159  void setConstraintsMapping(const MlcpMapping<Constraint>& constraintsMapping);
160 
161 private:
162 
168  std::vector<std::shared_ptr<Representation>> m_representations;
169 
171  std::vector<std::shared_ptr<Representation>> m_activeRepresentations;
172 
174  std::vector<std::shared_ptr<SurgSim::Collision::Representation>> m_collisionRepresentations;
175 
177  std::vector<std::shared_ptr<ConstraintComponent>> m_constraintComponents;
178 
180  std::unordered_map<std::shared_ptr<SurgSim::Collision::Representation>,
181  std::shared_ptr<SurgSim::Physics::Representation>> m_collisionsToPhysicsMap;
182 
184  std::vector<std::shared_ptr<SurgSim::Collision::CollisionPair>> m_collisionPairs;
185 
187  std::vector<std::shared_ptr<SurgSim::Collision::CollisionPair>> m_excludedCollisionPairs;
188 
190  std::unordered_map<int, std::vector<std::shared_ptr<Constraint>>> m_constraints;
191 
193  std::vector<std::shared_ptr<Constraint>> m_activeConstraints;
194 
197 
200 
204 
207 };
208 
209 }; // Physics
210 }; // SurgSim
211 
212 #endif
const std::vector< std::shared_ptr< Representation > > & getActiveRepresentations() const
Gets the active physics representations.
Definition: PhysicsManagerState.cpp:68
const std::vector< std::shared_ptr< Representation > > & getRepresentations()
Gets the physics representations.
Definition: PhysicsManagerState.cpp:57
std::vector< std::shared_ptr< SurgSim::Collision::Representation > > m_collisionRepresentations
List of all the collision representations know to the state.
Definition: PhysicsManagerState.h:174
void setRepresentationsMapping(const MlcpMapping< Representation > &representationsMapping)
Set the representations mapping.
Definition: PhysicsManagerState.cpp:192
A description of a physical mixed LCP system to be solved.
Definition: MlcpPhysicsProblem.h:43
const MlcpMapping< Representation > & getRepresentationsMapping() const
Gets the representations mapping.
Definition: PhysicsManagerState.cpp:187
ConstraintGroupType
Definition: PhysicsManagerState.h:39
std::vector< std::shared_ptr< Constraint > > m_activeConstraints
The list of active constraints.
Definition: PhysicsManagerState.h:193
void setCollisionRepresentations(const std::vector< std::shared_ptr< SurgSim::Collision::Representation >> &val)
Sets the collision representations for the state.
Definition: PhysicsManagerState.cpp:81
std::vector< std::shared_ptr< Representation > > m_activeRepresentations
The list of active representations.
Definition: PhysicsManagerState.h:171
std::vector< std::shared_ptr< SurgSim::Collision::CollisionPair > > m_excludedCollisionPairs
List of collision pairs to be excluded.
Definition: PhysicsManagerState.h:187
void setCollisionPairs(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:117
const std::vector< std::shared_ptr< SurgSim::Collision::CollisionPair > > & getCollisionPairs()
Gets collision pairs.
Definition: PhysicsManagerState.cpp:122
void setActiveConstraints(const std::vector< std::shared_ptr< Constraint >> &activeConstraints)
Filter the map of constraints into the active constraints list.
Definition: PhysicsManagerState.cpp:156
MlcpMapping< Constraint > m_constraintsIndexMapping
Constraints mapping.
Definition: PhysicsManagerState.h:199
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:39
const std::vector< std::shared_ptr< SurgSim::Collision::Representation > > & getCollisionRepresentations()
Gets the collision representations.
Definition: PhysicsManagerState.cpp:88
PhysicsManagerState()
Constructor.
Definition: PhysicsManagerState.cpp:29
const std::vector< std::shared_ptr< Constraint > > & getActiveConstraints() const
Definition: PhysicsManagerState.cpp:162
void setExcludedCollisionPairs(const std::vector< std::shared_ptr< SurgSim::Collision::CollisionPair >> &val)
Sets the exclusion pairs.
Definition: PhysicsManagerState.cpp:127
Definition: PhysicsManagerState.h:41
std::vector< std::shared_ptr< ConstraintComponent > > m_constraintComponents
List of the constraint components.
Definition: PhysicsManagerState.h:177
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:139
const std::vector< std::shared_ptr< ConstraintComponent > > & getConstraintComponents()
Gets the constraint components.
Definition: PhysicsManagerState.cpp:112
const std::vector< std::shared_ptr< SurgSim::Collision::CollisionPair > > & getExcludedCollisionPairs() const
Gets the exclusion pairs.
Definition: PhysicsManagerState.cpp:134
std::vector< std::shared_ptr< Representation > > m_representations
Definition: PhysicsManagerState.h:168
Definition: PhysicsManagerState.h:42
const std::unordered_map< std::shared_ptr< SurgSim::Collision::Representation >, std::shared_ptr< SurgSim::Physics::Representation > > & getCollisionToPhysicsMap() const
Definition: PhysicsManagerState.cpp:76
std::vector< std::shared_ptr< SurgSim::Collision::CollisionPair > > m_collisionPairs
The local list of collision pairs.
Definition: PhysicsManagerState.h:184
MlcpPhysicsSolution & getMlcpSolution()
Gets the Mlcp solution.
Definition: PhysicsManagerState.cpp:177
MlcpPhysicsProblem & getMlcpProblem()
Gets the Mlcp problem.
Definition: PhysicsManagerState.cpp:167
The description of a solution to a physical MLCP problem.
Definition: MlcpPhysicsSolution.h:34
const std::vector< std::shared_ptr< Constraint > > & getConstraintGroup(int type) const
Gets constraint group.
Definition: PhysicsManagerState.cpp:146
void setActiveRepresentations(const std::vector< std::shared_ptr< Representation >> &activeRepresentations)
Set the list of representations into the active representations list.
Definition: PhysicsManagerState.cpp:62
void setConstraintsMapping(const MlcpMapping< Constraint > &constraintsMapping)
Set the constraints mapping.
Definition: PhysicsManagerState.cpp:202
Definition: PhysicsManagerState.h:46
Definition: MlcpMapping.h:27
Definition: PhysicsManagerState.h:43
std::unordered_map< std::shared_ptr< SurgSim::Collision::Representation >, std::shared_ptr< SurgSim::Physics::Representation > > m_collisionsToPhysicsMap
Mapping of collision representations to their respective physics representation.
Definition: PhysicsManagerState.h:181
MlcpPhysicsSolution m_mlcpPhysicsSolution
Mlcp solution for this Physics Manager State.
Definition: PhysicsManagerState.h:206
std::unordered_map< int, std::vector< std::shared_ptr< Constraint > > > m_constraints
The local map of constraints.
Definition: PhysicsManagerState.h:190
void setConstraintComponents(const std::vector< std::shared_ptr< ConstraintComponent >> &val)
Sets the list of constraint components.
Definition: PhysicsManagerState.cpp:93
MlcpPhysicsProblem m_mlcpPhysicsProblem
Mlcp problem for this Physics Manager State.
Definition: PhysicsManagerState.h:203
const MlcpMapping< Constraint > & getConstraintsMapping() const
Gets the constraints mapping.
Definition: PhysicsManagerState.cpp:197
MlcpMapping< Representation > m_representationsIndexMapping
Representation mapping.
Definition: PhysicsManagerState.h:196
~PhysicsManagerState()
Destructor.
Definition: PhysicsManagerState.cpp:34