opensurgsim
MlcpSolution.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_MATH_MLCPSOLUTION_H
17 #define SURGSIM_MATH_MLCPSOLUTION_H
18 
19 #include <Eigen/Core>
20 #include "SurgSim/Math/MlcpConstraintType.h"
21 
22 namespace SurgSim
23 {
24 namespace Math
25 {
26 
34 {
35  typedef Eigen::Matrix<double, Eigen::Dynamic, 1> Vector;
36 
37  MlcpSolution() :
38  numIterations(0),
39  maxIterations(0),
40  epsilonConvergence(std::numeric_limits<double>::max()),
41  contactTolerance(std::numeric_limits<double>::max()),
42  validConvergence(false),
43  validSignorini(false),
44  convergenceCriteria(std::numeric_limits<double>::max()),
45  initialConvergenceCriteria(std::numeric_limits<double>::max())
46  {
47  for (size_t i = 0; i < MLCP_NUM_CONSTRAINT_TYPES; ++i)
48  {
49  constraintConvergenceCriteria[i] = std::numeric_limits<double>::max();
50  initialConstraintConvergenceCriteria[i] = std::numeric_limits<double>::max();
51  }
52  }
53 
55  Vector x;
56 
58  size_t numIterations;
60  size_t maxIterations;
74  double constraintConvergenceCriteria[MLCP_NUM_CONSTRAINT_TYPES] = {};
76  double initialConstraintConvergenceCriteria[MLCP_NUM_CONSTRAINT_TYPES] = {};
77 
78  // NB: We let the compiler generate the default code for the constructor, copy constructor and copy assignment,
79  // because we currently sometimes need to copy the solution (although we ought to minimize this).
80  // The C++11-ish way to indicate that explicitly would be to write code like this:
81  // MlcpProblem() = default;
82  // MlcpProblem(const MlcpProblem& other) = default;
83  // MlcpProblem& operator= (const MlcpProblem& other) = default;
84  // but I haven't yet tested that this works correctly on VS 2010, so I'm just putting in the comment.
85  // We may also want to add move construction and move assignment. --advornik 2013-06-24
86 };
87 
88 }; // namespace Math
89 }; // namespace SurgSim
90 
91 #endif // SURGSIM_MATH_MLCPSOLUTION_H
bool validConvergence
True if the final value of the convergence criteria is valid.
Definition: MlcpSolution.h:66
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Vector x
Vector specifying a solution to the specified mixed LCP problem.
Definition: MlcpSolution.h:55
bool validSignorini
True if the final solution satisfies the Signorini conditions.
Definition: MlcpSolution.h:68
double initialConstraintConvergenceCriteria[MLCP_NUM_CONSTRAINT_TYPES]
The initial value of the convergence criteria for each of the constraint types.
Definition: MlcpSolution.h:76
double initialConvergenceCriteria
The initial value of the convergence criteria, before the solver has done anything.
Definition: MlcpSolution.h:72
double epsilonConvergence
The precision, aka epsilon convergence.
Definition: MlcpSolution.h:62
The description of a solution to a mixed linear complementarity problem.
Definition: MlcpSolution.h:33
double constraintConvergenceCriteria[MLCP_NUM_CONSTRAINT_TYPES]
The final value of the convergence criteria for each of the constraint types.
Definition: MlcpSolution.h:74
size_t numIterations
The number of iterations performed.
Definition: MlcpSolution.h:58
double contactTolerance
The contact tolerance.
Definition: MlcpSolution.h:64
size_t maxIterations
The max iterations allowed for a solve.
Definition: MlcpSolution.h:60
double convergenceCriteria
The final value of the convergence criteria.
Definition: MlcpSolution.h:70