All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MlcpConstraintTypeName.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_MATH_MLCPCONSTRAINTTYPENAME_H
17 #define SURGSIM_MATH_MLCPCONSTRAINTTYPENAME_H
18 
19 #include <string>
22 #include "SurgSim/Framework/Log.h"
23 
24 namespace SurgSim
25 {
26 namespace Math
27 {
28 
29 inline std::string getMlcpConstraintTypeName(MlcpConstraintType constraintType)
30 {
31  switch (constraintType)
32  {
34  return "MLCP_BILATERAL_1D_CONSTRAINT";
36  return "MLCP_BILATERAL_2D_CONSTRAINT";
38  return "MLCP_BILATERAL_3D_CONSTRAINT";
39 // case MLCP_BILATERAL_4D_CONSTRAINT:
40 // return "MLCP_BILATERAL_4D_CONSTRAINT";
42  return "MLCP_UNILATERAL_3D_FRICTIONLESS_CONSTRAINT";
44  return "MLCP_UNILATERAL_3D_FRICTIONAL_CONSTRAINT";
46  return "MLCP_BILATERAL_FRICTIONLESS_SLIDING_CONSTRAINT";
48  return "MLCP_BILATERAL_FRICTIONAL_SLIDING_CONSTRAINT";
49  default:
50  SURGSIM_LOG_SEVERE(SURGSIM_ASSERT_LOGGER) << "bad MLCP constraint type value: " << constraintType;
51  return "";
52  }
53 }
54 
55 inline MlcpConstraintType getMlcpConstraintTypeValue(const std::string& typeName)
56 {
57 
58  if (typeName == "MLCP_BILATERAL_1D_CONSTRAINT")
59  {
61  }
62  else if (typeName == "MLCP_BILATERAL_2D_CONSTRAINT")
63  {
65  }
66  else if (typeName == "MLCP_BILATERAL_3D_CONSTRAINT")
67  {
69  }
70 // else if (typeName == "MLCP_BILATERAL_4D_CONSTRAINT")
71 // {
72 // return MLCP_BILATERAL_4D_CONSTRAINT;
73 // }
74  else if (typeName == "MLCP_UNILATERAL_3D_FRICTIONLESS_CONSTRAINT")
75  {
77  }
78  else if (typeName == "MLCP_UNILATERAL_3D_FRICTIONAL_CONSTRAINT")
79  {
81  }
82  else if (typeName == "MLCP_BILATERAL_FRICTIONLESS_SLIDING_CONSTRAINT")
83  {
85  }
86  else if (typeName == "MLCP_BILATERAL_FRICTIONAL_SLIDING_CONSTRAINT")
87  {
89  }
90  else
91  {
92  SURGSIM_LOG_WARNING(SURGSIM_ASSERT_LOGGER) << "bad MLCP constraint type name: '" << typeName << "'";
94  }
95 }
96 
97 }; // namespace Math
98 }; // namespace SurgSim
99 
100 #endif // SURGSIM_MATH_MLCPCONSTRAINTTYPENAME_H
Definition: MlcpConstraintType.h:31
#define SURGSIM_ASSERT_LOGGER
Logger used to log asserts.
Definition: Assert.h:45
#define SURGSIM_LOG_WARNING(logger)
Logs a message to the specified logger at the WARNING level.
Definition: LogMacros.h:96
MlcpConstraintType getMlcpConstraintTypeValue(const std::string &typeName)
Definition: MlcpConstraintTypeName.h:55
The convenience header that provides the entirety of the logging API.
Definition: MlcpConstraintType.h:27
Definition: MlcpConstraintType.h:29
The header that provides the assertion API.
std::string getMlcpConstraintTypeName(MlcpConstraintType constraintType)
Definition: MlcpConstraintTypeName.h:29
MlcpConstraintType
Definition: MlcpConstraintType.h:24
Definition: MlcpConstraintType.h:33
#define SURGSIM_LOG_SEVERE(logger)
Logs a message to the specified logger at the SEVERE level.
Definition: LogMacros.h:106