opensurgsim
SolveMlcp.h
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_SOLVEMLCP_H
17 #define SURGSIM_PHYSICS_SOLVEMLCP_H
18 
19 #include <memory>
20 
21 #include "SurgSim/Framework/Macros.h"
22 #include "SurgSim/Math/MlcpGaussSeidelSolver.h"
23 #include "SurgSim/Physics/Computation.h"
24 
25 namespace SurgSim
26 {
27 namespace Physics
28 {
29 
31 class SolveMlcp : public Computation
32 {
33 public:
36  explicit SolveMlcp(bool doCopyState = false);
37 
38  SURGSIM_CLASSNAME(SurgSim::Physics::SolveMlcp);
39 
41  virtual ~SolveMlcp();
42 
45  void setMaxIterations(size_t maxIterations);
46 
49  size_t getMaxIterations() const;
50 
53  void setPrecision(double epsilon);
54 
57  double getPrecision() const;
58 
61  void setContactTolerance(double epsilon);
62 
65  double getContactTolerance() const;
66 
67 protected:
68 
73  std::shared_ptr<PhysicsManagerState> doUpdate(const double& dt, const std::shared_ptr<PhysicsManagerState>& state)
74  override;
75 
76 private:
77 
79  SurgSim::Math::MlcpGaussSeidelSolver m_gaussSeidelSolver;
80 };
81 
82 }; // Physics
83 }; // SurgSim
84 
85 #endif // SURGSIM_PHYSICS_SOLVEMLCP_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
A solver for mixed LCP problems using the Gauss-Seidel iterative method.
Definition: MlcpGaussSeidelSolver.h:53
void setContactTolerance(double epsilon)
Set the contact tolerance for the MLCP solver.
Definition: SolveMlcp.cpp:95
double getPrecision() const
Get the precision of the MLCP solver.
Definition: SolveMlcp.cpp:90
double getContactTolerance() const
Get the contact tolerance for the MLCP solver.
Definition: SolveMlcp.cpp:100
void setMaxIterations(size_t maxIterations)
Set the maximum number of iterations for the MLCP solver.
Definition: SolveMlcp.cpp:75
virtual ~SolveMlcp()
Destructor.
Definition: SolveMlcp.cpp:32
void setPrecision(double epsilon)
Set the precision of the MLCP solver.
Definition: SolveMlcp.cpp:85
std::shared_ptr< PhysicsManagerState > doUpdate(const double &dt, const std::shared_ptr< PhysicsManagerState > &state) override
Override doUpdate from superclass.
Definition: SolveMlcp.cpp:35
size_t getMaxIterations() const
Get the maximum number of iterations for the MLCP solver.
Definition: SolveMlcp.cpp:80
Encapsulates a calculation over a selection of objects, needs to be subclassed to be used...
Definition: Computation.h:32
SolveMlcp(bool doCopyState=false)
Constructor.
Definition: SolveMlcp.cpp:28
Solve the system Mixed Linear Complementarity Problem (Mlcp)
Definition: SolveMlcp.h:31