5#define BOOST_TEST_DYN_LINK
7#include <boost/test/unit_test.hpp>
8#include "Grid/Geometry/grid_smb.hpp"
9#include "Grid/Geometry/grid_zmb.hpp"
11template <
unsigned int dim,
typename BGT>
12void testStandardLinearizations(BGT geometry)
15 BOOST_REQUIRE_EQUAL(geometry.LinId(origin), 0);
18 BOOST_REQUIRE_EQUAL(geometry.LinId(block0a), 7);
20 BOOST_REQUIRE_EQUAL(geometry.LinId(block0b), 8);
22 BOOST_REQUIRE_EQUAL(geometry.LinId(block0c), 63);
25 BOOST_REQUIRE_EQUAL(geometry.LinId(block1a), 64+7);
27 BOOST_REQUIRE_EQUAL(geometry.LinId(block1b), 64+8);
29 BOOST_REQUIRE_EQUAL(geometry.LinId(block1c), 64+63);
32 BOOST_REQUIRE_EQUAL(geometry.LinId(block3a), (64*3)+7);
34 BOOST_REQUIRE_EQUAL(geometry.LinId(block3b), (64*3)+8);
36 BOOST_REQUIRE_EQUAL(geometry.LinId(block3c), (64*3)+63);
39BOOST_AUTO_TEST_SUITE(BlockGeometry_tests)
41BOOST_AUTO_TEST_CASE(testLinId)
43 constexpr unsigned int dim = 2;
44 const size_t sz[dim] = {3*8,7*8};
47 testStandardLinearizations<dim>(geometry);
50BOOST_AUTO_TEST_CASE(testCopyConstructor)
52 constexpr unsigned int dim = 2;
53 const size_t sz[dim] = {3*8,7*8};
60 testStandardLinearizations<dim>(geometry);
63BOOST_AUTO_TEST_CASE(testCopyAssignOp)
65 constexpr unsigned int dim = 2;
66 const size_t sz[dim] = {3*8,7*8};
74 testStandardLinearizations<dim>(geometry);
77template<
typename gsmb_type>
80 const size_t sz[2] = {3*8,7*8};
81 gsmb_type geometry0(sz);
83 const size_t sz2[2] = {3*8+50,7*8+50};
84 gsmb_type geometry1(sz2);
86 geometry1.swap(geometry0);
89 BOOST_REQUIRE_EQUAL(geometry1.size(0),3*8);
90 BOOST_REQUIRE_EQUAL(geometry1.size(1),7*8);
92 BOOST_REQUIRE_EQUAL(geometry0.size(0),3*8+50);
93 BOOST_REQUIRE_EQUAL(geometry0.size(1),7*8+50);
96BOOST_AUTO_TEST_CASE(testSwap)
98 constexpr unsigned int dim = 2;
100 test_swap<grid_smb<dim, 8>>();
101 test_swap<grid_zmb<dim, 8, long int>>();
104BOOST_AUTO_TEST_SUITE_END()
grid_key_dx is the key to access any element in the grid