11 #include <boost/test/unit_test.hpp>
34 namespace tt = boost::test_tools;
52 return Vector3(r * z, 3 * r, -2 * z);
77 for (
size_t i = 1;
i <= g.numLocalBins().at(0) + 1; ++
i) {
78 for (
size_t j = 1;
j <= g.numLocalBins().at(1) + 1; ++
j) {
79 Grid_t::index_t indices = {{
i,
j}};
80 const auto& llCorner = g.lowerLeftBinEdge(indices);
86 BField_t
b{{transformPos, transformBField,
std::move(g)}};
89 BField_t::Cache&
bCache = bCacheAny.get<BField_t::Cache>();
91 auto check = [&](
double i) {
92 BOOST_CHECK(
b.isInside({0, 0,
i * 4.9}));
93 BOOST_CHECK(!
b.isInside({0, 0,
i * 5.1}));
95 BOOST_CHECK(
b.isInside({
i * 2.9, 0, 0}));
96 BOOST_CHECK(!
b.isInside({
i * 3.1, 0, 0}));
98 BOOST_CHECK(
b.isInside({0,
i * 2.9, 0}));
99 BOOST_CHECK(!
b.isInside({0,
i * 3.1, 0}));
101 BOOST_CHECK(
b.isInside({2, 2.2, 0}));
102 BOOST_CHECK(!
b.isInside({2, 3, 0}));
104 BOOST_CHECK(
b.isInside({
i * 2, 2.2, 0}));
105 BOOST_CHECK(!
b.isInside({
i * 2, 3, 0}));
107 BOOST_CHECK(
b.isInside({2,
i * 2.2, 0}));
108 BOOST_CHECK(!
b.isInside({2,
i * 3, 0}));
110 BOOST_CHECK(
b.isInside({
i * 2,
i * 2.2, 0}));
111 BOOST_CHECK(!
b.isInside({
i * 2,
i * 3, 0}));
120 BOOST_CHECK(!
b.isInside(
pos));
121 BOOST_CHECK(!
b.getField(
pos, bCacheAny).ok());
123 pos << -1.6, 2.5, 1.7;
124 BOOST_CHECK(
b.isInside(
pos));
129 BOOST_CHECK(
c.isInside(transformPos(
pos)));
133 ActsMatrix<3, 3>
deriv;
136 BOOST_CHECK(!
b.isInside(
pos));
137 BOOST_CHECK(!
b.getField(
pos, bCacheAny).ok());
138 BOOST_CHECK(!
b.getFieldGradient(
pos, deriv, bCacheAny).ok());
141 BOOST_CHECK(!
b.isInside(pos));
142 BOOST_CHECK(!
b.getField(pos, bCacheAny).ok());
143 BOOST_CHECK(!
b.getFieldGradient(pos, deriv, bCacheAny).ok());
146 BOOST_CHECK(
b.isInside(pos));
148 BField_t::Cache& bCache2 = bCacheAny.get<BField_t::Cache>();
151 c = *bCache2.fieldCell;
152 BOOST_CHECK(
c.isInside(transformPos(pos)));
157 BOOST_CHECK(!
b.isInside(pos));
160 BOOST_CHECK(
b.isInside(pos));
162 BField_t::Cache& bCache3 = bCacheAny.get<BField_t::Cache>();
165 c = *bCache3.fieldCell;
166 BOOST_CHECK(
c.isInside(transformPos(pos)));
171 BOOST_CHECK(not
c.isInside(transformPos((pos << 3, 2, -3.7).finished())));
172 BOOST_CHECK(not
c.isInside(transformPos((pos << -2, 3, -4.7).finished())));
173 BOOST_CHECK(not
c.isInside(transformPos((pos << -2, 3, 4.7).finished())));
174 BOOST_CHECK(
c.isInside(transformPos((pos << 0, 2, -4.7).finished())));
175 BOOST_CHECK(not
c.isInside(transformPos((pos << 5, 2, 14.).finished())));