All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MlcpTestData.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_TESTING_MLCPIO_MLCPTESTDATA_H
17 #define SURGSIM_TESTING_MLCPIO_MLCPTESTDATA_H
18 
19 #include <memory>
20 #include <string>
21 
22 #include <vector>
23 #include <Eigen/Core>
26 
27 
29 {
30 public:
31  // Description of an MLCP problem.
33 
34  // Expected output for the solver (as recorded from old Gauss-Seidel code).
35  Eigen::VectorXd expectedLambda;
36 
37  // Other metadata
38  std::string description;
39  std::vector<std::string> flags;
41 
44  {
45  }
46 
47  MlcpTestData(const MlcpTestData& other) :
48  problem(other.problem),
50  description(other.description),
51  flags(other.flags),
53  {
54  }
55 
57  {
58  problem = other.problem;
60 
61  description = other.description;
62  flags = other.flags;
64 
65  return *this;
66  }
67 
68  size_t getSize() const
69  {
70  return (problem.b.rows() >= 0) ? static_cast<size_t>(problem.b.rows()) : 0;
71  }
72 };
73 
75 
76 std::shared_ptr<MlcpTestData> loadTestData(const std::string& fileName);
77 
78 std::string getTestFileName(const std::string& prefix, int index, const std::string& suffix);
79 
80 #endif // SURGSIM_TESTING_MLCPIO_MLCPTESTDATA_H
int numDegreesOfFreedom
Definition: MlcpTestData.h:40
Definition: MlcpTestData.h:28
std::string description
Definition: MlcpTestData.h:38
const MlcpTestData * getTestProblem1()
Eigen::VectorXd expectedLambda
Definition: MlcpTestData.h:35
MlcpTestData & operator=(const MlcpTestData &other)
Definition: MlcpTestData.h:56
MlcpTestData(const MlcpTestData &other)
Definition: MlcpTestData.h:47
size_t getSize() const
Definition: MlcpTestData.h:68
std::shared_ptr< MlcpTestData > loadTestData(const std::string &fileName)
Definition: MlcpTestData.cpp:21
Vector b
Vector used to describe the mixed LCP problem.
Definition: MlcpProblem.h:68
std::string getTestFileName(const std::string &prefix, int index, const std::string &suffix)
Definition: MlcpTestData.cpp:31
std::vector< std::string > flags
Definition: MlcpTestData.h:39
A description of an MLCP (mixed linear complementarity problem, or mixed LCP) system to be solved...
Definition: MlcpProblem.h:57
SurgSim::Math::MlcpProblem problem
Definition: MlcpTestData.h:32
MlcpTestData()
Definition: MlcpTestData.h:42