7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for cf3::mesh::HilbertNumbering"
11 #include <boost/test/unit_test.hpp>
33 m_argc = boost::unit_test::framework::master_test_suite().argc;
34 m_argv = boost::unit_test::framework::master_test_suite().argv;
70 Hilbert compute_hilbert_level_1(bounding_box, 1);
71 point << 0.25; BOOST_CHECK_EQUAL(compute_hilbert_level_1(point), 0u);
72 point << 0.75; BOOST_CHECK_EQUAL(compute_hilbert_level_1(point), 1u);
74 Hilbert compute_hilbert_level_2(bounding_box, 2);
75 point << 0.125; BOOST_CHECK_EQUAL(compute_hilbert_level_2(point), 0u);
76 point << 0.375; BOOST_CHECK_EQUAL(compute_hilbert_level_2(point), 1u);
77 point << 0.625; BOOST_CHECK_EQUAL(compute_hilbert_level_2(point), 2u);
78 point << 0.875; BOOST_CHECK_EQUAL(compute_hilbert_level_2(point), 3u);
87 Hilbert compute_hilbert_level_1(bounding_box, 1);
88 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector2(0.25,0.25)), 0u);
89 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector2(0.25,0.75)), 1u);
90 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector2(0.75,0.75)), 2u);
91 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector2(0.75,0.25)), 3u);
93 Hilbert compute_hilbert_level_2(bounding_box, 2);
94 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector2(0.125,0.125)), 0u);
95 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector2(0.375,0.125)), 1u);
96 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector2(0.375,0.375)), 2u);
97 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector2(0.125,0.375)), 3u);
98 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector2(0.125,0.625)), 4u);
99 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector2(0.125,0.875)), 5u);
100 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector2(0.375,0.875)), 6u);
101 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector2(0.375,0.625)), 7u);
110 Hilbert compute_hilbert_level_1(bounding_box, 1);
111 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector3(0.25,0.25,0.25)), 0u);
112 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector3(0.25,0.25,0.75)), 1u);
113 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector3(0.75,0.25,0.75)), 2u);
114 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector3(0.75,0.25,0.25)), 3u);
115 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector3(0.75,0.75,0.25)), 4u);
116 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector3(0.75,0.75,0.75)), 5u);
117 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector3(0.25,0.75,0.75)), 6u);
118 BOOST_CHECK_EQUAL(compute_hilbert_level_1(
RealVector3(0.25,0.75,0.25)), 7u);
120 Hilbert compute_hilbert_level_2(bounding_box, 2);
121 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector3(0.125,0.125,0.125)), 0u);
122 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector3(0.125,0.375,0.125)), 1u);
123 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector3(0.375,0.375,0.125)), 2u);
124 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector3(0.375,0.125,0.125)), 3u);
125 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector3(0.875,0.375,0.125)), 28);
126 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector3(0.875,0.875,0.875)), 45);
127 BOOST_CHECK_EQUAL(compute_hilbert_level_2(
RealVector3(0.125,0.875,0.125)), 63);
129 Hilbert compute_hilbert(bounding_box,10);
144 BOOST_AUTO_TEST_SUITE_END()
#define CFinfo
these are always defined
Eigen::Matrix< Real, 1, 1 > RealVector1
Fixed size 1x1 column vector.
Class to compute a global index given a coordinate, based on the Hilbert Spacefilling Curve...
BOOST_AUTO_TEST_CASE(init)
Basic Classes for Mathematical applications used by COOLFluiD.
Real max(const Real a, const Real b)
Maximum between two scalars.
Static functions for mathematical constants.
HilbertNumberingTests_Fixture()
common setup for each test case
Real min(const Real a, const Real b)
Minimum between two scalars.
boost::uint64_t max_key() const
void initiate(int argc, char **argv)
Top-level namespace for coolfluid.
Uint uint_max()
Returns the maximum number representable with the chosen precision.
~HilbertNumberingTests_Fixture()
common tear-down for each test case
Eigen::Matrix< Real, 2, 1 > RealVector2
Fixed size 2x1 column vector.
Bounding box defined by minimum and maximum coordinates.
Most basic kernel library.
int m_argc
possibly common functions used on the tests below
Eigen::Matrix< Real, 3, 1 > RealVector3
Fixed size 3x1 column vector.