Directory: | ./ |
---|---|
File: | unittest/factory/integrator.hpp |
Date: | 2025-01-16 08:47:40 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 6 | 6 | 100.0% |
Branches: | 4 | 6 | 66.7% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | ||
2 | // BSD 3-Clause License | ||
3 | // | ||
4 | // Copyright (C) 2021, LAAS-CNRS, University of Edinburgh, University of Trento | ||
5 | // Copyright note valid unless otherwise stated in individual files. | ||
6 | // All rights reserved. | ||
7 | /////////////////////////////////////////////////////////////////////////////// | ||
8 | |||
9 | #ifndef CROCODDYL_INTEGRATOR_FACTORY_HPP_ | ||
10 | #define CROCODDYL_INTEGRATOR_FACTORY_HPP_ | ||
11 | |||
12 | #include <iterator> | ||
13 | |||
14 | #include "control.hpp" | ||
15 | #include "crocoddyl/core/integ-action-base.hpp" | ||
16 | |||
17 | namespace crocoddyl { | ||
18 | namespace unittest { | ||
19 | |||
20 | struct IntegratorTypes { | ||
21 | enum Type { | ||
22 | IntegratorEuler, | ||
23 | IntegratorRK2, | ||
24 | IntegratorRK3, | ||
25 | IntegratorRK4, | ||
26 | NbIntegratorTypes | ||
27 | }; | ||
28 | 23 | static std::vector<Type> init_all() { | |
29 | 23 | std::vector<Type> v; | |
30 |
1/2✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
|
23 | v.reserve(NbIntegratorTypes); |
31 |
2/2✓ Branch 0 taken 92 times.
✓ Branch 1 taken 23 times.
|
115 | for (int i = 0; i < NbIntegratorTypes; ++i) { |
32 |
1/2✓ Branch 1 taken 92 times.
✗ Branch 2 not taken.
|
92 | v.push_back((Type)i); |
33 | } | ||
34 | 23 | return v; | |
35 | } | ||
36 | static const std::vector<Type> all; | ||
37 | }; | ||
38 | |||
39 | std::ostream& operator<<(std::ostream& os, IntegratorTypes::Type type); | ||
40 | |||
41 | class IntegratorFactory { | ||
42 | public: | ||
43 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW | ||
44 | |||
45 | explicit IntegratorFactory(); | ||
46 | ~IntegratorFactory(); | ||
47 | |||
48 | boost::shared_ptr<crocoddyl::IntegratedActionModelAbstract> create( | ||
49 | IntegratorTypes::Type type, | ||
50 | boost::shared_ptr<DifferentialActionModelAbstract> model) const; | ||
51 | |||
52 | boost::shared_ptr<crocoddyl::IntegratedActionModelAbstract> create( | ||
53 | IntegratorTypes::Type type, | ||
54 | boost::shared_ptr<DifferentialActionModelAbstract> model, | ||
55 | boost::shared_ptr<ControlParametrizationModelAbstract> control) const; | ||
56 | }; | ||
57 | |||
58 | } // namespace unittest | ||
59 | } // namespace crocoddyl | ||
60 | |||
61 | #endif // CROCODDYL_INTEGRATOR_FACTORY_HPP_ | ||
62 |