staggered_grid_dist_unit_test.hpp 1.25 KB
Newer Older
incardon's avatar
incardon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * staggered_grid_unit_test.hpp
 *
 *  Created on: Aug 20, 2015
 *      Author: i-bird
 */

#ifndef SRC_GRID_STAGGERED_GRID_DIST_UNIT_TEST_HPP_
#define SRC_GRID_STAGGERED_GRID_DIST_UNIT_TEST_HPP_

#include "staggered_dist_grid.hpp"
#include "Point_test.hpp"

BOOST_AUTO_TEST_SUITE( staggered_grid_dist_id_test )


BOOST_AUTO_TEST_CASE( staggered_grid_dist_unit_test)
{
	typedef Point2D_test<float> p;

	// Domain
	Box<2,float> domain({0.0,0.0},{1.0,1.0});

24
25
26
27
	size_t k = 1024;

/*	for (size_t k = 1024 ; k >= 2 ; k--)
	{*/
incardon's avatar
incardon committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
		BOOST_TEST_CHECKPOINT( "Testing grid k=" << k );

		// grid size
		size_t sz[2];
		sz[0] = k;
		sz[1] = k;

		// Ghost
		Ghost<2,float> g(0.01);

		staggered_grid_dist<2,float,Point2D_test<float>,CartDecomposition<2,float>> sg(sz,domain,g);

		sg.setDefaultStagPosition();

		auto it = sg.getDomainIterator();

		while (it.isNext())
		{
			auto key = it.get();

48
			sg.template get<p::s>(key) = 1;
incardon's avatar
incardon committed
49

50
51
			sg.template get<p::v>(key)[0] = 0;
			sg.template get<p::v>(key)[1] = 1;
incardon's avatar
incardon committed
52

53
54
55
56
			sg.template get<p::t>(key)[0][0] = 0;
			sg.template get<p::t>(key)[0][1] = 1;
			sg.template get<p::t>(key)[1][0] = 2;
			sg.template get<p::t>(key)[1][1] = 3;
incardon's avatar
incardon committed
57
58
59
60

			++it;
		}

61
/*	}*/
incardon's avatar
incardon committed
62
63
64
65
66
}

BOOST_AUTO_TEST_SUITE_END()

#endif /* SRC_GRID_STAGGERED_GRID_DIST_UNIT_TEST_HPP_ */