Drake
autodiff.h
Go to the documentation of this file.
1 #pragma once
2 /// @file This header provides a single inclusion point for autodiff-related
3 /// header files in the `drake/common` directory. Users should include this
4 /// file. Including other individual headers such as `drake/common/autodiffxd.h`
5 /// will generate a compile-time warning.
6 
7 // In each header included below, it asserts that this macro
8 // `DRAKE_COMMON_AUTODIFF_HEADER` is defined. If the macro is not defined, it
9 // generates diagnostic warning messages.
10 #define DRAKE_COMMON_AUTODIFF_HEADER
11 
12 #include <Eigen/Core>
13 #include <unsupported/Eigen/AutoDiff>
14 
15 static_assert(EIGEN_VERSION_AT_LEAST(3, 3, 3),
16  "Drake requires Eigen >= v3.3.3.");
17 
18 // Do not alpha-sort the following block of hard-coded #includes, which is
19 // protected by `clang-format on/off`.
20 //
21 // Rationale: We want to maximize the use of this header, `autodiff.h`, even
22 // inside of the autodiff-related files to avoid any mistakes which might not be
23 // detected. By centralizing the list here, we make sure that everyone will see
24 // the correct order which respects the inter-dependencies of the autodiff
25 // headers. This shields us from triggering undefined behaviors due to
26 // order-of-specialization-includes-changed mistakes.
27 //
28 // clang-format off
29 #include "drake/common/eigen_autodiff_limits.h"
30 #include "drake/common/eigen_autodiff_types.h"
31 #include "drake/common/autodiffxd.h"
32 #include "drake/common/autodiff_overloads.h"
33 // clang-format on
34 #undef DRAKE_COMMON_AUTODIFF_HEADER