#include <catch.hpp>
#include <boost/log/trivial.hpp>
#include "class_mesh.hpp"
Go to the source code of this file.
| #define BOOST_LOG_DYN_LINK 1 |
| TEST_CASE |
( |
"UNIT TEST: mesh class {Mesh_base<T>}" |
, |
|
|
"" |
[core] |
|
) |
| |
Definition at line 8 of file test_mesh.cpp.
References Mesh_base< T >::assign(), CHECK, Mesh_base< T >::length, Mesh_base< T >::N1, Mesh_base< T >::N2, Mesh_base< T >::N3, Mesh_base< T >::real(), and REQUIRE.
13 Mesh_base<double> mesh(8, 16, 20); 14 CHECK( mesh.N1 == 8 ); 15 CHECK( mesh.N2 == 16 ); 16 CHECK( mesh.N3 == 20 ); 17 CHECK( mesh.length == 2560 ); 19 CHECK( mesh.length == 2560 ); 20 CHECK( mesh.N2 == 16 ); 21 CHECK( mesh[5] == -0.5 ); 25 REQUIRE( mesh[5] == 3.14 ); 26 CHECK( mesh(0,0,5) == 3.14 ); 27 CHECK( *(mesh.real()+5) == 3.14 ); 30 REQUIRE( mesh[1041] == 2.71 ); 31 CHECK( mesh(3,4,1) == 2.71 ); 32 CHECK( mesh(52,1) == 2.71 ); 33 Vec_3D<int> pos(3,4,1); 34 CHECK( mesh(pos) == 2.71 ); 37 Mesh_base<double> mesh2(mesh); 38 CHECK( mesh2[0] == -0.5 ); 39 CHECK( mesh2[5] == 3.14 ); 40 CHECK( mesh2[1041] == 2.71 ); 43 Mesh_base<double> mesh3(2,5,7); 45 CHECK( mesh3.N1 == 8 ); 46 CHECK( mesh3.N2 == 16 ); 47 CHECK( mesh3.N3 == 20 ); 48 CHECK( mesh3.length == 2560 ); 49 CHECK( mesh3[0] == -0.5 ); 50 CHECK( mesh3[5] == 3.14 ); 51 CHECK( mesh3[1041] == 2.71 ); 55 CHECK( mesh[0] == Approx(-1.) ); 56 CHECK( mesh[5] == Approx(6.28) ); 58 CHECK( mesh[0] == Approx(0.) ); 59 CHECK( mesh[5] == Approx(7.28) ); 61 CHECK( mesh[0] == Approx(0.) ); 62 CHECK( mesh[5] == Approx(1.) ); : class handling basic mesh functions, the most important are creating and destroing the underlying d...
| TEST_CASE |
( |
"UNIT TEST: mesh class {Mesh}" |
, |
|
|
"" |
[core] |
|
) |
| |
Definition at line 65 of file test_mesh.cpp.
References Mesh_base< T >::assign(), CHECK, Mesh::N, Mesh_base< T >::N1, Mesh_base< T >::N2, Mesh_base< T >::N3, and REQUIRE.
65 : mesh
class {
Mesh}
", "[core]
" ) 67 BOOST_LOG_TRIVIAL(info) << "mesh
class {
Mesh}
"; 72 CHECK( mesh_c.N == 8 ); 73 CHECK( mesh_c.N1 == 8 ); 74 CHECK( mesh_c.N2 == 8 ); 75 CHECK( mesh_c.N3 == 10 ); 79 REQUIRE( mesh_c[90] == (FTYPE_t)3.14 ); 80 CHECK( mesh_c(1,1,0) == (FTYPE_t)3.14 ); 82 Vec_3D<int> pos(1,1,0); 83 CHECK( mesh_c(pos) == (FTYPE_t)3.14 ); 84 pos = Vec_3D<int>(9,-7,8); 85 CHECK( mesh_c(pos) == (FTYPE_t)3.14 ); 86 pos = Vec_3D<int>(-6,10,0); 87 mesh_c(pos) = (FTYPE_t)2.5; 88 CHECK( mesh_c(2,2,0) == (FTYPE_t)2.5 ); 89 CHECK( mesh_c[180] == (FTYPE_t)2.5 ); 93 CHECK( mesh2_c[90] == (FTYPE_t)3.14 ); 94 CHECK( mesh2_c[180] == (FTYPE_t)2.5 ); 99 CHECK( mesh3_c.N1 == 8 ); 100 CHECK( mesh3_c.N2 == 8 ); 101 CHECK( mesh3_c.N3 == 10 ); 102 CHECK( mesh3_c.N == 8 ); 103 CHECK( mesh3_c[90] == (FTYPE_t)3.14 ); 104 CHECK( mesh3_c[180] == (FTYPE_t)2.5 ); 108 CHECK( mesh3_c[90] == Approx(6.28) ); 109 CHECK( mesh3_c[180] == Approx(5) ); 111 CHECK( mesh3_c[90] == Approx(1.28) ); 112 CHECK( mesh3_c[180] == Approx(0) ); 114 CHECK( mesh3_c[90] == Approx(1.) ); 115 CHECK( mesh3_c[180] == Approx(0) ); 116 }: creates a mesh of N*N*(N+2) cells