8#ifndef OPENFPM_NUMERICS_SRC_DRAW_DRAWPARTICLES_UNIT_TESTS_HPP_
9#define OPENFPM_NUMERICS_SRC_DRAW_DRAWPARTICLES_UNIT_TESTS_HPP_
11#include "PointIterator.hpp"
12#include "PointIteratorSkin.hpp"
13#include "DrawParticles.hpp"
15BOOST_AUTO_TEST_SUITE( draw_particles )
17BOOST_AUTO_TEST_CASE(point_iterator)
21 size_t sz[] = {23,27,20};
27 size_t sz_sub[] = {12,4,9};
30 size_t bc[3]={NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
46 vd.getLastPos()[0] = p.get().get(0);
47 vd.getLastPos()[1] = p.get().get(1);
48 vd.getLastPos()[2] = p.get().get(2);
50 good &= sub_domain.isInside(p.get());
64 BOOST_REQUIRE_EQUAL(cnt,sz_sub[0]*sz_sub[1]*sz_sub[2]);
65 BOOST_REQUIRE_EQUAL(good,
true);
69 BOOST_REQUIRE_CLOSE(marg.
getLow(0), sub_real.getLow(0) ,0.0001);
70 BOOST_REQUIRE_CLOSE(marg.
getLow(1), sub_real.getLow(1) ,0.0001);
71 BOOST_REQUIRE_CLOSE(marg.
getLow(2), sub_real.getLow(2) ,0.0001);
73 BOOST_REQUIRE_CLOSE(marg.
getHigh(0), sub_real.getHigh(0) ,0.0001);
74 BOOST_REQUIRE_CLOSE(marg.
getHigh(1), sub_real.getHigh(1) ,0.0001);
75 BOOST_REQUIRE_CLOSE(marg.
getHigh(2), sub_real.getHigh(2) ,0.0001);
78BOOST_AUTO_TEST_CASE(point_iterator_skin)
80 size_t sz[] = {23,27,20};
83 Box<3,double> sub_domainA({-0.15,0.75,0.15},{1.05,1.15,1.05});
84 Box<3,double> sub_domainB({-0.25,0.65,0.05},{0.95,1.05,1.05});
87 size_t bc[3]={NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
103 vd.getLastPos()[0] = p.get().get(0);
104 vd.getLastPos()[1] = p.get().get(1);
105 vd.getLastPos()[2] = p.get().get(2);
107 if (!((p.get().get(0) > -0.21 && p.get().get(0) < -0.19) || (p.get().get(1) > 0.69 && p.get().get(1) < 0.71) || (p.get().get(2) > 0.09 && p.get().get(2) < 0.11)) )
110 if (sub_domainA.isInside(p.get()))
123 BOOST_REQUIRE_EQUAL(good,
true);
126BOOST_AUTO_TEST_SUITE_END()
This class represent an N-dimensional box.
__device__ __host__ T getLow(int i) const
get the i-coordinate of the low bound interval of the box
__device__ __host__ T getHigh(int i) const
get the high interval of the box
static PointIteratorSkin< dim, T, typename vd_type::Decomposition_type > DrawSkin(vd_type &vd, size_t(&sz)[dim], Box< dim, T > &domain, Box< dim, T > &sub_A, Box< dim, T > &sub_B)
Draw particles in a box B excluding the area of a second box A (B - A)
static PointIterator< dim, T, typename vd_type::Decomposition_type > DrawBox(vd_type &vd, size_t(&sz)[dim], Box< dim, T > &domain, Box< dim, T > &sub)
Draw particles in a box.
void execute()
Execute all the requests.
void sum(T &num)
Sum the numbers across all processors and get the result.
Implementation of VCluster class.