GCC Code Coverage Report


Directory: ./
File: include/pinocchio/bindings/python/algorithm/contact-solver-base.hpp
Date: 2024-08-27 18:20:05
Exec Total Coverage
Lines: 18 18 100.0%
Branches: 19 38 50.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2022-2024 INRIA
3 //
4
5 #include "pinocchio/bindings/python/fwd.hpp"
6 #include "pinocchio/algorithm/contact-solver-base.hpp"
7
8 #include <eigenpy/eigen-from-python.hpp>
9
10 namespace pinocchio
11 {
12 namespace python
13 {
14
15 namespace bp = boost::python;
16
17 template<typename Solver>
18 struct ContactSolverBasePythonVisitor
19 : public boost::python::def_visitor<ContactSolverBasePythonVisitor<Solver>>
20 {
21 typedef typename Solver::Scalar Scalar;
22
23 public:
24 template<class PyClass>
25 40 void visit(PyClass & cl) const
26 {
27 #ifdef PINOCCHIO_PYTHON_PLAIN_SCALAR_TYPE
28 120 cl.def(
29 40 "getIterationCount", &Solver::getIterationCount, bp::arg("self"),
30 "Get the number of iterations achieved by the PGS algorithm.")
31
2/4
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 40 times.
✗ Branch 5 not taken.
80 .def(
32 "setMaxIterations", &Solver::setMaxIterations, bp::args("self", "max_it"),
33 "Set the maximum number of iterations.")
34
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
40 .def(
35
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
80 "getMaxIterations", &Solver::getMaxIterations, bp::arg("self"),
36 "Get the maximum number of iterations allowed.")
37
38
2/4
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 40 times.
✗ Branch 5 not taken.
80 .def(
39 "setAbsolutePrecision", &Solver::setAbsolutePrecision,
40 bp::args("self", "absolute_precision"), "Set the absolute precision for the problem.")
41
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
40 .def(
42
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
80 "getAbsolutePrecision", &Solver::getAbsolutePrecision, bp::arg("self"),
43 "Get the absolute precision requested.")
44
45
2/4
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 40 times.
✗ Branch 5 not taken.
80 .def(
46 "setRelativePrecision", &Solver::setRelativePrecision,
47 bp::args("self", "relative_precision"), "Set the relative precision for the problem.")
48
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
40 .def(
49
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
80 "getRelativePrecision", &Solver::getRelativePrecision, bp::arg("self"),
50 "Get the relative precision requested.")
51
52
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
40 .def(
53 "getAbsoluteConvergenceResidual", &Solver::getAbsoluteConvergenceResidual,
54
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
80 bp::arg("self"),
55 "Returns the value of the absolute residual value corresponding to the contact "
56 "complementary conditions.")
57
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
40 .def(
58 "getRelativeConvergenceResidual", &Solver::getRelativeConvergenceResidual,
59
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
80 bp::arg("self"),
60 "Returns the value of the relative residual value corresponding to the difference "
61 "between two successive iterates (infinity norms).")
62
63 #ifdef PINOCCHIO_WITH_HPP_FCL
64
3/6
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 40 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 40 times.
✗ Branch 8 not taken.
40 .def("getCPUTimes", &Solver::getCPUTimes, bp::arg("self"))
65 #endif // PINOCCHIO_WITH_HPP_FCL
66 ;
67 #endif
68 40 }
69 }; // struct ContactSolverBasePythonVisitor
70
71 } // namespace python
72 } // namespace pinocchio
73