stddeque.cpp File Reference
#include "main.h"
#include <Eigen/StdDeque>
#include <Eigen/Geometry>

Functions

template<typename MatrixType >
void check_stddeque_matrix (const MatrixType &m)
 
template<typename TransformType >
void check_stddeque_transform (const TransformType &)
 
template<typename QuaternionType >
void check_stddeque_quaternion (const QuaternionType &)
 
 EIGEN_DECLARE_TEST (stddeque)
 

Function Documentation

◆ check_stddeque_matrix()

template<typename MatrixType >
void check_stddeque_matrix ( const MatrixType m)
16  {
17  Index rows = m.rows();
18  Index cols = m.cols();
19  MatrixType x = MatrixType::Random(rows, cols), y = MatrixType::Random(rows, cols);
20  std::deque<MatrixType, Eigen::aligned_allocator<MatrixType> > v(10, MatrixType::Zero(rows, cols)), w(20, y);
21  v.front() = x;
22  w.front() = w.back();
23  VERIFY_IS_APPROX(w.front(), w.back());
24  v = w;
25 
26  typename std::deque<MatrixType, Eigen::aligned_allocator<MatrixType> >::iterator vi = v.begin();
27  typename std::deque<MatrixType, Eigen::aligned_allocator<MatrixType> >::iterator wi = w.begin();
28  for (int i = 0; i < 20; i++) {
29  VERIFY_IS_APPROX(*vi, *wi);
30  ++vi;
31  ++wi;
32  }
33 
34  v.resize(21, MatrixType::Zero(rows, cols));
35  v.back() = x;
36  VERIFY_IS_APPROX(v.back(), x);
37  v.resize(22, y);
38  VERIFY_IS_APPROX(v.back(), y);
39  v.push_back(x);
40  VERIFY_IS_APPROX(v.back(), x);
41 }
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
int i
Definition: BiCGSTAB_step_by_step.cpp:9
RowVector3d w
Definition: Matrix_resize_int.cpp:3
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
#define VERIFY_IS_APPROX(a, b)
Definition: integer_types.cpp:13
Scalar * y
Definition: level1_cplx_impl.h:128
int * m
Definition: level2_cplx_impl.h:294
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
double Zero
Definition: pseudosolid_node_update_elements.cc:35
list x
Definition: plotDoE.py:28

References cols, i, m, rows, v, VERIFY_IS_APPROX, w, plotDoE::x, y, and oomph::PseudoSolidHelper::Zero.

Referenced by EIGEN_DECLARE_TEST().

◆ check_stddeque_quaternion()

template<typename QuaternionType >
void check_stddeque_quaternion ( const QuaternionType &  )
71  {
72  typedef typename QuaternionType::Coefficients Coefficients;
73  QuaternionType x(Coefficients::Random()), y(Coefficients::Random()), qi = QuaternionType::Identity();
74  std::deque<QuaternionType, Eigen::aligned_allocator<QuaternionType> > v(10, qi), w(20, y);
75  v.front() = x;
76  w.front() = w.back();
77  VERIFY_IS_APPROX(w.front(), w.back());
78  v = w;
79 
80  typename std::deque<QuaternionType, Eigen::aligned_allocator<QuaternionType> >::iterator vi = v.begin();
81  typename std::deque<QuaternionType, Eigen::aligned_allocator<QuaternionType> >::iterator wi = w.begin();
82  for (int i = 0; i < 20; i++) {
83  VERIFY_IS_APPROX(*vi, *wi);
84  ++vi;
85  ++wi;
86  }
87 
88  v.resize(21, qi);
89  v.back() = x;
90  VERIFY_IS_APPROX(v.back(), x);
91  v.resize(22, y);
92  VERIFY_IS_APPROX(v.back(), y);
93  v.push_back(x);
94  VERIFY_IS_APPROX(v.back(), x);
95 }

References i, v, VERIFY_IS_APPROX, w, plotDoE::x, and y.

Referenced by EIGEN_DECLARE_TEST().

◆ check_stddeque_transform()

template<typename TransformType >
void check_stddeque_transform ( const TransformType &  )
44  {
45  typedef typename TransformType::MatrixType MatrixType;
46  TransformType x(MatrixType::Random()), y(MatrixType::Random()), ti = TransformType::Identity();
47  std::deque<TransformType, Eigen::aligned_allocator<TransformType> > v(10, ti), w(20, y);
48  v.front() = x;
49  w.front() = w.back();
50  VERIFY_IS_APPROX(w.front(), w.back());
51  v = w;
52 
53  typename std::deque<TransformType, Eigen::aligned_allocator<TransformType> >::iterator vi = v.begin();
54  typename std::deque<TransformType, Eigen::aligned_allocator<TransformType> >::iterator wi = w.begin();
55  for (int i = 0; i < 20; i++) {
56  VERIFY_IS_APPROX(*vi, *wi);
57  ++vi;
58  ++wi;
59  }
60 
61  v.resize(21, ti);
62  v.back() = x;
63  VERIFY_IS_APPROX(v.back(), x);
64  v.resize(22, y);
65  VERIFY_IS_APPROX(v.back(), y);
66  v.push_back(x);
67  VERIFY_IS_APPROX(v.back(), x);
68 }

References i, v, VERIFY_IS_APPROX, w, plotDoE::x, and y.

Referenced by EIGEN_DECLARE_TEST().

◆ EIGEN_DECLARE_TEST()

EIGEN_DECLARE_TEST ( stddeque  )
97  {
98  // some non vectorizable fixed sizes
102 
103  // some vectorizable fixed sizes
108 
109  // some dynamic sizes
110  CALL_SUBTEST_3(check_stddeque_matrix(MatrixXd(1, 1)));
111  CALL_SUBTEST_3(check_stddeque_matrix(VectorXd(20)));
112  CALL_SUBTEST_3(check_stddeque_matrix(RowVectorXf(20)));
113  CALL_SUBTEST_3(check_stddeque_matrix(MatrixXcf(10, 10)));
114 
115  // some Transform
119 
120  // some Quaternion
123 }
Transform< double, 3, Affine > Affine3d
Definition: Transform.h:686
Quaternion< double > Quaterniond
Definition: Eigen/Eigen/src/Geometry/Quaternion.h:387
Quaternion< float > Quaternionf
Definition: Eigen/Eigen/src/Geometry/Quaternion.h:384
Transform< float, 3, Affine > Affine3f
Definition: Transform.h:682
Transform< float, 2, Affine > Affine2f
Definition: Transform.h:680
#define CALL_SUBTEST_3(FUNC)
Definition: split_test_helper.h:16
#define CALL_SUBTEST_1(FUNC)
Definition: split_test_helper.h:4
#define CALL_SUBTEST_5(FUNC)
Definition: split_test_helper.h:28
#define CALL_SUBTEST_2(FUNC)
Definition: split_test_helper.h:10
#define CALL_SUBTEST_4(FUNC)
Definition: split_test_helper.h:22
void check_stddeque_quaternion(const QuaternionType &)
Definition: stddeque.cpp:71
void check_stddeque_matrix(const MatrixType &m)
Definition: stddeque.cpp:16
void check_stddeque_transform(const TransformType &)
Definition: stddeque.cpp:44

References CALL_SUBTEST_1, CALL_SUBTEST_2, CALL_SUBTEST_3, CALL_SUBTEST_4, CALL_SUBTEST_5, check_stddeque_matrix(), check_stddeque_quaternion(), and check_stddeque_transform().