CartDecomposition_unit_test.hpp 1.08 KB
Newer Older
incardon's avatar
incardon committed
1 2 3 4 5 6 7 8 9 10 11 12
#ifndef CARTDECOMPOSITION_UNIT_TEST_HPP
#define CARTDECOMPOSITION_UNIT_TEST_HPP

#include "CartDecomposition.hpp"
#include "mathutil.hpp"

BOOST_AUTO_TEST_SUITE( CartDecomposition_test )

#define SUB_UNIT_FACTOR 64

BOOST_AUTO_TEST_CASE( CartDecomposition_test_use)
{
incardon's avatar
Add ORB  
incardon committed
13 14 15 16 17
	// Vcluster
	Vcluster & vcl = *global_v_cluster;

	// Initialize the global VCluster
	init_global_v_cluster(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv);
incardon's avatar
incardon committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31

	CartDecomposition<3,float> dec(vcl);

	// Physical domain
	Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
	size_t div[3];

	// Get the number of processor and calculate the number of sub-domain
	// for decomposition
	size_t n_proc = vcl.getProcessingUnits();
	size_t n_sub = n_proc * SUB_UNIT_FACTOR;

	// Calculate the number of sub-domain on each dimension
	for (int i = 0 ; i < 3 ; i++)
32
	{div[i] = openfpm::math::round_big_2(pow(n_sub,1.0/3));}
incardon's avatar
incardon committed
33 34 35

	// Decompose
	dec.setParameters(div,box);
incardon's avatar
incardon committed
36 37 38 39 40 41 42

	Ghost<3,float> g(0.01);

	// create a ghost border
	dec.calculateGhostBoxes(g);

	//
incardon's avatar
incardon committed
43 44 45 46 47 48
}

BOOST_AUTO_TEST_SUITE_END()


#endif