4#define BOOST_TEST_DYN_LINK
6#include <boost/test/unit_test.hpp>
11#include "Draw/DrawSphere.hpp"
14BOOST_AUTO_TEST_SUITE(NarrowBandTestSuite)
15 BOOST_AUTO_TEST_CASE(NarrowBand_unit_sphere)
17 auto & v_cl = create_vcluster();
18 typedef double phi_type;
19 const size_t dims = 3;
25 const size_t Phi_0_grid = 0;
26 const size_t SDF_exact_grid = 1;
28 const size_t SDF_vd = 0;
29 const size_t Gradient_vd = 1;
30 const size_t magnOfGrad_vd = 2;
34 const double dt = 0.000165334;
35 const size_t sz[dims] = {N, N, N};
36 const double radius = 1.0;
37 const double box_lower = 0.0;
38 const double box_upper = 4.0 * radius;
39 Box<dims, double> box({box_lower, box_lower, box_lower}, {box_upper, box_upper, box_upper});
43 grid_in_type g_dist(sz, box, ghost);
44 g_dist.setPropNames({
"Phi_0",
"SDF_exact"});
46 const double center[dims] = {0.5*(box_upper+box_lower), 0.5*(box_upper+box_lower), 0.5*(box_upper+box_lower)};
47 init_grid_with_sphere<Phi_0_grid>(g_dist, radius, center[x], center[y], center[z]);
49 init_analytic_sdf_sphere<SDF_exact_grid>(g_dist, radius, center[x], center[y], center[z]);
53 size_t bc[dims] = {NON_PERIODIC, NON_PERIODIC, NON_PERIODIC};
57 vd_type vd_narrow_band(0, box, bc, ghost_vd);
58 vd_narrow_band.setPropNames({
"SDF_exact",
"Gradient of Phi",
"Gradient magnitude of Phi"});
59 size_t narrow_band_width = 8;
61 narrowBand.get_narrow_band<SDF_exact_grid, SDF_vd, Gradient_vd, magnOfGrad_vd>(g_dist, vd_narrow_band);
63 size_t narrow_band_size = vd_narrow_band.size_local();
66 v_cl.sum(narrow_band_size);
70 BOOST_CHECK(narrow_band_size == 6568);
72BOOST_AUTO_TEST_SUITE_END()
Header file containing functions that compute the analytical solution of the signed distance function...
Class for getting the narrow band around the interface.
This class represent an N-dimensional box.
Class for getting the narrow band around the interface.
This is a distributed grid.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...