38#include <boost/test/tools/floating_point_comparison.hpp>
39#include <boost/test/unit_test.hpp>
91 static const unsigned int Value = 10;
102 BOOST_CHECK(p1(i) == 2.7);
103 BOOST_CHECK(p1[i] == 2.7);
108 BOOST_CHECK(p2(0) == 0.0);
114 BOOST_CHECK(p3(i) == 2.7);
115 BOOST_CHECK(p3[i] == 2.7);
122 BOOST_CHECK_EQUAL(p2(i), 2.7);
123 BOOST_CHECK_EQUAL(p2[i], 2.7);
135 BOOST_CHECK(v1(0) == 1.1);
136 BOOST_CHECK(v1(1) == 1.2);
137 BOOST_CHECK(v1(2) == 1.3);
143 BOOST_CHECK(v1[0] == 1.4);
144 BOOST_CHECK(v1[1] == 1.5);
145 BOOST_CHECK(v1[2] == 1.6);
151 BOOST_CHECK(v1[0] == 1.7);
152 BOOST_CHECK(v1[1] == 1.8);
153 BOOST_CHECK(v1[2] == 1.9);
155 BOOST_CHECK(v1.
x() == 1.7);
156 BOOST_CHECK(v1.
y() == 1.8);
157 BOOST_CHECK(v1.
z() == 1.9);
164 BOOST_CHECK(v1 == v2);
165 BOOST_CHECK(!(v1 != v2));
168 BOOST_CHECK(v3 != v1);
171 BOOST_CHECK(v4 != v1);
180 double vals[] = {1, -2, 3};
183 double epsilon = 1e-11;
184 BOOST_CHECK_EQUAL(v.
L1Norm(), 1.0 + 2.0 + 3.0);
185 BOOST_CHECK_CLOSE(v.
L2Norm(),
sqrt(1.0 + 4.0 + 9.0), epsilon);
195 double matrix_buf[] = {1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0};
196 double vector_buf[] = {20.0, 30.0, 40.0};
202 double result_buf[] = {200.0, 470.0, 740.0};
204 BOOST_CHECK_EQUAL(result, expected_result);
212 double matrix_buf[] = {1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0};
213 double vector_buf[] = {20.0, 30.0, 40.0};
215 std::shared_ptr<NekMatrix<double>> m(
221 double result_buf[] = {400.0, 940.0, 1480.0};
223 BOOST_CHECK_EQUAL(result, expected_result);
231 double m1_buf[] = {1.0, 3.0, 2.0, 4.0};
232 double m2_buf[] = {5.0, 7.0, 6.0, 8.0};
233 double m3_buf[] = {9.0, 11.0, 10.0, 12.0};
234 double vector_buf[] = {20.0, 30.0};
236 std::shared_ptr<NekMatrix<double>> m1(
238 std::shared_ptr<NekMatrix<double>> m2(
240 std::shared_ptr<NekMatrix<double>> m3(
244 b.SetBlock(0, 0, m1);
245 b.SetBlock(1, 0, m2);
246 b.SetBlock(2, 0, m3);
251 double result_buf[] = {80.0, 180.0, 280.0, 380.0, 480.0, 580.0};
253 BOOST_CHECK_EQUAL(result, expected_result);
258 double m_buf[] = {1, 4, 7, 2, 5, 8, 3, 6, 9};
259 double v_buf[] = {10, 11, 12};
260 double expected_result_buf[] = {68, 167, 266};
261 double expected_transpose_result_buf[] = {138, 171, 204};
268 3, expected_transpose_result_buf);
272 BOOST_CHECK_EQUAL(variableResult, expected_result);
273 BOOST_CHECK_EQUAL(constantResult, expected_result);
276 constantResult = m * v_constant;
277 variableResult = m * v_variable;
278 BOOST_CHECK_EQUAL(variableResult, expected_transpose_result);
279 BOOST_CHECK_EQUAL(constantResult, expected_transpose_result);
282 constantResult = m * v_constant;
283 variableResult = m * v_variable;
284 BOOST_CHECK_EQUAL(variableResult, expected_result);
285 BOOST_CHECK_EQUAL(constantResult, expected_result);
288 constantResult = transposed * v_constant;
289 variableResult = transposed * v_variable;
290 BOOST_CHECK_EQUAL(variableResult, expected_transpose_result);
291 BOOST_CHECK_EQUAL(constantResult, expected_transpose_result);
295 double m_buf[] = {1, 4, 2, 5, 3, 6};
296 double v_non_transposed_buf[] = {10, 11, 12};
297 double v_transposed_buf[] = {20, 21};
298 double expected_result_buf[] = {68, 167};
299 double expected_transpose_result_buf[] = {104, 145, 186};
308 3, expected_transpose_result_buf);
312 BOOST_CHECK_EQUAL(variableResult, expected_result);
313 BOOST_CHECK_EQUAL(constantResult, expected_result);
316 variableResult = m * v_transposed_variable;
317 constantResult = m * v_transposed_constant;
318 BOOST_CHECK_EQUAL(variableResult, expected_transpose_result);
319 BOOST_CHECK_EQUAL(constantResult, expected_transpose_result);
322 variableResult = m * v_non_transposed_variable;
323 constantResult = m * v_non_transposed_constant;
324 BOOST_CHECK_EQUAL(variableResult, expected_result);
325 BOOST_CHECK_EQUAL(constantResult, expected_result);
328 variableResult = transposed * v_transposed_variable;
329 constantResult = transposed * v_transposed_constant;
330 BOOST_CHECK_EQUAL(variableResult, expected_transpose_result);
331 BOOST_CHECK_EQUAL(constantResult, expected_transpose_result);
338 double buf[] = {1.0, 2.0, 3.0, 4.0};
342 BOOST_CHECK_EQUAL(b.
GetRows(), 3u);
344 BOOST_CHECK_EQUAL(b[0], 1.0);
345 BOOST_CHECK_EQUAL(b[1], 2.0);
346 BOOST_CHECK_EQUAL(b[2], 3.0);
349 BOOST_CHECK_EQUAL(*iter, 1.0);
351 BOOST_CHECK_EQUAL(*iter, 2.0);
353 BOOST_CHECK_EQUAL(*iter, 3.0);
355 BOOST_CHECK(iter == b.
end());
359 double buf[] = {1.0, 2.0, 3.0, 4.0};
363 BOOST_CHECK_EQUAL(b.
GetRows(), 3u);
365 BOOST_CHECK_EQUAL(b[0], 1.0);
366 BOOST_CHECK_EQUAL(b[1], 2.0);
367 BOOST_CHECK_EQUAL(b[2], 3.0);
370 BOOST_CHECK_EQUAL(*iter, 1.0);
372 BOOST_CHECK_EQUAL(*iter, 2.0);
374 BOOST_CHECK_EQUAL(*iter, 3.0);
376 BOOST_CHECK(iter == b.
end());
380 double buf[] = {1.0, 2.0, 3.0, 4.0};
384 BOOST_CHECK_EQUAL(b.
GetRows(), 3u);
386 BOOST_CHECK_EQUAL(b[0], 1.0);
387 BOOST_CHECK_EQUAL(b[1], 2.0);
388 BOOST_CHECK_EQUAL(b[2], 3.0);
391 BOOST_CHECK_EQUAL(*iter, 1.0);
393 BOOST_CHECK_EQUAL(*iter, 2.0);
395 BOOST_CHECK_EQUAL(*iter, 3.0);
397 BOOST_CHECK(iter == b.
end());
400 BOOST_CHECK_EQUAL(b[0], a[0]);
boost::call_traits< DataType >::reference x()
unsigned int GetDimension() const
Returns the number of dimensions for the point.
unsigned int GetRows() const
boost::call_traits< DataType >::reference y()
DataType InfinityNorm() const
boost::call_traits< DataType >::reference z()
VectorTestClass operator=(const VectorTestClass &rhs)
VectorTestClass(const VectorTestClass &in)=default
VectorTestClass(int data)
bool operator!=(const PointTestClass &lhs, const PointTestClass &rhs)
bool operator==(const PointTestClass &lhs, const PointTestClass &rhs)
BOOST_AUTO_TEST_CASE(TestGaussInt)
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
scalarT< T > sqrt(scalarT< T > in)
static const unsigned int Value